public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
@ 2005-06-19  1:50 Keith Owens
  2005-06-20  2:02 ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Owens @ 2005-06-19  1:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: sam

Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
to suppress them.

Signed-off-by: Keith Owens <kaos@ocs.com.au>

Index: 2.6.12/Makefile
===================================================================
--- 2.6.12.orig/Makefile	2005-06-18 15:21:18.000000000 +1000
+++ 2.6.12/Makefile	2005-06-19 11:43:15.876218980 +1000
@@ -204,6 +204,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH"
 HOSTCC  	= gcc
 HOSTCXX  	= g++
 HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+# disable pointer signedness warnings in gcc 4.0
+HOSTCFLAGS += $(call cc-option,-Wno-pointer-sign,)
 HOSTCXXFLAGS	= -O2
 
 # 	Decide whether to build built-in, modular, or both.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
@ 2005-06-19  9:23 Mikael Pettersson
  2005-06-19  9:58 ` Russell King
  2005-06-19 10:32 ` Keith Owens
  0 siblings, 2 replies; 7+ messages in thread
From: Mikael Pettersson @ 2005-06-19  9:23 UTC (permalink / raw)
  To: kaos, linux-kernel; +Cc: sam

On Sun, 19 Jun 2005 11:50:03 +1000, Keith Owens wrote:
>Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
>programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
>to suppress them.
>
>Signed-off-by: Keith Owens <kaos@ocs.com.au>
>
>Index: 2.6.12/Makefile
>===================================================================
>--- 2.6.12.orig/Makefile	2005-06-18 15:21:18.000000000 +1000
>+++ 2.6.12/Makefile	2005-06-19 11:43:15.876218980 +1000
>@@ -204,6 +204,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH"
> HOSTCC  	= gcc
> HOSTCXX  	= g++
> HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>+# disable pointer signedness warnings in gcc 4.0
>+HOSTCFLAGS += $(call cc-option,-Wno-pointer-sign,)
> HOSTCXXFLAGS	= -O2

Please don't. Bogus code should be fixed, not hidden.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
  2005-06-19  9:23 Mikael Pettersson
@ 2005-06-19  9:58 ` Russell King
  2005-06-19 10:32 ` Keith Owens
  1 sibling, 0 replies; 7+ messages in thread
From: Russell King @ 2005-06-19  9:58 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: kaos, linux-kernel, sam

On Sun, Jun 19, 2005 at 11:23:37AM +0200, Mikael Pettersson wrote:
> On Sun, 19 Jun 2005 11:50:03 +1000, Keith Owens wrote:
> >Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
> >programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
> >to suppress them.
> >
> >Signed-off-by: Keith Owens <kaos@ocs.com.au>
> >
> >Index: 2.6.12/Makefile
> >===================================================================
> >--- 2.6.12.orig/Makefile	2005-06-18 15:21:18.000000000 +1000
> >+++ 2.6.12/Makefile	2005-06-19 11:43:15.876218980 +1000
> >@@ -204,6 +204,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH"
> > HOSTCC  	= gcc
> > HOSTCXX  	= g++
> > HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
> >+# disable pointer signedness warnings in gcc 4.0
> >+HOSTCFLAGS += $(call cc-option,-Wno-pointer-sign,)
> > HOSTCXXFLAGS	= -O2
> 
> Please don't. Bogus code should be fixed, not hidden.

cc-option checks to see if the flag is supported by $(CC) which could
be a completely different compiler from $(HOSTCC).  Hence the above
can incorrectly supply/fail to supply the argument.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
  2005-06-19  9:23 Mikael Pettersson
  2005-06-19  9:58 ` Russell King
@ 2005-06-19 10:32 ` Keith Owens
  2005-07-03 19:22   ` Sam Ravnborg
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Owens @ 2005-06-19 10:32 UTC (permalink / raw)
  To: Mikael Pettersson, Russell King; +Cc: linux-kernel, sam

On Sun, 19 Jun 2005 11:23:37 +0200 (MEST), 
Mikael Pettersson <mikpe@csd.uu.se> wrote:
>On Sun, 19 Jun 2005 11:50:03 +1000, Keith Owens wrote:
>>Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
>>programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
>>to suppress them.
>>
>>Signed-off-by: Keith Owens <kaos@ocs.com.au>
>>
>>Index: 2.6.12/Makefile
>>===================================================================
>>--- 2.6.12.orig/Makefile	2005-06-18 15:21:18.000000000 +1000
>>+++ 2.6.12/Makefile	2005-06-19 11:43:15.876218980 +1000
>>@@ -204,6 +204,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH"
>> HOSTCC  	= gcc
>> HOSTCXX  	= g++
>> HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>>+# disable pointer signedness warnings in gcc 4.0
>>+HOSTCFLAGS += $(call cc-option,-Wno-pointer-sign,)
>> HOSTCXXFLAGS	= -O2
>
>Please don't. Bogus code should be fixed, not hidden.

The entire kernel, except the scripts directory, is already being
compiled with -Wno-pointer-sign, and has done since 2.6.12-rc1.  This
patch makes scripts consistent with the rest of the kernel.  The
-Wno-pointer-sign option was added to gcc 4 just for this problem.

If you feel that the code is bogus then turn off the option in your own
tree.  Be prepared for thousands of lines of warnings.

On Sun, 19 Jun 2005 10:58:33 +0100, 
Russell King <rmk+lkml@arm.linux.org.uk> wrote:

>cc-option checks to see if the flag is supported by $(CC) which could
>be a completely different compiler from $(HOSTCC).  Hence the above
>can incorrectly supply/fail to supply the argument.

Good point.  New patch.


Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
to suppress them.  HOSTCFLAGS change from '=' to ':=' to avoid
recursion problems.

Signed-off-by: Keith Owens <kaos@ocs.com.au>

Index: 2.6.12/Makefile
===================================================================
--- 2.6.12.orig/Makefile	2005-06-19 20:28:20.504999656 +1000
+++ 2.6.12/Makefile	2005-06-19 20:30:14.157877993 +1000
@@ -203,7 +203,11 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH"
 
 HOSTCC  	= gcc
 HOSTCXX  	= g++
-HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS	:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+# disable pointer signedness warnings in gcc 4.0
+hostcc-option = $(shell if $(HOSTCC) $(HOSTCFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+HOSTCFLAGS	+= $(call hostcc-option,-Wno-pointer-sign,)
 HOSTCXXFLAGS	= -O2
 
 # 	Decide whether to build built-in, modular, or both.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
  2005-06-19  1:50 [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS Keith Owens
@ 2005-06-20  2:02 ` Jeff Garzik
  2005-07-03 19:26   ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2005-06-20  2:02 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel, sam, Andrew Morton

