From patchwork Thu Apr 4 15:16:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13617999 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F226745C4; Thu, 4 Apr 2024 15:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243858; cv=none; b=LR6mrTzFgvrYWfbBD4cxWwsOt9Btn0g3LXMwsXbCVefakk8AG+q8+UsLJITMRxQN0Wqv/lwAzpCsD6+EjXppEFncHzg4FI02yjxQVq/SyTsK42/zLmcwWt/yRtdXiJXyJALs7mZb2K/cFz3JjhGrOJXqgxvJ28TIm132pGuPHB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243858; c=relaxed/simple; bh=XGdU46c4ZSunIoursaUt7noQnOr0Myyw+lOAyQpQkBw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=emu+zrMWTCRxbA+WL9Pa3nMNtteQ8H4ymCSb85XjHXhqQXKGAJkSjqkR+67QKRR4ipCocyPDbVLH8j732HVCTkYEageSkzq+8/tUCY0GXKoOF42wN5NnNbk0ladzabR8pcGvEkL2Cs+hXST+/BC/4LWZei9+UPY4E6vohxY0gso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=glTE2pBD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="glTE2pBD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23849C433A6; Thu, 4 Apr 2024 15:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712243857; bh=XGdU46c4ZSunIoursaUt7noQnOr0Myyw+lOAyQpQkBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glTE2pBDWJNtz53CPi1jC2NHOgh8UlSZgRMfWuGk0vRqwwkGG79q8k6iVjEyQ8dzd IJvpOZgBuLJqdJVQVW4N9AKqr1VcLum1pqUVjgTtHE3u59vRvdP0aZdKI1CHS2tFxx nmRQ7ZTPF1GqvgkdJmWINqgCB4LYKOI+3hfEtJ3fix0kQ6slqhEP3tSL0PivG6wL3T fDwc2zZF11RPwP5MpAXJ9IyQv3IrfTw6BOuVrpxQhfNry7muujtpft26SxO6QyWivT hXpY5NL8Co/mP45AOOEV4HxqVMkaNzb7OpMLF+nxgyD8VAzpxd/3bJnM1kfMs1bNUf n98N9rqGTgKtQ== From: Arnd Bergmann To: Masahiro Yamada Cc: Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] kbuild: turn on -Wextra by default Date: Thu, 4 Apr 2024 17:16:54 +0200 Message-Id: <20240404151713.3493098-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240404151713.3493098-1-arnd@kernel.org> References: <20240404151713.3493098-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann The -Wextra option controls a number of different warnings that differ slightly by compiler version. Some are useful in general, others are better left at W=1 or higher. Based on earlier work, the ones that should be disabled by default are left for the higher warning levels already, and a lot of the useful ones have no remaining output when enabled. Move the -Wextra option up into the set of default-enabled warnings and just rely on the individual ones getting disabled as needed. The -Wunused warning was always grouped with this, so turn it on by default as well, except for the -Wunused-parameter warning that really has no value at all for the kernel since many interfaces have intentionally unused arguments. Signed-off-by: Arnd Bergmann Acked-by: Nathan Chancellor --- scripts/Makefile.extrawarn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index c5af566e911a..c247552c192c 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -82,12 +82,14 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) # Warn if there is an enum types mismatch KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion) +KBUILD_CFLAGS += -Wextra +KBUILD_CFLAGS += -Wunused + # # W=1 - warnings which may be relevant and do not occur too often # ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) -KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter KBUILD_CFLAGS += $(call cc-option, -Wrestrict) KBUILD_CFLAGS += -Wmissing-format-attribute KBUILD_CFLAGS += -Wold-style-definition @@ -190,6 +192,7 @@ else # The following turn off the warnings enabled by -Wextra KBUILD_CFLAGS += -Wno-sign-compare +KBUILD_CFLAGS += -Wno-unused-parameter endif From patchwork Thu Apr 4 15:16:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13618000 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52A7D12D770; Thu, 4 Apr 2024 15:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243866; cv=none; b=Z4VYfviB2KV4gV4Fk7klT1rHYYGvMiAYiLuWHQBA281yiWqdBGu6SOqFXI6pHJ2vAhULXWlwRFGWUlgsiWjVaxAAZ7ZfOoZSMZ6n/t3gc+8OWx8WvRQDpZrYRMN08zDjxrhP8X7oIJC7jF2HOoKZsw5ns6c5zyTlirbWAhqrA40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243866; c=relaxed/simple; bh=0okQEvlY3/SmSkoMjSltwkYaqxJU8EJLgR7wUY2TM0k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ATmwuj8XJQ4YJDI5Boyzw6eOQyCgMEXif875tmF7eZU35lhUrBNqC+nT6/KlZ3n01rzDnwHuqyR7YbyXnlgfkY2r7V/wNoR7vm1yiOsgwTOB5xuuzymRbnrxyrVp5+8US3CKxe/0m2tqHKUCM6EPvn607D0MZ5b9x8WfKSVglbM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C3/USwzP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C3/USwzP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1B88C433C7; Thu, 4 Apr 2024 15:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712243865; bh=0okQEvlY3/SmSkoMjSltwkYaqxJU8EJLgR7wUY2TM0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3/USwzPiex8Gf1TzLDW1D2Uco8gkj/kL9yXkA6mIM2ZDEWnqOgo99/BRPDWwCwhD jleghHFxzH5+FCnta0SzVdl8fzeo+oiP4eNCJh+KKq0HGrrILlMYtz0F48+Xv4MQRp 9i1gDEhvid7wVhXH8/2sWRWO4ikaFIrmCQlIJ5m30fIrUwnQOcUYNsyvKNxiUPPBzv Dcyo5mfgjyG+kRDb1KzHe9Gwe8fFgYX2oTi05WpcY/C5NXddqqppMvHO6ZWQm7SlF9 ahcPWmDnrdTS89kfeDQtBQ5l+kSZg319nzpHcVO8HF7aGZsSXOn405MqgCbABuffsH 5rHQ4SZ4OcAXQ== From: Arnd Bergmann To: Masahiro Yamada Cc: Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, Arnd Bergmann , Jani Nikula , Andrew Jeffery , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org Subject: [PATCH 2/4] kbuild: remove redundant extra warning flags Date: Thu, 4 Apr 2024 17:16:55 +0200 Message-Id: <20240404151713.3493098-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240404151713.3493098-1-arnd@kernel.org> References: <20240404151713.3493098-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann There is no point in turning individual options off and then on again, or vice versa, as the last one always wins. Now that -Wextra always gets passed first, remove all the redundant lines about warnings that are implied by either -Wall or -Wextra, and keep only the last one that disables it in some configurations. This should not have any effect but keep the Makefile more readable and the command line shorter. Signed-off-by: Arnd Bergmann --- scripts/Makefile.extrawarn | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index c247552c192c..17b00d85f6aa 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -37,11 +37,6 @@ else KBUILD_CFLAGS += -Wno-main endif -# 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) - # These result in bogus false positives KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer) @@ -90,16 +85,8 @@ KBUILD_CFLAGS += -Wunused # ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) -KBUILD_CFLAGS += $(call cc-option, -Wrestrict) KBUILD_CFLAGS += -Wmissing-format-attribute -KBUILD_CFLAGS += -Wold-style-definition KBUILD_CFLAGS += -Wmissing-include-dirs -KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable) -KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable) -KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned) -KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow) -KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation) -KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) KBUILD_CPPFLAGS += -Wundef KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 @@ -150,9 +137,6 @@ ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS += -Wdisabled-optimization KBUILD_CFLAGS += -Wshadow KBUILD_CFLAGS += $(call cc-option, -Wlogical-op) -KBUILD_CFLAGS += -Wmissing-field-initializers -KBUILD_CFLAGS += -Wtype-limits -KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2 From patchwork Thu Apr 4 15:16:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13618001 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70B4F12E1C7; Thu, 4 Apr 2024 15:17:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243872; cv=none; b=dwS2zdA2StQMunTujZvvaWgKtW0FzWqiSmVEGjCq3YWDqScZQFGMYL7kIIyY+4W/5i/Ior+fDXp1E33Y9H5JDE59+4OaLRn/e6xAf5V1KOC8E4Qsf0PJ3qe2RogemIw5EiDr99Vq869gIpb5BXhQFZHG33bh+QEYejsvltacihY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243872; c=relaxed/simple; bh=oKle+crpUH9O0OZWLH+Ub8gSc881pJVWxmfhgsu2NjE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gVbcKZvrm+rmiC9GkarLLpEAAzoaajiTUG1lMC6nBfeGyiLZuWLdf6iKopOkWRAbrL5AemCFgJaGW8/0WI1PkoDcwmX+o53e1t5lIOW6noufoetbOsQ+sR3gGZtXrEXBB6crg5NST79nyEd5cBEXpca48LXAh00SlOyYw439dWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cPWZ1G4Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cPWZ1G4Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2785FC433F1; Thu, 4 Apr 2024 15:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712243872; bh=oKle+crpUH9O0OZWLH+Ub8gSc881pJVWxmfhgsu2NjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cPWZ1G4ZXitGB2sYVLYOPxTDlMrOSYqJbDKZ+FcZt3U/8NYeW4Kz6OFKQASRO8p2Y UF3NbopfNGf7QXF1952iELj4MmR/zo7Vn7aZKjgPvgxxIlTp+qmAK+0y7Ohvdtg/uq B+5IYydfR1NDYJEcJyaLUGJ0q4nx4vsQ2zH35PmThB+Shnbh8InW+9fCZmIqthVLN3 wAwHD0g4jWhrUSdx7k0PJ74NFvqIo7vnX33OWmWwWiWs8l/SoMeu03SzAX6hGToDDh 9leooX1kxgSXVD0PoFcHjLH5nZigg1d+A8/klXQ25bj4IeZ9n8PP5CAGcDGnrFXpEb urIaUsTU1ybSw== From: Arnd Bergmann To: Masahiro Yamada Cc: Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, Arnd Bergmann , Jani Nikula , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] kbuild: turn on -Wrestrict by default Date: Thu, 4 Apr 2024 17:16:56 +0200 Message-Id: <20240404151713.3493098-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240404151713.3493098-1-arnd@kernel.org> References: <20240404151713.3493098-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann All known -Wrestrict warnings are addressed now, so don't disable the warning any more. Signed-off-by: Arnd Bergmann --- scripts/Makefile.extrawarn | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 17b00d85f6aa..fbe4d7144860 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -97,7 +97,6 @@ else # Suppress them by using -Wno... except for W=1. KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, restrict) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) From patchwork Thu Apr 4 15:16:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13618002 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38E7412E1C7; Thu, 4 Apr 2024 15:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243882; cv=none; b=Qx/TAOaLuApfeTojlB7ZWL4ZVFlFD4mgCLEZ1jTUwLpD46GjzRobqzybHSgCZTv03IPvkUj6xJ7kNVkAik+8nZ9ODuJyPMWYhkR9XSN0Suka7AFqglQcPapOAm2ZpfG+bc/Mj/Ih7iACpYcHHEmnmsjigryh0K89XcVdjY8WEF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712243882; c=relaxed/simple; bh=lz3EUYQCI/wMAJ8fw+7g8LlY6qdomo5S2mS7cruxavw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t1DZup7mHR6TRWr70h1RPAcT3pNqYxQ0TgSd0V5SfoB+XZxeWSJrcqlOBE3237f3IkWsXeXRjORJpBt06BQP1qlXJVRcEfNYw3O115pL4U3j2Tj9e6R2L9N7EwRntxOCVVVD6DbnoEqKsZshOVT8ejZdQEOd+Us5u6x/HO1Hvks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uZ7kfb45; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uZ7kfb45" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02BF9C433C7; Thu, 4 Apr 2024 15:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712243881; bh=lz3EUYQCI/wMAJ8fw+7g8LlY6qdomo5S2mS7cruxavw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZ7kfb454DbAzeYfGgxRnkq2XhaKiar/gY+s0ta8csvS5Dhx/xr462Uu5nSBMEiEb 6fbIm0ewI0SmO/8PwCGJ89ku5rpiNwqd9xIp460tpcpKDX48VpphL+WBLercjEpUve OMjgmYQD3OsKCsBHNXPPonFDEfKMwTOywH+UKyIfDcc7bhk1YN83ltjAGz56VgDlJ1 X2Dfj7a025W+oBBVpQFUAC2U4OQtFHGxnNeyNIVYn8G8ocZaxPjTnwDKnuTUk0OnWo UShgjM8T6dF0l5CUMxhpQ4Q1WF/stcQDDZcZE+ePgOKqBCkxF9G4fzz3C/4iO+6m1v unlRu1UoZ2WaA== From: Arnd Bergmann To: Masahiro Yamada Cc: Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Jani Nikula , Kees Cook , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 4/4] kbuild: enable -Wformat-truncation on clang Date: Thu, 4 Apr 2024 17:16:57 +0200 Message-Id: <20240404151713.3493098-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240404151713.3493098-1-arnd@kernel.org> References: <20240404151713.3493098-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann This warning option still produces output on gcc but is now clean when building with clang, so enable it conditionally on the compiler for now. As far as I can tell, the remaining warnings with gcc are the result of analysing the code more deeply across inlining, while clang only does this within a function. Link: https://lore.kernel.org/lkml/20240326230511.GA2796782@dev-arch.thelio-3990X/ Link: https://lore.kernel.org/linux-patches/20231002-disable-wformat-truncation-overflow-non-kprintf-v1-1-35179205c8d9@kernel.org/ Signed-off-by: Arnd Bergmann --- scripts/Makefile.extrawarn | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index fbe4d7144860..5063b847a658 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -99,7 +99,14 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) +ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) +else +# Clang checks for overflow/truncation with '%p', while GCC does not: +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219 +KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf) +KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf) +endif KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang