Subject: bug#11750: NO_RETURN -> _Noreturn

From: Paul Eggert <[email-masked]>
Date: Tue, 19 Jun 2012 14:53:33 -0700

Tags: patch

Here's a modernization patch I'd like to install
after some further testing.  This affects the NT port
so I'm CC'ing Eli.

=== modified file 'ChangeLog'
--- ChangeLog	2012-06-17 01:42:56 +0000
+++ ChangeLog	2012-06-19 21:22:45 +0000
@@ -1,3 +1,10 @@
+2012-06-19  Paul Eggert  <[email-masked]>
+
+	Switch from NO_RETURN to C11's _Noreturn.
+	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-13  Andreas Schwab  <[email-masked]>
 
 	* configure.in: Rename --enable-use-lisp-union-type to

=== modified file 'configure.in'
--- configure.in	2012-06-13 13:40:48 +0000
+++ configure.in	2012-06-19 21:22:45 +0000
@@ -3598,13 +3598,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-#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

=== modified file 'lib-src/ChangeLog'
--- lib-src/ChangeLog	2012-06-10 13:20:58 +0000
+++ lib-src/ChangeLog	2012-06-19 21:22:45 +0000
@@ -1,3 +1,18 @@
+2012-06-19  Paul Eggert  <[email-masked]>
+
+	Switch from NO_RETURN to C11's _Noreturn.
+	* 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-08  Andreas Schwab  <[email-masked]>
 
 	* make-docfile.c (search_lisp_doc_at_eol): Unget last read

=== modified file 'lib-src/ebrowse.c'
--- lib-src/ebrowse.c	2012-01-19 07:21:25 +0000
+++ lib-src/ebrowse.c	2012-06-19 21:22:45 +0000
@@ -463,10 +463,6 @@
 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 @@
       --version			display version info\n\
 "
 
-static void
+static _Noreturn void
 usage (int error)
 {
   puts (USAGE);
@@ -3522,7 +3518,7 @@
 # define VERSION "21"
 #endif
 
-static void
+static _Noreturn void
 version (void)
 {
   /* Makes it easier to update automatically. */

=== modified file 'lib-src/emacsclient.c'
--- lib-src/emacsclient.c	2012-05-05 04:32:58 +0000
+++ lib-src/emacsclient.c	2012-06-19 21:22:45 +0000
@@ -169,8 +169,7 @@
    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 @@
 }
 
 
-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 @@
   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)

=== modified file 'lib-src/etags.c'
--- lib-src/etags.c	2012-05-21 15:36:54 +0000
+++ lib-src/etags.c	2012-06-19 21:22:45 +0000
@@ -366,9 +366,9 @@
 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);

=== modified file 'lib-src/hexl.c'
--- lib-src/hexl.c	2012-01-19 07:21:25 +0000
+++ lib-src/hexl.c	2012-06-19 21:22:45 +0000
@@ -48,7 +48,7 @@
 int group_by = DEFAULT_GROUPING;
 char *progname;
 
-void usage (void) NO_RETURN;
+_Noreturn void usage (void);
 
 int
 main (int argc, char **argv)

=== modified file 'lib-src/make-docfile.c'
--- lib-src/make-docfile.c	2012-06-08 21:33:58 +0000
+++ lib-src/make-docfile.c	2012-06-19 21:22:45 +0000
@@ -76,7 +76,6 @@
 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 @@
 /* Print error message and exit.  */
 
 /* VARARGS1 */
