summaryrefslogtreecommitdiff
path: root/include/ruby/3/has/attribute.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/3/has/attribute.h')
-rw-r--r--include/ruby/3/has/attribute.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/ruby/3/has/attribute.h b/include/ruby/3/has/attribute.h
index 14c4ff5596..39ce321a4f 100644
--- a/include/ruby/3/has/attribute.h
+++ b/include/ruby/3/has/attribute.h
@@ -24,8 +24,18 @@
#include "ruby/3/compiler_since.h"
#include "ruby/3/token_paste.h"
+#ifndef __has_attribute
+# /* Don't bother. */
+#elif RUBY3_COMPILER_IS(GCC) && ! __has_attribute(pure)
+# /* FreeBSD's <sys/cdefs.h> defines its own *broken* version of
+# * __has_attribute. Cygwin copied that content to be a victim of the broken-
+# * ness. We don't take them into account. */
+#else
+# define RUBY3_HAVE___HAS_ATTRIBUTE 1
+#endif
+
/** Wraps (or simulates) `__has_attribute`. */
-#if defined(__has_attribute)
+#if defined(RUBY3_HAVE___HAS_ATTRIBUTE)
# define RUBY3_HAS_ATTRIBUTE(_) __has_attribute(_)
#elif RUBY3_COMPILER_IS(GCC)