Skip to content

Commit

Permalink
kbuild, LLVMLinux: Supress warnings unless W=1-3
Browse files Browse the repository at this point in the history
clang has more warnings enabled by default. Turn them off unless W is
set. This patch fixes a logic bug where warnings in clang were disabled
when W was set.

Signed-off-by: Behan Webster <[email protected]>
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Mark Charlebois <[email protected]>
Cc: [email protected]
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
behanw authored and michal42 committed Aug 5, 2014
1 parent bfaf2dd commit 26ea6bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
# See modpost pattern 2
KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
else

# This warning generated too much noise in a regular build.
Expand Down
21 changes: 11 additions & 10 deletions scripts/Makefile.extrawarn
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs)
warning-1 += $(call cc-option, -Wunused-but-set-variable)
warning-1 += $(call cc-disable-warning, missing-field-initializers)

# Clang
warning-1 += $(call cc-disable-warning, initializer-overrides)
warning-1 += $(call cc-disable-warning, unused-value)
warning-1 += $(call cc-disable-warning, format)
warning-1 += $(call cc-disable-warning, unknown-warning-option)
warning-1 += $(call cc-disable-warning, sign-compare)
warning-1 += $(call cc-disable-warning, format-zero-length)
warning-1 += $(call cc-disable-warning, uninitialized)
warning-1 += $(call cc-option, -fcatch-undefined-behavior)

warning-2 := -Waggregate-return
warning-2 += -Wcast-align
warning-2 += -Wdisabled-optimization
Expand Down Expand Up @@ -64,4 +54,15 @@ ifeq ("$(strip $(warning))","")
endif

KBUILD_CFLAGS += $(warning)
else

ifeq ($(COMPILER),clang)
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
KBUILD_CFLAGS += $(call cc-disable-warning, format)
KBUILD_CFLAGS += $(call cc-disable-warning, unknown-warning-option)
KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
endif
endif

0 comments on commit 26ea6bb

Please sign in to comment.