Keith Owens wrote:
> Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
> programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
> to suppress them.
> 
> Signed-off-by: Keith Owens <kaos@ocs.com.au>


Although I am a bit nervous about papering over these warnings without 
addressing them...  I still ACK the patch, because gcc4 on FC4 does 
indeed spew a bunch of noise.

Have you (or anyone) looked into the "root cause" of these warnings?

	Jeff



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
  2005-06-19 10:32 ` Keith Owens
@ 2005-07-03 19:22   ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2005-07-03 19:22 UTC (permalink / raw)
  To: Keith Owens; +Cc: Mikael Pettersson, Russell King, linux-kernel

> 
> >cc-option checks to see if the flag is supported by $(CC) which could
> >be a completely different compiler from $(HOSTCC).  Hence the above
> >can incorrectly supply/fail to supply the argument.
> 
> Good point.  New patch.

I am having this patch queued:

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/04/03 22:26:47+02:00 sam@mars.ravnborg.org 
#   kbuild: Use -Wno-pointer-sign when building for host
#   
#   Avoid lot's of useless warning when building host utilities.
#   A brave sould may take a look sometime - but not all warnings are correct.
#   
#   From: Pawel Sikora <pluto@pld-linux.org>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# Makefile
#   2005/04/03 22:26:24+02:00 sam@mars.ravnborg.org +12 -4
#   -Wno-pointer-sign for gcc 4.xx when compiling host programs
# 
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2005-04-30 00:35:17 +02:00
+++ b/Makefile	2005-04-30 00:35:17 +02:00
@@ -201,10 +201,10 @@
 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
 	  else echo sh; fi ; fi)
 
-HOSTCC  	= gcc
-HOSTCXX  	= g++
-HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCXXFLAGS	= -O2
+HOSTCC  	:= gcc
+HOSTCXX  	:= g++
+HOSTCFLAGS	:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCXXFLAGS	:= -O2
 
 # 	Decide whether to build built-in, modular, or both.
 #	Normally, just do built-in.
@@ -538,6 +538,14 @@
 
 # disable pointer signedness warnings in gcc 4.0
 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
+
+HOSTCFLAGS += $(shell if $(HOSTCC) $(HOSTCFLAGS) -Wno-pointer-sign -S \
+              -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
+               echo "-Wno-pointer-sign"; fi ;)
+
+HOSTCXXFLAGS += $(shell if $(HOSTCXX) $(HOSTCXXFLAGS) -Wno-pointer-sign -S \
+              -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
+               echo "-Wno-pointer-sign"; fi ;)
 
 # Default kernel image to build when no specific target is given.
 # KBUILD_IMAGE may be overruled on the commandline or

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS
  2005-06-20  2:02 ` Jeff Garzik
@ 2005-07-03 19:26   ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2005-07-03 19:26 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Keith Owens, linux-kernel, Andrew Morton

On Sun, Jun 19, 2005 at 10:02:41PM -0400, Jeff Garzik wrote:
> Keith Owens wrote:
> >Compiling 2.6.12 with gcc 4.0.0 (FC4) gets lots of warnings for the
> >programs in the scripts directory.  Add -Wno-pointer-sign to HOSTCFLAGS
> >to suppress them.
> >
> >Signed-off-by: Keith Owens <kaos@ocs.com.au>
> 
> 
> Although I am a bit nervous about papering over these warnings without 
> addressing them...  I still ACK the patch, because gcc4 on FC4 does 
> indeed spew a bunch of noise.
> 
> Have you (or anyone) looked into the "root cause" of these warnings?
I've receive a few pathes to scripts/ fixing this.
They almost all just used casts to hide the warning but some included
real fixes. They are all lost for now though.

	Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-03 19:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-19  1:50 [patch 2.6.12] Add -Wno-pointer-sign to HOSTCFLAGS Keith Owens
2005-06-20  2:02 ` Jeff Garzik
2005-07-03 19:26   ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2005-06-19  9:23 Mikael Pettersson
2005-06-19  9:58 ` Russell King
2005-06-19 10:32 ` Keith Owens
2005-07-03 19:22   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox