xref: /llvm-project/clang/lib/Headers/stdnoreturn.h (revision df241b19c952b904eec755d9f090737aed437986)
1 /*===---- stdnoreturn.h - Standard header for noreturn macro ---------------===
2  *
3  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4  * See https://llvm.org/LICENSE.txt for license information.
5  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6  *
7  *===-----------------------------------------------------------------------===
8  */
9 
10 #ifndef __STDNORETURN_H
11 #define __STDNORETURN_H
12 
13 #if defined(__MVS__) && __has_include_next(<stdnoreturn.h>)
14 #include_next <stdnoreturn.h>
15 #else
16 
17 #define noreturn _Noreturn
18 #define __noreturn_is_defined 1
19 
20 #endif /* __MVS__ */
21 
22 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L) &&               \
23     !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
24 /* The noreturn macro is deprecated in C23. We do not mark it as such because
25    including the header file in C23 is also deprecated and we do not want to
26    issue a confusing diagnostic for code which includes <stdnoreturn.h>
27    followed by code that writes [[noreturn]]. The issue with such code is not
28    with the attribute, or the use of 'noreturn', but the inclusion of the
29    header. */
30 /* FIXME: We should be issuing a deprecation warning here, but cannot yet due
31  * to system headers which include this header file unconditionally.
32  */
33 #endif
34 
35 #endif /* __STDNORETURN_H */
36