emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b99ec5d 3/3: Work around __has_attribute bug in clang 3.4


From: Paul Eggert
Subject: master b99ec5d 3/3: Work around __has_attribute bug in clang 3.4
Date: Fri, 22 Jan 2021 15:03:04 -0500 (EST)

branch: master
commit b99ec5d5b11154bafb193ceaaac6976daafe3f82
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Work around __has_attribute bug in clang 3.4
    
    * src/conf_post.h (HAS_ATTRIBUTE):
    * src/emacs-module.h.in (EMACS_ATTRIBUTE_NONNULL):
    Port to clang 3.4 and earlier.
---
 src/conf_post.h       | 4 +++-
 src/emacs-module.h.in | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/conf_post.h b/src/conf_post.h
index bd56f29..176ab28 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -71,7 +71,9 @@ typedef bool bool_bf;
    It is used only on arguments like cleanup that are handled here.
    This macro should be used only in #if expressions, as Oracle
    Studio 12.5's __has_attribute does not work in plain code.  */
-#ifdef __has_attribute
+#if (defined __has_attribute \
+     && (!defined __clang_minor__ \
+         || 3 < __clang_major__ + (5 <= __clang_minor__)))
 # define HAS_ATTRIBUTE(a) __has_attribute (__##a##__)
 #else
 # define HAS_ATTRIBUTE(a) HAS_ATTR_##a
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index 2989b43..fe52587 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -51,7 +51,9 @@ information how to write modules and use this header file.
 #if 3 < __GNUC__ + (3 <= __GNUC_MINOR__)
 # define EMACS_ATTRIBUTE_NONNULL(...) \
    __attribute__ ((__nonnull__ (__VA_ARGS__)))
-#elif defined __has_attribute
+#elif (defined __has_attribute \
+       && (!defined __clang_minor__ \
+          || 3 < __clang_major__ + (5 <= __clang_minor__)))
 # if __has_attribute (__nonnull__)
 #  define EMACS_ATTRIBUTE_NONNULL(...) \
     __attribute__ ((__nonnull__ (__VA_ARGS__)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]