]> git.sur5r.net Git - openldap/blob - include/ac/assert.h
Vienna Bulk Commit
[openldap] / include / ac / assert.h
1 /* Generic assert.h */
2 /*
3  * Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11
12 #ifndef _AC_ASSERT_H
13 #define _AC_ASSERT_H
14
15 #ifdef LDAP_DEBUG
16
17 #if defined( HAVE_ASSERT_H ) || defined( STDC_HEADERS )
18 #undef NDEBUG
19 #include <assert.h>
20 #else
21 #define LDAP_NEED_ASSERT 1
22
23 /*
24  * no assert()... must be a very old compiler.
25  * create a replacement and hope it works
26  */
27
28 void    ber_pvt_assert(char* file, int line, char* test);
29 #define assert(test) \
30         ((test) \
31                 ? (void)0 \
32                 : ber_pvt_assert( __FILE__, __LINE__, LDAP_STRING(test)) )
33
34 #endif
35
36 #else
37 /* no asserts */
38 #define assert(test) ((void)0)
39 #endif
40
41 #endif /* _AC_ASSERT_H */