diff options
Diffstat (limited to 'include/ruby/3/attr')
24 files changed, 150 insertions, 173 deletions
diff --git a/include/ruby/3/attr/alloc_size.h b/include/ruby/3/attr/alloc_size.h index 8296e9dcfd..251a19f7f3 100644 --- a/include/ruby/3/attr/alloc_size.h +++ b/include/ruby/3/attr/alloc_size.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_ALLOC_SIZE_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_ALLOC_SIZE_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,12 +22,10 @@ */ /** Wraps (or simulates) `__attribute__((alloc_size))` */ -#if defined(RUBY3_ATTR_ALLOC_SIZE) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(alloc_size) +#if RUBY3_HAS_ATTRIBUTE(alloc_size) # define RUBY3_ATTR_ALLOC_SIZE(tuple) __attribute__((__alloc_size__ tuple)) - #else # define RUBY3_ATTR_ALLOC_SIZE(tuple) /* void */ #endif + +#endif /* RUBY3_ATTR_ALLOC_SIZE_H */ diff --git a/include/ruby/3/attr/artificial.h b/include/ruby/3/attr/artificial.h index 5e94a048f9..a9f305daab 100644 --- a/include/ruby/3/attr/artificial.h +++ b/include/ruby/3/attr/artificial.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_ARTIFICIAL_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_ARTIFICIAL_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -34,12 +36,10 @@ */ /** Wraps (or simulates) `__attribute__((artificial))` */ -#if defined(RUBY3_ATTR_ARTIFICIAL) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(artificial) +#if RUBY3_HAS_ATTRIBUTE(artificial) # define RUBY3_ATTR_ARTIFICIAL() __attribute__((__artificial__)) - #else # define RUBY3_ATTR_ARTIFICIAL() /* void */ #endif + +#endif /* RUBY3_ATTR_ARTIFICIAL_H */ diff --git a/include/ruby/3/attr/cold.h b/include/ruby/3/attr/cold.h index 27f92763f1..5b5263feb0 100644 --- a/include/ruby/3/attr/cold.h +++ b/include/ruby/3/attr/cold.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_COLD_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_COLD_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -21,17 +23,14 @@ #include "ruby/3/compiler_is.h" /** Wraps (or simulates) `__attribute__((cold))` */ -#if defined(RUBY3_ATTR_COLD) -# /* Take that. */ - -#elif RUBY3_COMPILER_IS(SunPro) +#if RUBY3_COMPILER_IS(SunPro) # /* Recent SunPro has __has_attribute, and is borken. */ # /* It reports it has attribute cold, reality isn't (warnings issued). */ # define RUBY3_ATTR_COLD() /* void */ - #elif RUBY3_HAS_ATTRIBUTE(cold) # define RUBY3_ATTR_COLD() __attribute__((__cold__)) - #else # define RUBY3_ATTR_COLD() /* void */ #endif + +#endif /* RUBY3_ATTR_COLD_H */ diff --git a/include/ruby/3/attr/const.h b/include/ruby/3/attr/const.h index 689889cb65..d97495c647 100644 --- a/include/ruby/3/attr/const.h +++ b/include/ruby/3/attr/const.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_CONST_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_CONST_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -21,30 +23,22 @@ #include "ruby/3/has/declspec_attribute.h" /** Wraps (or simulates) `__attribute__((const))` */ -#if defined(RUBY3_ATTR_CONST) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(const) +#if RUBY3_HAS_ATTRIBUTE(const) # define RUBY3_ATTR_CONST() __attribute__((__const__)) - #elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(noalias) # /* If a function can be a const, that is also a noalias. */ # define RUBY3_ATTR_CONST() __declspec(noalias) - #elif RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) # define RUBY3_ATTR_CONST() _Pragma("no_side_effect") - #else # define RUBY3_ATTR_CONST() /* void */ #endif /** Enables #RUBY3_ATTR_CONST iff. #RUBY_NDEBUG. */ -#if defined(RUBY3_ATTR_CONST_ON_NDEBUG) -# /* Take that. */ - -#elif RUBY_NDEBUG +#if RUBY_NDEBUG # define RUBY3_ATTR_CONST_ON_NDEBUG() RUBY3_ATTR_CONST() - #else # define RUBY3_ATTR_CONST_ON_NDEBUG() /* void */ #endif + +#endif /* RUBY3_ATTR_CONST_H */ diff --git a/include/ruby/3/attr/constexpr.h b/include/ruby/3/attr/constexpr.h index 11842d87c0..582d9fd000 100644 --- a/include/ruby/3/attr/constexpr.h +++ b/include/ruby/3/attr/constexpr.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_CONSTEXPR_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_CONSTEXPR_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -21,11 +23,8 @@ #include "ruby/3/has/feature.h" #include "ruby/3/compiler_is.h" -/** @cond INTERNAL_MACRO*/ -#if defined(RUBY3_ATTR_CONSTEXPR) -# /* Take that. */ - -#elif ! defined(__cplusplus) +/** @cond INTERNAL_MACRO */ +#if ! defined(__cplusplus) # /* Makes no sense. */ # define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 0 # define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 0 @@ -63,10 +62,7 @@ /** @endcond */ /** Wraps (or simulates) C++11 `constexpr`. */ -#if defined(RUBY3_ATTR_CONSTEXPR) -# /* Take that. */ - -#elif RUBY3_HAS_ATTR_CONSTEXPR_CXX14 +#if RUBY3_HAS_ATTR_CONSTEXPR_CXX14 # define RUBY3_ATTR_CONSTEXPR(_) constexpr #elif RUBY3_HAS_ATTR_CONSTEXPR_CXX11 @@ -79,12 +75,10 @@ #endif /** Enables #RUBY3_ATTR_CONSTEXPR iff. #RUBY_NDEBUG. */ -#if defined(RUBY3_ATTR_CONSTEXPR_ON_NDEBUG) -# /* Take that. */ - -#elif RUBY_NDEBUG +#if RUBY_NDEBUG # define RUBY3_ATTR_CONSTEXPR_ON_NDEBUG(_) RUBY3_ATTR_CONSTEXPR(_) - #else # define RUBY3_ATTR_CONSTEXPR_ON_NDEBUG(_) /* void */ #endif + +#endif /* RUBY3_ATTR_CONSTEXPR_H */ diff --git a/include/ruby/3/attr/deprecated.h b/include/ruby/3/attr/deprecated.h index 629f7c9fc5..9f939a5e8c 100644 --- a/include/ruby/3/attr/deprecated.h +++ b/include/ruby/3/attr/deprecated.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_DEPRECATED_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_DEPRECATED_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -24,10 +26,7 @@ #include "ruby/3/has/extension.h" /** Wraps (or simulates) `[[deprecated]]` */ -#if defined(RUBY3_ATTR_DEPRECATED) -# /* Take that. */ - -#elif RUBY3_HAS_EXTENSION(attribute_deprecated_with_message) +#if RUBY3_HAS_EXTENSION(attribute_deprecated_with_message) # define RUBY3_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) #elif RUBY3_COMPILER_SINCE(GCC, 4, 5, 0) @@ -54,3 +53,5 @@ #else # define RUBY3_ATTR_DEPRECATED(msg) /* void */ #endif + +#endif /* RUBY3_ATTR_DEPRECATED_H */ diff --git a/include/ruby/3/attr/diagnose_if.h b/include/ruby/3/attr/diagnose_if.h index a363c4cdb3..488c3ec7ad 100644 --- a/include/ruby/3/attr/diagnose_if.h +++ b/include/ruby/3/attr/diagnose_if.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_DIAGNOSE_IF_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_DIAGNOSE_IF_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,10 +22,7 @@ */ /** Wraps (or simulates) `__attribute__((diagnose_if))` */ -#if defined(RUBY3_ATTR_DIAGNOSE_IF) -# /* Take that. */ - -#elif RUBY3_COMPILER_BEFORE(Clang, 5, 0, 0) +#if RUBY3_COMPILER_BEFORE(Clang, 5, 0, 0) # /* https://bugs.llvm.org/show_bug.cgi?id=34319 */ # define RUBY3_ATTR_DIAGNOSE_IF(_, __, ___) /* void */ @@ -37,3 +36,5 @@ #else # define RUBY3_ATTR_DIAGNOSE_IF(_, __, ___) /* void */ #endif + +#endif /* RUBY3_ATTR_DIAGNOSE_IF_H */ diff --git a/include/ruby/3/attr/enum_extensibility.h b/include/ruby/3/attr/enum_extensibility.h index 0631057383..a56d1a54b8 100644 --- a/include/ruby/3/attr/enum_extensibility.h +++ b/include/ruby/3/attr/enum_extensibility.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_ENUM_EXTENSIBILITY_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_ENUM_EXTENSIBILITY_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,12 +22,10 @@ */ /** Wraps (or simulates) `__attribute__((enum_extensibility))` */ -#if defined(RUBY3_ATTR_ENUM_EXTENSIBILITY) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(enum_extensibility) +#if RUBY3_HAS_ATTRIBUTE(enum_extensibility) # define RUBY3_ATTR_ENUM_EXTENSIBILITY(_) __attribute__((__enum_extensibility__(_))) - #else # define RUBY3_ATTR_ENUM_EXTENSIBILITY(_) /* void */ #endif + +#endif /* RUBY3_ATTR_ENUM_EXTENSIBILITY_H */ diff --git a/include/ruby/3/attr/error.h b/include/ruby/3/attr/error.h index ec9383aace..ee5e3290ae 100644 --- a/include/ruby/3/attr/error.h +++ b/include/ruby/3/attr/error.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_ERROR_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_ERROR_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,12 +22,10 @@ */ /** Wraps (or simulates) `__attribute__((error))` */ -#if defined(RUBY3_ATTR_ERROR) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(error) +#if RUBY3_HAS_ATTRIBUTE(error) # define RUBY3_ATTR_ERROR(msg) __attribute__((__error__ msg)) - #else # define RUBY3_ATTR_ERROR(msg) /* void */ #endif + +#endif /* RUBY3_ATTR_ERROR_H */ diff --git a/include/ruby/3/attr/flag_enum.h b/include/ruby/3/attr/flag_enum.h index 5e7e9982f9..7165347bd7 100644 --- a/include/ruby/3/attr/flag_enum.h +++ b/include/ruby/3/attr/flag_enum.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_FLAG_ENUM_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_FLAG_ENUM_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -21,12 +23,10 @@ */ /** Wraps (or simulates) `__attribute__((flag_enum)` */ -#if defined(RUBY3_ATTR_FLAG_ENUM) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(flag_enum) +#if RUBY3_HAS_ATTRIBUTE(flag_enum) # define RUBY3_ATTR_FLAG_ENUM() __attribute__((__flag_enum__)) - #else # define RUBY3_ATTR_FLAG_ENUM() /* void */ #endif + +#endif /* RUBY3ATTR_FLAG_ENUM_H */ diff --git a/include/ruby/3/attr/forceinline.h b/include/ruby/3/attr/forceinline.h index 6d279235b8..3c865e9c4b 100644 --- a/include/ruby/3/attr/forceinline.h +++ b/include/ruby/3/attr/forceinline.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_FORCEINLINE_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_FORCEINLINE_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -25,15 +27,12 @@ * `__forceinline` are mutually exclusive. We have to mimic that behaviour for * non-MSVC compilers. */ -#if defined(RUBY3_ATTR_FORCEINLINE) -# /* Take that. */ - -#elif RUBY3_COMPILER_SINCE(MSVC, 12, 0, 0) +#if RUBY3_COMPILER_SINCE(MSVC, 12, 0, 0) # define RUBY3_ATTR_FORCEINLINE() __forceinline - #elif RUBY3_HAS_ATTRIBUTE(always_inline) # define RUBY3_ATTR_FORCEINLINE() __attribute__((__always_inline__)) inline - #else # define RUBY3_ATTR_FORCEINLINE() inline #endif + +#endif /* RUBY3_ATTR_FORCEINLINE_H */ diff --git a/include/ruby/3/attr/format.h b/include/ruby/3/attr/format.h index de8e2f53c4..c234034afe 100644 --- a/include/ruby/3/attr/format.h +++ b/include/ruby/3/attr/format.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_FORMAT_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_FORMAT_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,22 +22,16 @@ */ /** Wraps (or simulates) `__attribute__((format))` */ -#if defined(RUBY3_ATTR_FORMAT) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(format) +#if RUBY3_HAS_ATTRIBUTE(format) # define RUBY3_ATTR_FORMAT(x, y, z) __attribute__((__format__(x, y, z))) - #else # define RUBY3_ATTR_FORMAT(x, y, z) /* void */ #endif -#if defined(RUBY3_PRINTF_FORMAT) -# /* Take that. */ - -#elif defined(__MINGW_PRINTF_FORMAT) +#if defined(__MINGW_PRINTF_FORMAT) # define RUBY3_PRINTF_FORMAT __MINGW_PRINTF_FORMAT - #else # define RUBY3_PRINTF_FORMAT __printf__ #endif + +#endif /* RUBY3_ATTR_FORMAT_H */ diff --git a/include/ruby/3/attr/maybe_unused.h b/include/ruby/3/attr/maybe_unused.h index 29a8c35bfc..f814804e9f 100644 --- a/include/ruby/3/attr/maybe_unused.h +++ b/include/ruby/3/attr/maybe_unused.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_MAYBE_UNUSED_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_MAYBE_UNUSED_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -22,18 +24,14 @@ #include "ruby/3/has/cpp_attribute.h" /** Wraps (or simulates) `[[maybe_unused]]` */ -#if defined(RUBY3_ATTR_MAYBE_UNUSED) -# /* Take that. */ - -#elif RUBY3_HAS_CPP_ATTRIBUTE(maybe_unused) +#if RUBY3_HAS_CPP_ATTRIBUTE(maybe_unused) # define RUBY3_ATTR_MAYBE_UNUSED() [[maybe_unused]] - #elif RUBY3_HAS_C_ATTRIBUTE(maybe_unused) # define RUBY3_ATTR_MAYBE_UNUSED() [[maybe_unused]] - #elif RUBY3_HAS_ATTRIBUTE(unused) # define RUBY3_ATTR_MAYBE_UNUSED() __attribute__((__unused__)) - #else # define RUBY3_ATTR_MAYBE_UNUSED() /* void */ #endif + +#endif /* RUBY3_ATTR_MAYBE_UNUSED */ diff --git a/include/ruby/3/attr/noalias.h b/include/ruby/3/attr/noalias.h index c15f1480cb..49ad11999d 100644 --- a/include/ruby/3/attr/noalias.h +++ b/include/ruby/3/attr/noalias.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_NOALIAS_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_NOALIAS_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -47,12 +49,10 @@ #include "ruby/3/has/declspec_attribute.h" /** Wraps (or simulates) `__declspec((noalias))` */ -#if defined(RUBY3_ATTR_NOALIAS) -# /* Take that. */ - -#elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(noalias) +#if RUBY3_HAS_DECLSPEC_ATTRIBUTE(noalias) # define RUBY3_ATTR_NOALIAS() __declspec(noalias) - #else # define RUBY3_ATTR_NOALIAS() /* void */ #endif + +#endif /* RUBY3_ATTR_NOALIAS_H */ diff --git a/include/ruby/3/attr/nodiscard.h b/include/ruby/3/attr/nodiscard.h index 342a1da7ad..0142d22bd4 100644 --- a/include/ruby/3/attr/nodiscard.h +++ b/include/ruby/3/attr/nodiscard.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_NODISCARD_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_NODISCARD_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -26,22 +28,17 @@ * nodiscard attribute can have a message why the result shall not be ignoed. * However GCC attribute and SAL annotation cannot take them. */ -#if defined(RUBY3_ATTR_NODISCARD) -# /* Take that. */ - -#elif RUBY3_HAS_CPP_ATTRIBUTE(nodiscard) +#if RUBY3_HAS_CPP_ATTRIBUTE(nodiscard) # define RUBY3_ATTR_NODISCARD() [[nodiscard]] - #elif RUBY3_HAS_C_ATTRIBUTE(nodiscard) # define RUBY3_ATTR_NODISCARD() [[nodiscard]] - #elif RUBY3_HAS_ATTRIBUTE(warn_unused_result) # define RUBY3_ATTR_NODISCARD() __attribute__((__warn_unused_result__)) - #elif defined(_Check_return_) # /* Take SAL definition. */ # define RUBY3_ATTR_NODISCARD() _Check_return_ - #else # define RUBY3_ATTR_NODISCARD() /* void */ #endif + +#endif /* RUBY3_ATTR_NODISCARD_H */ diff --git a/include/ruby/3/attr/noexcept.h b/include/ruby/3/attr/noexcept.h index 1bc90de88c..a99ca0b35c 100644 --- a/include/ruby/3/attr/noexcept.h +++ b/include/ruby/3/attr/noexcept.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_NOEXCEPT_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_NOEXCEPT_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -62,10 +64,7 @@ #include "ruby/3/has/feature.h" /** Wraps (or simulates) C++11 `noexcept` */ -#if defined(RUBY3_ATTR_NOEXCEPT) -# /* Take that. */ - -#elif ! defined(__cplusplus) +#if ! defined(__cplusplus) # /* Doesn't make sense. */ # define RUBY3_ATTR_NOEXCEPT(_) /* void */ @@ -87,3 +86,5 @@ #else # define RUBY3_ATTR_NOEXCEPT(_) /* void */ #endif + +#endif /* RUBY3_ATTR_NOEXCEPT_H */ diff --git a/include/ruby/3/attr/noinline.h b/include/ruby/3/attr/noinline.h index 4483c4c8d6..e5eca8eaef 100644 --- a/include/ruby/3/attr/noinline.h +++ b/include/ruby/3/attr/noinline.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_NOINLINE_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_NOINLINE_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -21,15 +23,12 @@ #include "ruby/3/has/declspec_attribute.h" /** Wraps (or simulates) `__declspec(noinline)` */ -#if defined(RUBY3_ATTR_NOINLINE) -# /* Take that. */ - -#elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(noinline) +#if RUBY3_HAS_DECLSPEC_ATTRIBUTE(noinline) # define RUBY3_ATTR_NOINLINE() __declspec(noinline) - #elif RUBY3_HAS_ATTRIBUTE(noinline) # define RUBY3_ATTR_NOINLINE() __attribute__((__noinline__)) - #else # define RUBY3_ATTR_NOINLINE() /* void */ #endif + +#endif /* RUBY3_ATTR_NOINLINE_H */ diff --git a/include/ruby/3/attr/nonnull.h b/include/ruby/3/attr/nonnull.h index 0431c5a363..4c2f3f1ca0 100644 --- a/include/ruby/3/attr/nonnull.h +++ b/include/ruby/3/attr/nonnull.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_NONNULL_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,12 +22,10 @@ */ /** Wraps (or simulates) `__attribute__((nonnull))` */ -#if defined(RUBY3_ATTR_NONNULL) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(nonnull) +#if RUBY3_HAS_ATTRIBUTE(nonnull) # define RUBY3_ATTR_NONNULL(list) __attribute__((__nonnull__ list)) - #else # define RUBY3_ATTR_NONNULL(list) /* void */ #endif + +#endif /* RUBY3_ATTR_NONNULL_H */ diff --git a/include/ruby/3/attr/noreturn.h b/include/ruby/3/attr/noreturn.h index 2dc940116a..2b7051428d 100644 --- a/include/ruby/3/attr/noreturn.h +++ b/include/ruby/3/attr/noreturn.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_NORETURN_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_NORETURN_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -22,10 +24,7 @@ #include "ruby/3/has/declspec_attribute.h" /** Wraps (or simulates) `[[noreturn]]` */ -#if defined(RUBY3_ATTR_NORETURN) -# /* Take that. */ - -#elif RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) +#if RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) # define RUBY3_ATTR_NORETURN() _Pragma("does_not_return") #elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(noreturn) @@ -47,3 +46,5 @@ #else # define RUBY3_ATTR_NORETURN() /* void */ #endif + +#endif /* RUBY3_ATTR_NORETURN_H */ diff --git a/include/ruby/3/attr/pure.h b/include/ruby/3/attr/pure.h index 530b0cf3b4..038fd2abdb 100644 --- a/include/ruby/3/attr/pure.h +++ b/include/ruby/3/attr/pure.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_PURE_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_PURE_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -21,26 +23,19 @@ #include "ruby/assert.h" /** Wraps (or simulates) `__attribute__((pure))` */ -#if defined(RUBY3_ATTR_PURE) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(pure) +#if RUBY3_HAS_ATTRIBUTE(pure) # define RUBY3_ATTR_PURE() __attribute__((__pure__)) - #elif RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) # define RUBY3_ATTR_PURE() _Pragma("does_not_write_global_data") - #else # define RUBY3_ATTR_PURE() /* void */ #endif /** Enables #RUBY3_ATTR_PURE iff. #RUBY_NDEBUG. */ -#if defined(RUBY3_ATTR_PURE_ON_NDEBUG) -# /* Take that. */ - -#elif RUBY_NDEBUG +#if RUBY_NDEBUG # define RUBY3_ATTR_PURE_ON_NDEBUG() RUBY3_ATTR_PURE() - #else # define RUBY3_ATTR_PURE_ON_NDEBUG() /* void */ #endif + +#endif /* RUBY3_ATTR_PURE_H */ diff --git a/include/ruby/3/attr/restrict.h b/include/ruby/3/attr/restrict.h index c42ad99a01..f6d7936b3a 100644 --- a/include/ruby/3/attr/restrict.h +++ b/include/ruby/3/attr/restrict.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_RESTRICT_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_RESTRICT_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -24,10 +26,7 @@ * `__has_declspec_attribute()` which involves macro substitution. */ /** Wraps (or simulates) `__declspec(restrict)` */ -#if defined(RUBY3_ATTR_RESTRICT) -# /* Take that. */ - -#elif RUBY3_COMPILER_SINCE(MSVC, 14, 0, 0) +#if RUBY3_COMPILER_SINCE(MSVC, 14, 0, 0) # define RUBY3_ATTR_RESTRICT() __declspec(RUBY3_TOKEN_PASTE(re, strict)) #elif RUBY3_HAS_ATTRIBUTE(malloc) @@ -39,3 +38,5 @@ #else # define RUBY3_ATTR_RESTRICT() /* void */ #endif + +#endif /* RUBY3_ATTR_RESTRICT_H */ diff --git a/include/ruby/3/attr/returns_nonnull.h b/include/ruby/3/attr/returns_nonnull.h index aefee7ef30..eb8db1d045 100644 --- a/include/ruby/3/attr/returns_nonnull.h +++ b/include/ruby/3/attr/returns_nonnull.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_RETURNS_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_RETURNS_NONNULL_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,10 +22,7 @@ */ /** Wraps (or simulates) `__attribute__((returns_nonnull))` */ -#if defined(RUBY3_ATTR_RETURNS_NONNULL) -# /* Take that. */ - -#elif defined(_Ret_nonnull_) +#if defined(_Ret_nonnull_) # /* Take SAL definition. */ # define RUBY3_ATTR_RETURNS_NONNULL() _Ret_nonnull_ @@ -33,3 +32,5 @@ #else # define RUBY3_ATTR_RETURNS_NONNULL() /* void */ #endif + +#endif /* RUBY3_ATTR_RETURNS_NONNULL_H */ diff --git a/include/ruby/3/attr/warning.h b/include/ruby/3/attr/warning.h index 6323b6e2fe..0c64e6a834 100644 --- a/include/ruby/3/attr/warning.h +++ b/include/ruby/3/attr/warning.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_WARNING_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_WARNING_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,12 +22,10 @@ */ /** Wraps (or simulates) `__attribute__((warning))` */ -#if defined(RUBY3_ATTR_WARNING) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(warning) +#if RUBY3_HAS_ATTRIBUTE(warning) # define RUBY3_ATTR_WARNING(msg) __attribute__((__warning__ msg)) - #else # define RUBY3_ATTR_WARNING(msg) /* void */ #endif + +#endif /* RUBY3_ATTR_WARNING_H */ diff --git a/include/ruby/3/attr/weakref.h b/include/ruby/3/attr/weakref.h index 28b901d44f..a540266219 100644 --- a/include/ruby/3/attr/weakref.h +++ b/include/ruby/3/attr/weakref.h @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp +#ifndef RUBY3_ATTR_WEAKREF_H /*-*-C++-*-vi:se ft=cpp:*/ +#define RUBY3_ATTR_WEAKREF_H +/** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @copyright This file is a part of the programming language Ruby. @@ -20,12 +22,10 @@ */ /** Wraps (or simulates) `__attribute__((weakref))` */ -#if defined(RUBY3_ATTR_WEAKREF) -# /* Take that. */ - -#elif RUBY3_HAS_ATTRIBUTE(weakref) +#if RUBY3_HAS_ATTRIBUTE(weakref) # define RUBY3_ATTR_WEAKREF(sym) __attribute__((__weakref__(# sym))) - #else # define RUBY3_ATTR_WEAKREF(sym) /* void */ #endif + +#endif /* RUBY3_ATTR_WEAKREF_H */ |