public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: behanw@converseincode.com
To: mmarek@suse.cz
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	dwmw2@infradead.org, "Behan Webster" <behanw@converseincode.com>,
	"Jan-Simon Möller" <dl9pf@gmx.de>,
	"Mark Charlebois" <charlebm@gmail.com>,
	bp@alien8.de
Subject: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
Date: Wed, 30 Jul 2014 21:16:21 -0700	[thread overview]
Message-ID: <1406780181-7973-1-git-send-email-behanw@converseincode.com> (raw)
In-Reply-To: <53D8ED5D.8070604@suse.cz>

From: Behan Webster <behanw@converseincode.com>

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 <behanw@converseincode.com>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Cc: mmarek@suse.cz
Cc: bp@alien8.de
---
 Makefile                   |  1 +
 scripts/Makefile.extrawarn | 22 ++++++++++++----------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index f6a7794..f343e17 100644
--- a/Makefile
+++ b/Makefile
@@ -668,6 +668,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.
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 6564350..b5b0751 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -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
@@ -55,6 +45,18 @@ warning-3 += -Wswitch-default
 warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
 warning-3 += $(call cc-option, -Wvla)
 
+ifeq ($(COMPILER),clang)
+ifndef $(W)
+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
+
 warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
 warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
 warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
-- 
1.9.1


  parent reply	other threads:[~2014-07-31  4:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 13:07 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang") Borislav Petkov
2014-06-16 15:29 ` PaX Team
2014-06-16 15:48   ` Jan-Simon Möller
2014-06-29 20:13     ` Borislav Petkov
2014-07-01  0:42       ` [PATCH] kbuild, LLVMLinux: only use warnings when using clang behanw
2014-07-01 10:12         ` Borislav Petkov
2014-07-30 13:04           ` Michal Marek
2014-07-30 21:39             ` Behan Webster
2014-07-31  4:16             ` behanw [this message]
2014-07-31  8:18               ` [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3 Michal Marek
2014-07-31 16:12                 ` Behan Webster
2014-07-31 20:46                   ` Michal Marek
2014-08-01  4:07                     ` Behan Webster
2014-08-01  4:08                     ` [PATCH v3] " behanw
2014-08-05 13:42                       ` Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406780181-7973-1-git-send-email-behanw@converseincode.com \
    --to=behanw@converseincode.com \
    --cc=bp@alien8.de \
    --cc=charlebm@gmail.com \
    --cc=dl9pf@gmx.de \
    --cc=dwmw2@infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox