emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 8882419: Improve wur coverage on older GCCs


From: Paul Eggert
Subject: [Emacs-diffs] master 8882419: Improve wur coverage on older GCCs
Date: Mon, 22 Apr 2019 15:25:58 -0400 (EDT)

branch: master
commit 8882419798bb9508fce23e6c4a85df7f9876dda8
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Improve wur coverage on older GCCs
    
    * src/conf_post.h (__has_attribute_warn_unused_result):
    New macro for compilers lacking __has_attribute.
    * src/systhread.h (__has_attribute): Remove ineffective define.
    (ATTRIBUTE_WARN_UNUSED_RESULT): Work better on GCC 3.4 thru 4.
---
 src/conf_post.h | 1 +
 src/systhread.h | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/conf_post.h b/src/conf_post.h
index 6ea2c7b..7699d2c 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -78,6 +78,7 @@ typedef bool bool_bf;
 # define __has_attribute_no_address_safety_analysis false
 # define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0)
 # define __has_attribute_no_sanitize_undefined GNUC_PREREQ (4, 9, 0)
+# define __has_attribute_warn_unused_result GNUC_PREREQ (3, 4, 0)
 #endif
 
 /* Simulate __has_feature on compilers that lack it.  It is used only
diff --git a/src/systhread.h b/src/systhread.h
index a1d2746..8070bcd 100644
--- a/src/systhread.h
+++ b/src/systhread.h
@@ -21,12 +21,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include <stdbool.h>
 
-#ifndef __has_attribute
-# define __has_attribute(a) false
-#endif
-
-#if __has_attribute (__warn_unused_result__)
-# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
+#if __has_attribute (warn_unused_result)
+# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
 #else
 # define ATTRIBUTE_WARN_UNUSED_RESULT
 #endif



reply via email to

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