Initial vendor import of ldns-1.6.4 into contrib.
[dragonfly.git] / contrib / ldns / ldns / common.h
1 /**
2  * \file common.h
3  *
4  * Common definitions for LDNS
5  */
6
7 /**
8  * a Net::DNS like library for C
9  *
10  * (c) NLnet Labs, 2004-2006
11  *
12  * See the file LICENSE for the license
13  */
14
15 #ifndef LDNS_COMMON_H
16 #define LDNS_COMMON_H
17
18 #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
19
20 #if defined(HAVE_STDBOOL_H)
21 #include <stdbool.h>
22 #else
23
24 /*@ignore@*/
25 /* splint barfs on this construct */
26 typedef unsigned char bool;
27 #define bool bool
28 #define false 0
29 #define true  1
30 #define __bool_true_false_are_defined 1
31 /*@end@*/
32
33 #endif
34
35 #endif
36
37 #ifdef HAVE_ATTR_FORMAT
38 #define ATTR_FORMAT(archetype, string_index, first_to_check) \
39     __attribute__ ((format (archetype, string_index, first_to_check)))
40 #else /* !HAVE_ATTR_FORMAT */
41 #define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
42 #endif /* !HAVE_ATTR_FORMAT */
43
44 #if defined(__cplusplus)
45 #define ATTR_UNUSED(x)
46 #elif defined(HAVE_ATTR_UNUSED)
47 #define ATTR_UNUSED(x)  x __attribute__((unused))
48 #else /* !HAVE_ATTR_UNUSED */
49 #define ATTR_UNUSED(x)  x
50 #endif /* !HAVE_ATTR_UNUSED */
51
52 #endif /* LDNS_COMMON_H */