Stop using inline, get restrict from autoconf.
[darkstat] / 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 #ifndef MAX
21 # define MAX(a,b) ((a) > (b) ? (a) : (b))
22 #endif
23
24 #ifndef MIN
25 # define MIN(a,b) ((a) < (b) ? (a) : (b))
26 #endif
27
28 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
29 # ifdef __COUNTER__
30 # define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
31 # else
32 # define _Static_assert(x, y) __Static_assert(x, __LINE__)
33 # endif
34 # define __Static_assert(x, y) ___Static_assert(x, y)
35 # define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1]
36 #endif
37
38 /* vim:set ts=3 sw=3 tw=78 expandtab: */