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]

misc warnings patch (installed)


Mostly adding prototypes, and more consts in gcc.c.  The remaining
prototype warnings, not counting gen_call and friends, are:

cp/errfn.c:42: warning: function declaration isn't a prototype
cp/error.c:29: warning: function declaration isn't a prototype
libgcc2.c:1297: warning: no previous prototype for `__builtin_saveregs'
libgcc2.c:1355: warning: function declaration isn't a prototype

errfn.c and error.c are pulling dirty tricks with function pointers.
I'm not sure what's up with libgcc2.c.

The remaining write-strings warnings are:

dwarfout.c:5866: warning: passing arg 2 of `output_die' discards qualifiers
			  from pointer target type
gcc.c:2603: warning: passing arg 2 of `pexecute' from incompatible pointer type
gcc.c:3085: warning: passing arg 2 of `lang_specific_driver' from 
		     incompatible pointer type

dwarfout.c is pulling dirty tricks with function pointers.  I didn't
feel like adjusting pexecute or lang_specific_driver just yet.

The remaining uninitialized variable warnings are:

java/parse.y:10002: warning: `rlist' might be used uninitialized
bb-reorder.c:920: warning: `curr_scope' might be used uninitialized
calls.c:2493: warning: `save_pending_stack_adjust' might be used uninitialized
calls.c:2494: warning: `save_stack_pointer_delta' might be used uninitialized
cp/class.c:2359: warning: `method' might be used uninitialized
ifcvt.c:283: warning: `else_start' might be used uninitialized
ifcvt.c:284: warning: `else_end' might be used uninitialized
regrename.c:238: warning: `avail_reg' might be used uninitialized
regrename.c:533: warning: `reg_use' might be used uninitialized
regrename.c:674: warning: `dest_subregno' might be used uninitialized

-- I didn't look at any of these.

