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]

Re: [PATCH] [PR19090] Add -Wno-pointer-sign option


On Mon, Jan 10, 2005 at 02:40:03PM -0800, Mike Stump wrote:
> On Jan 9, 2005, at 7:55 PM, Andi Kleen wrote:
> >--- gcc/c-common.h 20 Dec 2004 20:11:17 -0000 1.273
> >+++ gcc/c-common.h 10 Jan 2005 03:33:42 -0000
> >@@ -444,6 +444,9 @@
> >
> > extern int warn_main;
> >
> >+/* Warn if pointer differs in signedness */
> >+
> >+extern int warn_pointer_sign;
> I'm thinking you don't need this if options.h is included and c.opt is 
> done differently.

[...]  New patch will all the suggestions incorporated.  Thanks.
Survives bootstrap and I tested independently that it avoids
the thousands warnings on a linux kernel build with -Wno-pointer-sign.

If approved please check in.

-Andi

2005-01-13  Andi Kleen <ak@muc.de>
	
	PR 19090
	* c-typeck.c: (convert_for_assignment): Check warn_pointer_sign.
	* c.opts (-Wpointer-sign): Add.
	* doc/invoke.texi: (-Wpointer-sign): Add.

Index: gcc/c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.407
diff -u -u -r1.407 c-typeck.c
--- gcc/c-typeck.c	5 Jan 2005 15:22:38 -0000	1.407
+++ gcc/c-typeck.c	14 Jan 2005 06:50:14 -0000
@@ -3654,7 +3654,7 @@
 		       || target_cmp)
 		;
 	      /* If there is a mismatch, do warn.  */
-	      else
+	      else if (warn_pointer_sign)
 		WARN_FOR_ASSIGNMENT (N_("pointer targets in passing argument "
 					"%d of %qE differ in signedness"),
 				     N_("pointer targets in assignment "
Index: gcc/c.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c.opt,v
retrieving revision 1.33
diff -u -u -r1.33 c.opt
--- gcc/c.opt	28 Aug 2004 02:33:48 -0000	1.33
+++ gcc/c.opt	14 Jan 2005 06:50:14 -0000
@@ -430,6 +430,10 @@
 C ObjC C++ ObjC++
 Give strings the type \"array of char\"
 
+Wpointer-sign
+C ObjC Var(warn_pointer_sign) Init(1)
+Warn when a pointer differs in signedness in an assignment.
+
 ansi
 C ObjC C++ ObjC++
 A synonym for -std=c89.  In a future version of GCC it will become synonymous with -std=c99 instead
Index: gcc/doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.566
diff -u -u -r1.566 invoke.texi
--- gcc/doc/invoke.texi	11 Jan 2005 10:15:32 -0000	1.566
+++ gcc/doc/invoke.texi	14 Jan 2005 06:50:34 -0000
@@ -3135,6 +3135,12 @@
 complex; GCC will refuse to optimize programs when the optimization
 itself is likely to take inordinate amounts of time.
 
+@item -Wno-pointer-sign
+@opindex Wno-pointer-sign
+Don't warn for pointer argument passing or assignment with different signedness.
+Only useful in the negative form since this warning is enabled by default.
+This option is only supported for C and Objective C.
+
 @item -Werror
 @opindex Werror
 Make all warnings into errors.


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