blob: e3749ff6cf2f6ac2216e4cdfdc0455130c84a7d7 [file] [log] [blame]
Juan Cespedescac15c32003-01-31 18:58:58 +01001#include <features.h>
2
Ian Wienand2d45b1a2006-02-20 22:48:07 +01003void debug_(int level, const char *file, int line, const char *func,
Juan Cespedesa413e5b2007-09-04 17:34:53 +02004 const char *fmt, ...) __attribute__((format(printf,5,6)));
Ian Wienand9a2ad352006-02-20 22:44:45 +01005
Ian Wienand9a2ad352006-02-20 22:44:45 +01006int xinfdump(long, void *, int);
7
Juan Cespedescac15c32003-01-31 18:58:58 +01008# 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 ((__const char *) 0)
22# endif
23# endif