blob: 53626ef2bef4e64fb745300b0bff215552a2014d [file] [log] [blame]
Juan Cespedescac15c32003-01-31 18:58:58 +01001#include <features.h>
2
Ian Wienand9a2ad352006-02-20 22:44:45 +01003void debug_(int level, const char *file, int line, const char *func, const char *fmt, ...);
4
5int xwrite(const char *, size_t);
6int xwrites(const char *);
7int xwritehexi(int);
8int xwritehexl(long);
9int xwritec(char);
10int xwritecr(void);
11int xwritedump(void *, long, int);
12int xinfdump(long, void *, int);
13
Juan Cespedescac15c32003-01-31 18:58:58 +010014
15# define debug(level, expr...) debug_(level, __FILE__, __LINE__, DEBUG_FUNCTION, expr)
16
17/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
18 which contains the name of the function currently being defined.
19 This is broken in G++ before version 2.6.
20 C9x has a similar variable called __func__, but prefer the GCC one since
21 it demangles C++ function names. */
22# if __GNUC_PREREQ (2, 4)
23# define DEBUG_FUNCTION __PRETTY_FUNCTION__
24# else
25# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
26# define DEBUG_FUNCTION __func__
27# else
28# define DEBUG_FUNCTION ((__const char *) 0)
29# endif
30# endif