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]
Other format: [Raw text]

[PATCH]: 3.3.x fix traditional C warning regressions et al.


As 3.3.x is the last GCC series which claims to support being built by
a stage1 traditional C compiler, I felt we should try and make it
work.  There are a number of traditional C warning regressions (and a
few other types) that have crept in lately, and here's my attempt to
fix all of them.  While I had my hands in there, I couldn't resist the
easy fixes for other warnings, regressions or otherwise.

I can easily separate out what patch fixes what warning if necessary
as they are all simply one or two line fixes.  But I've batched them
up because they are so simple.

1.  The first bits to alias.c fixes the traditional C regressions.
2.  The patches to the cp dir are also recent regressions.
3.  The fortran patches are backports for a long standing warning.
4.  The unwind* patches are also backports for warning regressions.

NOTE: the bit in alias.c to change the parameter type from bool to int
arises because GCC complains when using a prototype with a bool
parameter with an old style function definition.  Something about
promoted type not being the same as the parameter's type.

The patch below fixes the following warnings on the 3.3.x branch.
Tested via bootstrap on sparc-sun-solaris2.9, no testsuite
regressions.  Also did bootstrap-only on mips-sgi-irix6.5.

Ok for 3.3.x?

		Thanks,
		--Kaveh


< alias.c:1072: warning: traditional C rejects ISO C style function definitions
< alias.c:1086: warning: traditional C rejects ISO C style function definitions
< alias.c:1099: warning: traditional C rejects ISO C style function definitions
< alias.c:1111: warning: traditional C rejects ISO C style function definitions
< cp/except.c:518: warning: function declaration isn't a prototype
< cp/init.c:3125: warning: implicit declaration of function `inform'


< f/sta.c:340: warning: dereferencing type-punned pointer will break strict-aliasing rules
< f/sta.c:384: warning: dereferencing type-punned pointer will break strict-aliasing rules
< unwind-dw2.c:174: warning: cast from pointer to integer of different size
< unwind-pe.h:61: warning: `size_of_encoded_value' defined but not used
< unwind-pe.h:61: warning: `size_of_encoded_value' defined but not used


2004-05-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* alias.c (set_reg_known_value, set_reg_known_equiv_p):
	Prototype.
	(get_reg_known_value, set_reg_known_value,
	get_reg_known_equiv_p, set_reg_known_equiv_p): Use traditional
	style function definitions.
	(set_reg_known_equiv_p): Change parameter from bool to int.
	
	Backport:
	
	2003-06-13  Matt Kraai  <kraai@alumni.cmu.edu>

	* unwind-c.c: Define NO_SIZE_OF_ENCODED_VALUE.
	* unwind-pe.h (size_of_encoded_value): Do not define if
	NO_SIZE_OF_ENCODED_VALUE is defined.

	2003-10-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
	
	* unwind-dw2.c (NO_SIZE_OF_ENCODED_VALUE): Define when
	appropriate.

	2003-05-07  Richard Henderson  <rth@redhat.com>
	
	* unwind-dw2.c (_Unwind_GetCFA): Cast pointer to _Unwind_Ptr,
	not _Unwind_Word.
	
cp:
	* Make-lang.in (cp/init.o): Depend on diagnostic.h.
	* except.c (do_free_exception): Prototype.
	* init.c: Include "diagnostic.h".

f:
	Backport:
	
	2004-02-24  Michael Matz  <matz@suse.de>
	
	* sta.c (ffesta_save_): Don't break aliasing rules.

diff -rup orig/egcc-3.3-CVS20040505/gcc/alias.c egcc-3.3-CVS20040505/gcc/alias.c
--- orig/egcc-3.3-CVS20040505/gcc/alias.c	Sat Apr 24 20:11:58 2004
+++ egcc-3.3-CVS20040505/gcc/alias.c	Thu May  6 13:36:33 2004
@@ -110,6 +110,8 @@ static tree decl_for_component_ref	PARAM
 static rtx adjust_offset_for_component_ref PARAMS ((tree, rtx));
 static int nonoverlapping_memrefs_p	PARAMS ((rtx, rtx));
 static int write_dependence_p           PARAMS ((rtx, rtx, int));
+static void set_reg_known_value		PARAMS ((unsigned int, rtx));
+static void set_reg_known_equiv_p	PARAMS ((unsigned int, int));
 
 static int nonlocal_mentioned_p_1       PARAMS ((rtx *, void *));
 static int nonlocal_mentioned_p         PARAMS ((rtx));
@@ -1068,7 +1070,8 @@ clear_reg_alias_info (reg)
 /* If a value is known for REGNO, return it.  */
 
 rtx 
-get_reg_known_value (unsigned int regno)
+get_reg_known_value (regno)
+     unsigned int regno;
 {
   if (regno >= FIRST_PSEUDO_REGISTER)
     {
@@ -1082,7 +1085,9 @@ get_reg_known_value (unsigned int regno)
 /* Set it.  */
 
 static void
-set_reg_known_value (unsigned int regno, rtx val)
+set_reg_known_value (regno, val)
+     unsigned int regno;
+     rtx val;
 {
   if (regno >= FIRST_PSEUDO_REGISTER)
     {
@@ -1095,7 +1100,8 @@ set_reg_known_value (unsigned int regno,
 /* Similarly for reg_known_equiv_p.  */
 
 bool
-get_reg_known_equiv_p (unsigned int regno)
+get_reg_known_equiv_p (regno)
+     unsigned int regno;
 {
   if (regno >= FIRST_PSEUDO_REGISTER)
     {
@@ -1107,7 +1113,9 @@ get_reg_known_equiv_p (unsigned int regn
 }
 
 static void
-set_reg_known_equiv_p (unsigned int regno, bool val)
+set_reg_known_equiv_p (regno, val)
+     unsigned int regno;
+     int val;
 {
   if (regno >= FIRST_PSEUDO_REGISTER)
     {
diff -rup orig/egcc-3.3-CVS20040505/gcc/cp/Make-lang.in egcc-3.3-CVS20040505/gcc/cp/Make-lang.in
--- orig/egcc-3.3-CVS20040505/gcc/cp/Make-lang.in	Mon Jun 23 20:06:15 2003
+++ egcc-3.3-CVS20040505/gcc/cp/Make-lang.in	Thu May  6 12:39:41 2004
@@ -250,7 +250,7 @@ cp/call.o: cp/call.c $(CXX_TREE_H) flags
      $(GGC_H) diagnostic.h gt-cp-call.h
 cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
 cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
-  $(GGC_H) except.h
+  diagnostic.h $(GGC_H) except.h
 cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \
   $(TM_P_H) $(TARGET_H)
 cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h
diff -rup orig/egcc-3.3-CVS20040505/gcc/cp/except.c egcc-3.3-CVS20040505/gcc/cp/except.c
--- orig/egcc-3.3-CVS20040505/gcc/cp/except.c	Wed Mar  3 20:07:22 2004
+++ egcc-3.3-CVS20040505/gcc/cp/except.c	Thu May  6 12:39:41 2004
@@ -53,6 +53,7 @@ static bool is_admissible_throw_operand 
 static int can_convert_eh PARAMS ((tree, tree));
 static void check_handlers_1 PARAMS ((tree, tree));
 static tree cp_protect_cleanup_actions PARAMS ((void));
+static tree do_free_exception PARAMS ((tree));
 
 /* Sets up all the global eh stuff that needs to be initialized at the
    start of compilation.  */
diff -rup orig/egcc-3.3-CVS20040505/gcc/cp/init.c egcc-3.3-CVS20040505/gcc/cp/init.c
--- orig/egcc-3.3-CVS20040505/gcc/cp/init.c	Sat Mar 13 20:06:10 2004
+++ egcc-3.3-CVS20040505/gcc/cp/init.c	Thu May  6 12:39:41 2004
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "except.h"
 #include "toplev.h"
+#include "diagnostic.h"
 #include "ggc.h"
 
 static void construct_virtual_base (tree, tree);
diff -rup orig/egcc-3.3-CVS20040505/gcc/f/sta.c egcc-3.3-CVS20040505/gcc/f/sta.c
--- orig/egcc-3.3-CVS20040505/gcc/f/sta.c	Wed Oct 17 18:34:52 2001
+++ egcc-3.3-CVS20040505/gcc/f/sta.c	Thu May  6 12:39:41 2004
@@ -337,7 +337,7 @@ ffesta_save_ (ffelexToken t)
     {				/* No handler in this list, try exec list if
 				   not tried yet. */
       if (ffesta_current_possible_
-	  == (ffestaPossible_) &ffesta_possible_nonexecs_)
+	  == (ffestaPossible_) &ffesta_possible_nonexecs_.first)
 	{
 	  ffesta_current_possible_ = ffesta_possible_execs_.first;
 	  ffesta_current_handler_ = ffesta_current_possible_->handler;
@@ -381,7 +381,7 @@ ffesta_save_ (ffelexToken t)
 		{
 		  if (possible->handler == NULL)
 		    {
-		      if (possible == (ffestaPossible_) &ffesta_possible_nonexecs_)
+		      if (possible == (ffestaPossible_) &ffesta_possible_nonexecs_.first)
 			{
 			  possible = first_exec = ffesta_possible_execs_.first;
 			  continue;
diff -rup orig/egcc-3.3-CVS20040505/gcc/unwind-c.c egcc-3.3-CVS20040505/gcc/unwind-c.c
--- orig/egcc-3.3-CVS20040505/gcc/unwind-c.c	Tue Jul 22 20:07:34 2003
+++ egcc-3.3-CVS20040505/gcc/unwind-c.c	Thu May  6 12:39:41 2004
@@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - S
 #include "tconfig.h"
 #include "tsystem.h"
 #include "unwind.h"
+#define NO_SIZE_OF_ENCODED_VALUE
 #include "unwind-pe.h"
 
 typedef struct
diff -rup orig/egcc-3.3-CVS20040505/gcc/unwind-dw2.c egcc-3.3-CVS20040505/gcc/unwind-dw2.c
--- orig/egcc-3.3-CVS20040505/gcc/unwind-dw2.c	Wed Oct  1 20:05:33 2003
+++ egcc-3.3-CVS20040505/gcc/unwind-dw2.c	Thu May  6 12:39:41 2004
@@ -23,6 +23,9 @@
 #include "tsystem.h"
 #include "dwarf2.h"
 #include "unwind.h"
+#ifdef __USING_SJLJ_EXCEPTIONS__
+# define NO_SIZE_OF_ENCODED_VALUE
+#endif
 #include "unwind-pe.h"
 #include "unwind-dw2-fde.h"
 #include "gthr.h"
@@ -171,7 +174,7 @@ _Unwind_GetGR (struct _Unwind_Context *c
 _Unwind_Word
 _Unwind_GetCFA (struct _Unwind_Context *context)
 {
-  return (_Unwind_Word) context->cfa;
+  return (_Unwind_Ptr) context->cfa;
 }
 
 /* Overwrite the saved value for register REG in CONTEXT with VAL.  */
diff -rup orig/egcc-3.3-CVS20040505/gcc/unwind-pe.h egcc-3.3-CVS20040505/gcc/unwind-pe.h
--- orig/egcc-3.3-CVS20040505/gcc/unwind-pe.h	Thu Aug 15 14:01:30 2002
+++ egcc-3.3-CVS20040505/gcc/unwind-pe.h	Thu May  6 12:39:42 2004
@@ -52,6 +52,8 @@
 #define DW_EH_PE_indirect	0x80
 
 
+#ifndef NO_SIZE_OF_ENCODED_VALUE
+
 /* Given an encoding, return the number of bytes the format occupies.
    This is only defined for fixed-size encodings, and so does not
    include leb128.  */
@@ -75,6 +77,8 @@ size_of_encoded_value (unsigned char enc
     }
   __gxx_abort ();
 }
+
+#endif
 
 #ifndef NO_BASE_OF_ENCODED_VALUE
 


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