From patchwork Thu Nov 23 09:05:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp312453vqx; Thu, 23 Nov 2023 01:06:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuey5ldXeEPhnlW8DEP5n9yOMRTgXFanyNSQQUmHfHiTmfldyJuyLFj3EoY1af7Xpz4qT6 X-Received: by 2002:a17:903:2444:b0:1ce:1892:2fa6 with SMTP id l4-20020a170903244400b001ce18922fa6mr5446985pls.0.1700730383969; Thu, 23 Nov 2023 01:06:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700730383; cv=none; d=google.com; s=arc-20160816; b=NW4b4KsFH92ES6uGs4L+FDp3cwMuMyYBBK/mdWvWctjOiTQLK3r5r8xw25zLQpEo5Q UiJEOLdUYObjzfgaLBN278rQ6iCbUG9Wbx22dLo1BQw1HRYCP+kh8q/zhaQU9wRlH2v7 MTSN/n0qWt2hOtv0p//yhnnYzN1qIFzX1+FCb0xpRVBlQn1/yRxBy20GwCaWb4QojGS8 u4tkYnViZGDRIyZz1pEBF2QnFMTWoORfhXzaIIE6gl2rP1O52dAm+Hoiyg2hkWklXJfW 72NHCL2uofd0MIdnB/LnS2Zq2yioKRZ2sQskBBL680BHCRHRANC2d73ReyPeLFTHN9jQ zQnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wyk3DTQxoSrD5g6YvTmIuc59xVESsti+gpbsmDTlk4c=; fh=z6zlbrdwEBYihHOg8AEGoiJIDU/YloHY3rJZbZfmluM=; b=EmjN+oRFkhQC6onlCHVp8ArxJaePhfHV62xlUW3Df1XopG0gJgeCMAsiGXlDcPtXyQ 3N05demSkh0ZreCBzKNEOOS06n+DHzI0pmvzzBFq7gjB+bcwQyTc5l1vRU7i0yVCYLLU he5MxBaea0ZLugQob1sT4pHnEAszj9fI3FmN1hpeaiDVGY7+IQ46SyE4MD9BxzyQynBc sbF4jM9HBLFo5HMIr9NcEocj+XC5UMVni4LkZW2ma0WrFTLc7unlDlQuNXfZtG+eqlTX zVI+NPBDFmqLbcmgPVDa5DX7aWG7EzRMuYmzOF5Ut2dh3b3jW2YfAdomsyRZXlrgHjrp Q+Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nUimwDIM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a17-20020a170902b59100b001cc2ef72ab2si736504pls.68.2023.11.23.01.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 01:06:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nUimwDIM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 09017809217B; Thu, 23 Nov 2023 01:05:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbjKWJFs (ORCPT + 99 others); Thu, 23 Nov 2023 04:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjKWJFr (ORCPT ); Thu, 23 Nov 2023 04:05:47 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACBDD101 for ; Thu, 23 Nov 2023 01:05:53 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4651AC433C8; Thu, 23 Nov 2023 09:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700730353; bh=+S0QOs7zuWZpTFZyFLS6YyVha4vuoTNTbVeQoPbXayw=; h=From:To:Cc:Subject:Date:From; b=nUimwDIM3kEWMXTLYyaNe/kIGqot2BYZsI6KSDQeNRxirqfA1rFhNYqJ7/Fmef+eU kk6/GvIJ7HWifHJcEhO/IhcUFO2+mBVDGtNDdF3OncQo2D1rqscuvZ8plDM8zGzHsb KPsLyNlk3yys5ww6DinYnQ7z7BfL3cFC7uI4avn0qt2bNt3Xj+vCbP7HW2tv2K8w6V IFhFtv/HUJZsZ05KrRkh0eyOsan/yxlmfsZ+h8I+Uizih29sD3f87bZo3FLH0kAY06 eEu9rpBFvx3SDe13u1U10KRm8YlvDKx9DgKBLcaTaQdynfq61QpVuNQ4r4DWyU3zXY Me8WYYTdxn8Gg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH] kbuild: support W=c and W=e shorthands for Kconfig Date: Thu, 23 Nov 2023 18:05:40 +0900 Message-Id: <20231123090540.485309-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 23 Nov 2023 01:05:57 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783345063307149156 X-GMAIL-MSGID: 1783345063307149156 KCONFIG_WARN_UNKNOWN_SYMBOLS=1 and KCONFIG_WERROR=1 are descriptive and suitable in scripting, but it is tedious to type them from the command line. Associate them with KBUILD_EXTRA_WARN (and the W= shorthand). Support a new letter 'c' for KBUILD_EXTRA_WARN to enable extra checks in Kconfig. You can still manage compiler warnings (W=1) and Kconfig warnings (W=c) independently. Reuse the letter 'e' to turn Kconfig warnings into errors. As usual, you can combine multiple letters in KCONFIG_EXTRA_WARN. $ KCONFIG_WARN_UNKNOWN_SYMBOLS=1 KCONFIG_WERROR=1 make defconfig can be shortened to: $ KBUILD_EXTRA_WARN=ce make defconfig or, even shorter: $ make W=ce defconfig Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor --- Makefile | 10 ++++++++++ scripts/Makefile.extrawarn | 9 --------- scripts/kconfig/Makefile | 8 ++++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f128a1a1b1a0..91947f722b77 100644 --- a/Makefile +++ b/Makefile @@ -155,6 +155,15 @@ endif export KBUILD_EXTMOD +# backward compatibility +KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) + +ifeq ("$(origin W)", "command line") + KBUILD_EXTRA_WARN := $(W) +endif + +export KBUILD_EXTRA_WARN + # Kbuild will save output files in the current working directory. # This does not need to match to the root of the kernel source tree. # @@ -1659,6 +1668,7 @@ help: @echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 3: more obscure warnings, can most likely be ignored' + @echo ' c: extra checks in the configuration stage (Kconfig)' @echo ' e: warnings are being treated as errors' @echo ' Multiple levels can be combined with W=12 or W=123' @$(if $(dtstree), \ diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 2fe6f2828d37..3f94915fab37 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -80,15 +80,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) # Warn if there is an enum types mismatch KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion) -# backward compatibility -KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) - -ifeq ("$(origin W)", "command line") - KBUILD_EXTRA_WARN := $(W) -endif - -export KBUILD_EXTRA_WARN - # # W=1 - warnings which may be relevant and do not occur too often # diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 4eee155121a8..322c061b464d 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -27,6 +27,14 @@ KCONFIG_DEFCONFIG_LIST += \ endif KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) +ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WARN_UNKNOWN_SYMBOLS=1 +endif + +ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WERROR=1 +endif + # We need this, in case the user has it in its environment unexport CONFIG_