X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flib%2Fdebug.h;h=3ab800b9b5f5ccd6a291b1d1c1f3daf7ba6cd089;hb=7a3dff52c8a44deeadd071ea93f19b9cee2a67fa;hp=76c3f77b732f8aa807847fb9be13a7af91c2bb8d;hpb=0a60e906e608f4505584281acfe6c699d04ef00b;p=pintos-anon diff --git a/src/lib/debug.h b/src/lib/debug.h index 76c3f77..3ab800b 100644 --- a/src/lib/debug.h +++ b/src/lib/debug.h @@ -9,20 +9,11 @@ #define NO_INLINE __attribute__ ((noinline)) #define PRINTF_FORMAT(FMT, FIRST) __attribute__ ((format (printf, FMT, FIRST))) -/* Prints a debug message along with the source file name, line - number, and function name of where it was emitted. CLASS is - used to filter out unwanted messages. */ -#define DEBUG(CLASS, ...) \ - debug_message (__FILE__, __LINE__, __func__, #CLASS, __VA_ARGS__) - /* Halts the OS, printing the source file name, line number, and function name, plus a user-specific message. */ #define PANIC(...) debug_panic (__FILE__, __LINE__, __func__, __VA_ARGS__) void debug_enable (char *classes); -void debug_message (const char *file, int line, const char *function, - const char *class, const char *message, ...) - PRINTF_FORMAT (5, 6); void debug_panic (const char *file, int line, const char *function, const char *message, ...) PRINTF_FORMAT (4, 5) NO_RETURN; void debug_backtrace (void); @@ -37,8 +28,10 @@ void debug_backtrace (void); #undef NOT_REACHED #ifndef NDEBUG -#define ASSERT(CONDITION) \ - ((void) ((CONDITION) || PANIC ("assertion `%s' failed.", #CONDITION))) +#define ASSERT(CONDITION) \ + if (CONDITION) { } else { \ + PANIC ("assertion `%s' failed.", #CONDITION); \ + } #define NOT_REACHED() PANIC ("executed an unreachable statement"); #else #define ASSERT(CONDITION) ((void) 0)