Skip to content

Commit 095fbca

Browse files
arndbmasahir0y
authored andcommitted
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>
1 parent 418baf2 commit 095fbca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/Makefile.extrawarn

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ endif
6060
#
6161
ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
6262

63-
KBUILD_CFLAGS += -Wcast-align
6463
KBUILD_CFLAGS += -Wdisabled-optimization
6564
KBUILD_CFLAGS += -Wnested-externs
6665
KBUILD_CFLAGS += -Wshadow
@@ -80,6 +79,7 @@ endif
8079
ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
8180

8281
KBUILD_CFLAGS += -Wbad-function-cast
82+
KBUILD_CFLAGS += -Wcast-align
8383
KBUILD_CFLAGS += -Wcast-qual
8484
KBUILD_CFLAGS += -Wconversion
8585
KBUILD_CFLAGS += -Wpacked

0 commit comments

Comments
 (0)