Re: linux-next: build warning after merge of the char-misc tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 1, 2013 at 6:16 PM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> On Friday 01 March 2013, Sedat Dilek wrote:
>> I have seen a lot of such failures when using the Freetz (a small
>> router project) build-system with gcc-4.7-x where "-Os" is default
>> optimization-level.
>>
>> Last, when I tried to integrate ltrace GIT snapshots into Freetz.
>> All these "build-errors" could be solved in changing ltrace code.
>> So, I would not talk about "false positives".
>
> But the point is that we should not be changing the source code to
> unnecessary initializations, because that may hide real bugs if the
> code is modified in a way that relies on a sane value of some
> variable. They are false positives if the code is actually correct
> and does not need to be changed.
>
> I actually have a newer version of my patch (see below) that uses
> the cc-disable-warning macro in order to avoid some of the
> side-effects of setting an unknown option on older gcc versions.
>
>> Furthermore, "-Wno-maybe-uninitialized" gcc-option is available
>> gcc-4-7+, so your patch is incomplete.
>
> O don't understand. The patch avoids the warnings when building
> with gcc-4.7 or higher with -Os.
>

If the ...$(call cc-disable-warning...) line is checking $compiler for
$feature_is-available than I have misunderstood it.

Looks good, thanks.

- Sedat -

>         Arnd
>
>
> From d313219a2f2e0753b8e96105b7a944e1c22566ae Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <arnd@xxxxxxxx>
> Date: Fri, 15 Feb 2013 21:23:58 +0100
> Subject: [PATCH] Turn off -Wmaybe-uninitialized when building with -Os
>
> gcc-4.7 and higher add a lot of false positive warnings about
> potential uses of uninitialized warnings, but only when optimizing
> for size (-Os). This is the default when building allyesconfig,
> which turns on CONFIG_CC_OPTIMIZE_FOR_SIZE.
>
> In order to avoid getting a lot of patches that initialize such
> variables and accidentally hide real errors along the way, let's
> just turn off this warning on the respective gcc versions
> when building with size optimizations. The -Wmaybe-uninitialized
> option was introduced in the same gcc version (4.7) that is now
> causing the false positives, so there is no effect on older compilers.
>
> A side effect is that when building with CONFIG_CC_OPTIMIZE_FOR_SIZE,
> we might now see /fewer/ warnings about possibly uninitialized
> warnings than with -O2, but that is still much better than seeing
> warnings known to be bogus.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> diff --git a/Makefile b/Makefile
> index 473beb1..f0ec9bc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -570,7 +570,7 @@ endif # $(dot-config)
>  all: vmlinux
>
>  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> -KBUILD_CFLAGS  += -Os
> +KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
>  else
>  KBUILD_CFLAGS  += -O2
>  endif
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux