This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

patch to mark some functions with `noreturn'


	Using my patch to detect candidates for attribute noreturn, (see
http://www.cygnus.com/ml/egcs-patches/1998-Oct/0412.html), here are just
some of the hits it produced.  Okay to install?

		--Kaveh



Tue Oct 13 22:13:15 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* cppalloc.c (memory_full): Mark function prototype with
	ATTRIBUTE_NORETURN.

	* demangle.h (collect_exit): Likewise.

	* fix-header.c (v_fatal, fatal): Likewise.

	* gcc.c (pfatal_with_name, pfatal_pexecute, fatal, fancy_abort):
	Likewise.

	* gcov.c (print_usage): Likewise.

	* genattr.c (fatal, fancy_abort): Likewise.

	* genattrtab.c (fatal, fancy_abort): Likewise.

	* gencodes.c (fatal, fancy_abort): Likewise.

	* genconfig.c (fatal, fancy_abort): Likewise.

	* genemit.c (fatal, fancy_abort): Likewise.

	* genextract.c (fatal, fancy_abort): Likewise.

	* genflags.c (fatal, fancy_abort): Likewise.

	* genopinit.c (fatal, fancy_abort): Likewise.

	* genoutput.c (fatal, fancy_abort): Likewise.

	* genpeep.c (fatal, fancy_abort): Likewise.

	* genrecog.c (fatal, fancy_abort): Likewise.

	* libgcc2.c (__eprintf, __default_terminate, __sjthrow,
	__sjpopnthrow, __throw): Likewise.

	* objc/objc-act.c (objc_fatal): Likewise.

	* protoize.c (usage, aux_info_corrupted,
	declare_source_confusing): Likewise.

	* rtl.c (dump_and_abort): Likewise.

	* rtl.h (sets_cc0_p): Likewise.

	* toplev.c (float_signal, pipe_closed): Likewise.
	

diff -rup orig/egcs-CVS19981009/gcc/cppalloc.c egcs-CVS19981009/gcc/cppalloc.c
--- orig/egcs-CVS19981009/gcc/cppalloc.c	Fri Oct  9 23:57:32 1998
+++ egcs-CVS19981009/gcc/cppalloc.c	Sun Oct 11 00:34:19 1998
@@ -27,6 +27,8 @@ Foundation, 59 Temple Place - Suite 330,
 #include "gansidecl.h"
 #include "cpplib.h"
 
+static void memory_full PROTO ((void)) ATTRIBUTE_NORETURN;
+
 static void
 memory_full ()
 {
diff -rup orig/egcs-CVS19981009/gcc/demangle.h egcs-CVS19981009/gcc/demangle.h
--- orig/egcs-CVS19981009/gcc/demangle.h	Fri Oct  9 23:57:34 1998
+++ egcs-CVS19981009/gcc/demangle.h	Sun Oct 11 00:16:30 1998
@@ -94,7 +94,7 @@ extern void
 collect_execute PARAMS ((char *, char **, char *));
 
 extern void
-collect_exit PARAMS ((int));
+collect_exit PARAMS ((int)) ATTRIBUTE_NORETURN;
 
 extern int
 collect_wait PARAMS ((char *));
diff -rup orig/egcs-CVS19981009/gcc/fix-header.c egcs-CVS19981009/gcc/fix-header.c
--- orig/egcs-CVS19981009/gcc/fix-header.c	Fri Oct  9 23:57:38 1998
+++ egcs-CVS19981009/gcc/fix-header.c	Sun Oct 11 00:38:38 1998
@@ -78,7 +78,8 @@ Foundation, 59 Temple Place - Suite 330,
 #include "cpplib.h"
 #include "cpphash.h"
 
-void fatal PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
+static void v_fatal PROTO ((const char *, va_list)) ATTRIBUTE_NORETURN;
+void fatal PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 
 sstring buf;
 
diff -rup orig/egcs-CVS19981009/gcc/gcc.c egcs-CVS19981009/gcc/gcc.c
--- orig/egcs-CVS19981009/gcc/gcc.c	Fri Oct  9 23:57:52 1998
+++ egcs-CVS19981009/gcc/gcc.c	Sat Oct 10 23:59:15 1998
@@ -235,14 +235,14 @@ static int used_arg		PROTO((char *, int)
 static int default_arg		PROTO((char *, int));
 static void set_multilib_dir	PROTO((void));
 static void print_multilib_info	PROTO((void));
-static void pfatal_with_name	PROTO((char *));
+static void pfatal_with_name	PROTO((char *)) ATTRIBUTE_NORETURN;
 static void perror_with_name	PROTO((char *));
-static void pfatal_pexecute	PROTO((char *, char *));
-static void fatal		PVPROTO((char *, ...));
+static void pfatal_pexecute	PROTO((char *, char *)) ATTRIBUTE_NORETURN;
+static void fatal		PVPROTO((char *, ...)) ATTRIBUTE_NORETURN;
 static void error		PVPROTO((char *, ...));
 static void display_help 	PROTO((void));
 
-void fancy_abort ();
+void fancy_abort		PROTO((void)) ATTRIBUTE_NORETURN;
 char *xmalloc ();
 char *xrealloc ();
 
diff -rup orig/egcs-CVS19981009/gcc/gcov.c egcs-CVS19981009/gcc/gcov.c
--- orig/egcs-CVS19981009/gcc/gcov.c	Fri Oct  9 23:57:53 1998
+++ egcs-CVS19981009/gcc/gcov.c	Sun Oct 11 00:00:26 1998
@@ -218,7 +218,7 @@ static void open_files PROTO ((void));
 static void read_files PROTO ((void));
 static void scan_for_source_files PROTO ((void));
 static void output_data PROTO ((void));
-static void print_usage PROTO ((void));
+static void print_usage PROTO ((void)) ATTRIBUTE_NORETURN;
 char * xmalloc ();
 
 int
diff -rup orig/egcs-CVS19981009/gcc/genattr.c egcs-CVS19981009/gcc/genattr.c
--- orig/egcs-CVS19981009/gcc/genattr.c	Fri Oct  9 23:57:53 1998
+++ egcs-CVS19981009/gcc/genattr.c	Sat Oct 10 23:31:30 1998
@@ -32,8 +32,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
diff -rup orig/egcs-CVS19981009/gcc/genattrtab.c egcs-CVS19981009/gcc/genattrtab.c
--- orig/egcs-CVS19981009/gcc/genattrtab.c	Fri Oct  9 23:57:29 1998
+++ egcs-CVS19981009/gcc/genattrtab.c	Sat Oct 10 23:44:08 1998
@@ -119,8 +119,9 @@ struct obstack *temp_obstack = &obstack2
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
 
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* enough space to reserve for printing out ints */
 #define MAX_DIGITS (HOST_BITS_PER_INT * 3 / 10 + 3)
diff -rup orig/egcs-CVS19981009/gcc/gencodes.c egcs-CVS19981009/gcc/gencodes.c
--- orig/egcs-CVS19981009/gcc/gencodes.c	Fri Oct  9 23:58:17 1998
+++ egcs-CVS19981009/gcc/gencodes.c	Sat Oct 10 23:28:49 1998
@@ -34,8 +34,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
diff -rup orig/egcs-CVS19981009/gcc/genconfig.c egcs-CVS19981009/gcc/genconfig.c
--- orig/egcs-CVS19981009/gcc/genconfig.c	Fri Oct  9 23:58:17 1998
+++ egcs-CVS19981009/gcc/genconfig.c	Sat Oct 10 23:32:55 1998
@@ -50,8 +50,9 @@ static int clobbers_seen_this_insn;
 static int dup_operands_seen_this_insn;
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 static void walk_insn_part PROTO((rtx, int, int));
 static void gen_insn PROTO((rtx));
diff -rup orig/egcs-CVS19981009/gcc/genemit.c egcs-CVS19981009/gcc/genemit.c
--- orig/egcs-CVS19981009/gcc/genemit.c	Fri Oct  9 23:58:17 1998
+++ egcs-CVS19981009/gcc/genemit.c	Sat Oct 10 23:43:14 1998
@@ -31,8 +31,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
diff -rup orig/egcs-CVS19981009/gcc/genextract.c egcs-CVS19981009/gcc/genextract.c
--- orig/egcs-CVS19981009/gcc/genextract.c	Fri Oct  9 23:58:17 1998
+++ egcs-CVS19981009/gcc/genextract.c	Sat Oct 10 23:42:02 1998
@@ -100,10 +100,11 @@ static void walk_rtx PROTO ((rtx, char *
 static void print_path PROTO ((char *));
 char *xmalloc PROTO ((unsigned));
 char *xrealloc PROTO ((char *, unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 static char *copystr PROTO ((char *));
 static void mybzero ();
-void fancy_abort PROTO ((void));
+void fancy_abort PROTO ((void)) ATTRIBUTE_NORETURN;
 
 static void
 gen_insn (insn)
diff -rup orig/egcs-CVS19981009/gcc/genflags.c egcs-CVS19981009/gcc/genflags.c
--- orig/egcs-CVS19981009/gcc/genflags.c	Fri Oct  9 23:58:18 1998
+++ egcs-CVS19981009/gcc/genflags.c	Sat Oct 10 23:35:28 1998
@@ -34,8 +34,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* Names for patterns.  Need to allow linking with print-rtl.  */
 char **insn_name_ptr;
diff -rup orig/egcs-CVS19981009/gcc/genopinit.c egcs-CVS19981009/gcc/genopinit.c
--- orig/egcs-CVS19981009/gcc/genopinit.c	Fri Oct  9 23:58:18 1998
+++ egcs-CVS19981009/gcc/genopinit.c	Sat Oct 10 23:40:32 1998
@@ -31,8 +31,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* Many parts of GCC use arrays that are indexed by machine mode and
    contain the insn codes for pattern in the MD file that perform a given
diff -rup orig/egcs-CVS19981009/gcc/genoutput.c egcs-CVS19981009/gcc/genoutput.c
--- orig/egcs-CVS19981009/gcc/genoutput.c	Fri Oct  9 23:58:18 1998
+++ egcs-CVS19981009/gcc/genoutput.c	Sat Oct 10 23:42:50 1998
@@ -108,8 +108,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 static void error PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 static void mybcopy ();
 static void mybzero ();
diff -rup orig/egcs-CVS19981009/gcc/genpeep.c egcs-CVS19981009/gcc/genpeep.c
--- orig/egcs-CVS19981009/gcc/genpeep.c	Fri Oct  9 23:58:18 1998
+++ egcs-CVS19981009/gcc/genpeep.c	Sat Oct 10 23:39:20 1998
@@ -47,8 +47,9 @@ struct link
 };
 
 char *xmalloc PROTO((unsigned));
-static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
-void fancy_abort PROTO((void));
+static void fatal PVPROTO ((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
 
 static int max_opno;
 
diff -rup orig/egcs-CVS19981009/gcc/genrecog.c egcs-CVS19981009/gcc/genrecog.c
--- orig/egcs-CVS19981009/gcc/genrecog.c	Fri Oct  9 23:58:18 1998
+++ egcs-CVS19981009/gcc/genrecog.c	Sat Oct 10 23:41:29 1998
@@ -191,10 +191,11 @@ static void change_state	PROTO((char *, 
 static char *copystr		PROTO((char *));
 static void mybzero		PROTO((char *, unsigned));
 static void mybcopy		PROTO((char *, char *, unsigned));
-static void fatal		PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
+static void fatal		PVPROTO((char *, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 char *xrealloc			PROTO((char *, unsigned));
 char *xmalloc			PROTO((unsigned));
-void fancy_abort		PROTO((void));
+void fancy_abort		PROTO((void)) ATTRIBUTE_NORETURN;
 
 /* Construct and return a sequence of decisions
    that will recognize INSN.
diff -rup orig/egcs-CVS19981009/gcc/libgcc2.c egcs-CVS19981009/gcc/libgcc2.c
--- orig/egcs-CVS19981009/gcc/libgcc2.c	Fri Oct  9 23:58:27 1998
+++ egcs-CVS19981009/gcc/libgcc2.c	Sat Oct 10 23:25:10 1998
@@ -1403,6 +1403,9 @@ __builtin_saveregs ()
 #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
 #include <stdio.h>
 /* This is used by the `assert' macro.  */
