1 /* This include file was added by Paul A. Rombouts.
2    I had terrible difficulties with cyclic dependencies of the include files
3    written by Thomas Moestl. The only way I knew how to break the cycle was to
4    put some declarations in a seperate file.
5 
6    Copyright (C) 2000, 2001 Thomas Moestl
7    Copyright (C) 2002 Paul A. Rombouts
8 
9   This file is part of the pdnsd package.
10 
11   pdnsd is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 3 of the License, or
14   (at your option) any later version.
15 
16   pdnsd is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   GNU General Public License for more details.
20 
21   You should have received a copy of the GNU General Public License
22   along with pdnsd; see the file COPYING. If not, see
23   <http://www.gnu.org/licenses/>.
24 */
25 
26 #ifndef PDNSD_ASSERT_H
27 #define PDNSD_ASSERT_H
28 
29 /* Originally in helpers.h */
30 
31 /* format string checking for printf-like functions */
32 #ifdef __GNUC__
33 #define printfunc(fmt, firstva) __attribute__((__format__(__printf__, fmt, firstva)))
34 #else
35 #define printfunc(fmt, firstva)
36 #endif
37 
38 void pdnsd_exit(void);
39 
40 
41 /*
42  * Assert macro, used in some places. For now, it should be always defined, not
43  * only in the DEBUG case, to be on the safe side security-wise.
44  */
45 #define PDNSD_ASSERT(cond, msg)						\
46 	{ if (!(cond)) {						\
47 		log_error("%s:%d: %s", __FILE__, __LINE__, msg);	\
48 		pdnsd_exit();						\
49  	} }
50 
51 #endif
52