blob: ed28e8b3237156229faa3a29f621bb36affbca1a [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,
4 const char *fmt, ...);
Ian Wienand9a2ad352006-02-20 22:44:45 +01005
6int xwrite(const char *, size_t);
7int xwrites(const char *);
8int xwritehexi(int);
9int xwritehexl(long);
10int xwritec(char);
11int xwritecr(void);
12int xwritedump(void *, long, int);
13int xinfdump(long, void *, int);
14
Juan Cespedescac15c32003-01-31 18:58:58 +010015# 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