1 /* function-attributes.h - Provides compiler abstractions for
4 * Copyright (c) 2012 Justus Winter <4winter@informatik.uni-hamburg.de>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see https://www.gnu.org/licenses/ .
20 #ifndef FUNCTION_ATTRIBUTES_H
21 #define FUNCTION_ATTRIBUTES_H
23 /* clang provides this macro to test for support for function
24 * attributes. If it isn't defined, this provides a compatibility
25 * macro for other compilers.
27 #ifndef __has_attribute
28 #define __has_attribute(x) 0
31 /* Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE from
34 * This attribute is understood by gcc since version 2.5. clang
35 * provides support for testing for function attributes.
37 #ifndef NORETURN_ATTRIBUTE
38 #if (__GNUC__ >= 3 || \
39 (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || \
40 __has_attribute (noreturn))
41 #define NORETURN_ATTRIBUTE __attribute__ ((noreturn))
43 #define NORETURN_ATTRIBUTE