From 845ca893904e4664063cb5c121b34925386849f7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Jun 2012 10:39:14 -0700 Subject: [PATCH] Switch from NO_RETURN to C11's _Noreturn. Fixes: debbugs:11750 --- ChangeLog | 7 +++++ configure.in | 7 ----- lib-src/ChangeLog | 15 ++++++++++ lib-src/ebrowse.c | 8 ++--- lib-src/emacsclient.c | 7 ++--- lib-src/etags.c | 6 ++-- lib-src/hexl.c | 2 +- lib-src/make-docfile.c | 3 +- lib-src/movemail.c | 6 ++-- lib-src/update-game-score.c | 12 ++------ lwlib/ChangeLog | 7 +++++ lwlib/xlwmenu.c | 3 +- nt/ChangeLog | 7 +++++ nt/config.nt | 19 +++++++----- src/ChangeLog | 32 ++++++++++++++++++++ src/buffer.h | 2 +- src/data.c | 3 +- src/eval.c | 5 ++-- src/image.c | 6 ++-- src/keyboard.c | 10 +++---- src/lisp.h | 60 ++++++++++++++++++------------------- src/lread.c | 8 ++--- src/process.c | 2 +- src/puresize.h | 2 +- src/search.c | 3 +- src/sound.c | 11 ++----- src/sysdep.c | 2 +- src/syssignal.h | 2 +- src/term.c | 10 +++---- src/textprop.c | 3 +- src/undo.c | 4 +-- src/unexmacosx.c | 4 +-- src/xterm.c | 6 ++-- 33 files changed, 159 insertions(+), 125 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d3aefc994..667634cd1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-06-24 Paul Eggert + + Switch from NO_RETURN to C11's _Noreturn (Bug#11750). + We might as well use the spelling standardized by C11, + as in the long run that should simplify maintenance. + * configure.in (NO_RETURN): Remove. All uses replaced by _Noreturn. + 2012-06-24 Eli Zaretskii * lib/makefile.w32-in ($(BLD)/dtotimespec.$(O)): diff --git a/configure.in b/configure.in index 4c3316a0d3..1115486b2e 100644 --- a/configure.in +++ b/configure.in @@ -3536,13 +3536,6 @@ AH_BOTTOM([ #include #include -#if defined __GNUC__ && (__GNUC__ > 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) -#define NO_RETURN __attribute__ ((__noreturn__)) -#else -#define NO_RETURN /* nothing */ -#endif - #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ #define NO_INLINE __attribute__((noinline)) #else diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index e3232a46f3..a573cd88d1 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,18 @@ +2012-06-24 Paul Eggert + + Switch from NO_RETURN to C11's _Noreturn (Bug#11750). + * ebrowse.c (usage, version): + * emacsclient.c (print_help_and_exit, fail): + * etags.c (suggest_asking_for_help, fatal, pfatal): + * hexl.c (usage): + * make-docfile.c (fatal): + * movemail.c (fatal, pfatal_with_name, pfatal_and_delete): + * update-game-score.c (usage): + * ebrowse.c (usage, version): + * emacsclient.c (print_help_and_exit, fail): + Use _Noreturn rather than NO_RETURN. + No need for separate decl merely because of _Noreturn. + 2012-06-24 Samuel Bronson (tiny change) * emacsclient.c (set_local_socket): Fix compiler warning (Bug#7838). diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index a1fe10b863..1c43bc6a4f 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -463,10 +463,6 @@ static struct member *add_member (struct sym *, char *, int, int, unsigned); static void class_definition (struct sym *, int, int, int); static char *operator_name (int *); static void parse_qualified_param_ident_or_type (char **); -static void usage (int) NO_RETURN; -static void version (void) NO_RETURN; - - /*********************************************************************** Utilities @@ -3507,7 +3503,7 @@ Usage: ebrowse [options] {files}\n\ --version display version info\n\ " -static void +static _Noreturn void usage (int error) { puts (USAGE); @@ -3522,7 +3518,7 @@ usage (int error) # define VERSION "21" #endif -static void +static _Noreturn void version (void) { /* Makes it easier to update automatically. */ diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index f8e8125610..94cfa85d3f 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -169,8 +169,7 @@ int emacs_pid = 0; be used for the new frame */ const char *frame_parameters = NULL; -static void print_help_and_exit (void) NO_RETURN; -static void fail (void) NO_RETURN; +static _Noreturn void print_help_and_exit (void); struct option longopts[] = @@ -670,7 +669,7 @@ an empty string"); } -static void +static _Noreturn void print_help_and_exit (void) { /* Spaces and tabs are significant in this message; they're chosen so the @@ -718,7 +717,7 @@ Report bugs with M-x report-emacs-bug.\n", progname); defined-- exit with an errorcode. Uses argv, but gets it from the global variable main_argv. */ -static void +static _Noreturn void fail (void) { if (alternate_editor) diff --git a/lib-src/etags.c b/lib-src/etags.c index 7d2a5a9099..71f153163e 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -366,9 +366,9 @@ static void analyse_regex (char *); static void free_regexps (void); static void regex_tag_multiline (void); static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); -static void suggest_asking_for_help (void) NO_RETURN; -void fatal (const char *, const char *) NO_RETURN; -static void pfatal (const char *) NO_RETURN; +static _Noreturn void suggest_asking_for_help (void); +_Noreturn void fatal (const char *, const char *); +static _Noreturn void pfatal (const char *); static void add_node (node *, node **); static void init (void); diff --git a/lib-src/hexl.c b/lib-src/hexl.c index f8fb11f821..d418eca78c 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -48,7 +48,7 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1; int group_by = DEFAULT_GROUPING; char *progname; -void usage (void) NO_RETURN; +_Noreturn void usage (void); int main (int argc, char **argv) diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 4f68fdb78c..8156db9b73 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -76,7 +76,6 @@ along with GNU Emacs. If not, see . */ static int scan_file (char *filename); static int scan_lisp_file (const char *filename, const char *mode); static int scan_c_file (char *filename, const char *mode); -static void fatal (const char *s1, const char *s2) NO_RETURN; static void start_globals (void); static void write_globals (void); @@ -111,7 +110,7 @@ error (const char *s1, const char *s2) /* Print error message and exit. */ /* VARARGS1 */ -static void +static _Noreturn void fatal (const char *s1, const char *s2) { error (s1, s2); diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 9d19df3281..3d994ec5a5 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -137,10 +137,10 @@ static char *mail_spool_name (char *); char *strerror (int); #endif -static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN; +static _Noreturn void fatal (const char *s1, const char *s2, const char *s3); static void error (const char *s1, const char *s2, const char *s3); -static void pfatal_with_name (char *name) NO_RETURN; -static void pfatal_and_delete (char *name) NO_RETURN; +static _Noreturn void pfatal_with_name (char *name); +static _Noreturn void pfatal_and_delete (char *name); static char *concat (const char *s1, const char *s2, const char *s3); static long *xmalloc (unsigned int size); #ifdef MAIL_USE_POP diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index e0c940510b..94de662e58 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -48,8 +48,6 @@ along with GNU Emacs. If not, see . */ #include #include -static int usage (int err) NO_RETURN; - #define MAX_ATTEMPTS 5 #define MAX_SCORES 200 #define MAX_DATA_LEN 1024 @@ -59,7 +57,7 @@ static int usage (int err) NO_RETURN; #define difftime(t1, t0) (double)((t1) - (t0)) #endif -static int +static _Noreturn void usage (int err) { fprintf (stdout, "Usage: update-game-score [-m MAX] [-r] [-d DIR] game/scorefile SCORE DATA\n"); @@ -89,17 +87,13 @@ static void sort_scores (struct score_entry *scores, int count, int reverse); static int write_scores (const char *filename, const struct score_entry *scores, int count); -static void lose (const char *msg) NO_RETURN; - -static void +static _Noreturn void lose (const char *msg) { fprintf (stderr, "%s\n", msg); exit (EXIT_FAILURE); } -static void lose_syserr (const char *msg) NO_RETURN; - /* Taken from sysdep.c. */ #ifndef HAVE_STRERROR #ifndef WINDOWSNT @@ -116,7 +110,7 @@ strerror (int errnum) #endif /* not WINDOWSNT */ #endif /* ! HAVE_STRERROR */ -static void +static _Noreturn void lose_syserr (const char *msg) { fprintf (stderr, "%s: %s\n", msg, strerror (errno)); diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 558b996021..a6445f3ed5 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,10 @@ +2012-06-24 Paul Eggert + + Switch from NO_RETURN to C11's _Noreturn (Bug#11750). + * xlwmenu.c (abort_gracefully): + Use _Noreturn rather than NO_RETURN. + No need for separate decl merely because of _Noreturn. + 2012-05-31 Paul Eggert Remove obsolete '#define static' cruft. diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 4406c50539..31e041d3da 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -190,7 +190,6 @@ static void Key(Widget w, XEvent *ev, String *params, Cardinal *num_params); static void Nothing(Widget w, XEvent *ev, String *params, Cardinal *num_params); static int separator_height (enum menu_separator); static void pop_up_menu (XlwMenuWidget, XButtonPressedEvent *); -static void abort_gracefully (Widget w) NO_RETURN; static XtActionsRec xlwMenuActionsList [] = @@ -273,7 +272,7 @@ ungrab_all (Widget w, Time ungrabtime) /* Like abort, but remove grabs from widget W before. */ -static void +static _Noreturn void abort_gracefully (Widget w) { if (XtIsShell (XtParent (w))) diff --git a/nt/ChangeLog b/nt/ChangeLog index 7c2ebd0293..088a19ac74 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,10 @@ +2012-06-24 Paul Eggert + + Switch from NO_RETURN to C11's _Noreturn (Bug#11750). + * config.nt (_Noreturn): New macro. + (NO_RETURN): Remove. All uses replaced with _Noreturn. + (w32_abort) [HAVE_NTGUI]: Use _Noreturn rather than NO_RETURN. + 2012-06-24 Eli Zaretskii * inc/sys/time.h (struct timespec): Don't define it here, it is diff --git a/nt/config.nt b/nt/config.nt index f32c38f843..8c66d3d6eb 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -495,18 +495,23 @@ extern char *getenv (); #endif #include -#ifndef NO_RETURN -#if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR >= 5)) -#define NO_RETURN __attribute__ ((__noreturn__)) -#else -#define NO_RETURN /* nothing */ -#endif +/* The _Noreturn keyword of C11. */ +#if ! (defined _Noreturn \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif #endif /* Redefine abort. */ #ifdef HAVE_NTGUI #define abort w32_abort -void w32_abort (void) NO_RETURN; +_Noreturn void w32_abort (void); #endif /* Prevent accidental use of features unavailable in diff --git a/src/ChangeLog b/src/ChangeLog index 3f799b9d37..9b383b5243 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,38 @@ * s/ms-w32.h (struct timespec): Definition moved from nt/inc/sys/time.h. Suggested by Paul Eggert . +2012-06-24 Paul Eggert + + Switch from NO_RETURN to C11's _Noreturn (Bug#11750). + * buffer.h (buffer_slot_type_mismatch): + * data.c (arith_error) [!FORWARD_SIGNAL_TO_MAIN_THREAD]: + * eval.c (unwind_to_catch): + * image.c (my_png_error, my_error_exit): + * keyboard.c (quit_throw_to_read_char, user_error) + (Fexit_recursive_edit, Fabort_recursive_edit): + * lisp.h (die, args_out_of_range, args_out_of_range_3) + (wrong_type_argument, buffer_overflow, __executable_start) + (memory_full, buffer_memory_full, string_overflow, Fthrow) + (xsignal, xsignal0, xsignal1, xsignal2, xsignal3, signal_error) + (error, verror, nsberror, report_file_error, Ftop_level, Fkill_emacs) + (fatal): + (child_setup) [!DOS_NT]: + * lread.c (end_of_file_error, invalid_syntax): + * process.c (send_process_trap) [!FORWARD_SIGNAL_TO_MAIN_THREAD]: + * puresize.h (pure_write_error): + * search.c (matcher_overflow): + * sound.c (sound_perror, alsa_sound_perror): + * sysdep.c, syssignal.h (croak): + * term.c (maybe_fatal, vfatal): + * textprop.c (text_read_only): + * undo.c (user_error): + * unexmacosx.c (unexec_error): + * xterm.c (x_ins_del_lines, x_delete_glyphs): + Use _Noreturn rather than NO_RETURN. + No need for separate decl merely because of _Noreturn. + * sound.c (sound_warning, parse_sound): + Remove unnecessary forward decls. + 2012-06-24 Paul Eggert Fix bug when time_t is unsigned and as wide as intmax_t (Bug#9000). diff --git a/src/buffer.h b/src/buffer.h index 97b45e1538..b1ace4663c 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -886,7 +886,7 @@ extern void set_buffer_internal_1 (struct buffer *); extern void set_buffer_temp (struct buffer *); extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); extern void record_buffer (Lisp_Object); -extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN; +extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int); extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); extern void mmap_set_vars (int); diff --git a/src/data.c b/src/data.c index ee43b98e6e..cd4b14a9f9 100644 --- a/src/data.c +++ b/src/data.c @@ -3213,9 +3213,8 @@ syms_of_data (void) } #ifndef FORWARD_SIGNAL_TO_MAIN_THREAD -static void arith_error (int) NO_RETURN; +_Noreturn #endif - static void arith_error (int signo) { diff --git a/src/eval.c b/src/eval.c index 5a9327a99d..3360a6b9a5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -131,7 +131,6 @@ int handling_signal; Lisp_Object inhibit_lisp_code; static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); -static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; static int interactive_p (int); static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); static Lisp_Object Ffetch_bytecode (Lisp_Object); @@ -1111,10 +1110,10 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object This is used for correct unwinding in Fthrow and Fsignal. */ -static void +static _Noreturn void unwind_to_catch (struct catchtag *catch, Lisp_Object value) { - register int last_time; + int last_time; /* Save the value in the tag. */ catch->val = value; diff --git a/src/image.c b/src/image.c index 47b14a333e..c5f7be3e75 100644 --- a/src/image.c +++ b/src/image.c @@ -5548,8 +5548,7 @@ init_png_functions (Lisp_Object libraries) /* Error and warning handlers installed when the PNG library is initialized. */ -static void my_png_error (png_struct *, const char *) NO_RETURN; -static void +static _Noreturn void my_png_error (png_struct *png_ptr, const char *msg) { xassert (png_ptr != NULL); @@ -6130,8 +6129,7 @@ struct my_jpeg_error_mgr }; -static void my_error_exit (j_common_ptr) NO_RETURN; -static void +static _Noreturn void my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; diff --git a/src/keyboard.c b/src/keyboard.c index a39be2b859..ae27920b18 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -462,7 +462,7 @@ static void input_available_signal (int signo); static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); static void handle_interrupt (void); -static void quit_throw_to_read_char (int) NO_RETURN; +static _Noreturn void quit_throw_to_read_char (int); static void process_special_events (void); static void timer_start_idle (void); static void timer_stop_idle (void); @@ -1195,13 +1195,13 @@ This also exits all active minibuffers. */) Fthrow (Qtop_level, Qnil); } -static void user_error (const char*) NO_RETURN; -static void user_error (const char *msg) +static _Noreturn void +user_error (const char *msg) { xsignal1 (Quser_error, build_string (msg)); } -static Lisp_Object Fexit_recursive_edit (void) NO_RETURN; +_Noreturn DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", doc: /* Exit from the innermost recursive edit or minibuffer. */) (void) @@ -1212,7 +1212,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, user_error ("No recursive edit is in progress"); } -static Lisp_Object Fabort_recursive_edit (void) NO_RETURN; +_Noreturn DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", doc: /* Abort the command that requested this recursive edit or minibuffer input. */) (void) diff --git a/src/lisp.h b/src/lisp.h index 275761b0e9..f7ec612ac5 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -113,7 +113,7 @@ typedef EMACS_UINT uprintmax_t; # define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */ #else /* ENABLE_CHECKING */ -extern void die (const char *, const char *, int) NO_RETURN; +extern _Noreturn void die (const char *, const char *, int); /* The suppress_checking variable is initialized to 0 in alloc.c. Set it to 1 using a debugger to temporarily disable aborting on @@ -2388,10 +2388,10 @@ extern intmax_t cons_to_signed (Lisp_Object, intmax_t, intmax_t); extern uintmax_t cons_to_unsigned (Lisp_Object, uintmax_t); extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *); -extern void args_out_of_range (Lisp_Object, Lisp_Object) NO_RETURN; -extern void args_out_of_range_3 (Lisp_Object, Lisp_Object, - Lisp_Object) NO_RETURN; -extern Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object) NO_RETURN; +extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object); +extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object, + Lisp_Object); +extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int); extern void syms_of_data (void); @@ -2554,7 +2554,7 @@ extern void init_image (void); extern Lisp_Object Qinhibit_modification_hooks; extern void move_gap (ptrdiff_t); extern void move_gap_both (ptrdiff_t, ptrdiff_t); -extern void buffer_overflow (void) NO_RETURN; +extern _Noreturn void buffer_overflow (void); extern void make_gap (ptrdiff_t); extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, ptrdiff_t, int, int); @@ -2599,7 +2599,7 @@ extern void syms_of_insdel (void); /* Defined in dispnew.c */ #if (defined PROFILING \ && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) -void __executable_start (void) NO_RETURN; +_Noreturn void __executable_start (void); #endif extern Lisp_Object selected_frame; extern Lisp_Object Vwindow_system; @@ -2675,8 +2675,8 @@ extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); extern void reset_malloc_hooks (void); extern void uninterrupt_malloc (void); extern void malloc_warning (const char *); -extern void memory_full (size_t) NO_RETURN; -extern void buffer_memory_full (ptrdiff_t) NO_RETURN; +extern _Noreturn void memory_full (size_t); +extern _Noreturn void buffer_memory_full (ptrdiff_t); extern int survives_gc_p (Lisp_Object); extern void mark_object (Lisp_Object); #if defined REL_ALLOC && !defined SYSTEM_MALLOC @@ -2698,7 +2698,7 @@ EXFUN (Fmake_vector, 2); EXFUN (Fvector, MANY); EXFUN (Fmake_symbol, 1); EXFUN (Fmake_marker, 0); -extern void string_overflow (void) NO_RETURN; +extern _Noreturn void string_overflow (void); EXFUN (Fmake_string, 2); extern Lisp_Object build_string (const char *); extern Lisp_Object make_string (const char *, ptrdiff_t); @@ -2872,14 +2872,15 @@ extern Lisp_Object run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args, (ptrdiff_t nargs, Lisp_Object *args)); EXFUN (Fprogn, UNEVALLED); EXFUN (Finteractive_p, 0); -EXFUN (Fthrow, 2) NO_RETURN; +_Noreturn EXFUN (Fthrow, 2); EXFUN (Fsignal, 2); -extern void xsignal (Lisp_Object, Lisp_Object) NO_RETURN; -extern void xsignal0 (Lisp_Object) NO_RETURN; -extern void xsignal1 (Lisp_Object, Lisp_Object) NO_RETURN; -extern void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN; -extern void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN; -extern void signal_error (const char *, Lisp_Object) NO_RETURN; +extern _Noreturn void xsignal (Lisp_Object, Lisp_Object); +extern _Noreturn void xsignal0 (Lisp_Object); +extern _Noreturn void xsignal1 (Lisp_Object, Lisp_Object); +extern _Noreturn void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object); +extern _Noreturn void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object); +extern _Noreturn void signal_error (const char *, Lisp_Object); EXFUN (Fcommandp, 2); EXFUN (Ffunctionp, 1); EXFUN (Feval, 2); @@ -2905,9 +2906,9 @@ extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (ptrdiff_t, Lisp_O extern void specbind (Lisp_Object, Lisp_Object); extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); extern Lisp_Object unbind_to (ptrdiff_t, Lisp_Object); -extern void error (const char *, ...) NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2); -extern void verror (const char *, va_list) - NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); +extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); +extern _Noreturn void verror (const char *, va_list) + ATTRIBUTE_FORMAT_PRINTF (1, 0); extern void do_autoload (Lisp_Object, Lisp_Object); extern Lisp_Object un_autoload (Lisp_Object); extern void init_eval_once (void); @@ -2954,7 +2955,7 @@ EXFUN (Fnarrow_to_region, 2); EXFUN (Fwiden, 0); EXFUN (Fuser_login_name, 1); EXFUN (Fsystem_name, 0); -extern void time_overflow (void) NO_RETURN; +extern _Noreturn void time_overflow (void); EXFUN (Fcurrent_time, 0); EXFUN (Fget_internal_run_time, 0); extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, int); @@ -2969,7 +2970,7 @@ extern void set_time_zone_rule (const char *); /* Defined in buffer.c */ extern int mouse_face_overlay_overlaps (Lisp_Object); -extern void nsberror (Lisp_Object) NO_RETURN; +extern _Noreturn void nsberror (Lisp_Object); EXFUN (Fset_buffer_multibyte, 1); EXFUN (Foverlay_start, 1); EXFUN (Foverlay_end, 1); @@ -3052,7 +3053,7 @@ EXFUN (Ffile_readable_p, 1); EXFUN (Fread_file_name, 6); extern Lisp_Object close_file_unwind (Lisp_Object); extern Lisp_Object restore_point_unwind (Lisp_Object); -extern void report_file_error (const char *, Lisp_Object) NO_RETURN; +extern _Noreturn void report_file_error (const char *, Lisp_Object); extern int internal_delete_file (Lisp_Object); extern void syms_of_fileio (void); extern Lisp_Object make_temp_name (Lisp_Object, int); @@ -3140,7 +3141,7 @@ extern Lisp_Object Qtop; extern int input_pending; EXFUN (Fdiscard_input, 0); EXFUN (Frecursive_edit, 0); -EXFUN (Ftop_level, 0) NO_RETURN; +_Noreturn EXFUN (Ftop_level, 0); extern Lisp_Object menu_bar_items (Lisp_Object); extern Lisp_Object tool_bar_items (Lisp_Object, int *); extern void discard_mouse_events (void); @@ -3209,7 +3210,7 @@ extern Lisp_Object Qfile_name_handler_alist; extern void fatal_error_signal (int); #endif extern Lisp_Object Qkill_emacs; -EXFUN (Fkill_emacs, 1) NO_RETURN; +_Noreturn EXFUN (Fkill_emacs, 1); #if HAVE_SETLOCALE void fixup_locale (void); void synchronize_system_messages_locale (void); @@ -3269,11 +3270,10 @@ extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); EXFUN (Fcall_process, MANY); -extern int child_setup (int, int, int, char **, int, Lisp_Object) #ifndef DOS_NT - NO_RETURN + _Noreturn #endif - ; +extern int child_setup (int, int, int, char **, int, Lisp_Object); extern void init_callproc_1 (void); extern void init_callproc (void); extern void set_initial_environment (void); @@ -3406,8 +3406,8 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, extern int *char_ins_del_vector; extern void mark_ttys (void); extern void syms_of_term (void); -extern void fatal (const char *msgid, ...) - NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2); +extern _Noreturn void fatal (const char *msgid, ...) + ATTRIBUTE_FORMAT_PRINTF (1, 2); /* Defined in terminal.c */ EXFUN (Fframe_terminal, 1); diff --git a/src/lread.c b/src/lread.c index fee97044a7..2cd203da5b 100644 --- a/src/lread.c +++ b/src/lread.c @@ -154,10 +154,6 @@ static void readevalloop (Lisp_Object, FILE*, Lisp_Object, int, Lisp_Object, Lisp_Object); static Lisp_Object load_unwind (Lisp_Object); static Lisp_Object load_descriptor_unwind (Lisp_Object); - -static void invalid_syntax (const char *) NO_RETURN; -static void end_of_file_error (void) NO_RETURN; - /* Functions that read one byte from the current source READCHARFUN or unreads one byte. If the integer argument C is -1, it returns @@ -1656,7 +1652,7 @@ readevalloop_1 (Lisp_Object old) /* Signal an `end-of-file' error, if possible with file name information. */ -static void +static _Noreturn void end_of_file_error (void) { if (STRINGP (Vload_file_name)) @@ -2024,7 +2020,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) /* Signal Qinvalid_read_syntax error. S is error string of length N (if > 0) */ -static void +static _Noreturn void invalid_syntax (const char *s) { xsignal1 (Qinvalid_read_syntax, build_string (s)); diff --git a/src/process.c b/src/process.c index 457a1a9c7e..aaf8693a62 100644 --- a/src/process.c +++ b/src/process.c @@ -5372,7 +5372,7 @@ static jmp_buf send_process_frame; static Lisp_Object process_sent_to; #ifndef FORWARD_SIGNAL_TO_MAIN_THREAD -static void send_process_trap (int) NO_RETURN; +static _Noreturn void send_process_trap (int); #endif static void diff --git a/src/puresize.h b/src/puresize.h index bee82d1e78..7f8f279f56 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -75,7 +75,7 @@ along with GNU Emacs. If not, see . */ { if (PURE_P (obj)) \ pure_write_error (); } -extern void pure_write_error (void) NO_RETURN; +extern _Noreturn void pure_write_error (void); /* Define PURE_P. */ diff --git a/src/search.c b/src/search.c index 71ab60d9f8..4912c0f23e 100644 --- a/src/search.c +++ b/src/search.c @@ -101,9 +101,8 @@ static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, ptrdiff_t, static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, int, Lisp_Object, Lisp_Object, int); -static void matcher_overflow (void) NO_RETURN; -static void +static _Noreturn void matcher_overflow (void) { error ("Stack overflow in regexp matcher"); diff --git a/src/sound.c b/src/sound.c index 143653e48e..65e7af70c5 100644 --- a/src/sound.c +++ b/src/sound.c @@ -109,13 +109,6 @@ enum sound_attr SOUND_ATTR_SENTINEL }; -#ifdef HAVE_ALSA -static void alsa_sound_perror (const char *, int) NO_RETURN; -#endif -static void sound_perror (const char *) NO_RETURN; -static void sound_warning (const char *); -static int parse_sound (Lisp_Object, Lisp_Object *); - /* END: Common Definitions */ /* BEGIN: Non Windows Definitions */ @@ -320,7 +313,7 @@ static int do_play_sound (const char *, unsigned long); /* Like perror, but signals an error. */ -static void +static _Noreturn void sound_perror (const char *msg) { int saved_errno = errno; @@ -909,7 +902,7 @@ vox_write (struct sound_device *sd, const char *buffer, ptrdiff_t nbytes) #define DEFAULT_ALSA_SOUND_DEVICE "default" #endif -static void +static _Noreturn void alsa_sound_perror (const char *msg, int err) { error ("%s: %s", msg, snd_strerror (err)); diff --git a/src/sysdep.c b/src/sysdep.c index 42f53a75e9..9994f312f4 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -114,7 +114,7 @@ extern char *getwd (char *); static int emacs_get_tty (int, struct emacs_tty *); static int emacs_set_tty (int, struct emacs_tty *, int); #if defined TIOCNOTTY || defined USG5 || defined CYGWIN -static void croak (char *) NO_RETURN; +static _Noreturn void croak (char *); #endif /* Declare here, including term.h is problematic on some systems. */ diff --git a/src/syssignal.h b/src/syssignal.h index a2522f2442..5c3683423b 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -76,7 +76,7 @@ sigset_t sys_sigblock (sigset_t new_mask); sigset_t sys_sigunblock (sigset_t new_mask); sigset_t sys_sigsetmask (sigset_t new_mask); #if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN) -void croak (char *) NO_RETURN; +_Noreturn void croak (char *); #endif #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG) diff --git a/src/term.c b/src/term.c index 1a2524fd29..d58dc2ba87 100644 --- a/src/term.c +++ b/src/term.c @@ -86,11 +86,11 @@ static void clear_tty_hooks (struct terminal *terminal); static void set_tty_hooks (struct terminal *terminal); static void dissociate_if_controlling_tty (int fd); static void delete_tty (struct terminal *); -static void maybe_fatal (int must_succeed, struct terminal *terminal, - const char *str1, const char *str2, ...) - NO_RETURN ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); -static void vfatal (const char *str, va_list ap) - NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); +static _Noreturn void maybe_fatal (int must_succeed, struct terminal *terminal, + const char *str1, const char *str2, ...) + ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); +static _Noreturn void vfatal (const char *str, va_list ap) + ATTRIBUTE_FORMAT_PRINTF (1, 0); #define OUTPUT(tty, a) \ diff --git a/src/textprop.c b/src/textprop.c index afeb0339d5..fb58f8e080 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -72,7 +72,6 @@ Lisp_Object Qfront_sticky, Qrear_nonsticky; static Lisp_Object interval_insert_behind_hooks; static Lisp_Object interval_insert_in_front_hooks; -static void text_read_only (Lisp_Object) NO_RETURN; static Lisp_Object Fprevious_property_change (Lisp_Object, Lisp_Object, Lisp_Object); @@ -80,7 +79,7 @@ static Lisp_Object Fprevious_property_change (Lisp_Object, Lisp_Object, /* Signal a `text-read-only' error. This function makes it easier to capture that error in GDB by putting a breakpoint on it. */ -static void +static _Noreturn void text_read_only (Lisp_Object propval) { if (STRINGP (propval)) diff --git a/src/undo.c b/src/undo.c index ae9025c298..c4ef557a22 100644 --- a/src/undo.c +++ b/src/undo.c @@ -438,8 +438,8 @@ truncate_undo_list (struct buffer *b) unbind_to (count, Qnil); } -static void user_error (const char*) NO_RETURN; -static void user_error (const char *msg) +static _Noreturn void +user_error (const char *msg) { xsignal1 (Quser_error, build_string (msg)); } diff --git a/src/unexmacosx.c b/src/unexmacosx.c index a61bbd8eb8..47efe41fdd 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -197,8 +197,6 @@ static off_t data_segment_old_fileoff = 0; static struct segment_command *data_segment_scp; -static void unexec_error (const char *format, ...) NO_RETURN; - /* Read N bytes from infd into memory starting at address DEST. Return true if successful, false otherwise. */ static int @@ -275,7 +273,7 @@ unexec_copy (off_t dest, off_t src, ssize_t count) /* Debugging and informational messages routines. */ -static void +static _Noreturn void unexec_error (const char *format, ...) { va_list ap; diff --git a/src/xterm.c b/src/xterm.c index cb7aac2838..9587a47f9b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -316,7 +316,7 @@ static void XTframe_up_to_date (struct frame *); static void XTset_terminal_modes (struct terminal *); static void XTreset_terminal_modes (struct terminal *); static void x_clear_frame (struct frame *); -static void x_ins_del_lines (struct frame *, int, int) NO_RETURN; +static _Noreturn void x_ins_del_lines (struct frame *, int, int); static void frame_highlight (struct frame *); static void frame_unhighlight (struct frame *); static void x_new_focus_frame (struct x_display_info *, struct frame *); @@ -349,7 +349,7 @@ static int handle_one_xevent (struct x_display_info *, XEvent *, #ifdef USE_GTK static int x_dispatch_event (XEvent *, Display *); #endif -/* Don't declare this NO_RETURN because we want no +/* Don't declare this _Noreturn because we want no interference with debugging failing X calls. */ static void x_connection_closed (Display *, const char *); static void x_wm_set_window_state (struct frame *, int); @@ -908,7 +908,7 @@ static void x_draw_glyph_string_foreground (struct glyph_string *); static void x_draw_composite_glyph_string_foreground (struct glyph_string *); static void x_draw_glyph_string_box (struct glyph_string *); static void x_draw_glyph_string (struct glyph_string *); -static void x_delete_glyphs (struct frame *, int) NO_RETURN; +static _Noreturn void x_delete_glyphs (struct frame *, int); static void x_compute_glyph_string_overhangs (struct glyph_string *); static void x_set_cursor_gc (struct glyph_string *); static void x_set_mode_line_face_gc (struct glyph_string *); -- 2.20.1