]> git.sur5r.net Git - openldap/blob - include/ac/assert.h
Eliminate DECL_STRDUP check in favor of simple fix to <ac/string.h> header.
[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 #undef assert
16
17 #ifdef LDAP_DEBUG
18
19 #if defined( HAVE_ASSERT_H ) || defined( STDC_HEADERS )
20 #undef NDEBUG
21 #include <assert.h>
22 #else
23 #define LDAP_NEED_ASSERT 1
24
25 /*
26  * no assert()... must be a very old compiler.
27  * create a replacement and hope it works
28  */
29
30 void    ber_pvt_assert(char* file, int line, char* test);
31 #define assert(test) \
32         ((test) \
33                 ? (void)0 \
34                 : ber_pvt_assert( __FILE__, __LINE__, LDAP_STRING(test)) )
35
36 #endif
37
38 #else
39 /* no asserts */
40 #define assert(test) ((void)0)
41 #endif
42
43 #endif /* _AC_ASSERT_H */