-static void
+static _Noreturn void
 fatal (const char *s1, const char *s2)
 {
   error (s1, s2);

=== modified file 'lib-src/movemail.c'
--- lib-src/movemail.c	2012-01-19 07:21:25 +0000
+++ lib-src/movemail.c	2012-06-19 21:22:45 +0000
@@ -137,10 +137,10 @@
 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

=== modified file 'lib-src/update-game-score.c'
--- lib-src/update-game-score.c	2012-04-16 00:41:01 +0000
+++ lib-src/update-game-score.c	2012-06-19 21:22:45 +0000
@@ -48,8 +48,6 @@
 #include <sys/stat.h>
 #include <getopt.h>
 
-static int usage (int err) NO_RETURN;
-
 #define MAX_ATTEMPTS 5
 #define MAX_SCORES 200
 #define MAX_DATA_LEN 1024
@@ -59,7 +57,7 @@
 #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 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 @@
 #endif /* not WINDOWSNT */
 #endif /* ! HAVE_STRERROR */
 
-static void
+static _Noreturn void
 lose_syserr (const char *msg)
 {
   fprintf (stderr, "%s: %s\n", msg, strerror (errno));

=== modified file 'lwlib/ChangeLog'
--- lwlib/ChangeLog	2012-06-10 13:20:58 +0000
+++ lwlib/ChangeLog	2012-06-19 21:22:45 +0000
@@ -1,3 +1,10 @@
+2012-06-19  Paul Eggert  <[email-masked]>
+
+	Switch from NO_RETURN to C11's _Noreturn.
+	* xlwmenu.c (abort_gracefully):
+	Use _Noreturn rather than NO_RETURN.
+	No need for separate decl merely because of _Noreturn.
+
 2012-05-31  Paul Eggert  <[email-masked]>
 
 	Remove obsolete '#define static' cruft.

=== modified file 'lwlib/xlwmenu.c'
--- lwlib/xlwmenu.c	2012-05-31 05:08:37 +0000
+++ lwlib/xlwmenu.c	2012-06-19 21:22:45 +0000
@@ -190,7 +190,6 @@
 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 @@
 
 /* Like abort, but remove grabs from widget W before.  */
 
-static void
+static _Noreturn void
 abort_gracefully (Widget w)
 {
   if (XtIsShell (XtParent (w)))

=== modified file 'nt/ChangeLog'
--- nt/ChangeLog	2012-06-16 13:17:14 +0000
+++ nt/ChangeLog	2012-06-19 21:22:45 +0000
@@ -1,3 +1,10 @@
+2012-06-19  Paul Eggert  <[email-masked]>
+
+	Switch from NO_RETURN to C11's _Noreturn.
+	* 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-16  Eli Zaretskii  <[email-masked]>
 
 	* makefile.w32-in (install-addpm): New target.

=== modified file 'nt/config.nt'
--- nt/config.nt	2012-06-11 23:17:11 +0000
+++ nt/config.nt	2012-06-19 21:22:45 +0000
@@ -495,18 +495,23 @@
 #endif
 #include <stdlib.h>
 
-#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

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-06-19 18:57:39 +0000
+++ src/ChangeLog	2012-06-19 21:22:45 +0000
@@ -1,3 +1,36 @@
+2012-06-19  Paul Eggert  <[email-masked]>
+
+	Switch from NO_RETURN to C11's _Noreturn.
+	* buffer.h (buffer_slot_type_mismatch):
+	* data.c (arith_error) [!FORWARD_SIGNAL_TO_MAIN_THREAD]:
+	* editfns.c (time_overflow):
+	* 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-19  Stefan Monnier  <[email-masked]>
 
 	* minibuf.c (Fread_string): Bind minibuffer-completion-table.

=== modified file 'src/buffer.h'
--- src/buffer.h	2012-06-16 12:24:15 +0000
+++ src/buffer.h	2012-06-19 21:22:45 +0000
@@ -882,7 +882,7 @@
 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);

=== modified file 'src/data.c'
--- src/data.c	2012-06-19 16:56:28 +0000
+++ src/data.c	2012-06-19 21:22:45 +0000
@@ -3213,9 +3213,8 @@
 }
 
 #ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
-static void arith_error (int) NO_RETURN;
+_Noreturn
 #endif
-
 static void
 arith_error (int signo)
 {

=== modified file 'src/editfns.c'
--- src/editfns.c	2012-06-16 12:24:15 +0000
+++ src/editfns.c	2012-06-19 21:22:45 +0000
@@ -73,7 +73,6 @@
 extern Lisp_Object w32_get_internal_run_time (void);
 #endif
 
-static void time_overflow (void) NO_RETURN;
 static Lisp_Object format_time_string (char const *, ptrdiff_t, Lisp_Object,
 				       int, time_t *, struct tm *);
 static int tm_diff (struct tm *, struct tm *);
@@ -1378,7 +1377,7 @@
 #endif
 
 /* Report that a time value is out of range for Emacs.  */
-static void
+static _Noreturn void
 time_overflow (void)
 {
   error ("Specified time is not representable");

=== modified file 'src/eval.c'
--- src/eval.c	2012-06-08 13:18:26 +0000
+++ src/eval.c	2012-06-19 21:22:45 +0000
@@ -131,7 +131,6 @@
 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 @@
 
    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;

=== modified file 'src/image.c'
--- src/image.c	2012-06-19 16:56:28 +0000
+++ src/image.c	2012-06-19 21:22:45 +0000
@@ -5553,8 +5553,7 @@
 /* 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);
@@ -6135,8 +6134,7 @@
 };

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

=== modified file 'src/keyboard.c'
--- src/keyboard.c	2012-06-19 16:56:28 +0000
+++ src/keyboard.c	2012-06-19 21:22:45 +0000
@@ -462,7 +462,7 @@
 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 @@
   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 @@
   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)

=== modified file 'src/lisp.h'
--- src/lisp.h	2012-06-17 08:21:25 +0000
+++ src/lisp.h	2012-06-19 21:22:45 +0000
@@ -113,7 +113,7 @@
 # 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 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 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 @@
 /* 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 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 (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 @@
 				       (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 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);
@@ -2968,7 +2969,7 @@
 
 /* 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);
@@ -3051,7 +3052,7 @@
 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);
@@ -3139,7 +3140,7 @@
 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);
@@ -3208,7 +3209,7 @@
 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);
@@ -3260,11 +3261,10 @@
 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);
@@ -3397,8 +3397,8 @@
 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);

=== modified file 'src/lread.c'
--- src/lread.c	2012-06-19 16:56:28 +0000
+++ src/lread.c	2012-06-19 21:22:45 +0000
@@ -154,10 +154,6 @@
                           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
@@ -1664,7 +1660,7 @@
 /* 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))
@@ -2032,7 +2028,7 @@
 /* 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));

=== modified file 'src/process.c'
--- src/process.c	2012-06-18 06:58:00 +0000
+++ src/process.c	2012-06-19 21:22:45 +0000
@@ -5361,7 +5361,7 @@
 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

=== modified file 'src/puresize.h'
--- src/puresize.h	2012-05-25 18:19:24 +0000
+++ src/puresize.h	2012-06-19 21:22:45 +0000
@@ -75,7 +75,7 @@
   { 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.  */

=== modified file 'src/search.c'
--- src/search.c	2012-06-16 12:24:15 +0000
+++ src/search.c	2012-06-19 21:22:45 +0000
@@ -101,9 +101,8 @@
 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");

=== modified file 'src/sound.c'
--- src/sound.c	2012-05-25 18:19:24 +0000
+++ src/sound.c	2012-06-19 21:22:45 +0000
@@ -109,13 +109,6 @@
   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 @@
 
 /* Like perror, but signals an error.  */
 
-static void
+static _Noreturn void
 sound_perror (const char *msg)
 {
   int saved_errno = errno;
@@ -909,7 +902,7 @@
 #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));

=== modified file 'src/sysdep.c'
--- src/sysdep.c	2012-06-02 21:01:07 +0000
+++ src/sysdep.c	2012-06-19 21:22:45 +0000
@@ -127,7 +127,7 @@
 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.  */

=== modified file 'src/syssignal.h'
--- src/syssignal.h	2012-05-01 03:45:39 +0000
+++ src/syssignal.h	2012-06-19 21:22:45 +0000
@@ -76,7 +76,7 @@
 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)

=== modified file 'src/term.c'
--- src/term.c	2012-06-19 06:49:50 +0000
+++ src/term.c	2012-06-19 21:22:45 +0000
@@ -85,11 +85,11 @@
 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)                                          \

=== modified file 'src/textprop.c'
--- src/textprop.c	2012-06-16 12:24:15 +0000
+++ src/textprop.c	2012-06-19 21:22:45 +0000
@@ -72,7 +72,6 @@
 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 @@
 /* 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))

=== modified file 'src/undo.c'
--- src/undo.c	2012-06-16 12:24:15 +0000
+++ src/undo.c	2012-06-19 21:22:45 +0000
@@ -438,8 +438,8 @@
   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));
 }

=== modified file 'src/unexmacosx.c'
--- src/unexmacosx.c	2012-05-27 12:18:35 +0000
+++ src/unexmacosx.c	2012-06-19 21:22:45 +0000
@@ -197,8 +197,6 @@
 
 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 @@
 
 /* Debugging and informational messages routines.  */
 
-static void
+static _Noreturn void
 unexec_error (const char *format, ...)
 {
   va_list ap;

=== modified file 'src/xterm.c'
--- src/xterm.c	2012-06-17 07:39:50 +0000
+++ src/xterm.c	2012-06-19 21:22:45 +0000
@@ -320,7 +320,7 @@
 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 *);
@@ -353,7 +353,7 @@
 #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);
@@ -912,7 +912,7 @@
 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 *);