Message ID | 201303251544.55765.arnd@arndb.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/Makefile b/Makefile index 22113a7..d8e3f36 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
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. Building v3.9-rc3 allmodconfig shows how the number of false positives is reduced: 74 x86-linux-gcc-4.7 -Os 12 x86-linux-gcc-4.7 -O2 1 x86-linux-gcc-4.7 -Os -Wno-maybe-uninitialized 8 arm-linux-gcc-4.6 -Os 8 arm-linux-gcc-4.6 -Os 50 arm-linux-gcc-4.7 -Os 8 arm-linux-gcc-4.7 -O2 0 arm-linux-gcc-4.7 -Os -Wno-maybe-uninitialized 33 arm-linux-gcc-4.8 -Os 13 arm-linux-gcc-4.8 -O2 0 arm-linux-gcc-4.8 -Os -Wno-maybe-uninitialized The 8 to 13 warnings that are now hidden compared to the -O2 output seem to all be false positives as well. The total number of all other warnings I see is (independent of optimization level) 24 x86-linux-gcc-4.7 19 arm-linux-gcc-4.6 17 arm-linux-gcc-4.7 16 arm-linux-gcc-4.8 Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html