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]

egcs-CVS19980905, warning patches & __noreturn__ attribute.


	Here are some more warning fixes, mainly in toplev.c.  However
I've also begun to make use of the __noreturn__ attribute in toplev.h.

The motivation being that according to the docs, marking functions with
__noreturn__ allows for slightly better optimization and also helps
reduce spurious uninitialized variable warnings. 

	Okay to install?

		--Kaveh


Sat Sep  5 15:13:13 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* Makefile.in (toplev.o): Depend on $(EXPR_H).
	(insn-extract.o, insn-attrtab.o): Depend on toplev.h.

	* gansidecl.h: Define ATTRIBUTE_NORETURN.

	* genattrtab.c: Have insn-attrtab.c include toplev.h.

	* genextract.c: Have insn-extract.c include toplev.h.

	* rtl.h: Don't prototype `fatal_insn_not_found' and `fatal_insn'.

	* toplev.c: Include expr.h.
  	(really_sorry, fancy_abort): Remove prototypes.
	(set_target_switch): Add argument in prototype.
	(vfatal): Mark prototype with ATTRIBUTE_NORETURN.
	(v_really_sorry): Likewise.
	(print_version, print_single_switch, print_switch_values): Make
	static and add prototype arguments.
	(decl_printable_name): Add prototype arguments.
	(lang_expand_expr_t): New typedef.
	(lang_expand_expr): Declare as a lang_expand_expr_t.
	(incomplete_decl_finalize_hook): Add prototype argument.
	(decl_name): Mark variable `verbosity' with ATTRIBUTE_UNUSED.
	(botch): Likewise for variable `s'.
	(rest_of_type_compilation): Mark variables `type' and `toplev'
	with ATTRIBUTE_UNUSED if none of DBX_DEBUGGING_INFO,
	XCOFF_DEBUGGING_INFO or SDB_DEBUGGING_INFO are defined.
	(display_help): Make variable `i' an `unsigned long'.
	(main): Remove unused parameter `envp'.
	Cast assignment to `lang_expand_expr' to a `lang_expand_expr_t'.
	Cast -1 when comparing it with a `size_t'.

	* toplev.h (fatal, fatal_io_error, pfatal_with_name): Mark
	prototype with ATTRIBUTE_NORETURN.
	(fatal_insn_not_found, fatal_insn, really_sorry,
	push_float_handler, pop_float_handler): Add prototypes.
	(fancy_abort): Mark prototype with ATTRIBUTE_NORETURN.
	(do_abort, botch): Add prototypes.
	
diff -rup orig/egcs-CVS19980905/gcc/Makefile.in egcs-CVS19980905/gcc/Makefile.in
--- orig/egcs-CVS19980905/gcc/Makefile.in	Sat Sep  5 08:05:04 1998
+++ egcs-CVS19980905/gcc/Makefile.in	Sat Sep  5 15:05:28 1998
@@ -1383,7 +1383,7 @@ fold-const.o : fold-const.c $(CONFIG_H) 
 toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \
    flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
    insn-codes.h insn-config.h $(RECOG_H) Makefile toplev.h dwarfout.h \
-   dwarf2out.h sdbout.h dbxout.h \
+   dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \
    $(lang_options_files)
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
 	  -DTARGET_NAME=\"$(target_alias)\" \
@@ -1606,7 +1606,7 @@ s-opinit : $(md_file) genopinit $(srcdir
 	$(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
 	touch s-opinit
 
-insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h
+insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
 
 insn-extract.c: s-extract ; @true
@@ -1625,7 +1625,7 @@ s-peep : $(md_file) genpeep $(srcdir)/mo
 	touch s-peep
 
 insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h output.h \
-     insn-attr.h insn-config.h system.h
+     insn-attr.h insn-config.h system.h toplev.h
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
 
 insn-attr.h: s-attr ; @true
diff -rup orig/egcs-CVS19980905/gcc/gansidecl.h egcs-CVS19980905/gcc/gansidecl.h
--- orig/egcs-CVS19980905/gcc/gansidecl.h	Sat Sep  5 08:05:39 1998
+++ egcs-CVS19980905/gcc/gansidecl.h	Sat Sep  5 15:05:28 1998
@@ -54,6 +54,10 @@ Boston, MA 02111-1307, USA.  */
 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
 #endif /* ATTRIBUTE_UNUSED */
 
+#ifndef ATTRIBUTE_NORETURN
+#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif /* ATTRIBUTE_NORETURN */
+
 #ifndef ATTRIBUTE_PRINTF
 #define ATTRIBUTE_PRINTF(m, n) __attribute__ ((format (__printf__, m, n)))
 #define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
diff -rup orig/egcs-CVS19980905/gcc/genattrtab.c egcs-CVS19980905/gcc/genattrtab.c
--- orig/egcs-CVS19980905/gcc/genattrtab.c	Sat Sep  5 08:06:05 1998
+++ egcs-CVS19980905/gcc/genattrtab.c	Sat Sep  5 16:46:24 1998
@@ -6000,6 +6000,7 @@ from the machine description file `md'. 
   printf ("#include \"real.h\"\n");
   printf ("#include \"output.h\"\n");
   printf ("#include \"insn-attr.h\"\n");