In addition there are 207 warnings about mismatched signed and
unsigned types.
    136 signed and unsigned type in conditional expression
     61 comparison between signed and unsigned
     10 pointer targets in passing arg ??? of `???' differ in signedness

Bootstrapped i686-pc-linux-gnu.  Committed.

zw

top level:
	* diagnostic.c: Eliminate implicit int.
	* except.c, gcc.c: Add static prototypes.
	* final.c (final_end_function): Mark file arg ATTRIBUTE_UNUSED.
	* gensupport.c (process_rtx): Use XVEC to initialize vector
	slot of 'split'.

	* print-rtl.c: If DEBUG_REGISTER_NAMES, define static 
	debug_reg_names instead of static reg_names.  If not, define
	global reg_names.
	* regclass.c: Don't define global reg_names unless
	DEBUG_REGISTER_NAMES is defined.

	* reload1.c (order_regs_for_reload): Remove unused variable.
	* varasm.c: Include output.h after defaults.h.  Define
	eh_frame_section as function of no args, not of unspecified args.

	* gcc.c: Constify argbuf; arguments to store_arg,
	process_command, main; elements of struct command and struct
	switchstr; local variables in execute, process_command, main.

cp:
	* except.c: Add static prototypes.

===================================================================
Index: diagnostic.c
--- diagnostic.c	2000/05/14 08:44:46	1.14
+++ diagnostic.c	2000/05/20 19:34:29
@@ -112,7 +112,7 @@ static int output_maximum_width = 0;
 
 /* Used to control every diagnostic message formatting.  Front-ends should
    call set_message_prefixing_rule to set up their politics.  */
-static current_prefixing_rule = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
+static int current_prefixing_rule = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
 
 /* Predicate. Return 1 if we're in automatic line wrapping mode.  */
 
===================================================================
Index: except.c
--- except.c	2000/05/11 14:20:31	1.129
+++ except.c	2000/05/20 19:34:30
@@ -470,6 +470,7 @@ static void set_insn_eh_region	PARAMS ((
 #ifdef DONT_USE_BUILTIN_SETJMP
 static void jumpif_rtx		PARAMS ((rtx, rtx));
 #endif
+static void find_exception_handler_labels_1 PARAMS ((rtx));
 static void mark_eh_node        PARAMS ((struct eh_node *));
 static void mark_eh_stack       PARAMS ((struct eh_stack *));
 static void mark_eh_queue       PARAMS ((struct eh_queue *));
@@ -483,7 +484,6 @@ static int find_func_region	PARAMS ((int
 static int find_func_region_from_symbol PARAMS ((rtx));
 static void clear_function_eh_region PARAMS ((void));
 static void process_nestinfo	PARAMS ((int, eh_nesting_info *, int *));
-
 rtx expand_builtin_return_addr	PARAMS ((enum built_in_function, int, rtx));
 static void emit_cleanup_handler PARAMS ((struct eh_entry *));
 static int eh_region_from_symbol PARAMS ((rtx));
===================================================================
Index: final.c
--- final.c	2000/05/19 20:51:49	1.128
+++ final.c	2000/05/20 19:34:31
@@ -1779,7 +1779,7 @@ profile_function (file)
 void
 final_end_function (first, file, optimize)
      rtx first ATTRIBUTE_UNUSED;
-     FILE *file;
+     FILE *file ATTRIBUTE_UNUSED;
      int optimize ATTRIBUTE_UNUSED;
 {
   app_disable ();
===================================================================
Index: gcc.c
--- gcc.c	2000/05/09 21:55:11	1.143
+++ gcc.c	2000/05/20 19:34:32
@@ -199,6 +199,8 @@ static char **split_directories	PARAMS (
 static void free_split_directories PARAMS ((char **));
 static char *make_relative_prefix PARAMS ((const char *, const char *, const char *));
 #endif /* VMS */
+static void store_arg		PARAMS ((const char *, int, int));
+static char *load_specs		PARAMS ((const char *));
 static void read_specs		PARAMS ((const char *, int));
 static void set_spec		PARAMS ((const char *, const char *));
 static struct compiler *lookup_compiler PARAMS ((const char *, size_t, const char *));
@@ -208,6 +210,7 @@ static int access_check		PARAMS ((const 
 static char *find_a_file	PARAMS ((struct path_prefix *, const char *, int));
 static void add_prefix		PARAMS ((struct path_prefix *, const char *,
 					 const char *, int, int, int *));
+static void translate_options	PARAMS ((int *, const char ***));
 static char *skip_whitespace	PARAMS ((char *));
 static void record_temp_file	PARAMS ((const char *, int, int));
 static void delete_if_ordinary	PARAMS ((const char *));
@@ -239,7 +242,7 @@ static void display_help 	PARAMS ((void)
 static void add_preprocessor_option	PARAMS ((const char *, int));
 static void add_assembler_option	PARAMS ((const char *, int));
 static void add_linker_option		PARAMS ((const char *, int));
-static void process_command		PARAMS ((int, char **));
+static void process_command		PARAMS ((int, const char **));
 static int execute			PARAMS ((void));
 static void unused_prefix_warnings	PARAMS ((struct path_prefix *));
 static void clear_args			PARAMS ((void));
@@ -1287,7 +1290,7 @@ set_spec (name, spec)
 
 /* Vector of pointers to arguments in the current line of specifications.  */
 
-static char **argbuf;
+static const char **argbuf;
 
 /* Number of elements allocated in argbuf.  */
 
@@ -1437,12 +1440,13 @@ clear_args ()
 
 static void
 store_arg (arg, delete_always, delete_failure)
-     char *arg;
+     const char *arg;
      int delete_always, delete_failure;
 {
   if (argbuf_index + 1 == argbuf_length)
     argbuf
-      = (char **) xrealloc (argbuf, (argbuf_length *= 2) * sizeof (char *));
+      = (const char **) xrealloc (argbuf,
+				  (argbuf_length *= 2) * sizeof (const char *));
 
   argbuf[argbuf_index++] = arg;
   argbuf[argbuf_index] = 0;
@@ -2504,7 +2508,7 @@ execute ()
   struct command
     {
       const char *prog;		/* program name.  */
-      char **argv;		/* vector of args.  */
+      const char **argv;	/* vector of args.  */
       int pid;			/* pid of process for this command.  */
     };
 
@@ -2558,7 +2562,7 @@ execute ()
       /* Print each piped command as a separate line.  */
       for (i = 0; i < n_commands ; i++)
 	{
-	  char **j;
+	  const char **j;
 
 	  for (j = commands[i].argv; *j; j++)
 	    fprintf (stderr, " %s", *j);
@@ -2587,7 +2591,7 @@ execute ()
   for (i = 0; i < n_commands; i++)
     {
       char *errmsg_fmt, *errmsg_arg;
-      char *string = commands[i].argv[0];
+      const char *string = commands[i].argv[0];
 
       commands[i].pid = pexecute (string, commands[i].argv,
 				  programname, temp_filename,
@@ -2602,7 +2606,7 @@ execute ()
 	pfatal_pexecute (errmsg_fmt, errmsg_arg);
 
       if (string != commands[i].prog)
-	free (string);
+	free ((PTR) string);
     }
 
   execution_count++;
@@ -2703,7 +2707,7 @@ execute ()
 struct switchstr
 {
   const char *part1;
-  char **args;
+  const char **args;
   int live_cond;
   int validated;
 };
@@ -2909,12 +2913,12 @@ add_linker_option (option, len)					
 static void
 process_command (argc, argv)
      int argc;
-     char **argv;
+     const char **argv;
 {
   register int i;
   const char *temp;
   char *temp1;
-  char *spec_lang = 0;
+  const char *spec_lang = 0;
   int last_language_n_infiles;
   int have_c = 0;
   int have_o = 0;
@@ -3229,7 +3233,7 @@ process_command (argc, argv)
 	report_times = 1;
       else if (argv[i][0] == '-' && argv[i][1] != 0)
 	{
-	  register char *p = &argv[i][1];
+	  register const char *p = &argv[i][1];
 	  register int c = *p;
 
 	  switch (c)
@@ -3248,7 +3252,7 @@ process_command (argc, argv)
 
 	    case 'B':
 	      {
-		char *value;
+		const char *value;
 		if (p[1] == 0 && i + 1 == argc)
 		  fatal ("argument to `-B' is missing");
 		if (p[1] == 0)
