From patchwork Mon Oct 26 22:03:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11858905 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECB18921 for ; Mon, 26 Oct 2020 22:03:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C693421655 for ; Mon, 26 Oct 2020 22:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603749818; bh=DmLwsZj6EZcsnvLvDgbYr67ECzrC3Drdxf44wh+PWU4=; h=From:To:Cc:Subject:Date:List-ID:From; b=AZd6KusGlgakLv0Azh/GzXyun3/OSHpZ+zmFisbluzKy9tVboJ6a5vJmcyM6iFVbW kslQyPM5DQNKfcfCM8+abw2/Q8LGD7CT3Vav57uJdfC6x/4X2w4aotPtt7LOV/ugqb pG0iw8KGuTEG1aUif4BdSBVtIMDjScsMKGEZjtRo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391687AbgJZWDi (ORCPT ); Mon, 26 Oct 2020 18:03:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:57336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391677AbgJZWDi (ORCPT ); Mon, 26 Oct 2020 18:03:38 -0400 Received: from localhost.localdomain (unknown [192.30.34.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D45A920706; Mon, 26 Oct 2020 22:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603749818; bh=DmLwsZj6EZcsnvLvDgbYr67ECzrC3Drdxf44wh+PWU4=; h=From:To:Cc:Subject:Date:From; b=YjBffOju/ndKBxhoedC7FHK5JkIWSgILcO/YbiQJSmHy9RvzpB+n+R2XJKJIG6Rx0 knCAa2qhaOci5aYTGmd6qndbf+0vuFy8s7Lxb7PZGRMzLBP0iJxgwNlMJA4f/3mMUo rGBdxy05ErPFDzMYX5O3qkWQpizQ9sFK8S6w3Vgo= From: Arnd Bergmann To: Masahiro Yamada , Michal Marek Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH 1/2] Makefile.extrawarn: move -Wcast-align to W=3 Date: Mon, 26 Oct 2020 23:03:13 +0100 Message-Id: <20201026220331.3896226-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From: Arnd Bergmann This warning behaves differently depending on the architecture and compiler. Using x86 gcc, we get no output at all because gcc knows the architecture can handle unaligned accesses. Using x86 clang, or gcc on an architecture that needs to manually deal with unaligned accesses, the build log is completely flooded with these warnings, as they are commonly invoked by inline functions of networking headers, e.g. include/linux/skbuff.h:1426:26: warning: cast increases required alignment of target type [-Wcast-align] The compiler is correct to point this out, as we are dealing with undefined behavior that does cause problems in practice, but there is also no good way to rewrite the code in commonly included headers to a safer method. Signed-off-by: Arnd Bergmann Reviewed-by: Nathan Chancellor --- scripts/Makefile.extrawarn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 95e4cdb94fe9..6baee1200615 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -60,7 +60,6 @@ endif # ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) -KBUILD_CFLAGS += -Wcast-align KBUILD_CFLAGS += -Wdisabled-optimization KBUILD_CFLAGS += -Wnested-externs KBUILD_CFLAGS += -Wshadow @@ -80,6 +79,7 @@ endif ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS += -Wbad-function-cast +KBUILD_CFLAGS += -Wcast-align KBUILD_CFLAGS += -Wcast-qual KBUILD_CFLAGS += -Wconversion KBUILD_CFLAGS += -Wpacked From patchwork Mon Oct 26 22:03:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11858907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA6111130 for ; Mon, 26 Oct 2020 22:03:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1F1D216FD for ; Mon, 26 Oct 2020 22:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603749834; bh=mZA155bDOUr6xE6zOwjLW4uXm7Jxh/NAZ+oFR/xBspM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tJ+ZC2vQcKU2wNoWYFAA3roTdccQAMOBlQbSFvzo3zz7n69ipXQvFL+2UB47UKzvK 41CCtCGlB1+kEroSrWnd2zH+OmGMKl7xihkwMfCMwHxsjqUtwjt6ORKU+J0x32msrL E5pLTqAox842GWN0z1bT7xO04R4L79y+9zs2fJRY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391776AbgJZWDy (ORCPT ); Mon, 26 Oct 2020 18:03:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:57476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391763AbgJZWDx (ORCPT ); Mon, 26 Oct 2020 18:03:53 -0400 Received: from localhost.localdomain (unknown [192.30.34.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D5BF20706; Mon, 26 Oct 2020 22:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603749832; bh=mZA155bDOUr6xE6zOwjLW4uXm7Jxh/NAZ+oFR/xBspM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOi3aCf7R2Q877PaaGvAQEYVlU4kW46/FX7+85kQQbasAyM7LG0YLn8VBiD394wHf MgRskRIgBsPawQZZ0QSXVci31gg91cO1i5TFNc8g20aElXBOBsJUqhkwOkkB90mqT6 qJRw4c7p+m1D99VGc1pkliJyB5RXSMsHBz06T8ag= From: Arnd Bergmann To: Masahiro Yamada , Michal Marek Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH 2/2] Makefile.extrawarn: limit -Wnested-externs to clang Date: Mon, 26 Oct 2020 23:03:14 +0100 Message-Id: <20201026220331.3896226-2-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201026220331.3896226-1-arnd@kernel.org> References: <20201026220331.3896226-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From: Arnd Bergmann The -Wnested-externs warning has become useless with gcc, since this warns every time that BUILD_BUG_ON() or similar macros are used. Signed-off-by: Arnd Bergmann Reviewed-by: Nathan Chancellor --- scripts/Makefile.extrawarn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 6baee1200615..9406f752e355 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -61,7 +61,10 @@ endif ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS += -Wdisabled-optimization +ifdef CONFIG_CC_IS_CLANG KBUILD_CFLAGS += -Wnested-externs +endif + KBUILD_CFLAGS += -Wshadow KBUILD_CFLAGS += $(call cc-option, -Wlogical-op) KBUILD_CFLAGS += -Wmissing-field-initializers