File: debug.h

package info (click to toggle)
libaal 1.0.7-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 1,768 kB
  • sloc: sh: 4,118; ansic: 2,461; makefile: 52
file content (63 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* Copyright (C) 2001, 2002, 2003 by Hans Reiser, licensing governed by
   libaal/COPYING.
   
   debug.h -- asserts implementation. */

#ifndef AAL_DEBUG_H
#define AAL_DEBUG_H

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

extern void __actual_bug(char *hint, char *file, int line, 
			 char *func, char *text, ...);

extern void __actual_assert(char *hint, int cond, char *text,
			    char *file, int line, char *func);

#if !defined(ENABLE_MINIMAL) && defined(ENABLE_DEBUG)
#ifdef __GNUC__
#define aal_bug(hint, text, list...)         \
    	__actual_bug(hint,                   \
		     __FILE__,		     \
		     __LINE__,		     \
		     __PRETTY_FUNCTION__,    \
		     text,		     \
		     ##list)

#define aal_assert(hint, cond)               \
    	__actual_assert(hint,                \
			cond,		     \
			#cond,		     \
			__FILE__,	     \
			__LINE__,	     \
			__PRETTY_FUNCTION__)

#else
#define aal_bug(hint, text, list...)         \
    	__actual_bug(hint,                   \
		     "unknown",		     \
		     0,		             \
		     "unknown",              \
		     text,		     \
		     ##list)

#define aal_assert(hint, cond)               \
	__actual_assert(hint, cond,          \
			#cond,		     \
			"unknown",	     \
			0,		     \
			"unknown")

#endif

#else
#define aal_bug(hint, text, list...)
#define aal_assert(hint, cond)
#endif

extern assert_handler_t aal_assert_get_handler(void);
extern void aal_assert_set_handler(assert_handler_t handler);
#endif