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 17, 2005 at 12:30:38PM +0000, Joseph S. Myers wrote:
> On Sun, 17 Jan 2005, Andi Kleen wrote:
> 
> > On Sun, Jan 16, 2005 at 10:35:10PM +0000, Joseph S. Myers wrote:
> > > On Fri, 14 Jan 2005, Andi Kleen wrote:
> > > 
> > > > --- gcc/doc/invoke.texi	11 Jan 2005 10:15:32 -0000	1.566
> > > > +++ gcc/doc/invoke.texi	14 Jan 2005 06:50:34 -0000
> > > 
> > > You need to update the summary table of C warning options as well as 
> > > documenting this individual option below.
> > 
> > Can you approve the patch when I do this change? 
> 
> Only with testcase.  A testcase is required so that, for example, if the 

Well you could say that the test case already exists, since the
warning is enabled by default and there is a test case for the warning.

Also from a quick look at the dejagnu docs there is "do-no-warning"
command to test that nothing happens, so I don't see how I should add one, 
sorry.  (i'm not suggesting such a command should be added) 

-Andi

Here's the patch with the documentation fix you requested.
Please commit if ok.

2005-01-13  Andi Kleen <ak@muc.de>
		
	* 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	17 Jan 2005 15:01:30 -0000
@@ -242,7 +242,7 @@
 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
 -Wstrict-prototypes  -Wtraditional @gol
--Wdeclaration-after-statement}
+-Wdeclaration-after-statement -Wno-pointer-sign}
 
 @item Debugging Options
 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
@@ -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]