summaryrefslogtreecommitdiff
path: root/lib/cdefs.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-01-21 13:40:16 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-01-21 17:09:58 -0800
commit605e20a698d3f7296cda18ac7dd84b1a8f388b50 (patch)
tree1e175acc33337e6fb6f29e8e0e7c2eb310c340a7 /lib/cdefs.h
parent65f62234c816cae5a0f42fc02c9edb94b5a2f72a (diff)
downloadgnulib-605e20a698d3f7296cda18ac7dd84b1a8f388b50.tar.gz
Port FALLTHROUGH to clang 3.4 and earlier
Problem reported by Akim Demaille in: https://lists.gnu.org/r/bug-gnulib/2021-01/msg00241.html * lib/cdefs.h (__glibc_has_attribute): * m4/gnulib-common.m4 (gl_COMMON_BODY): Do not trust __has_attribute in clang 3.4 and earlier, as <https://releases.llvm.org/3.5.0/tools/clang/docs/ReleaseNotes.html> says that __has_attribute is unreliable in these old versions.
Diffstat (limited to 'lib/cdefs.h')
-rw-r--r--lib/cdefs.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/cdefs.h b/lib/cdefs.h
index a22ae6db26..060a3d0689 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -38,7 +38,9 @@
#if defined __has_attribute && __has_attribute (...)
even though they do not need to evaluate the right-hand side of the &&.
Similarly for __has_builtin, etc. */
-#ifdef __has_attribute
+#if (defined __has_attribute \
+ && (!defined __clang_minor__ \
+ || 3 < __clang_major__ + (5 <= __clang_minor__)))
# define __glibc_has_attribute(attr) __has_attribute (attr)
#else
# define __glibc_has_attribute(attr) 0