PATCH: put setjmp warnings under control of -W

Marc Lehmann pcg@opengroup.org
Sun Oct 31 13:14:00 GMT 1999


This patch puts the "clobbered by setjmp" warnings under control of -W
(formerly they were under control of -Wuninitialized).

This makes the behaviour consistent with the documentation.

Sun Oct 31 13:32:15 CET 1999  Marc Lehmann <pcg@goof.com>

	* toplev.c (rest_of_compilation): Seperate the setjmp/vfork clobber
        warning from -Wuninitialized and put it under -W.
        * function.c (uninitialized_vars_warning): Warn only when the
        corresponding flag is set.

Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.119
diff -u -p -r1.119 function.c
--- function.c	1999/10/03 16:28:33	1.119
+++ function.c	1999/10/31 21:08:50
@@ -5061,7 +5061,8 @@ uninitialized_vars_warning (block)
   register tree decl, sub;
   for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
     {
-      if (TREE_CODE (decl) == VAR_DECL
+      if (warn_uninitialized
+          && TREE_CODE (decl) == VAR_DECL
 	  /* These warnings are unreliable for and aggregates
 	     because assigning the fields one by one can fail to convince
 	     flow.c that the entire aggregate was initialized.
@@ -5080,7 +5081,8 @@ uninitialized_vars_warning (block)
 	  && regno_uninitialized (REGNO (DECL_RTL (decl))))
 	warning_with_decl (decl,
 			   "`%s' might be used uninitialized in this function");
-      if (TREE_CODE (decl) == VAR_DECL
+      if (extra_warnings
+          && TREE_CODE (decl) == VAR_DECL
 	  && DECL_RTL (decl) != 0
 	  && GET_CODE (DECL_RTL (decl)) == REG
 	  && regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.242
diff -u -p -r1.242 toplev.c
--- toplev.c	1999/10/19 13:02:39	1.242
+++ toplev.c	1999/10/31 21:08:56
@@ -4007,10 +4007,11 @@ rest_of_compilation (decl)
 	   life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
 	 });
 
-      if (warn_uninitialized)
+      if (warn_uninitialized || extra_warnings)
 	{
 	  uninitialized_vars_warning (DECL_INITIAL (decl));
-	  setjmp_args_warning ();
+          if (extra_warnings)
+	    setjmp_args_warning ();
 	}
     }
 

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@opengroup.org |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |


More information about the Gcc-patches mailing list