summaryrefslogtreecommitdiffstats
path: root/gl/_Noreturn.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/_Noreturn.h')
-rw-r--r--gl/_Noreturn.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/gl/_Noreturn.h b/gl/_Noreturn.h
new file mode 100644
index 0000000..6fed3c7
--- /dev/null
+++ b/gl/_Noreturn.h
@@ -0,0 +1,45 @@
1/* A C macro for declaring that a function does not return.
2 Copyright (C) 2011-2021 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _Noreturn
18# if (defined __cplusplus \
19 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
20 || (defined _MSC_VER && 1900 <= _MSC_VER)) \
21 && 0)
22 /* [[noreturn]] is not practically usable, because with it the syntax
23 extern _Noreturn void func (...);
24 would not be valid; such a declaration would only be valid with 'extern'
25 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
26 AIX system header files and several gnulib header files use precisely
27 this syntax with 'extern'. */
28# define _Noreturn [[noreturn]]
29# elif ((!defined __cplusplus || defined __clang__) \
30 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
31 || (!defined __STRICT_ANSI__ \
32 && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
33 || (defined __apple_build_version__ \
34 ? 6000000 <= __apple_build_version__ \
35 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
36 /* _Noreturn works as-is. */
37# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
38 || 0x5110 <= __SUNPRO_C)
39# define _Noreturn __attribute__ ((__noreturn__))
40# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
41# define _Noreturn __declspec (noreturn)
42# else
43# define _Noreturn
44# endif
45#endif