Received: by 10.223.176.5 with SMTP id f5csp1253941wra; Tue, 6 Feb 2018 15:47:55 -0800 (PST) X-Google-Smtp-Source: AH8x224nFcEZSRKAuzV5DYiTIwCw9RESbOSrhuNsSQpkzfBlOlAlcGEfkTbGy68FPsuv+BgXaH8H X-Received: by 2002:a17:902:5303:: with SMTP id b3-v6mr3892623pli.133.1517960875777; Tue, 06 Feb 2018 15:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517960875; cv=none; d=google.com; s=arc-20160816; b=a5KOLcGh5BwqOdLAv3ta8OrxwgGco0WYoBP897CT7NLL0P8bv8f4RvpXdlv2o4jlO5 M9WXpElrECwGUmmJ43NSL3OWg6PRwkYpTIc/X0G9AcN6uDEsDa35js4OQpZIqj4v6/DR GI4/jGl+EpT3ocgTxpADjBO5LzOef2l+MWXZA6l1WWJPawiSXsWC+gcq4fYGzZmQJ6ZV 4mIF+tauDhp+cAOidDppGcPnVpf7AO9h3MUXqVFGbhIztxrEszVxr1Jst4OvfUpHVg8G hDRE98EuEwb3f2jnNaA1wf2CqWYUe6wLw9w940OjVOfUi/iwrDHtkrZXlVMXYis6/6Wr P2EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=XMNunb7/1Ijgi+WvxGFi/Uxol24HCHtQ6uH4s+Vxmeo=; b=jQGx0WGmTYwKsc0qtVgLmDvNsiya1tRESBovicYS9NLs3q05JS+TdzNDbmbiPXwadQ 9UGlvUymVIBtIGot3jUArGsRcaC2aUEqFtp5Lp/aJXEhY+4/fm6qHCAizL9iwt8rB+pu Eqyme5ZP7Ea75uWslHhvZmx6dWdP67NesnREPSvIUbigWxJhY8/E4J7ACdCe4xbkmtBx UKzlTmVvh08MviSCdEgmi2RpUsE+fx7EYSFXSbcNcNyplU6oT+5FUWsDJ+5SJ+XYI/N3 /aJaYijWxlXjylCzgHN51MF/Hc3Zs7F290HEBwe4pmQXc2INRHqxrEPimZBDGlQ9qfgJ u6tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TnN+coOH; dkim=pass header.i=@codeaurora.org header.s=default header.b=TnN+coOH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si98480pgo.780.2018.02.06.15.47.39; Tue, 06 Feb 2018 15:47:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TnN+coOH; dkim=pass header.i=@codeaurora.org header.s=default header.b=TnN+coOH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754198AbeBFXrD (ORCPT + 99 others); Tue, 6 Feb 2018 18:47:03 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:57552 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753346AbeBFXrA (ORCPT ); Tue, 6 Feb 2018 18:47:00 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B90C7609D1; Tue, 6 Feb 2018 23:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517960819; bh=KrkGPnGmaKsvBhqR/233+laN0a3ejRM2jAdtbaxlD38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TnN+coOHBqgs5aLPIPY+e0rz5cSwHKWPw7H5YV3+u1LX6C59WU6xULjbc9yGmaf+g C4GWWNcLVPlHiKWJ+TFWPYb7quMTqiyxQrCi5HEQvWiRCaSrwrP6PcviCrk6VhUYBf 1AgHg4OyPlryzL0txuj6DjDZ8lTMu19rkFQfSeLo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from psodagud-linux1.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: psodagud@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BC1ED60209; Tue, 6 Feb 2018 23:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517960819; bh=KrkGPnGmaKsvBhqR/233+laN0a3ejRM2jAdtbaxlD38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TnN+coOHBqgs5aLPIPY+e0rz5cSwHKWPw7H5YV3+u1LX6C59WU6xULjbc9yGmaf+g C4GWWNcLVPlHiKWJ+TFWPYb7quMTqiyxQrCi5HEQvWiRCaSrwrP6PcviCrk6VhUYBf 1AgHg4OyPlryzL0txuj6DjDZ8lTMu19rkFQfSeLo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BC1ED60209 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=psodagud@codeaurora.org From: Prasad Sodagudi To: yamada.masahiro@socionext.com Cc: gregkh@linuxfoundation.org, segher@kernel.crashing.org, ghackmann@google.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Prasad Sodagudi Subject: [PATCH] kbuild: clang: disable unused variable warnings only when constant Date: Tue, 6 Feb 2018 15:46:51 -0800 Message-Id: <1517960811-21674-1-git-send-email-psodagud@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, GCC disables -Wunused-const-variable, but not -Wunused-variable, so warns unused variables if they are non-constant. While, Clang does not warn unused variables at all regardless of the const qualifier because -Wno-unused-const-variable is implied by the stronger option -Wno-unused-variable. Disable -Wunused-const-variable instead of -Wunused-variable so that GCC and Clang work in the same way. Signed-off-by: Prasad Sodagudi Reviewed-by: Masahiro Yamada --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 11aff0f..ca0a571 100644 --- a/Makefile +++ b/Makefile @@ -700,7 +700,6 @@ KBUILD_CFLAGS += $(stackp-flag) ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) @@ -718,9 +717,9 @@ else # These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project