All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rad_assert.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 #ifndef _FR_RAD_ASSERT_H
17 #define _FR_RAD_ASSERT_H
18 /**
19  * $Id: 71cb9c29aae13db2012bcb7a5857b8cc32cc9e9d $
20  *
21  * @file include/rad_assert.h
22  * @brief Debug assertions, with logging.
23  *
24  * @copyright 2000,2001,2006 The FreeRADIUS server project
25  */
26 RCSIDH(rad_assert_h, "$Id: 71cb9c29aae13db2012bcb7a5857b8cc32cc9e9d $")
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 void rad_assert_fail(char const *file, unsigned int line, char const *expr) CC_HINT(noreturn);
33 
34 #ifdef NDEBUG
35  #define rad_assert(expr) ((void) (0))
36 
37 #elif !defined(__clang_analyzer__)
38  #define rad_assert(expr) \
39  ((void) ((expr) ? (void) 0 : \
40  (void) rad_assert_fail (__FILE__, __LINE__, #expr)))
41 
42 #else
43 #include <assert.h>
44 #define rad_assert assert
45 #endif
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 #endif /* _FR_RAD_ASSERT_H */
#define RCSIDH(h, id)
Definition: build.h:136
#define CC_HINT(_x)
Definition: build.h:71
void rad_assert_fail(char const *file, unsigned int line, char const *expr) CC_HINT(noreturn)
Definition: util.c:481