Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6889560rwb; Mon, 5 Dec 2022 20:28:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+0J554aRk7Hw5bvScY/Uk0XNf+4PqFicDQG8Nh3KYSVeAmTX7GyZiJpEyEso4xP+AVHfm X-Received: by 2002:a17:90a:8402:b0:218:7744:5e9 with SMTP id j2-20020a17090a840200b00218774405e9mr94456626pjn.44.1670300933610; Mon, 05 Dec 2022 20:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670300933; cv=none; d=google.com; s=arc-20160816; b=fzzA+uciBBcf2M3iPbmXki8OsJdq52Rjk0XrOudlaGjxgJbuQn6Y/lPPHHLZdk9kYl iCjH9tohCsmYBasyUFa/LbusSra1VTIqDDzibxUXlebQhvmWire5U4mADd2EO8ByrS3F 1kZVLHwjx2GCLhxOOY9W2bsXGeeO364+7dO+8y3TCeosbLpyEgzeOMvke/R+dxCP0xic oayFtjmP0qIrM0lY/OxH3hHpvPGGTUF0xcYcvrbJmWy4vNmlRiWq0gs0tE/t7L4F5nbE 1SfBgS8qz0KZsnKP724mWqdNlO7inlZN/asbtM+CXXAF8CDYjEcrSjmXtoNpiu83r8IC 8tcw== 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=G8MciaSDVisVg/UgNCoTkeshC0v7sTsEAPQMcwWFeCw=; b=uD9reEsxQnmqDh/AGlZumc/xpLn9PJBJT5ahB9LUltbKq0D2F6RKmQ9OCFLWcU9ZNp 9TH6VGClnwsxFgG6JBFlIYS6wIycFqM/DuhA5eCsQ5c5vPlk9oGTP4bah3goEbV7foSQ 9PWoybwRHSDAMg+i9JTq1b/n2Yn9vUAyQF12VozBwkD283xxsZXErZxBaVPLLyxb2qaU mbenpqRkT32DL+2DH78B6d05sjHHuNDBCBWNV40Gx2+nOsfEXtia6jW4+49WkLRhxmll XoctePwr+Ef/fqzPG7MLVCUm4JNYY+L2JxcKJiKsPNk3Q39iF47GJP2fSxcxwTo1fvKA ODXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gTgkS23L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a630415000000b0047060a55c40si3511149pge.712.2022.12.05.20.28.42; Mon, 05 Dec 2022 20:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gTgkS23L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbiLFEHs (ORCPT + 79 others); Mon, 5 Dec 2022 23:07:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbiLFEHm (ORCPT ); Mon, 5 Dec 2022 23:07:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEAE825F0; Mon, 5 Dec 2022 20:07:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6206E6154E; Tue, 6 Dec 2022 04:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 849F2C433C1; Tue, 6 Dec 2022 04:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670299658; bh=xMuxZCae0szPGAJBhjSo4T2NR8ZPREZDgVVh/yx9ZQY=; h=From:To:Cc:Subject:Date:From; b=gTgkS23LO53e9ZXwSI8myw+UnXHo138gf3ao7r8gpyPpDn8KGHtIIatSMjBU6SFM1 wcnf8nk53H9p19I3XY/w6KCoeLakXRgXvo5BYzLcRoI+nhJpTUuH/hHOhmo8YVJacu FO9olYX74DbjsL2XuY+Rd0OAOPH7W0wUWx+ZcO1gUiYO8/MDeFufTyLpYBijHiuaTr H2MLBc4wwSqrVI7PPgiyMeEXCRZJCxkolFhhgiv/eSHzatxtva7gDwHX1vH1jFBlXg YMogoNE3RK19Pdl+rIJbgHeGxPmzYvb045iOqE8lvuo5O+9k+bZHQMfWY8buHsQOUR SswN4twsvD0Ew== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nick Desaulniers , Nathan Chancellor , Nicolas Schier Subject: [PATCH 1/2] kbuild: move -Werror from KBUILD_CFLAGS to KBUILD_CPPFLAGS Date: Tue, 6 Dec 2022 13:07:30 +0900 Message-Id: <20221206040731.442499-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CONFIG_WERROR turns warnings into errors, which happens only for *.c files because -Werror is added to KBUILD_CFLAGS. Adding it to KBUILD_CPPFLAGS makes more sense because preprocessors understand the -Werror option. For example, you can put a #warning directive in any preprocessed code. warning: #warning "this is a warning message" [-Wcpp] If -Werror is added, it is promoted to an error. error: #warning "this is a warning message" [-Werror=cpp] This commit moves -Werror to KBUILD_CPPFLAGS so it works in the same way for *.c, *.S, *.lds.S or whatever needs preprocessing. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 53fa1a9fba8a..f84b57910667 100644 --- a/Makefile +++ b/Makefile @@ -869,7 +869,8 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong KBUILD_CFLAGS += $(stackp-flags-y) -KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings -- 2.34.1