Ruby: include/ruby/internal/attr/noreturn.h Source File

Ruby 4.0.6p0 (2026-07-14 revision 03b6d3f8898a28604fe6cb00eae3226b821168f4)

noreturn.h
Go to the documentation of this file.
1#ifndef RBIMPL_ATTR_NORETURN_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ATTR_NORETURN_H
23#include "ruby/internal/has/attribute.h"
24#include "ruby/internal/has/cpp_attribute.h"
25#include "ruby/internal/has/declspec_attribute.h"
26
28#if RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noreturn)
29# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
30
31#elif RBIMPL_HAS_ATTRIBUTE(noreturn)
32# define RBIMPL_ATTR_NORETURN() __attribute__((__noreturn__))
33
34#elif RBIMPL_HAS_CPP_ATTRIBUTE(noreturn)
35# define RBIMPL_ATTR_NORETURN() [[noreturn]]
36
37#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112)
38# define RBIMPL_ATTR_NORETURN() _Noreturn
39
40#elif defined(_Noreturn)
41# /* glibc <sys/cdefs.h> has this macro. */
42# define RBIMPL_ATTR_NORETURN() _Noreturn
43
44#else
45# define RBIMPL_ATTR_NORETURN() /* void */
46#endif
47
48#endif /* RBIMPL_ATTR_NORETURN_H */
attribute.h
Defines RBIMPL_HAS_ATTRIBUTE.
cpp_attribute.h
Defines RBIMPL_HAS_CPP_ATTRIBUTE.
declspec_attribute.h
Defines RBIMPL_HAS_DECLSPEC_ATTRIBUTE.