@@ -3586,8 +3590,8 @@ process_command (argc, argv)
 	}
       else if (argv[i][0] == '-' && argv[i][1] != 0)
 	{
-	  register char *p = &argv[i][1];
-	  register int c = *p;
+	  const char *p = &argv[i][1];
+	  int c = *p;
 
 	  if (c == 'x')
 	    {
@@ -3622,7 +3626,7 @@ process_command (argc, argv)
 	      if (i + n_args >= argc)
 		fatal ("argument to `-%s' is missing", p);
 	      switches[n_switches].args
-		= (char **) xmalloc ((n_args + 1) * sizeof (char *));
+		= (const char **) xmalloc ((n_args + 1) * sizeof(const char *));
 	      while (j < n_args)
 		switches[n_switches].args[j++] = argv[++i];
 	      /* Null-terminate the vector.  */
@@ -3633,13 +3637,15 @@ process_command (argc, argv)
 	      /* On some systems, ld cannot handle some options without
 		 a space.  So split the option from its argument.  */
 	      char *part1 = (char *) xmalloc (2);
+	      char *tmp;
 	      part1[0] = c;
 	      part1[1] = '\0';
 	      
 	      switches[n_switches].part1 = part1;
-	      switches[n_switches].args = (char **) xmalloc (2 * sizeof (char *));
-	      switches[n_switches].args[0] = xmalloc (strlen (p));
-	      strcpy (switches[n_switches].args[0], &p[1]);
+	      switches[n_switches].args
+		= (const char **) xmalloc (2 * sizeof (const char *));
+	      switches[n_switches].args[0] = tmp = xmalloc (strlen (p));
+	      strcpy (tmp, &p[1]);
 	      switches[n_switches].args[1] = 0;
 	    }
 	  else
@@ -4982,7 +4988,7 @@ give_switch (switchnum, omit_first_word,
 
   if (switches[switchnum].args != 0)
     {
-      char **p;
+      const char **p;
       for (p = switches[switchnum].args; *p; p++)
 	{
 	  if (include_blanks)
@@ -5124,12 +5130,12 @@ fatal_error (signum)
   kill (getpid (), signum);
 }
 
-extern int main PARAMS ((int, char **));
+extern int main PARAMS ((int, const char **));
 
 int
 main (argc, argv)
      int argc;
-     char **argv;
+     const char **argv;
 {
   register size_t i;
   size_t j;
@@ -5165,7 +5171,7 @@ main (argc, argv)
 #endif
 
   argbuf_length = 10;
-  argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
+  argbuf = (const char **) xmalloc (argbuf_length * sizeof (const char *));
 
   obstack_init (&obstack);
 
@@ -5250,7 +5256,7 @@ main (argc, argv)
     first_time = TRUE;
     for (i = 0; (int)i < n_switches; i++)
       {
-	char **args;
+	const char **args;
 	const char *p, *q;
 	if (!first_time)
 	  obstack_grow (&collect_obstack, " ", 1);
===================================================================
Index: gensupport.c
--- gensupport.c	2000/05/18 22:05:15	1.7
+++ gensupport.c	2000/05/20 19:34:34
@@ -180,7 +180,7 @@ process_rtx (desc, lineno)
 	split = rtx_alloc (DEFINE_SPLIT);
 
 	i = XVECLEN (desc, 1);
-	XEXP (split, 0) = rtvec_alloc (i);
+	XVEC (split, 0) = rtvec_alloc (i);
 	while (--i >= 0)
 	  {
 	    XVECEXP (split, 0, i) = copy_rtx (XVECEXP (desc, 1, i));
===================================================================
Index: print-rtl.c
--- print-rtl.c	2000/05/19 22:27:27	1.53
+++ print-rtl.c	2000/05/20 19:34:34
@@ -39,9 +39,10 @@ Boston, MA 02111-1307, USA.  */
 /* Array containing all of the register names */
 
 #ifdef DEBUG_REGISTER_NAMES
-static const char * const reg_names[] = DEBUG_REGISTER_NAMES;
+static const char * const debug_reg_names[] = DEBUG_REGISTER_NAMES;
+#define reg_names debug_reg_names
 #else
-static const char * const reg_names[] = REGISTER_NAMES;
+const char * const reg_names[] = REGISTER_NAMES;
 #endif
 
 static FILE *outfile;
===================================================================
Index: regclass.c
--- regclass.c	2000/05/19 22:27:27	1.96
+++ regclass.c	2000/05/20 19:34:35
@@ -160,9 +160,12 @@ enum reg_class reg_class_subunion[N_REG_
 
 enum reg_class reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
 
-/* Array containing all of the register names */
+/* Array containing all of the register names.  Unless
+   DEBUG_REGISTER_NAMES is defined, use the copy in print-rtl.c.  */
 
+#ifdef DEBUG_REGISTER_NAMES
 const char * const reg_names[] = REGISTER_NAMES;
+#endif
 
 /* For each hard register, the widest mode object that it can contain.
    This will be a MODE_INT mode if the register can hold integers.  Otherwise
===================================================================
Index: reload1.c
--- reload1.c	2000/05/19 22:27:27	1.212
+++ reload1.c	2000/05/20 19:34:37
@@ -1518,7 +1518,7 @@ static void
 order_regs_for_reload (chain)
      struct insn_chain *chain;
 {
-  register int i, j;
+  int i;
   HARD_REG_SET used_by_pseudos;
   HARD_REG_SET used_by_pseudos2;
 
@@ -1541,14 +1541,14 @@ order_regs_for_reload (chain)
   CLEAR_REG_SET (&pseudos_counted);
 
   EXECUTE_IF_SET_IN_REG_SET
-    (&chain->live_throughout, FIRST_PSEUDO_REGISTER, j,
+    (&chain->live_throughout, FIRST_PSEUDO_REGISTER, i,
      {
-       count_pseudo (j);
+       count_pseudo (i);
      });
   EXECUTE_IF_SET_IN_REG_SET
-    (&chain->dead_or_set, FIRST_PSEUDO_REGISTER, j,
+    (&chain->dead_or_set, FIRST_PSEUDO_REGISTER, i,
      {
-       count_pseudo (j);
+       count_pseudo (i);
      });
   CLEAR_REG_SET (&pseudos_counted);
 }
===================================================================
Index: varasm.c
--- varasm.c	2000/05/16 06:11:56	1.118
+++ varasm.c	2000/05/20 19:34:38
@@ -35,10 +35,10 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "function.h"
 #include "expr.h"
-#include "output.h"
 #include "hard-reg-set.h"
 #include "regs.h"
 #include "defaults.h"
+#include "output.h"
 #include "real.h"
 #include "toplev.h"
 #include "dbxout.h"
@@ -427,7 +427,7 @@ asm_output_aligned_bss (file, decl, name
 
 #ifdef EH_FRAME_SECTION_ASM_OP
 void
-eh_frame_section ()
+eh_frame_section (void)
 {
   if (in_section != in_eh_frame)
     {
===================================================================
Index: cp/except.c
--- cp/except.c	2000/05/15 01:31:45	1.109
+++ cp/except.c	2000/05/20 19:34:38
@@ -54,6 +54,8 @@ static tree build_eh_type_type_ref PARAM
 static tree build_terminate_handler PARAMS ((void));
 static tree alloc_eh_object PARAMS ((tree));
 static int complete_ptr_ref_or_void_ptr_p PARAMS ((tree, tree));
+static int can_convert_eh PARAMS ((tree, tree));
+static void check_handlers_1 PARAMS ((tree, tree));
 static void initialize_handler_parm PARAMS ((tree));
 static tree expand_throw PARAMS ((tree));
 static int decl_is_java_type PARAMS ((tree decl, int err));

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