Pull in darkstat-3.0.718
[darkstat-debian] / cdefs.h
1 /* darkstat 3
2 * copyright (c) 2001-2014 Emil Mikulic.
3 *
4 * cdefs.h: compiler-specific defines
5 *
6 * This file borrows from FreeBSD's sys/cdefs.h
7 */
8
9 #ifdef __GNUC__
10 # define _unused_ __attribute__((__unused__))
11 # define _noreturn_ __attribute__((__noreturn__))
12 # define _printflike_(fmtarg, firstvararg) \
13 __attribute__((__format__ (__printf__, fmtarg, firstvararg) ))
14 #else
15 # define _unused_
16 # define _noreturn_
17 # define _printflike_(fmtarg, firstvararg)
18 #endif
19
20 #if __GNUC__ == 2
21 # define inline __inline__
22 #else
23 # ifdef __TenDRA__
24 # define inline __inline
25 # endif
26 #endif
27
28 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
29 # define restrict __restrict
30 #endif
31
32 #ifndef MAX
33 # define MAX(a,b) ((a) > (b) ? (a) : (b))
34 #endif
35
36 #ifndef MIN
37 # define MIN(a,b) ((a) < (b) ? (a) : (b))
38 #endif
39
40 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
41 # ifdef __COUNTER__
42 # define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
43 # else
44 # define _Static_assert(x, y) __Static_assert(x, __LINE__)
45 # endif
46 # define __Static_assert(x, y) ___Static_assert(x, y)
47 # define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1]
48 #endif
49
50 /* vim:set ts=3 sw=3 tw=78 expandtab: */