debug.h revision 43739a69d0fb63011609af50f758fbe4734e0c67
1#include <features.h> 2 3void debug_(int level, const char *file, int line, const char *func, 4 const char *fmt, ...) __attribute__((format(printf,5,6))); 5 6int xinfdump(long, void *, int); 7 8# define debug(level, expr...) debug_(level, __FILE__, __LINE__, DEBUG_FUNCTION, expr) 9 10/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' 11 which contains the name of the function currently being defined. 12 This is broken in G++ before version 2.6. 13 C9x has a similar variable called __func__, but prefer the GCC one since 14 it demangles C++ function names. */ 15# if __GNUC_PREREQ (2, 4) 16# define DEBUG_FUNCTION __PRETTY_FUNCTION__ 17# else 18# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 19# define DEBUG_FUNCTION __func__ 20# else 21# define DEBUG_FUNCTION "???" 22# endif 23# endif 24