From b61bf2f0e8bdc1e522ae8e97d57d5625163b42ea Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 10 May 2020 10:42:35 +0200 Subject: [PATCH] don't use stdnoreturn Reported by Paul Eggert. * src/getargs.c: We don't need it anyway, since we use _Noreturn. * data/skeletons/c.m4: While at it, update the definition of _Noreturn stolen from gnulib. --- data/skeletons/c.m4 | 16 +++++++++++++--- src/getargs.c | 1 - 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4 index 3c6daef2..f2d7b32f 100644 --- a/data/skeletons/c.m4 +++ b/data/skeletons/c.m4 @@ -359,11 +359,21 @@ m4_define([b4_attribute_define], [#ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ - || (defined _MSC_VER && 1900 <= _MSC_VER))) + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ # define _Noreturn [[noreturn]] -# elif ((!defined __cplusplus || defined __clang__) \ +# elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) + || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))) /* _Noreturn works as-is. */ # elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) diff --git a/src/getargs.c b/src/getargs.c index 74474704..4815eaa2 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include "complain.h"