diff options
24 files changed, 150 insertions, 173 deletions
@@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_ALLOC_SIZE(tuple) __attribute__((__alloc_size__ tuple)) - #else # define RUBY3_ATTR_ALLOC_SIZE(tuple) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_ARTIFICIAL() __attribute__((__artificial__)) - #else # define RUBY3_ATTR_ARTIFICIAL() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # /* 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 # define RUBY3_ATTR_CONST_ON_NDEBUG() RUBY3_ATTR_CONST() - #else # define RUBY3_ATTR_CONST_ON_NDEBUG() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # /* 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 # 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 # define RUBY3_ATTR_CONSTEXPR_ON_NDEBUG(_) RUBY3_ATTR_CONSTEXPR(_) - #else # define RUBY3_ATTR_CONSTEXPR_ON_NDEBUG(_) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # /* 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_ENUM_EXTENSIBILITY(_) __attribute__((__enum_extensibility__(_))) - #else # define RUBY3_ATTR_ENUM_EXTENSIBILITY(_) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_ERROR(msg) __attribute__((__error__ msg)) - #else # define RUBY3_ATTR_ERROR(msg) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_FLAG_ENUM() __attribute__((__flag_enum__)) - #else # define RUBY3_ATTR_FLAG_ENUM() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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) # define RUBY3_PRINTF_FORMAT __MINGW_PRINTF_FORMAT - #else # define RUBY3_PRINTF_FORMAT __printf__ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_NOALIAS() __declspec(noalias) - #else # define RUBY3_ATTR_NOALIAS() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # /* Doesn't make sense. */ # define RUBY3_ATTR_NOEXCEPT(_) /* void */ @@ -87,3 +86,5 @@ #else # define RUBY3_ATTR_NOEXCEPT(_) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_NOINLINE() __declspec(noinline) - #elif RUBY3_HAS_ATTRIBUTE(noinline) # define RUBY3_ATTR_NOINLINE() __attribute__((__noinline__)) - #else # define RUBY3_ATTR_NOINLINE() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_NONNULL(list) __attribute__((__nonnull__ list)) - #else # define RUBY3_ATTR_NONNULL(list) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 # define RUBY3_ATTR_PURE_ON_NDEBUG() RUBY3_ATTR_PURE() - #else # define RUBY3_ATTR_PURE_ON_NDEBUG() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # 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 @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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_) # /* Take SAL definition. */ # define RUBY3_ATTR_RETURNS_NONNULL() _Ret_nonnull_ @@ -33,3 +32,5 @@ #else # define RUBY3_ATTR_RETURNS_NONNULL() /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_WARNING(msg) __attribute__((__warning__ msg)) - #else # define RUBY3_ATTR_WARNING(msg) /* void */ #endif @@ -1,4 +1,6 @@ -/** \noop-*-C++-*-vi:ft=cpp * @file * @author Ruby developers <[email protected]> * @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) # define RUBY3_ATTR_WEAKREF(sym) __attribute__((__weakref__(# sym))) - #else # define RUBY3_ATTR_WEAKREF(sym) /* void */ #endif |