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: 34568 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CCD8420792 for ; Thu, 31 Jul 2014 04:16:35 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf12926888pde.3 for ; Wed, 30 Jul 2014 21:16:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=SXV5ed8XHVOprYe247b13NMPuW2qZQfIZ+DNJRbRe20=; b=gaNGlNSSngT+wxKd2YXWM+R2FYhpNYkVCsT031N4IbpbSbEx7zponMU4zlzvYHtc3s +Vj/hgRvXvs91N3qTtQ0O8EwhX17F3GZi0WAB98kZtO5BAkzyaFg8AfNssabrT1JUb3D x8KZuo02py1VBDHl1gvg418vYPChsLdh/Qj6gr0w4m6ltWwE/2oM/Qp7e0MCIpyUUO1p p9o9gW1iBQ7iZpHAZL7kL9GZ/Ou/Yqm+MKhBDmQagNVIFC9oGEAVsDQOfaIT9NQ7MGTM v1Q5XC2O4XgDCu54FTw9jluumT4WfSfqfGqpHrRJVjNdzgmE3bG1B8OTvh1JmHDn/gSm 4lug== X-Gm-Message-State: ALoCoQnVNNzDldcdr02D8y22/c3TZiyTxqsiCy/FciEnKjaEOw+8B9TSqxIh1lG00AOhGr2QDt1R X-Received: by 10.66.168.197 with SMTP id zy5mr642263pab.7.1406780194882; Wed, 30 Jul 2014 21:16:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.101 with SMTP id c92ls801690qge.90.gmail; Wed, 30 Jul 2014 21:16:34 -0700 (PDT) X-Received: by 10.220.116.196 with SMTP id n4mr10195284vcq.6.1406780194758; Wed, 30 Jul 2014 21:16:34 -0700 (PDT) Received: from mail-vc0-x231.google.com (mail-vc0-x231.google.com [2607:f8b0:400c:c03::231]) by mx.google.com with ESMTPS id s2si3567870vcn.62.2014.07.30.21.16.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 21:16:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::231 as permitted sender) client-ip=2607:f8b0:400c:c03::231; Received: by mail-vc0-f177.google.com with SMTP id hy4so3320996vcb.22 for ; Wed, 30 Jul 2014 21:16:34 -0700 (PDT) X-Received: by 10.220.131.207 with SMTP id y15mr6865588vcs.71.1406780194518; Wed, 30 Jul 2014 21:16:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp76372vcb; Wed, 30 Jul 2014 21:16:33 -0700 (PDT) X-Received: by 10.68.65.101 with SMTP id w5mr1424710pbs.5.1406780192916; Wed, 30 Jul 2014 21:16:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gz4si4428499pac.233.2014.07.30.21.16.32 for ; Wed, 30 Jul 2014 21:16:32 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751599AbaGaEQb (ORCPT + 23 others); Thu, 31 Jul 2014 00:16:31 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:43673 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751043AbaGaEQ3 (ORCPT ); Thu, 31 Jul 2014 00:16:29 -0400 Received: by mail-pa0-f45.google.com with SMTP id eu11so2812718pac.4 for ; Wed, 30 Jul 2014 21:16:28 -0700 (PDT) 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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::231 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)))