+  printf ("#include \"toplev.h\"\n");
   printf ("\n");  
   printf ("#define operands recog_operand\n\n");
 
diff -rup orig/egcs-CVS19980905/gcc/genextract.c egcs-CVS19980905/gcc/genextract.c
--- orig/egcs-CVS19980905/gcc/genextract.c	Sat Sep  5 08:06:05 1998
+++ egcs-CVS19980905/gcc/genextract.c	Sat Sep  5 16:47:26 1998
@@ -458,7 +458,8 @@ from the machine description file `md'. 
 
   printf ("#include \"config.h\"\n");
   printf ("#include \"system.h\"\n");
-  printf ("#include \"rtl.h\"\n\n");
+  printf ("#include \"rtl.h\"\n");
+  printf ("#include \"toplev.h\"\n\n");
 
   /* This variable exists only so it can be the "location"
      of any missing operand whose numbers are skipped by a given pattern.  */
diff -rup orig/egcs-CVS19980905/gcc/rtl.h egcs-CVS19980905/gcc/rtl.h
--- orig/egcs-CVS19980905/gcc/rtl.h	Sat Sep  5 08:06:28 1998
+++ egcs-CVS19980905/gcc/rtl.h	Sat Sep  5 15:05:28 1998
@@ -1165,10 +1165,6 @@ extern rtx output_constant_def		PROTO((u
 extern rtx immed_real_const		PROTO((union tree_node *));
 extern union tree_node *make_tree	PROTO((union tree_node *, rtx));
 
-/* Abort routines */
-extern void fatal_insn_not_found	PROTO((rtx));
-extern void fatal_insn			PROTO((char *, rtx));
-
 /* Define a default value for STORE_FLAG_VALUE.  */
 
 #ifndef STORE_FLAG_VALUE
diff -rup orig/egcs-CVS19980905/gcc/toplev.c egcs-CVS19980905/gcc/toplev.c
--- orig/egcs-CVS19980905/gcc/toplev.c	Sat Sep  5 08:06:36 1998
+++ egcs-CVS19980905/gcc/toplev.c	Sat Sep  5 15:05:29 1998
@@ -51,6 +51,7 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "except.h"
 #include "toplev.h"
+#include "expr.h"
 
 #ifdef DWARF_DEBUGGING_INFO
 #include "dwarfout.h"
@@ -173,9 +174,7 @@ void pedwarn PVPROTO((char *s, ...));
 void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
 void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
 void sorry PVPROTO((char *s, ...));
-void really_sorry PVPROTO((char *s, ...));
-void fancy_abort ();
-void set_target_switch ();
+static void set_target_switch PROTO((char *));
 static char *decl_name PROTO((tree, int));
 static void vmessage PROTO((char *, char *, va_list));
 static void v_message_with_file_and_line PROTO((char *, int, char *,
@@ -186,7 +185,7 @@ static void v_error_with_file_and_line P
 static void v_error_with_decl PROTO((tree, char *, va_list));
 static void v_error_for_asm PROTO((rtx, char *, va_list));
 static void verror PROTO((char *, va_list));
-static void vfatal PROTO((char *, va_list));
+static void vfatal PROTO((char *, va_list)) ATTRIBUTE_NORETURN;
 static void v_warning_with_file_and_line PROTO ((char *, int, char *, va_list));
 static void v_warning_with_decl PROTO((tree, char *, va_list));
 static void v_warning_for_asm PROTO((rtx, char *, va_list));
@@ -195,7 +194,7 @@ static void vpedwarn PROTO((char *, va_l
 static void v_pedwarn_with_decl PROTO((tree, char *, va_list));
 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));
+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 output_lang_identify PROTO((FILE *));
@@ -206,9 +205,11 @@ static void clean_dump_file PROTO((char 
 static void compile_file PROTO((char *));
 static void display_help PROTO ((void));
 
-void print_version ();
-int print_single_switch ();
-void print_switch_values ();
+static void print_version PROTO((FILE *, char *));
+static int print_single_switch PROTO((FILE *, int, int, char *, char *, char *,
+				      char *, char *));
+static void print_switch_values PROTO((FILE *, int, int, char *, char *,
+				       char *));
 /* Length of line when printing switch values.  */
 #define MAX_LINE 75
 
@@ -339,16 +340,20 @@ int sorrycount = 0;
      2: and any other information that might be interesting, such as function
         parameter types in C++.  */
 
-char *(*decl_printable_name) (/* tree decl, int verbosity */);
+char *(*decl_printable_name)		PROTO ((tree, int));
 
 /* Pointer to function to compute rtl for a language-specific tree code.  */
 
-struct rtx_def *(*lang_expand_expr) ();
+typedef rtx (*lang_expand_expr_t)
+  PROTO ((union tree_node *, rtx, enum machine_mode,
+	  enum expand_modifier modifier));
+
+lang_expand_expr_t lang_expand_expr = 0;
 
 /* Pointer to function to finish handling an incomplete decl at the
    end of compilation.  */
 
-void (*incomplete_decl_finalize_hook) () = 0;
+void (*incomplete_decl_finalize_hook) PROTO((tree)) = 0;
 
 /* Highest label number used at the end of reload.  */
 
@@ -1379,7 +1384,7 @@ fatal_insn_not_found (insn)
 static char *
 decl_name (decl, verbosity)
      tree decl;
-     int verbosity;
+     int verbosity ATTRIBUTE_UNUSED;
 {
   return IDENTIFIER_POINTER (DECL_NAME (decl));
 }
@@ -2128,7 +2133,7 @@ do_abort ()
 
 void
 botch (s)
-  char * s;
+  char * s ATTRIBUTE_UNUSED;
 {
   abort ();
 }
@@ -3168,8 +3173,13 @@ rest_of_decl_compilation (decl, asmspec,
 
 void
 rest_of_type_compilation (type, toplev)
+#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
      tree type;
      int toplev;
+#else
+     tree type ATTRIBUTE_UNUSED;
+     int toplev ATTRIBUTE_UNUSED;
+#endif
 {
 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
@@ -3938,7 +3948,7 @@ static void
 display_help ()
 {
   int    undoc;
-  long	 i;
+  unsigned long	 i;
   char * lang;
   
 #ifndef USE_CPPLIB  
@@ -4167,10 +4177,9 @@ check_lang_option (option, lang_option)
    33 if had nonfatal errors, else success.  */
 
 int
-main (argc, argv, envp)
+main (argc, argv)
      int argc;
      char **argv;
-     char **envp;
 {
   register int i;
   char *filename = 0;
@@ -4210,7 +4219,7 @@ main (argc, argv, envp)
 #endif
 
   decl_printable_name = decl_name;
-  lang_expand_expr = (struct rtx_def *(*)()) do_abort;
+  lang_expand_expr = (lang_expand_expr_t) do_abort;
 
   /* Initialize whether `char' is signed.  */
   flag_signed_char = DEFAULT_SIGNED_CHAR;
