move BUG_ON, panic and kprintf define to debug.h; add BUILD_BUG_ON
these functions are more logical to keep together there as they depend on each other. Also add a comment about the __printf attribute, if we have a quiet period it would be useful to enable and clear the thousands of warnings... Change-Id: I47d3891c9cd87da28b2883c29384959f5abd1459
This commit is contained in:
committed by
Masamichi Takagi
parent
1e1fa4f70d
commit
c3bfa3f6a9
@@ -1,7 +1,12 @@
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <lwk/compiler.h>
|
||||
#include "lwk/compiler.h"
|
||||
|
||||
void panic(const char *);
|
||||
|
||||
/* when someone has a lot of time, add attribute __printf(1, 2) to kprintf */
|
||||
int kprintf(const char *format, ...);
|
||||
|
||||
struct ddebug {
|
||||
const char *file;
|
||||
@@ -37,4 +42,13 @@ do { \
|
||||
} while (0)
|
||||
#define ekprintf(fmt, args...) kprintf(fmt, ##args)
|
||||
|
||||
#define BUG_ON(condition) do { \
|
||||
if (condition) { \
|
||||
kprintf("PANIC: %s: %s(line:%d)\n", \
|
||||
__FILE__, __func__, __LINE__); \
|
||||
panic(""); \
|
||||
} \
|
||||
} while (0)
|
||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,11 +13,9 @@
|
||||
#ifndef __HEADER_KMALLOC_H
|
||||
#define __HEADER_KMALLOC_H
|
||||
|
||||
#include <ihk/mm.h>
|
||||
#include <cls.h>
|
||||
|
||||
void panic(const char *);
|
||||
int kprintf(const char *format, ...);
|
||||
#include "ihk/mm.h"
|
||||
#include "cls.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define kmalloc(size, flag) ({\
|
||||
void *r = _kmalloc(size, flag, __FILE__, __LINE__);\
|
||||
|
||||
Reference in New Issue
Block a user