Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4862441ybl; Mon, 26 Aug 2019 17:43:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqztTsSmKP+Id28dwv1lDQ1h5GO2zrlutS3ORm+3fu78DlLYFzOdiwNgYJql+IFamkYZy98P X-Received: by 2002:a17:902:183:: with SMTP id b3mr9108269plb.210.1566866593781; Mon, 26 Aug 2019 17:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566866593; cv=none; d=google.com; s=arc-20160816; b=ovBE98qzVR9V3WBuVLVY0yfONNpw9EC4CT58lNKn4/4TW4sNkpb2Lu+vpn4WXxhcMe h6xggqrWqW/218zJeFfycc9cZ0T+MjyyZJaHuHzGGrGGJ69/Rt7eKUuu2UiD/4w8r5LZ JpKtqzLuCkBzV9ArYn6pGE2W8C6Tj8qV2ZmHtGfsOOu2ZXIBOQnXbfmymvQ0k6cl5Rvt bGBzY5yQ8EVGCcw/YkLQGEN7hTRpovWHn9eqE1QAgIFJTw63O+ZXyD/BzZRKo2dLWKh8 smgc+K4TiN+cEI+LQIC7IBj5n6NZbSmkDcCA4o/0g/Vfy8XmGtIiWsd4VOFyHYqLCoZH Qtyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wraJLvz6EmcrQqM6J8VAkrpu9wLHEffkySlFIVb29F0=; b=IFaX41DtkEpH9tRCZW4LE4+y46DL0XxZl8e4ZIqXQ2ccwyxU7dZ0/YsWuAdLDm51+P FTts4Kcba++76LzV8dgpCjHo6rwdFULesMuGBHANTqu+tBNyiU2lQ6gzFb3vGBpIdO0U OsyNZgk2dEFsW5I0A5ZiUPyy4FARlGF5GduEWaQ5gyH0eKAAhlmy1NtzO9nqCl3dyTx/ lN19UuxuiIZ9MOyX0BSqbhXOmKU8aUu7+/eIigrT9cEob41AIfIOcnZjQrgTiWS+Bk5t PPyxZDOWOzmP+F0/qSodHRZf5X4Ddq580RsITjCpBZX7oZB+KYl0zGFIIBvLVTJIZwgu iORQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PeDP1g4l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m22si10285467pgh.190.2019.08.26.17.42.58; Mon, 26 Aug 2019 17:43:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PeDP1g4l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbfH0AmH (ORCPT + 99 others); Mon, 26 Aug 2019 20:42:07 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36623 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfH0AmH (ORCPT ); Mon, 26 Aug 2019 20:42:07 -0400 Received: by mail-wm1-f66.google.com with SMTP id g67so1183226wme.1; Mon, 26 Aug 2019 17:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wraJLvz6EmcrQqM6J8VAkrpu9wLHEffkySlFIVb29F0=; b=PeDP1g4ldCcu3fhNgWXbCJ5ZxhMa4yIWvVYGz//wgx08FfXXVI4JRs/uHjRAVe04SS 65Cdv45Rszv5yOevPof37G3B0Pn/7wn//QeEyDFloQpYW2/Y/BOAURqA9Jne868qQmte hBMjd4H4CvHWZARjBRc7rMn/C5vnETz76kqdbHUozej0dJLy6spbc1PmRVKFUGJaqxg8 4hl2swVc30lPiOa3E+5E4Pi1JVdRExpUhV72++KHhEn/lwQEGO/fSq0HZlkx7OiRqtFq /pdROK7/Z3zDFMSCsiQEwzW32ivzxSXjq5tzuiFu4fDuQZUz84YsMYFDXunzuAlEZBgx JxmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wraJLvz6EmcrQqM6J8VAkrpu9wLHEffkySlFIVb29F0=; b=Cxq4ec0HDL5seFbih/dmX/s6/cVVl5BYL02g8ANVYmCiUqRyze9zyUSWYyxLPabemq vUHWMYVFNJCYyomMSDOrA0L+sz74SZ6Ww+99UbI8vy84LhYqbcst2v+qQ//85ny7cwMA IEfzPmiExGVEy0qmpMLHeP0FEYF00OTT10wxpk2vCR4kW6ln50stAvcBJ1Mkt9ILtz/E 2IfQHX094dQl6IyWjepF3yivk0fxVk1DGrAESnPHdNTZlyC7iJji5DnsFdMQ/g4mRggf AKExtzEPCQMzdxIBo8VWOVAF1qt60ohjsIVEtBAils0V2ew5v+sV+VA+wVOttlS8t2bN 59bw== X-Gm-Message-State: APjAAAWwBqccNnY3VpVGeLQN2tC/PX4pQW/QvsDsiTEhCjL4y31jJYzI M9ehyDTACE8CIXA0rv3RiS/2EAgvOmm4/A== X-Received: by 2002:a1c:9648:: with SMTP id y69mr22955151wmd.122.1566866524573; Mon, 26 Aug 2019 17:42:04 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f8:222:2f1b::2]) by smtp.gmail.com with ESMTPSA id 7sm882049wmj.46.2019.08.26.17.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 17:42:03 -0700 (PDT) From: Nathan Chancellor To: Masahiro Yamada , Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Huckleberry , Joe Perches , Miguel Ojeda , Nick Desaulniers , Nathan Chancellor Subject: [PATCH] kbuild: Do not enable -Wimplicit-fallthrough for clang for now Date: Mon, 26 Aug 2019 17:41:55 -0700 Message-Id: <20190827004155.11366-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190815225844.145726-1-nhuck@google.com> References: <20190815225844.145726-1-nhuck@google.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This functionally reverts commit bfd77145f35c ("Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang"). clang enabled support for -Wimplicit-fallthrough in C in r369414 [1], which causes a lot of warnings when building the kernel for two reasons: 1. Clang does not support the /* fall through */ comments. There seems to be a general consensus in the LLVM community that this is not something they want to support. Joe Perches wrote a script to convert all of the comments to a "fallthrough" keyword that will be added to compiler_attributes.h [2] [3], which catches the vast majority of the comments. There doesn't appear to be any consensus in the kernel community when to do this conversion. 2. Clang and GCC disagree about falling through to final case statements with no content or cases that simply break: https://godbolt.org/z/c8csDu This difference contributes at least 50 warnings in an allyesconfig build for x86, not considering other architectures. This difference will need to be discussed to see which compiler is right [4] [5]. [1]: https://github.com/llvm/llvm-project/commit/1e0affb6e564b7361b0aadb38805f26deff4ecfc [2]: https://lore.kernel.org/lkml/61ddbb86d5e68a15e24ccb06d9b399bbf5ce2da7.camel@perches.com/ [3]: https://lore.kernel.org/lkml/1d2830aadbe9d8151728a7df5b88528fc72a0095.1564549413.git.joe@perches.com/ [4]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432 [5]: https://github.com/ClangBuiltLinux/linux/issues/636 Given these two problems need discussion and coordination, do not enable -Wimplicit-fallthrough with clang right now. Add a comment to explain what is going on as well. This commit should be reverted once these two issues are fully flushed out and resolved. Suggested-by: Masahiro Yamada Signed-off-by: Nathan Chancellor --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f125625efd60..6007a56bdbee 100644 --- a/Makefile +++ b/Makefile @@ -751,6 +751,11 @@ else # These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += -Wno-unused-but-set-variable + +# Warn about unmarked fall-throughs in switch statement. +# Disabled for clang while comment to attribute conversion happens and +# https://github.com/ClangBuiltLinux/linux/issues/636 is discussed. +KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,) endif KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) @@ -845,9 +850,6 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) # warn about C99 declaration after statement KBUILD_CFLAGS += -Wdeclaration-after-statement -# Warn about unmarked fall-throughs in switch statement. -KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,) - # Variable Length Arrays (VLAs) should not be used anywhere in the kernel KBUILD_CFLAGS += -Wvla -- 2.23.0