This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed: mark sim_io_error and callees as noreturn


See previous comment about getting rid of:
 x/src/sim/cris/traps.c: In function 'h_supr_get_handler':
 x/src/sim/cris/traps.c:1125: warning: control reaches end of non-void function
 x/src/sim/cris/traps.c: In function 'cris_bmod_handler':
 x/src/sim/cris/traps.c:1106: warning: control reaches end of non-void function

While sim/common is riddled with unprotected __attribute__ (with
nothing #defining it away controlled by configure-checks), there's no
such "prior art" in include/gdb/callback.h, so better safe than sorry.
Ditto sim/common/callback.c.  All simulators built and some even
tested, no regressions.  I also compiled gdb for native
i686-pc-linux-gnu and cris-axis-elf as a sanity-check, hoping to avoid
trivially introducing warnings.  The noreturn attribute is accepted in
this form as "far back" as gcc-2.95.

Committed.

include/gdb:
	* callback.h (struct host_callback_struct): Mark member error as
	pointing to a noreturn function.

sim/common:
	* callback.c (os_error): Mark as being a noreturn function.
	* sim-io.h (sim_io_error): Similar for sim_io_error.

Index: include/gdb/callback.h
===================================================================
RCS file: /cvs/src/src/include/gdb/callback.h,v
retrieving revision 1.14
diff -p -u -r1.14 callback.h
--- include/gdb/callback.h	1 Jan 2008 22:53:22 -0000	1.14
+++ include/gdb/callback.h	6 Jan 2009 23:12:44 -0000
@@ -124,7 +124,11 @@ struct host_callback_struct 
   /* Print an error message and "exit".
      In the case of gdb "exiting" means doing a longjmp back to the main
      command loop.  */
-  void (*error) PARAMS ((host_callback *, const char *, ...));
+  void (*error) PARAMS ((host_callback *, const char *, ...))
+#ifdef __GNUC__
+    __attribute__ ((__noreturn__))
+#endif
+    ;
 
   int last_errno;		/* host format */
 
Index: sim/common/callback.c
===================================================================
RCS file: /cvs/src/src/sim/common/callback.c,v
retrieving revision 1.23
diff -p -u -r1.23 callback.c
--- sim/common/callback.c	1 Jan 2008 22:53:23 -0000	1.23
+++ sim/common/callback.c	6 Jan 2009 23:12:45 -0000
@@ -91,7 +91,11 @@ static int os_get_errno PARAMS ((host_ca
 static int os_close PARAMS ((host_callback *, int));
 static void os_vprintf_filtered PARAMS ((host_callback *, const char *, va_list));
 static void os_evprintf_filtered PARAMS ((host_callback *, const char *, va_list));
-static void os_error PARAMS ((host_callback *, const char *, ...));
+static void os_error PARAMS ((host_callback *, const char *, ...))
+#ifdef __GNUC__
+  __attribute__ ((__noreturn__))
+#endif
+  ;
 static int fdmap PARAMS ((host_callback *, int));
 static int fdbad PARAMS ((host_callback *, int));
 static int wrap PARAMS ((host_callback *, int));
Index: sim/common/sim-io.h
===================================================================
RCS file: /cvs/src/src/sim/common/sim-io.h,v
retrieving revision 1.5
diff -p -u -r1.5 sim-io.h
--- sim/common/sim-io.h	1 Jan 2008 22:53:23 -0000	1.5
+++ sim/common/sim-io.h	6 Jan 2009 23:12:46 -0000
@@ -75,7 +75,9 @@ void sim_io_evprintf (SIM_DESC sd, const
 
 void sim_io_error (SIM_DESC sd,
 		   const char *fmt,
-		   ...) __attribute__ ((format (printf, 2, 3)));
+		   ...)
+  __attribute__ ((format (printf, 2, 3)))
+  __attribute__ ((__noreturn__));
 
 void sim_io_poll_quit (SIM_DESC sd);
 
brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]