3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2022 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
24 #if defined( HAVE_ASSERT_H ) || defined( STDC_HEADERS )
29 #else /* !(HAVE_ASSERT_H || STDC_HEADERS) */
31 #define LDAP_NEED_ASSERT 1
34 * no assert()... must be a very old compiler.
35 * create a replacement and hope it works
38 LBER_F (void) ber_pvt_assert
LDAP_P(( const char *file
, int line
,
41 /* Can't use LDAP_STRING(test), that'd expand to "test" */
42 #if defined(__STDC__) || defined(__cplusplus)
43 #define assert(test) \
44 ((test) ? (void)0 : ber_pvt_assert( __FILE__, __LINE__, #test ) )
46 #define assert(test) \
47 ((test) ? (void)0 : ber_pvt_assert( __FILE__, __LINE__, "test" ) )
50 #endif /* (HAVE_ASSERT_H || STDC_HEADERS) */
52 #else /* !LDAP_DEBUG */
54 #define assert(test) ((void)0)
55 #endif /* LDAP_DEBUG */
57 #endif /* _AC_ASSERT_H */