All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
@ 2015-11-23 16:26 ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2015-11-23 16:26 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-arch, linux-kernel, linux-kbuild, linux-arm-kernel

CONFIG_PROFILE_ALL_BRANCHES confuses gcc-5.x to the degree that it prints
incorrect warnings about a lot of variables that it thinks can be used
uninitialized, e.g.:

i2c/busses/i2c-diolan-u2c.c: In function 'diolan_usb_xfer':
i2c/busses/i2c-diolan-u2c.c:391:16: warning: 'byte' may be used uninitialized in this function
iio/gyro/itg3200_core.c: In function 'itg3200_probe':
iio/gyro/itg3200_core.c:213:6: warning: 'val' may be used uninitialized in this function
leds/leds-lp55xx-common.c: In function 'lp55xx_update_bits':
leds/leds-lp55xx-common.c:350:6: warning: 'tmp' may be used uninitialized in this function
misc/bmp085.c: In function 'show_pressure':
misc/bmp085.c:363:10: warning: 'pressure' may be used uninitialized in this function
power/ds2782_battery.c: In function 'ds2786_get_capacity':
power/ds2782_battery.c:214:17: warning: 'raw' may be used uninitialized in this function

These are all false positives that either rob someone's time when trying
to figure out whether they are real, or they get people to send wrong
patches to shut up the warnings.

Nobody normally wants to run a CONFIG_PROFILE_ALL_BRANCHES kernel in
production, so disabling the whole class of warnings for this configuration
has no serious downsides either.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/Makefile b/Makefile
index 5e01a416c6e4..f8b921658f29 100644
--- a/Makefile
+++ b/Makefile
@@ -626,7 +626,11 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
-KBUILD_CFLAGS	+= -O2
+ifdef CONFIG_PROFILE_ALL_BRANCHES
+KBUILD_CFLAGS	+= -O2 $(call cc-disable-warning,maybe-uninitialized,)
+else
+KBUILD_CFLAGS   += -O2
+endif
 endif
 
 # Tell gcc to never replace conditional load with a non-conditional one


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