@@ -4314,7 +4323,7 @@ main (argc, argv, envp)
 	if (check_lang_option (argv[i], documented_lang_options[j].option))
 	  break;
       
-      if (j != -1)
+      if (j != (size_t)-1)
 	{
 	  /* If the option is valid for *some* language,
 	     treat it as valid even if this language doesn't understand it.  */
@@ -4862,7 +4871,7 @@ main (argc, argv, envp)
 /* Decode -m switches.  */
 /* Decode the switch -mNAME.  */
 
-void
+static void
 set_target_switch (name)
      char *name;
 {
@@ -4900,7 +4909,7 @@ set_target_switch (name)
    Each line begins with INDENT (for the case where FILE is the
    assembler output file).  */
 
-void
+static void
 print_version (file, indent)
      FILE *file;
      char *indent;
@@ -4922,7 +4931,7 @@ print_version (file, indent)
    ??? We don't handle error returns from fprintf (disk full); presumably
    other code will catch a disk full though.  */
 
-int
+static int
 print_single_switch (file, pos, max, indent, sep, term, type, name)
      FILE *file;
      int pos, max;
diff -rup orig/egcs-CVS19980905/gcc/toplev.h egcs-CVS19980905/gcc/toplev.h
--- orig/egcs-CVS19980905/gcc/toplev.h	Sat Sep  5 08:10:15 1998
+++ egcs-CVS19980905/gcc/toplev.h	Sat Sep  5 15:05:29 1998
@@ -19,9 +19,13 @@ extern void debug_end_source_file	PROTO 
 extern void debug_define		PROTO ((unsigned, char *));
 extern void debug_undef			PROTO ((unsigned, char *));
 extern void fatal			PVPROTO ((char *, ...))
-						ATTRIBUTE_PRINTF_1;
-extern void fatal_io_error		PROTO ((char *));
-extern void pfatal_with_name		PROTO ((char *));
+  ATTRIBUTE_PRINTF_1
+  ATTRIBUTE_NORETURN;
+extern void fatal_io_error		PROTO ((char *)) ATTRIBUTE_NORETURN;
+extern void pfatal_with_name		PROTO ((char *)) ATTRIBUTE_NORETURN;
+extern void fatal_insn_not_found	PROTO ((struct rtx_def *)) ATTRIBUTE_NORETURN;
+extern void fatal_insn			PROTO ((char *, struct rtx_def *))
+  ATTRIBUTE_NORETURN;
 extern void warning			PVPROTO ((char *, ...))
 						ATTRIBUTE_PRINTF_1;
 extern void error			PVPROTO ((char *, ...))
@@ -36,6 +40,8 @@ extern void error_with_file_and_line	PVP
 						ATTRIBUTE_PRINTF_3;
 extern void sorry			PVPROTO ((char *s, ...))
 						ATTRIBUTE_PRINTF_1;
+extern void really_sorry		PVPROTO((char *s, ...))
+  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 extern void default_print_error_function PROTO ((char *));
 extern void report_error_function	PROTO ((char *));
 
@@ -53,6 +59,8 @@ extern void warning_for_asm		PVPROTO((st
 						ATTRIBUTE_PRINTF_2;
 #ifdef _JBLEN
 extern void set_float_handler PROTO((jmp_buf));
+extern int push_float_handler PROTO((jmp_buf, jmp_buf));
+extern void pop_float_handler PROTO((int, jmp_buf));
 #endif
 
 #ifdef BUFSIZ
@@ -60,6 +68,8 @@ extern void output_quoted_string	PROTO (
 extern void output_file_directive	PROTO ((FILE *, char *));
 #endif
 
-extern void fancy_abort			PROTO ((void));
+extern void fancy_abort			PROTO ((void)) ATTRIBUTE_NORETURN;
+extern void do_abort			PROTO ((void)) ATTRIBUTE_NORETURN;
+extern void botch			PROTO ((char *)) ATTRIBUTE_NORETURN;
 
 #endif /* __GCC_TOPLEV_H */


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