Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp762241pxb; Thu, 12 Nov 2020 16:12:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJgHfXLV71uyI2ays4+dLm6c85pKW8UwjwEc7ouIsGCCVsISkXKlKe8Zwoxz7qgPA21iQj X-Received: by 2002:aa7:d801:: with SMTP id v1mr2599848edq.250.1605226327554; Thu, 12 Nov 2020 16:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605226327; cv=none; d=google.com; s=arc-20160816; b=ijBFtftjAvriAfQEjEeERMOAtB/0H5ecpnpAdz04PAhLXMuXUjdfShTXAAM2CBqCre qBoqzKc15cjR5JIgBle2Q3f+NO2UJvx7YEFKAGv9FTqWFaQnRqRAicq/fkm1a9q9xA5o hJUy2q2M6vLihNtk0ihblgZ/wZvdVylN0hpEk7865psY/P6m5m/en64q2AFoaGPyIcPX XQISk/iLoc9IYT2MIj8JrJ4Pm2Q/yN+CgRjFsQWMdisnSqkFHweQtg3QNwec0V+bh8DD wHzy5bf0Jqls6IE3QDgylgYx3dHdhShfH6LZjugvqxpRWI7Lon1WPOUsB5dUMhku3Y9C mprA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2DHsDoriK54ucih8d4V/3kj6D7gH+qZ0YXsshl+T4v0=; b=b/KJR0trRmdL0j5rjuzbYbkR0gMuqrxRexdVuf8bu7BodSR3RT1itLChRjjLlyqlFR 5hc9ctC9CoXVB/+H1bIJqxgZXX8TT4LE15UKbtivKVK5CND/DRRZQUyrdEcLyCh3TagK cYfAWDEoNrLnT0N/tLtq7Q/VdIGv/gipMKjLa+fa8IbiROr1JncWgKnDwx4mvhwWTQfB vvi3dlxg/Qa/MaPJFTLyOQpIZO0Y0Sc4tTVQrZEmM4BBVDNzTaQkJGJtck6IvWTttW/u dW1KgQCLg2MdDNRtLsUfqeoStGmzusOdGr/t9Azhjpfyu0Y3iQxxKcpqvIxGrCx9djeO an+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CzElBqwW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si4602480ejn.501.2020.11.12.16.11.44; Thu, 12 Nov 2020 16:12:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CzElBqwW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726015AbgKMAJa (ORCPT + 99 others); Thu, 12 Nov 2020 19:09:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgKMAJa (ORCPT ); Thu, 12 Nov 2020 19:09:30 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB77C0613D4 for ; Thu, 12 Nov 2020 16:09:16 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id y22so3656891plr.6 for ; Thu, 12 Nov 2020 16:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=2DHsDoriK54ucih8d4V/3kj6D7gH+qZ0YXsshl+T4v0=; b=CzElBqwWilQwhy6JBOgUZY6M7XqXa+yl5U9ZdhZoZR5NE6dY1ajkPehr8X+pOXYAsB W+qtHA8cHgfnCfGC5b0vsesszBUj/ZRlpOePuIKM90t5ASEVVK1DRJ1ICWtloJOvICMq usqzCvJfTuiDZJukhpZ5gsW9TRqWGf/thsBmg2/Na8WQwKG+NEO91ez8QqBQRP2aF/Wp NYMNHSCacOq+lrriq1DJ5U+kcZEXHACqUqSQocro4I1nC90Zo2AD49qMTlIYbzojzmvP WSyZd2wc/iBq1qC7WLZeNeApaqajj5o+Dtt+g6iMXLiAaemt0Yb3j2gMaRwj0tXuzqKd Ivfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=2DHsDoriK54ucih8d4V/3kj6D7gH+qZ0YXsshl+T4v0=; b=ibdO7A/LgdqNDzDIWJOhRjGynFTMX17VlzPzIW1KAbN48+hMYp/hVYaCitiacupkQr 7ShzwVCIHMS6NPsh1l9eP83+UHhfxRQsZ95dY4Fglaa2dA7GJPJ/MsOVislZhSUwa3XJ kHBltBH+S8zURjRZLXXmgwACjNmwjUgEgoyhncRen+MbHiprqyU4m6utrfdw3J1WUSxq dbITAss6UhWdmoEK4hkNGqNram9zj0MCf5qoOQwk2av/zVZcoR99EJX7daKa5se3v6kL CGIZWBn14lE57fE2LuxqS4UWoCjoO0sHi6cYmbItNYxpG04ggQXRW9NjFbFy8KaREJMP CwEA== X-Gm-Message-State: AOAM5325eNsUYdQVk/ICW0iy5ZOOBp/nBgJ+FYbAI1ykRHjBl3tQMvZN kvlzrQC+NoMMLEAkbLhbj80CqaJ7jt2Y1bZDyKw9wA== X-Received: by 2002:a17:902:760c:b029:d6:efa5:4cdd with SMTP id k12-20020a170902760cb02900d6efa54cddmr1571407pll.56.1605226154891; Thu, 12 Nov 2020 16:09:14 -0800 (PST) MIME-Version: 1.0 References: <20201111021131.822867-1-ndesaulniers@google.com> In-Reply-To: From: Nick Desaulniers Date: Thu, 12 Nov 2020 16:09:03 -0800 Message-ID: Subject: Re: [PATCH] ACPICA: fix -Wfallthrough To: "Moore, Robert" , Miguel Ojeda Cc: "Kaneda, Erik" , "Wysocki, Rafael J" , "Gustavo A . R . Silva" , "clang-built-linux@googlegroups.com" , Len Brown , "linux-acpi@vger.kernel.org" , "devel@acpica.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 12, 2020 at 1:48 PM Moore, Robert wrot= e: > > > > -----Original Message----- > From: Nick Desaulniers > Sent: Thursday, November 12, 2020 11:31 AM > To: Moore, Robert > Cc: Kaneda, Erik ; Wysocki, Rafael J ; Gustavo A . R . Silva ; clang-built= -linux@googlegroups.com; Len Brown ; linux-acpi@vger.kerne= l.org; devel@acpica.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] ACPICA: fix -Wfallthrough > > On Thu, Nov 12, 2020 at 7:13 AM Moore, Robert wr= ote: > > > > > > > > -----Original Message----- > > From: Nick Desaulniers > > Sent: Wednesday, November 11, 2020 10:48 AM > > To: Moore, Robert > > Cc: Kaneda, Erik ; Wysocki, Rafael J > > ; Gustavo A . R . Silva > > ; clang-built-linux@googlegroups.com; Len Brown > > ; linux-acpi@vger.kernel.org; devel@acpica.org; > > linux-kernel@vger.kernel.org > > Subject: Re: [PATCH] ACPICA: fix -Wfallthrough > > > > On Wed, Nov 11, 2020 at 7:15 AM Moore, Robert = wrote: > > > > > > Yes, but: isn't the "fallthrough" keyword compiler-specific? That is = the problem for us. > > > > It's not a keyword. > > > > It's a preprocessor macro that expands to > > __attribute__((__fallthrough__)) for compilers that support it. For co= mpilers that do not, it expands to nothing. Both GCC 7+ and Clang support = this attribute. Which other compilers that support -Wimplicit-fallthrough = do you care to support? > > > > We need to support MSVC 2017 -- which apparently does not support this. > > In which case, the macro is not expanded to a compiler attribute the comp= iler doesn't support. Please see also its definition in include/linux/comp= iler_attributes.h. > > From what I can tell, MSVC does not warn on implicit fallthrough, so ther= e's no corresponding attribute (or comment) to disable the warning in MSVC. > > That doesn't mean this code is not portable to MSVC; a macro that expands= to nothing should not be a problem. > > Based on > https://docs.microsoft.com/en-us/cpp/code-quality/c26819?view=3Dmsvc-160 > https://developercommunity.visualstudio.com/idea/423975/issue-compiler-wa= rning-when-using-implicit-fallthr.html > it sounds like MSVC 2019 will be able to warn, for C++ mode, which will r= ely on the C++ style attribute to annotate intentional fallthrough. > > Can you confirm how this does not work for MSVC 2017? > > 1>c:\acpica\source\components\utilities\utdelete.c(270): warning C4013: '= __attribute__' undefined; assuming extern returning int > 1>c:\acpica\source\components\utilities\utdelete.c(270): error C2065: '__= fallthrough__': undeclared identifier > 1>c:\acpica\source\components\utilities\utdelete.c(272): error C2143: syn= tax error: missing ';' before 'case' Thank you for the explicit diagnostics observed. Something fishy is going on though, https://godbolt.org/z/Gbxbxa is how I expect MSVC to handle include/linux/compiler_attributes.h. The C preprocessor should make it such that MSVC never sees `__attribute__` or `__fallthrough__`; that it does begs the question. That would seem to imply that `#if __has_attribute(__fallthrough__)` somehow evaluates to true on MSVC, but my godbolt link shows it does not. Could the upstream ACPICA project be #define'ing something that could be altering this? (Or not #define'ing something?) Worst case, we could do as Joe Perches suggested and disable -Wfallthrough for drivers/acpi/acpica/. > > > > Bob > > > > > > > > > -----Original Message----- > > > From: ndesaulniers via sendgmr > > > On Behalf Of Nick > > > Desaulniers > > > Sent: Tuesday, November 10, 2020 6:12 PM > > > To: Moore, Robert ; Kaneda, Erik > > > ; Wysocki, Rafael J > > > ; Gustavo A . R . Silva > > > > > > Cc: clang-built-linux@googlegroups.com; Nick Desaulniers > > > ; Len Brown ; > > > linux-acpi@vger.kernel.org; devel@acpica.org; > > > linux-kernel@vger.kernel.org > > > Subject: [PATCH] ACPICA: fix -Wfallthrough > > > > > > The "fallthrough" pseudo-keyword was added as a portable way to denot= e intentional fallthrough. This code seemed to be using a mix of fallthroug= h comments that GCC recognizes, and some kind of lint marker. > > > I'm guessing that linter hasn't been run in a while from the mixed us= e of the marker vs comments. > > > > > > Signed-off-by: Nick Desaulniers > > > --- > > > drivers/acpi/acpica/dscontrol.c | 3 +-- > > > drivers/acpi/acpica/dswexec.c | 4 +--- > > > drivers/acpi/acpica/dswload.c | 3 +-- > > > drivers/acpi/acpica/dswload2.c | 3 +-- > > > drivers/acpi/acpica/exfldio.c | 3 +-- > > > drivers/acpi/acpica/exresop.c | 5 ++--- > > > drivers/acpi/acpica/exstore.c | 6 ++---- > > > drivers/acpi/acpica/hwgpe.c | 3 +-- > > > drivers/acpi/acpica/utdelete.c | 3 +-- > > > drivers/acpi/acpica/utprint.c | 2 +- > > > 10 files changed, 12 insertions(+), 23 deletions(-) > > > > > > diff --git a/drivers/acpi/acpica/dscontrol.c > > > b/drivers/acpi/acpica/dscontrol.c index 4b5b6e859f62..1e75e5fbfd19 > > > 100644 > > > --- a/drivers/acpi/acpica/dscontrol.c > > > +++ b/drivers/acpi/acpica/dscontrol.c > > > @@ -61,8 +61,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_stat= e *walk_state, > > > break; > > > } > > > } > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case AML_IF_OP: > > > /* > > > diff --git a/drivers/acpi/acpica/dswexec.c > > > b/drivers/acpi/acpica/dswexec.c index 1d4f8c81028c..e8c32d4fe55f > > > 100644 > > > --- a/drivers/acpi/acpica/dswexec.c > > > +++ b/drivers/acpi/acpica/dswexec.c > > > @@ -597,9 +597,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_= state *walk_state) > > > if (ACPI_FAILURE(status)) { > > > break; > > > } > > > - > > > - /* Fall through */ > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case AML_INT_EVAL_SUBTREE_OP: > > > > > > diff --git a/drivers/acpi/acpica/dswload.c > > > b/drivers/acpi/acpica/dswload.c index 27069325b6de..afc663c3742d > > > 100644 > > > --- a/drivers/acpi/acpica/dswload.c > > > +++ b/drivers/acpi/acpica/dswload.c > > > @@ -223,8 +223,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *wa= lk_state, > > > parse_flags & ACPI_PARSE_MODULE_LEVEL)) = { > > > break; > > > } > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > default: > > > > > > diff --git a/drivers/acpi/acpica/dswload2.c > > > b/drivers/acpi/acpica/dswload2.c index edadbe146506..1b794b6ba072 > > > 100644 > > > --- a/drivers/acpi/acpica/dswload2.c > > > +++ b/drivers/acpi/acpica/dswload2.c > > > @@ -213,8 +213,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *wa= lk_state, > > > parse_flags & ACPI_PARSE_MODULE_LEVEL)) = { > > > break; > > > } > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > default: > > > > > > diff --git a/drivers/acpi/acpica/exfldio.c > > > b/drivers/acpi/acpica/exfldio.c index ade35ff1c7ba..9d1cabe0fed9 > > > 100644 > > > --- a/drivers/acpi/acpica/exfldio.c > > > +++ b/drivers/acpi/acpica/exfldio.c > > > @@ -433,8 +433,7 @@ acpi_ex_field_datum_io(union acpi_operand_object = *obj_desc, > > > * Now that the Bank has been selected, fall through = to the > > > * region_field case and write the datum to the Opera= tion Region > > > */ > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case ACPI_TYPE_LOCAL_REGION_FIELD: > > > /* > > > diff --git a/drivers/acpi/acpica/exresop.c > > > b/drivers/acpi/acpica/exresop.c index 4d1b22971d58..df48faa9a551 > > > 100644 > > > --- a/drivers/acpi/acpica/exresop.c > > > +++ b/drivers/acpi/acpica/exresop.c > > > @@ -197,8 +197,7 @@ acpi_ex_resolve_operands(u16 opcode, > > > case ACPI_REFCLASS_DEBUG: > > > > > > target_op =3D AML_DEBUG_OP; > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case ACPI_REFCLASS_ARG: > > > case ACPI_REFCLASS_LOCAL: > > > @@ -264,7 +263,7 @@ acpi_ex_resolve_operands(u16 opcode, > > > * Else not a string - fall through to the no= rmal Reference > > > * case below > > > */ > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case ARGI_REFERENCE: /* References: */ > > > case ARGI_INTEGER_REF: > > > diff --git a/drivers/acpi/acpica/exstore.c > > > b/drivers/acpi/acpica/exstore.c index 3adc0a29d890..2067baa7c120 > > > 100644 > > > --- a/drivers/acpi/acpica/exstore.c > > > +++ b/drivers/acpi/acpica/exstore.c > > > @@ -95,8 +95,7 @@ acpi_ex_store(union acpi_operand_object *source_des= c, > > > if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) { > > > return_ACPI_STATUS(AE_OK); > > > } > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > default: > > > > > > @@ -421,8 +420,7 @@ acpi_ex_store_object_to_node(union acpi_operand_o= bject *source_desc, > > > } > > > break; > > > } > > > - > > > - /* Fallthrough */ > > > + fallthrough; > > > > > > case ACPI_TYPE_DEVICE: > > > case ACPI_TYPE_EVENT: > > > diff --git a/drivers/acpi/acpica/hwgpe.c > > > b/drivers/acpi/acpica/hwgpe.c index b13a4ed5bc63..fbfad80c8a53 > > > 100644 > > > --- a/drivers/acpi/acpica/hwgpe.c > > > +++ b/drivers/acpi/acpica/hwgpe.c > > > @@ -166,8 +166,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *g= pe_event_info, u32 action) > > > if (!(register_bit & gpe_register_info->enable_mask))= { > > > return (AE_BAD_PARAMETER); > > > } > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case ACPI_GPE_ENABLE: > > > > > > diff --git a/drivers/acpi/acpica/utdelete.c > > > b/drivers/acpi/acpica/utdelete.c index 4c0d4e434196..8076e7947585 > > > 100644 > > > --- a/drivers/acpi/acpica/utdelete.c > > > +++ b/drivers/acpi/acpica/utdelete.c > > > @@ -111,8 +111,7 @@ static void acpi_ut_delete_internal_obj(union acp= i_operand_object *object) > > > (void)acpi_ev_delete_gpe_block(object->device= . > > > gpe_block); > > > } > > > - > > > - /*lint -fallthrough */ > > > + fallthrough; > > > > > > case ACPI_TYPE_PROCESSOR: > > > case ACPI_TYPE_THERMAL: > > > diff --git a/drivers/acpi/acpica/utprint.c > > > b/drivers/acpi/acpica/utprint.c index 681c11f4af4e..f7e43baf5ff2 > > > 100644 > > > --- a/drivers/acpi/acpica/utprint.c > > > +++ b/drivers/acpi/acpica/utprint.c > > > @@ -475,7 +475,7 @@ int vsnprintf(char *string, acpi_size size, const= char *format, va_list args) > > > case 'X': > > > > > > type |=3D ACPI_FORMAT_UPPER; > > > - /* FALLTHROUGH */ > > > + fallthrough; > > > > > > case 'x': > > > > > > -- > > > 2.29.2.222.g5d2a92d10f8-goog > > > > > > > > > -- > > Thanks, > > ~Nick Desaulniers > > > > -- > Thanks, > ~Nick Desaulniers --=20 Thanks, ~Nick Desaulniers