added files
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / library / snmp_assert.h
1 #ifndef SNMP_ASSERT_H
2 #define SNMP_ASSERT_H
3
4 #ifdef NET_SNMP_USE_ASSERT
5 #   include <assert.h>
6 #else
7 #   include <net-snmp/library/snmp_logging.h>
8 #endif
9
10
11 /*
12  * MACROs don't need extern "C"
13  */
14
15 #ifdef DEBUG
16
17 #ifdef NET_SNMP_USE_ASSERT
18 /*   void netsnmp_assert( int );*/
19 #   define netsnmp_assert(x)  assert( x )
20 #else
21 #   ifdef  HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
22 #      define netsnmp_assert(x)  do { \
23                  if ( x ) \
24                     ; \
25                  else \
26                     snmp_log(LOG_ERR,"netsnmp_assert %s failed %s:%d %s()\n", \
27                              __STRING(x),__FILE__,__LINE__,__FUNCTION__); \
28               }while(0)
29 #   else
30 #      define netsnmp_assert(x)  do { \
31                  if( x )\
32                     ; \
33                  else \
34                     snmp_log(LOG_ERR,"netsnmp_assert %s failed %s:%d\n", \
35                              __STRING(x),__FILE__,__LINE__); \
36               }while(0)
37 #   endif
38 #endif
39
40 #else
41
42 #define netsnmp_assert(x)
43
44 #endif
45
46
47 #endif /* SNMP_ASSERT_H */