* [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
@ 2015-11-23 16:26 ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2015-11-23 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

CONFIG_PROFILE_ALL_BRANCHES confuses gcc-5.x to the degree that it prints
incorrect warnings about a lot of variables that it thinks can be used
uninitialized, e.g.:

i2c/busses/i2c-diolan-u2c.c: In function 'diolan_usb_xfer':
i2c/busses/i2c-diolan-u2c.c:391:16: warning: 'byte' may be used uninitialized in this function
iio/gyro/itg3200_core.c: In function 'itg3200_probe':
iio/gyro/itg3200_core.c:213:6: warning: 'val' may be used uninitialized in this function
leds/leds-lp55xx-common.c: In function 'lp55xx_update_bits':
leds/leds-lp55xx-common.c:350:6: warning: 'tmp' may be used uninitialized in this function
misc/bmp085.c: In function 'show_pressure':
misc/bmp085.c:363:10: warning: 'pressure' may be used uninitialized in this function
power/ds2782_battery.c: In function 'ds2786_get_capacity':
power/ds2782_battery.c:214:17: warning: 'raw' may be used uninitialized in this function

These are all false positives that either rob someone's time when trying
to figure out whether they are real, or they get people to send wrong
patches to shut up the warnings.

Nobody normally wants to run a CONFIG_PROFILE_ALL_BRANCHES kernel in
production, so disabling the whole class of warnings for this configuration
has no serious downsides either.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/Makefile b/Makefile
index 5e01a416c6e4..f8b921658f29 100644
--- a/Makefile
+++ b/Makefile
@@ -626,7 +626,11 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
-KBUILD_CFLAGS	+= -O2
+ifdef CONFIG_PROFILE_ALL_BRANCHES
+KBUILD_CFLAGS	+= -O2 $(call cc-disable-warning,maybe-uninitialized,)
+else
+KBUILD_CFLAGS   += -O2
+endif
 endif
 
 # Tell gcc to never replace conditional load with a non-conditional one

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

* Re: [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
  2015-11-23 16:26 ` Arnd Bergmann
@ 2015-11-24 10:20   ` Michal Marek
  -1 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-11-24 10:20 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch, linux-kernel, linux-kbuild, linux-arm-kernel

On 2015-11-23 17:26, Arnd Bergmann wrote:
> These are all false positives that either rob someone's time when trying
> to figure out whether they are real, or they get people to send wrong
> patches to shut up the warnings.
[...]
> diff --git a/Makefile b/Makefile
> index 5e01a416c6e4..f8b921658f29 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -626,7 +626,11 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>  KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
>  else
> -KBUILD_CFLAGS	+= -O2
> +ifdef CONFIG_PROFILE_ALL_BRANCHES
> +KBUILD_CFLAGS	+= -O2 $(call cc-disable-warning,maybe-uninitialized,)
> +else
> +KBUILD_CFLAGS   += -O2
> +endif

Does it only happen with -O2? Normally, we would add it outside the
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.

Michal

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

* [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
@ 2015-11-24 10:20   ` Michal Marek
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-11-24 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015-11-23 17:26, Arnd Bergmann wrote:
> These are all false positives that either rob someone's time when trying
> to figure out whether they are real, or they get people to send wrong
> patches to shut up the warnings.
[...]
> diff --git a/Makefile b/Makefile
> index 5e01a416c6e4..f8b921658f29 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -626,7 +626,11 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>  KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
>  else
> -KBUILD_CFLAGS	+= -O2
> +ifdef CONFIG_PROFILE_ALL_BRANCHES
> +KBUILD_CFLAGS	+= -O2 $(call cc-disable-warning,maybe-uninitialized,)
> +else
> +KBUILD_CFLAGS   += -O2
> +endif

Does it only happen with -O2? Normally, we would add it outside the
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.

Michal

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

* Re: [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
  2015-11-24 10:20   ` Michal Marek
  (?)
@ 2015-11-24 10:42     ` Arnd Bergmann
  -1 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2015-11-24 10:42 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-arch, linux-kernel, linux-kbuild, linux-arm-kernel

On Tuesday 24 November 2015 11:20:43 Michal Marek wrote:
> > diff --git a/Makefile b/Makefile
> > index 5e01a416c6e4..f8b921658f29 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -626,7 +626,11 @@ KBUILD_CFLAGS    += $(call cc-option,-fno-delete-null-pointer-checks,)
> >  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> >  KBUILD_CFLAGS        += -Os $(call cc-disable-warning,maybe-uninitialized,)
> >  else
> > -KBUILD_CFLAGS        += -O2
> > +ifdef CONFIG_PROFILE_ALL_BRANCHES
> > +KBUILD_CFLAGS        += -O2 $(call cc-disable-warning,maybe-uninitialized,)
> > +else
> > +KBUILD_CFLAGS   += -O2
> > +endif
> 
> Does it only happen with -O2? Normally, we would add it outside the
> ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.
> 

We already disable the warning for -Os builds based on a patch we merged
a while ago. It seems easier to add it to the block we already have.

	Arnd

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

* Re: [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
@ 2015-11-24 10:42     ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2015-11-24 10:42 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-arch, linux-kernel, linux-arm-kernel, linux-kbuild

On Tuesday 24 November 2015 11:20:43 Michal Marek wrote:
> > diff --git a/Makefile b/Makefile
> > index 5e01a416c6e4..f8b921658f29 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -626,7 +626,11 @@ KBUILD_CFLAGS    += $(call cc-option,-fno-delete-null-pointer-checks,)
> >  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> >  KBUILD_CFLAGS        += -Os $(call cc-disable-warning,maybe-uninitialized,)
> >  else
> > -KBUILD_CFLAGS        += -O2
> > +ifdef CONFIG_PROFILE_ALL_BRANCHES
> > +KBUILD_CFLAGS        += -O2 $(call cc-disable-warning,maybe-uninitialized,)
> > +else
> > +KBUILD_CFLAGS   += -O2
> > +endif
> 
> Does it only happen with -O2? Normally, we would add it outside the
> ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.
> 

We already disable the warning for -Os builds based on a patch we merged
a while ago. It seems easier to add it to the block we already have.

	Arnd

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

* [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
@ 2015-11-24 10:42     ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2015-11-24 10:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 24 November 2015 11:20:43 Michal Marek wrote:
> > diff --git a/Makefile b/Makefile
> > index 5e01a416c6e4..f8b921658f29 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -626,7 +626,11 @@ KBUILD_CFLAGS    += $(call cc-option,-fno-delete-null-pointer-checks,)
> >  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> >  KBUILD_CFLAGS        += -Os $(call cc-disable-warning,maybe-uninitialized,)
> >  else
> > -KBUILD_CFLAGS        += -O2
> > +ifdef CONFIG_PROFILE_ALL_BRANCHES
> > +KBUILD_CFLAGS        += -O2 $(call cc-disable-warning,maybe-uninitialized,)
> > +else
> > +KBUILD_CFLAGS   += -O2
> > +endif
> 
> Does it only happen with -O2? Normally, we would add it outside the
> ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.
> 

We already disable the warning for -Os builds based on a patch we merged
a while ago. It seems easier to add it to the block we already have.

	Arnd

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

* Re: [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
  2015-11-24 10:42     ` Arnd Bergmann
@ 2015-11-24 12:07       ` Michal Marek
  -1 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-11-24 12:07 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arch, linux-kernel, linux-kbuild, linux-arm-kernel

On 2015-11-24 11:42, Arnd Bergmann wrote:
> On Tuesday 24 November 2015 11:20:43 Michal Marek wrote:
>>> diff --git a/Makefile b/Makefile
>>> index 5e01a416c6e4..f8b921658f29 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -626,7 +626,11 @@ KBUILD_CFLAGS    += $(call cc-option,-fno-delete-null-pointer-checks,)
>>>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>>>  KBUILD_CFLAGS        += -Os $(call cc-disable-warning,maybe-uninitialized,)
>>>  else
>>> -KBUILD_CFLAGS        += -O2
>>> +ifdef CONFIG_PROFILE_ALL_BRANCHES
>>> +KBUILD_CFLAGS        += -O2 $(call cc-disable-warning,maybe-uninitialized,)
>>> +else
>>> +KBUILD_CFLAGS   += -O2
>>> +endif
>>
>> Does it only happen with -O2? Normally, we would add it outside the
>> ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.
>>
> 
> We already disable the warning for -Os builds based on a patch we merged
> a while ago. It seems easier to add it to the block we already have.

I'm blind, sorry.

Michal


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

* [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
@ 2015-11-24 12:07       ` Michal Marek
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-11-24 12:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 2015-11-24 11:42, Arnd Bergmann wrote:
> On Tuesday 24 November 2015 11:20:43 Michal Marek wrote:
>>> diff --git a/Makefile b/Makefile
>>> index 5e01a416c6e4..f8b921658f29 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -626,7 +626,11 @@ KBUILD_CFLAGS    += $(call cc-option,-fno-delete-null-pointer-checks,)
>>>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>>>  KBUILD_CFLAGS        += -Os $(call cc-disable-warning,maybe-uninitialized,)
>>>  else
>>> -KBUILD_CFLAGS        += -O2
>>> +ifdef CONFIG_PROFILE_ALL_BRANCHES
>>> +KBUILD_CFLAGS        += -O2 $(call cc-disable-warning,maybe-uninitialized,)
>>> +else
>>> +KBUILD_CFLAGS   += -O2
>>> +endif
>>
>> Does it only happen with -O2? Normally, we would add it outside the
>> ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE.
>>
> 
> We already disable the warning for -Os builds based on a patch we merged
> a while ago. It seems easier to add it to the block we already have.

I'm blind, sorry.

Michal

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

end of thread, other threads:[~2015-11-24 12:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 16:26 [PATCH] Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES Arnd Bergmann
2015-11-23 16:26 ` Arnd Bergmann
2015-11-24 10:20 ` Michal Marek
2015-11-24 10:20   ` Michal Marek
2015-11-24 10:42   ` Arnd Bergmann
2015-11-24 10:42     ` Arnd Bergmann
2015-11-24 10:42     ` Arnd Bergmann
2015-11-24 12:07     ` Michal Marek
2015-11-24 12:07       ` Michal Marek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.