From patchwork Tue May 10 21:30:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9063411 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4FD569F1C3 for ; Tue, 10 May 2016 21:30:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61DBD2017D for ; Tue, 10 May 2016 21:30:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C96220172 for ; Tue, 10 May 2016 21:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751622AbcEJVau (ORCPT ); Tue, 10 May 2016 17:30:50 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:64280 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752092AbcEJVat (ORCPT ); Tue, 10 May 2016 17:30:49 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0MK5c9-1b1coR1qDN-001OM4; Tue, 10 May 2016 23:30:26 +0200 From: Arnd Bergmann To: linux-kbuild@vger.kernel.org, Michal Marek Cc: Olof Johansson , Arnd Bergmann , stable@vger.kernel.org, Ingo Molnar , David Howells , Nicolas Pitre , Josh Poimboeuf , David Woodhouse , Lee Jones , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: move -Wunused-const-variable to W=1 warning level Date: Tue, 10 May 2016 23:30:01 +0200 Message-Id: <1462915821-2843456-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:7vTeZyp3bZ5SSu6ZEV77RG8lOjER0NlXlo0+K6JRB7r7oBCddfQ ppgnAc564yEC4Ot28dD8xbXtFfd9hWitzY/EznSnuH8mtq4tD2h+L+TMQMh2EQ0uB7AG0IP 4McKBwvgd6u3syw0kgO9cbhIBjg6ZRGiDVopEWEnoG5U6mXG+qSwtb8LXD94TjgvzACdSl9 AMjd0aZjUJi2Aoabm+OqQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:8kb237GsJtY=:JuQRkhX+YkBQykSW/+lIYU o6zxZ4hBunG1JGxoj1A5yfv6rRTPhhF2KfJKFGeJlrOkZMv+MZBV6oGaF0MlEqubFwdEIPmA/ ccFBYpy4LBwPhtWr4ZHAaqxyeU/walOloyK/foxOquzLC9yLPNak3fRhVz/GdTq+41OiShZis bOhvBryJalwJHdmSGWVrU5wPtQk7rauEIa0zpeqmJjclFOjG/Iw5uIXMdt7k/spWORrcg+Z7i AMzyA3FeXdrLZmuE8xAwDojFujfNugKz7YiaKfxN3otqk2+DpICsX6gGwkoU8kopCOUax9GNh vJ2BNpCBETN/WMMl4pUspg0vLocCKgr6uQpYrlXbCfVyP1ufwwE1Ki2H/TdjoHm0K/Bx+AC7n bDvIF02gf+gsbTFVB7E7ynsIJMcHV61/BABhX62/5iJ+nIJjFpc4r7sChihnpa+LSyEvUPP03 uCsRbXOIxzrJUXATlypmili16QgLINSmdPD/wha/gdXUUC6XN/mIYL1FnAClxOBLe5QCnRTdw 8cTJSVhjNQnJGf2wWdiQ9aHwzFYZ85v1clnuONlSjdbPGlq8eRnyVIAGmjOdrYY6lIdurgEOF OHrLFManEmbUz3IQM+oLStWUXkH+Mz7zKolI8Do0Stmt8UXQFlKjoqgeLcURHbG0tcW6X20uM 0DrJkW2JU2ajmKdiGogJ6nh4QzyZUK8BfYqdW5rAF+wM5qCECGhTEJYf7SbUhbu6dlFA= Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 gcc-6 started warning by default about variables that are not used anywhere and that are marked 'const', generating many false positives in an allmodconfig build, e.g.: arch/arm/mach-davinci/board-da830-evm.c:282:20: warning: 'da830_evm_emif25_pins' defined but not used [-Wunused-const-variable=] arch/arm/plat-omap/dmtimer.c:958:34: warning: 'omap_timer_match' defined but not used [-Wunused-const-variable=] drivers/bluetooth/hci_bcm.c:625:39: warning: 'acpi_bcm_default_gpios' defined but not used [-Wunused-const-variable=] drivers/char/hw_random/omap-rng.c:92:18: warning: 'reg_map_omap4' defined but not used [-Wunused-const-variable=] drivers/devfreq/exynos/exynos5_bus.c:381:32: warning: 'exynos5_busfreq_int_pm' defined but not used [-Wunused-const-variable=] drivers/dma/mv_xor.c:1139:34: warning: 'mv_xor_dt_ids' defined but not used [-Wunused-const-variable=] This is similar to the existing -Wunused-but-set-variable warning that was added in an earlier release and that we disable by default now and only enable when W=1 is set, so it makes sense to do the same here. Once we have eliminated the majority of the warnings for both, we can put them back into the default list. We probably want this in backport kernels as well, to allow building them with gcc-6 without introducing extra warnings. Signed-off-by: Arnd Bergmann Cc: stable@vger.kernel.org Acked-by: Olof Johansson --- I had originally started testing with gcc-6 a while ago and turned off this option in my build scripts because it was too noisy. I fixed all the other warnings I got and forgot about it until Olof mentioned it when he upgraded his build bot and the warnings started exploding. Makefile | 5 +++-- scripts/Makefile.extrawarn | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f7ccd8a40450..7934088c011b 100644 --- a/Makefile +++ b/Makefile @@ -708,9 +708,10 @@ 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. -# Use make W=1 to enable this warning (see scripts/Makefile.build) +# These warnings generated too much noise in a regular build. +# Use make W=1 to enable them (see scripts/Makefile.build) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif ifdef CONFIG_FRAME_POINTER diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index f9e47a70509c..53449a6ff6aa 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -24,6 +24,7 @@ warning-1 += $(call cc-option, -Wmissing-prototypes) warning-1 += -Wold-style-definition warning-1 += $(call cc-option, -Wmissing-include-dirs) warning-1 += $(call cc-option, -Wunused-but-set-variable) +warning-1 += $(call cc-option, -Wunused-const-variable) warning-1 += $(call cc-disable-warning, missing-field-initializers) warning-1 += $(call cc-disable-warning, sign-compare)