aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-04-22 12:25:40 -0700
committerPaul Eggert2019-04-22 12:25:53 -0700
commit8882419798bb9508fce23e6c4a85df7f9876dda8 (patch)
tree1d42cc08e89d7cf6730225afc9b01a733da02d10 /src
parent4bf3c94939406de6610cc83476adaed789826623 (diff)
downloademacs-8882419798bb9508fce23e6c4a85df7f9876dda8.tar.gz
emacs-8882419798bb9508fce23e6c4a85df7f9876dda8.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/conf_post.h1
-rw-r--r--src/systhread.h8
2 files changed, 3 insertions, 6 deletions
diff --git a/src/conf_post.h b/src/conf_post.h
index 6ea2c7b664b..7699d2c95bc 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -78,6 +78,7 @@ typedef bool bool_bf;
78# define __has_attribute_no_address_safety_analysis false 78# define __has_attribute_no_address_safety_analysis false
79# define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0) 79# define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0)
80# define __has_attribute_no_sanitize_undefined GNUC_PREREQ (4, 9, 0) 80# define __has_attribute_no_sanitize_undefined GNUC_PREREQ (4, 9, 0)
81# define __has_attribute_warn_unused_result GNUC_PREREQ (3, 4, 0)
81#endif 82#endif
82 83
83/* Simulate __has_feature on compilers that lack it. It is used only 84/* Simulate __has_feature on compilers that lack it. It is used only
diff --git a/src/systhread.h b/src/systhread.h
index a1d2746721d..8070bcde752 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/>. */
21 21
22#include <stdbool.h> 22#include <stdbool.h>
23 23
24#ifndef __has_attribute 24#if __has_attribute (warn_unused_result)
25# define __has_attribute(a) false 25# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
26#endif
27
28#if __has_attribute (__warn_unused_result__)
29# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
30#else 26#else
31# define ATTRIBUTE_WARN_UNUSED_RESULT 27# define ATTRIBUTE_WARN_UNUSED_RESULT
32#endif 28#endif