Warning patch for toplev.c

Kaveh R. Ghazi ghaziATcaip.rutgers.edu
Tue Sep 14 10:02:00 GMT 1999


	 This patch zaps a few warnings from toplev.c, etc.
Okay to install?

		Thanks,
		--Kaveh


1999-09-14  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* rtl.h (get_insn_name, print_rtl_with_bb): Add prototypes.

	* print-rtl.c (get_insn_name): Remove prototype.

	* toplev.h (progname): Declare const.

	* toplev.c (init_decl_processing, init_obstacks, init_tree_codes,
	init_regs, init_optabs, init_stmt, init_reg_sets, dump_flow_info,
	dump_sched_info, dump_local_alloc, regset_release_memory,
	print_rtl, print_rtl_with_bb, rest_of_decl_compilation,
	error_with_file_and_line, error_with_decl, error_for_asm, error,
	fatal, warning_with_file_and_line, warning_with_decl, warning,
	pedwarn, pedwarn_with_decl, pedwarn_with_file_and_line, sorry):
	Remove redundant prototypes.

	(notice, check_lang_option, report_file_and_line, vnotice,
	mark_file_stack): Add static prototype.
	(set_fatal_function): Add prototype.
	(vnotice, report_file_and_line, set_fatal_function,
	check_lang_option): Constify a char*.
	(main): Prototype.  Call return, not exit.

cp:

	* typeck2.c (ack): Don't declare progname.


