source: trunk/include/sh_trace.h

Last change on this file was 583, checked in by katerina, 10 days ago

Fix for ticket #471 (autoreconf throws warnings/errors).

File size: 1.1 KB
Line 
1#ifndef SH_TRACE_H
2#define SH_TRACE_H
3
4
5/* This file should be included via samhain.h only.
6 */
7#ifdef SL_DEBUG
8#define SDG_0RETU _("return.\n")
9#define SDG_TERRO _("ERROR: file=<%s>, line=<%d>, reason=<%s>\n")
10#define SDG_AERRO _("ERROR: file=<%s>, line=<%d>, failed_assertion=<%s>\n")
11#define SDG_AFAIL _("FAILED: file=<%s>, line=<%d>, assertion=<%s>\n")
12#define SDG_ENTER _("enter=<%s>\n")
13#define SDG_RETUR _("return=<%s>.\n")
14#define SDG_ERROR _("error=<%ld>.\n")
15#endif
16
17#ifdef SL_DEBUG
18#define ASSERT(expr, expr1) \
19 if (!(expr)) \
20 { \
21 fprintf(stderr, \
22 SDG_AERRO, \
23 FIL__, __LINE__, expr1 ); \
24 abort(); \
25 }
26
27
28#define ASSERT_RET(expr, expr1, rr) \
29 if (!(expr)) \
30 { \
31 fprintf(stderr, \
32 SDG_AERRO, \
33 FIL__, __LINE__, expr1 ); \
34 TPT(( (-1), FIL__, __LINE__, SDG_0RETU)) \
35 return (rr); \
36 }
37#else
38#define ASSERT(expr, expr1)
39
40#define ASSERT_RET(expr, expr1, rr) \
41 if (!(expr)) return (rr);
42#endif
43
44
45#ifdef SL_DEBUG
46#define TX1(expr1) \
47 fprintf(stderr, \
48 SDG_TERRO, \
49 FIL__, __LINE__, expr1 );
50#else
51#define TX1(expr1)
52#endif
53
54/* #ifndef SH_TRACE_H */
55#endif
56
Note: See TracBrowser for help on using the repository browser.