]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: switch to C11-style _Noreturn
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Oct 2021 01:41:10 +0000 (18:41 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Oct 2021 01:44:21 +0000 (18:44 -0700)
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.

gl/lib/randread.c
src/csplit.c
src/dd.c
src/paste.c
src/ptx.c
src/seq.c
src/sort.c
src/system.h
src/tail.c
src/test.c

index 7124e3df03c7a3a0d0b9e759020852200b77f303..5ed42b547f24c8c142cfec3c8aefff6ee473e212 100644 (file)
 # 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)
index a7191fedd2f019fdbc809e86ca1c0e6c964a3b25..be356df674b369c227be6df7bf3411e3e1c93a36 100644 (file)
@@ -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)
 {
index 6b095982f5455da0d024cce11290738b08dd779c..ab9ac677d9cbba743bad62845352fa49623a66f3 100644 (file)
--- 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 ();
index f43fb56c2d7ac10c40774ea8d08e560d50469ba8..5d9c757626b1b4ae85e96f9b299493731fee16df 100644 (file)
@@ -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)
 {
index 43075c840a73dbf41adb249ab5150afe8945ff4e..60dedb99cd0d1029dfefb10063917807e0ac6d67 100644 (file)
--- 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"));
index d9946da30bdc6a217240b133c44bd3bbebb14f7a..5025fac9297c5c56a1fc3156237bc7b6b34f635a 100644 (file)
--- 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 */
index 5f4c817ded7f6b209ea979d15c124610d0b9fc87..2979400e76e91b6687c1fc1f81f49dd08d0d92ea 100644 (file)
@@ -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)
 {
index 3a914965f7953d90f7f5f66c66452e8a0513b9c3..411dc8b46c7f6c13d9ebde60af4ea432d507b776 100644 (file)
@@ -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.  */
index df1b28f07a27e1bedf360d11e836e2ed46858bb6..ede3bc8acfad4c272d1b1f90bffb69f8868c9e53 100644 (file)
@@ -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);
index 825b4f83b80351867627167e2422bf6981378bb2..8f179ec0228981772deafec6263fcc9509a03299 100644 (file)
@@ -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;