diff -rup orig/egcs-CVS19990913/gcc/rtl.h egcs-CVS19990913/gcc/rtl.h
--- orig/egcs-CVS19990913/gcc/rtl.h	Thu Sep  9 07:43:06 1999
+++ egcs-CVS19990913/gcc/rtl.h	Tue Sep 14 10:54:41 1999
@@ -997,6 +997,7 @@ extern rtx make_safe_from		PROTO((rtx, r
 extern rtx convert_memory_address	PROTO((enum machine_mode, rtx));
 extern rtx memory_address		PROTO((enum machine_mode, rtx));
 extern rtx get_insns			PROTO((void));
+extern const char *get_insn_name	PROTO((int));
 extern rtx get_last_insn		PROTO((void));
 extern rtx get_last_insn_anywhere	PROTO((void));
 extern void start_sequence		PROTO((void));
@@ -1530,6 +1531,7 @@ extern void allocate_bb_life_data	PROTO 
 extern void allocate_reg_life_data	PROTO ((void));
 extern void recompute_reg_usage		PROTO ((rtx, int));
 #ifdef BUFSIZ
+extern void print_rtl_with_bb		PROTO ((FILE *, rtx));
 extern void dump_flow_info		PROTO ((FILE *));
 #endif
 extern void free_bb_mem			PROTO ((void));
diff -rup orig/egcs-CVS19990913/gcc/print-rtl.c egcs-CVS19990913/gcc/print-rtl.c
--- orig/egcs-CVS19990913/gcc/print-rtl.c	Sun Sep 12 14:31:14 1999
+++ egcs-CVS19990913/gcc/print-rtl.c	Tue Sep 14 09:42:05 1999
@@ -52,10 +52,6 @@ static int sawclose = 0;
 
 static int indent;
 
-/* Names for patterns.  */
-
-extern const char *get_insn_name PROTO ((int));
-
 static void print_rtx		PROTO ((rtx));
 
 /* Nonzero means suppress output of instruction numbers and line number
diff -rup orig/egcs-CVS19990913/gcc/toplev.h egcs-CVS19990913/gcc/toplev.h
--- orig/egcs-CVS19990913/gcc/toplev.h	Thu Aug 26 07:42:08 1999
+++ egcs-CVS19990913/gcc/toplev.h	Tue Sep 14 10:57:32 1999
@@ -130,4 +130,6 @@ extern void check_global_declarations   
 extern int errorcount;
 extern int warningcount;
 extern int sorrycount;
+
+extern const char *progname;
 #endif /* __GCC_TOPLEV_H */
diff -rup orig/egcs-CVS19990913/gcc/toplev.c egcs-CVS19990913/gcc/toplev.c
--- orig/egcs-CVS19990913/gcc/toplev.c	Sun Sep 12 14:31:22 1999
+++ egcs-CVS19990913/gcc/toplev.c	Tue Sep 14 11:05:07 1999
@@ -149,38 +149,7 @@ extern char *version_string;
 extern int size_directive_output;
 extern tree last_assemble_variable_decl;
 
-extern void init_decl_processing ();
-extern void init_obstacks ();
-extern void init_tree_codes ();
-extern void init_regs ();
-extern void init_optabs ();
-extern void init_stmt ();
-extern void init_reg_sets ();
-extern void dump_flow_info ();
-extern void dump_sched_info ();
-extern void dump_local_alloc ();
-extern void regset_release_memory ();
-
-extern void print_rtl ();
-extern void print_rtl_with_bb ();
-
-void rest_of_decl_compilation ();
-void error_with_file_and_line PVPROTO((const char *file,
-				       int line, const char *s, ...));
-void error_with_decl PVPROTO((tree decl, const char *s, ...));
-void error_for_asm PVPROTO((rtx insn, const char *s, ...));
-void notice PVPROTO((const char *s, ...));
-void error PVPROTO((const char *s, ...));
-void fatal PVPROTO((const char *s, ...));
-void warning_with_file_and_line PVPROTO((const char *file,
-					 int line, const char *s, ...));
-void warning_with_decl PVPROTO((tree decl, const char *s, ...));
-void warning PVPROTO((const char *s, ...));
-void pedwarn PVPROTO((const char *s, ...));
-void pedwarn_with_decl PVPROTO((tree decl, const char *s, ...));
-void pedwarn_with_file_and_line PVPROTO((const char *file,
-					 int line, const char *s, ...));
-void sorry PVPROTO((const char *s, ...));
+static void notice PVPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1;
 static void set_target_switch PROTO((const char *));
 static const char *decl_name PROTO((tree, int));
 static void vmessage PROTO((const char *, const char *, va_list));
@@ -204,6 +173,7 @@ static void v_pedwarn_with_decl PROTO((t
 static void v_pedwarn_with_file_and_line PROTO((const char *, int,
 						const char *, va_list));
 static void vsorry PROTO((const char *, va_list));
+extern void set_fatal_function PROTO((void (*)(const char *, va_list)));
 static void float_signal PROTO((int)) ATTRIBUTE_NORETURN;
 static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN;
 #ifdef ASM_IDENTIFY_LANGUAGE
@@ -216,6 +186,10 @@ static void dump_rtl PROTO((const char *
 static void clean_dump_file PROTO((const char *));
 static void compile_file PROTO((char *));
 static void display_help PROTO ((void));
+static int check_lang_option PROTO ((const char *, const char *));
+static void report_file_and_line PROTO ((const char *, int, int));
+static void vnotice PROTO ((FILE *, const char *, va_list));
+static void mark_file_stack PROTO ((void *));
 
 static void print_version PROTO((FILE *, const char *));
 static int print_single_switch PROTO((FILE *, int, int, const char *,
@@ -232,7 +206,7 @@ void finish_graph_dump_file PROTO ((cons
 
 /* Name of program invoked, sans directories.  */
 
-char *progname;
+const char *progname;
 
 /* Copy of arguments to main.  */
 int save_argc;
@@ -1607,13 +1581,13 @@ report_error_function (file)
 static void
 vnotice (file, msgid, ap)
      FILE *file;
-     char *msgid;
+     const char *msgid;
      va_list ap;
 {
   vfprintf (file, _(msgid), ap);
 }
 
-void
+static void
 notice VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
@@ -1655,7 +1629,7 @@ fnotice VPROTO((FILE *file, const char *
 
 static void
 report_file_and_line (file, line, warn)
-     char *file;
+     const char *file;
      int line;
      int warn;
 {
@@ -1943,7 +1917,7 @@ static void (*fatal_function) PROTO((con
 
 void
 set_fatal_function (f)
-     void (*f) PROTO((char *, va_list));
+     void (*f) PROTO((const char *, va_list));
 {
   fatal_function = f;
 }
@@ -4668,13 +4642,13 @@ display_help ()
 
 static int
 check_lang_option (option, lang_option)
-     char * option;
-     char * lang_option;
+     const char * option;
+     const char * lang_option;
 {
   lang_independent_options * indep_options;
   int    len;
   long    k;
-  char * space;
+  const char * space;
   
   /* Ignore NULL entries.  */
   if (option == NULL || lang_option == NULL)
@@ -4736,6 +4710,8 @@ check_lang_option (option, lang_option)
    Exit code is 35 if can't open files, 34 if fatal error,
    33 if had nonfatal errors, else success.  */
 
+extern int main PROTO ((int, char **));
+
 int
 main (argc, argv)
      int argc;
@@ -4914,7 +4890,7 @@ main (argc, argv)
 	  if (!strcmp (argv[i], "--help"))
 	    {
 	      display_help ();
-	      exit (0);
+	      return (0);
 	    }
 	  
 	  if (strings_processed != 0)
@@ -5360,7 +5336,7 @@ main (argc, argv)
 	  else if (!strcmp (str, "-help"))
 	    {
 	      display_help ();
-	      exit (0);
+	      return (0);
 	    }
 	  else
 	    error ("Invalid option `%s'", argv[i]);
@@ -5489,11 +5465,10 @@ main (argc, argv)
 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
 
   if (errorcount)
-    exit (FATAL_EXIT_CODE);
+    return (FATAL_EXIT_CODE);
   if (sorrycount)
-    exit (FATAL_EXIT_CODE);
-  exit (SUCCESS_EXIT_CODE);
-  return 0;
+    return (FATAL_EXIT_CODE);
+  return (SUCCESS_EXIT_CODE);
 }
 
 /* Decode -m switches.  */
diff -rup orig/egcs-CVS19990913/gcc/cp/typeck2.c egcs-CVS19990913/gcc/cp/typeck2.c
--- orig/egcs-CVS19990913/gcc/cp/typeck2.c	Fri Sep 10 07:43:21 1999
+++ egcs-CVS19990913/gcc/cp/typeck2.c	Tue Sep 14 12:52:43 1999
@@ -253,7 +253,6 @@ ack VPROTO ((const char *msg, ...))
   const char *msg;
 #endif
   va_list ap;
-  extern char * progname;
   
   VA_START (ap, msg);
 


More information about the Gcc-patches mailing list