/* Generic assert.h */1/* $OpenLDAP$ */2/* This work is part of OpenLDAP Software <http://www.openldap.org/>.3*4* Copyright 1998-2024 The OpenLDAP Foundation.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted only as authorized by the OpenLDAP9* Public License.10*11* A copy of this license is available in file LICENSE in the12* top-level directory of the distribution or, alternatively, at13* <http://www.OpenLDAP.org/license.html>.14*/1516#ifndef _AC_ASSERT_H17#define _AC_ASSERT_H1819#undef assert2021#ifdef LDAP_DEBUG2223#if defined( HAVE_ASSERT_H ) || defined( STDC_HEADERS )2425#undef NDEBUG26#include <assert.h>2728#else /* !(HAVE_ASSERT_H || STDC_HEADERS) */2930#define LDAP_NEED_ASSERT 13132/*33* no assert()... must be a very old compiler.34* create a replacement and hope it works35*/3637LBER_F (void) ber_pvt_assert LDAP_P(( const char *file, int line,38const char *test ));3940/* Can't use LDAP_STRING(test), that'd expand to "test" */41#if defined(__STDC__) || defined(__cplusplus)42#define assert(test) \43((test) ? (void)0 : ber_pvt_assert( __FILE__, __LINE__, #test ) )44#else45#define assert(test) \46((test) ? (void)0 : ber_pvt_assert( __FILE__, __LINE__, "test" ) )47#endif4849#endif /* (HAVE_ASSERT_H || STDC_HEADERS) */5051#else /* !LDAP_DEBUG */52/* no asserts */53#define assert(test) ((void)0)54#endif /* LDAP_DEBUG */5556#endif /* _AC_ASSERT_H */575859