From: Paul Eggert Date: Sun, 3 Oct 2021 01:41:10 +0000 (-0700) Subject: maint: switch to C11-style _Noreturn X-Git-Tag: v9.1~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b31a6a09ad0caddce29729f8c9bc4c36c073b7b6;p=thirdparty%2Fcoreutils.git maint: switch to C11-style _Noreturn Use C11-style _Noreturn instead of the old ATTRIBUTE_NORETURN macro. This pacifies clang on OpenBSD 6.9, which otherwise complains "'noreturn' function does return" in some places. * gl/lib/randread.c, src/system.h (ATTRIBUTE_NORETURN): Remove. All uses either removed as GCC no longer needs them, or changed to C11-style _Noreturn since Gnulib arranges for _Noreturn globally nowadays. --- diff --git a/gl/lib/randread.c b/gl/lib/randread.c index 7124e3df03..5ed42b547f 100644 --- a/gl/lib/randread.c +++ b/gl/lib/randread.c @@ -51,10 +51,6 @@ # endif #endif -#ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -#endif - #ifndef MIN # define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif @@ -115,7 +111,7 @@ struct randread_source /* The default error handler. */ -static void ATTRIBUTE_NORETURN +static void randread_error (void const *file_name) { if (file_name) diff --git a/src/csplit.c b/src/csplit.c index a7191fedd2..be356df674 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -220,8 +220,7 @@ cleanup (void) sigprocmask (SIG_SETMASK, &oldset, NULL); } -static void cleanup_fatal (void) ATTRIBUTE_NORETURN; -static void +static _Noreturn void cleanup_fatal (void) { cleanup (); @@ -709,8 +708,6 @@ dump_rest_of_file (void) /* Handle an attempt to read beyond EOF under the control of record P, on iteration REPETITION if nonzero. */ -static void handle_line_error (const struct control *, uintmax_t) - ATTRIBUTE_NORETURN; static void handle_line_error (const struct control *p, uintmax_t repetition) { @@ -765,7 +762,6 @@ process_line_count (const struct control *p, uintmax_t repetition) handle_line_error (p, repetition); } -static void regexp_error (struct control *, uintmax_t, bool) ATTRIBUTE_NORETURN; static void regexp_error (struct control *p, uintmax_t repetition, bool ignore) { diff --git a/src/dd.c b/src/dd.c index 6b095982f5..ab9ac677d9 100644 --- a/src/dd.c +++ b/src/dd.c @@ -1029,7 +1029,7 @@ finish_up (void) print_stats (); } -static void ATTRIBUTE_NORETURN +static void quit (int code) { finish_up (); diff --git a/src/paste.c b/src/paste.c index f43fb56c2d..5d9c757626 100644 --- a/src/paste.c +++ b/src/paste.c @@ -156,7 +156,6 @@ collapse_escapes (char const *strptr) /* Report a write error and exit. */ -static void write_error (void) ATTRIBUTE_NORETURN; static void write_error (void) { diff --git a/src/ptx.c b/src/ptx.c index 43075c840a..60dedb99cd 100644 --- a/src/ptx.c +++ b/src/ptx.c @@ -282,7 +282,7 @@ static BLOCK reference; /* reference field for input reference mode */ /* Diagnose an error in the regular expression matcher. Then exit. */ -static void ATTRIBUTE_NORETURN +static void matcher_error (void) { die (EXIT_FAILURE, errno, _("error in regular expression matcher")); diff --git a/src/seq.c b/src/seq.c index d9946da30b..5025fac929 100644 --- a/src/seq.c +++ b/src/seq.c @@ -287,7 +287,7 @@ long_double_format (char const *fmt, struct layout *layout) } } -static void ATTRIBUTE_NORETURN +static void io_error (void) { /* FIXME: consider option to silently ignore errno=EPIPE */ diff --git a/src/sort.c b/src/sort.c index 5f4c817ded..2979400e76 100644 --- a/src/sort.c +++ b/src/sort.c @@ -370,8 +370,7 @@ static unsigned int nmerge = NMERGE_DEFAULT; This can be used safely from signal handlers, and between fork and exec of multithreaded processes. */ -static void async_safe_die (int, char const *) ATTRIBUTE_NORETURN; -static void +static _Noreturn void async_safe_die (int errnum, char const *errstr) { ignore_value (write (STDERR_FILENO, errstr, strlen (errstr))); @@ -397,7 +396,6 @@ async_safe_die (int errnum, char const *errstr) /* Report MESSAGE for FILE, then clean up and exit. If FILE is null, it represents standard output. */ -static void sort_die (char const *, char const *) ATTRIBUTE_NORETURN; static void sort_die (char const *message, char const *file) { @@ -4034,8 +4032,6 @@ insertkey (struct keyfield *key_arg) /* Report a bad field specification SPEC, with extra info MSGID. */ -static void badfieldspec (char const *, char const *) - ATTRIBUTE_NORETURN; static void badfieldspec (char const *spec, char const *msgid) { @@ -4045,7 +4041,6 @@ badfieldspec (char const *spec, char const *msgid) /* Report incompatible options. */ -static void incompatible_options (char const *) ATTRIBUTE_NORETURN; static void incompatible_options (char const *opts) { diff --git a/src/system.h b/src/system.h index 3a914965f7..411dc8b46c 100644 --- a/src/system.h +++ b/src/system.h @@ -425,10 +425,6 @@ enum # endif #endif -#ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -#endif - /* The warn_unused_result attribute appeared first in gcc-3.4.0 */ #undef ATTRIBUTE_WARN_UNUSED_RESULT #if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) @@ -708,7 +704,7 @@ usable_st_size (struct stat const *sb) || S_TYPEISSHM (sb) || S_TYPEISTMO (sb)); } -void usage (int status) ATTRIBUTE_NORETURN; +_Noreturn void usage (int status); /* Like error(0, 0, ...), but without an implicit newline. Also a noop unless the global DEV_DEBUG is set. */ diff --git a/src/tail.c b/src/tail.c index df1b28f07a..ede3bc8acf 100644 --- a/src/tail.c +++ b/src/tail.c @@ -337,7 +337,7 @@ named file in a way that accommodates renaming, removal and creation.\n\ } /* Ensure exit, either with SIGPIPE or EXIT_FAILURE status. */ -static void ATTRIBUTE_NORETURN +static void die_pipe (void) { raise (SIGPIPE); diff --git a/src/test.c b/src/test.c index 825b4f83b8..8f179ec022 100644 --- a/src/test.c +++ b/src/test.c @@ -83,11 +83,9 @@ static bool term (void); static bool and (void); static bool or (void); -static void test_syntax_error (char const *format, ...) - ATTRIBUTE_NORETURN; -static void beyond (void) ATTRIBUTE_NORETURN; +static void beyond (void); -static void +static _Noreturn void test_syntax_error (char const *format, ...) { va_list ap;