Makefile.extrawarn: move -Wcast-align to W=3
This warning behaves differently depending on the architecture and compiler. Using x86 gcc, we get no output at all because gcc knows the architecture can handle unaligned accesses. Using x86 clang, or gcc on an architecture that needs to manually deal with unaligned accesses, the build log is completely flooded with these warnings, as they are commonly invoked by inline functions of networking headers, e.g. include/linux/skbuff.h:1426:26: warning: cast increases required alignment of target type [-Wcast-align] The compiler is correct to point this out, as we are dealing with undefined behavior that does cause problems in practice, but there is also no good way to rewrite the code in commonly included headers to a safer method. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
418baf2c28
commit
095fbca0a9
|
@ -60,7 +60,6 @@ endif
|
||||||
#
|
#
|
||||||
ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
|
ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
|
||||||
|
|
||||||
KBUILD_CFLAGS += -Wcast-align
|
|
||||||
KBUILD_CFLAGS += -Wdisabled-optimization
|
KBUILD_CFLAGS += -Wdisabled-optimization
|
||||||
KBUILD_CFLAGS += -Wnested-externs
|
KBUILD_CFLAGS += -Wnested-externs
|
||||||
KBUILD_CFLAGS += -Wshadow
|
KBUILD_CFLAGS += -Wshadow
|
||||||
|
@ -80,6 +79,7 @@ endif
|
||||||
ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
|
ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
|
||||||
|
|
||||||
KBUILD_CFLAGS += -Wbad-function-cast
|
KBUILD_CFLAGS += -Wbad-function-cast
|
||||||
|
KBUILD_CFLAGS += -Wcast-align
|
||||||
KBUILD_CFLAGS += -Wcast-qual
|
KBUILD_CFLAGS += -Wcast-qual
|
||||||
KBUILD_CFLAGS += -Wconversion
|
KBUILD_CFLAGS += -Wconversion
|
||||||
KBUILD_CFLAGS += -Wpacked
|
KBUILD_CFLAGS += -Wpacked
|
||||||
|
|
Loading…
Reference in New Issue