+extern void __eprintf (const char *, const char *, unsigned int, const char *)
+  __attribute__ ((__noreturn__));
+
 void
 __eprintf (const char *string, const char *expression,
 	   unsigned int line, const char *filename)
@@ -3023,6 +3026,8 @@ int atexit (func_ptr func)
 
 /* Shared exception handling support routines.  */
 
+extern void __default_terminate (void) __attribute__ ((__noreturn__));
+
 void
 __default_terminate ()
 {
@@ -3226,6 +3231,8 @@ __get_dynamic_handler_chain ()
    dynamic handler chain, and use longjmp to transfer back to the associated
    handler.  */
 
+extern void __sjthrow (void) __attribute__ ((__noreturn__));
+
 void
 __sjthrow ()
 {
@@ -3302,6 +3309,8 @@ __sjthrow ()
    then throw.  This is used to skip the first handler, and transfer
    control to the next handler in the dynamic handler stack.  */
 
+extern void __sjpopnthrow (void) __attribute__ ((__noreturn__));
+
 void
 __sjpopnthrow ()
 {
@@ -3627,6 +3636,8 @@ next_stack_level (void *pc, frame_state 
 
    If we find one, then we unwind the frames down to the one that
    has the handler and transfer control into the handler.  */
+
+extern void __throw(void) __attribute__ ((__noreturn__));
 
 void
 __throw ()
diff -rup orig/egcs-CVS19981009/gcc/objc/objc-act.c egcs-CVS19981009/gcc/objc/objc-act.c
--- orig/egcs-CVS19981009/gcc/objc/objc-act.c	Fri Oct  9 23:58:40 1998
+++ egcs-CVS19981009/gcc/objc/objc-act.c	Sun Oct 11 00:08:15 1998
@@ -284,7 +284,8 @@ static void dump_interface			PROTO((FILE
 
 /* Everything else.  */
 
-static void objc_fatal				PROTO((void));
+static void objc_fatal				PROTO((void))
+  ATTRIBUTE_NORETURN;
 static tree define_decl				PROTO((tree, tree));
 static tree lookup_method_in_protocol_list	PROTO((tree, tree, int));
 static tree lookup_protocol_in_reflist		PROTO((tree, tree));
diff -rup orig/egcs-CVS19981009/gcc/protoize.c egcs-CVS19981009/gcc/protoize.c
--- orig/egcs-CVS19981009/gcc/protoize.c	Fri Oct  9 23:58:30 1998
+++ egcs-CVS19981009/gcc/protoize.c	Sat Oct 10 23:51:44 1998
@@ -121,6 +121,10 @@ extern int pwait PROTO ((int, int *, int
 #define PEXECUTE_LAST   2
 #define PEXECUTE_SEARCH 4
 
+static void usage PROTO ((void)) ATTRIBUTE_NORETURN;
+static void aux_info_corrupted PROTO ((void)) ATTRIBUTE_NORETURN;
+static void declare_source_confusing PROTO ((const char *)) ATTRIBUTE_NORETURN;
+
 /* Aliases for pointers to void.
    These were made to facilitate compilation with old brain-dead DEC C
    compilers which didn't properly grok `void*' types.  */
diff -rup orig/egcs-CVS19981009/gcc/rtl.c egcs-CVS19981009/gcc/rtl.c
--- orig/egcs-CVS19981009/gcc/rtl.c	Fri Oct  9 23:58:33 1998
+++ egcs-CVS19981009/gcc/rtl.c	Sat Oct 10 23:30:34 1998
@@ -195,7 +195,7 @@ char *reg_note_name[] = { "", "REG_DEAD"
 			  "REG_BR_PRED", "REG_EH_CONTEXT",
 			  "REG_FRAME_RELATED_EXPR" };
 
-static void dump_and_abort	PROTO((int, int, FILE *));
+static void dump_and_abort	PROTO((int, int, FILE *)) ATTRIBUTE_NORETURN;
 static void read_name		PROTO((char *, FILE *));
 
 /* Allocate an rtx vector of N elements.
diff -rup orig/egcs-CVS19981009/gcc/rtl.h egcs-CVS19981009/gcc/rtl.h
--- orig/egcs-CVS19981009/gcc/rtl.h	Fri Oct  9 23:58:18 1998
+++ egcs-CVS19981009/gcc/rtl.h	Sat Oct 10 23:38:27 1998
@@ -1262,7 +1262,11 @@ extern void cse_end_of_basic_block	PROTO
 extern int comparison_dominates_p	PROTO ((enum rtx_code, enum rtx_code));
 extern int condjump_p			PROTO ((rtx));
 extern int simplejump_p			PROTO ((rtx));
-extern int sets_cc0_p			PROTO ((rtx));
+extern int sets_cc0_p			PROTO ((rtx))
+#ifndef HAVE_cc0
+  ATTRIBUTE_NORETURN
+#endif
+  ;
 extern int invert_jump			PROTO ((rtx, rtx));
 extern int rtx_renumbered_equal_p	PROTO ((rtx, rtx));
 extern int true_regnum			PROTO ((rtx));
diff -rup orig/egcs-CVS19981009/gcc/toplev.c egcs-CVS19981009/gcc/toplev.c
--- orig/egcs-CVS19981009/gcc/toplev.c	Fri Oct  9 23:58:24 1998
+++ egcs-CVS19981009/gcc/toplev.c	Sat Oct 10 23:33:34 1998
@@ -195,8 +195,8 @@ static void v_pedwarn_with_decl PROTO((t
 static void v_pedwarn_with_file_and_line PROTO((char *, int, char *, va_list));
 static void vsorry PROTO((char *, va_list));
 static void v_really_sorry PROTO((char *, va_list)) ATTRIBUTE_NORETURN;
-static void float_signal PROTO((int));
-static void pipe_closed PROTO((int));
+static void float_signal PROTO((int)) ATTRIBUTE_NORETURN;
+static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN;
 static void output_lang_identify PROTO((FILE *));
 static void open_dump_file PROTO((char *, char *));
 static void close_dump_file PROTO((void (*) (FILE *, rtx), rtx));


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