3 Compiler-specific definitions. Note that unknown compiler is not a
6 Copyright (C) 2010-2013 Andrew Nayenko
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef COMPILER_H_INCLUDED
23 #define COMPILER_H_INCLUDED
25 #if __STDC_VERSION__ < 199901L
26 #error C99-compliant compiler is required
29 #if defined(__GNUC__) /* this includes Clang */
31 #define PRINTF __attribute__((format(printf, 1, 2)))
32 #define NORETURN __attribute((noreturn))
33 #define PACKED __attribute__((packed))
43 #define CONCAT2(a, b) a ## b
44 #define CONCAT1(a, b) CONCAT2(a, b)
45 #define STATIC_ASSERT(cond) \
46 extern void CONCAT1(static_assert, __LINE__)(int x[(cond) ? 1 : -1])
48 #endif /* ifndef COMPILER_H_INCLUDED */