diff options
author | 卜部昌平 <[email protected]> | 2023-08-25 13:28:12 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2023-08-25 17:27:53 +0900 |
commit | fa2712981fc109368bf914e59577fcfdbf82379a (patch) | |
tree | 8e8fa26e8ca40e004c6e5bf20209a9b7ca501562 /include | |
parent | b88bdf1ebba52a447a39c1fee815dd55bd48ff9e (diff) |
workaround clang-17 -Wc2x-extensions
cf: https://github.com/llvm/llvm-project/commit/874217f99b99ab3c9026dc3b7bd84cd2beebde6e
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8274
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/internal/has/c_attribute.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/ruby/internal/has/c_attribute.h b/include/ruby/internal/has/c_attribute.h index c5c48867bf..69b0f402cd 100644 --- a/include/ruby/internal/has/c_attribute.h +++ b/include/ruby/internal/has/c_attribute.h @@ -21,11 +21,23 @@ * @brief Defines #RBIMPL_HAS_C_ATTRIBUTE. */ +#include "ruby/internal/has/extension.h" +#include "ruby/internal/has/warning.h" + /** Wraps (or simulates) `__has_c_attribute`. */ #if defined(__cplusplus) # /* Makes no sense. */ # define RBIMPL_HAS_C_ATTRIBUTE(_) 0 +#elif RBIMPL_HAS_EXTENSION(c_attributes) +# /* Hmm. It seems Clang 17 has this macro defined even when -std=c99 mode, +# * _and_ fails to compile complaining that attributes are C2X feature. We +# * need to work around this nonsense. */ +# define RBIMPL_HAS_C_ATTRIBUTE(_) __has_c_attribute(_) + +#elif RBIMPL_HAS_WARNING("-Wc2x-extensions") +# define RBIMPL_HAS_C_ATTRIBUTE(_) 0 + #elif defined(__has_c_attribute) # define RBIMPL_HAS_C_ATTRIBUTE(_) __has_c_attribute(_) |