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.
This commit is contained in:
Paul Eggert 2019-04-22 12:25:40 -07:00
parent 4bf3c94939
commit 8882419798
2 changed files with 3 additions and 6 deletions

View file

@ -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

View file

@ -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