From patchwork Thu Jul 31 04:16:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 4653251 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B7DBFC0338 for ; Thu, 31 Jul 2014 04:16:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4E6720149 for ; Thu, 31 Jul 2014 04:16:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D859320120 for ; Thu, 31 Jul 2014 04:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751181AbaGaEQa (ORCPT ); Thu, 31 Jul 2014 00:16:30 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:42845 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750783AbaGaEQ3 (ORCPT ); Thu, 31 Jul 2014 00:16:29 -0400 Received: by mail-pa0-f46.google.com with SMTP id lj1so2807238pab.33 for ; Wed, 30 Jul 2014 21:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=converseincode.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=cviBE9+5wAowAVv3n6kE5h0IJW1LP2y8+Sk+XKPnJ2I=; b=nvi7yo8mHwj+fzsK/MP/Z8ojuqU7RceROj2RncpnGf5CxrtCS7D8z8EE7Pf2zpyVZe WIa80j07yUNKlG8bkg1fLbOUA/15K16Zcv4twwhrujxdQw660fK1E8yXbTHIzph0lynp PbWxaUtxnJ/98GrLo5GFrYZCvYl4svrjtQ+Dw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=cviBE9+5wAowAVv3n6kE5h0IJW1LP2y8+Sk+XKPnJ2I=; b=lR5LyZKHb2l5upBQ7Dn5TsbKkkcbRgrEjJgF2Y/569crINOlCh/o9j5Qoog9O2xUub YuXn3V6lG9w8WekQriTq56A25olcB8iwHZnl7ypn2o4FJnOyk6BnkhbJhDINDVPckO+z ooeNbr7yCcV07REBu2tiyCcr2zKsOZzzMLwLMtVatunAJ1SMOlolnAy7jrvyy0q8jkPC O+pqdJuhT0YBuZLjxu5xyZ/8BYq51zp4XueQWslxYkGf+3wSCwBfhRDHn4eFEfCpiukY OfK3mnjq/NGcATxpmlEtPGwYIq4mBb9Od4O1vqC1Wok2kBKRjxNthY3xTfBxkQW/PdG/ Me3w== X-Gm-Message-State: ALoCoQlmyN11fJEzCfjGfH9/tTfswWZOFoE7ZcF1YvEjmfZ4sTUSigv1GWU9Bqnf/JAys1sKd69U X-Received: by 10.70.136.194 with SMTP id qc2mr9338842pdb.109.1406780188820; Wed, 30 Jul 2014 21:16:28 -0700 (PDT) Received: from galdor.websterwood.com (S0106dc9fdb80cffd.gv.shawcable.net. [96.50.97.138]) by mx.google.com with ESMTPSA id jr5sm3945989pbc.75.2014.07.30.21.16.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Jul 2014 21:16:27 -0700 (PDT) From: behanw@converseincode.com To: mmarek@suse.cz Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org, Behan Webster , =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= , Mark Charlebois , bp@alien8.de Subject: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3 Date: Wed, 30 Jul 2014 21:16:21 -0700 Message-Id: <1406780181-7973-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <53D8ED5D.8070604@suse.cz> References: <53D8ED5D.8070604@suse.cz> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Behan Webster 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 Signed-off-by: Jan-Simon Möller Signed-off-by: Mark Charlebois 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)))