Re: [PATCH] ACPICA: fix -Wfallthrough

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2020-11-12 at 11:30 -0800, Nick Desaulniers wrote:
> On Thu, Nov 12, 2020 at 7:13 AM Moore, Robert <robert.moore@xxxxxxxxx> wrote:
> > -----Original Message-----
> > From: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> > On Wed, Nov 11, 2020 at 7:15 AM Moore, Robert <robert.moore@xxxxxxxxx> 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 compilers 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
> compiler doesn't support.  Please see also its definition in
> include/linux/compiler_attributes.h.
> 
> From what I can tell, MSVC does not warn on implicit fallthrough, so
> there'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.

acpica is a special case as all the code is in a separate
repository and converted via Lindent to resemble linux
standard styles.

Perhaps it'd easier to avoid modifying acpica and add something like:
---
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 59700433a96e..469508a8d671 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -4,6 +4,7 @@
 #
 
 ccflags-y			:= -Os -D_LINUX -DBUILDING_ACPICA
+ccflags-y			+= -Wno-implicit-fallthrough
 ccflags-$(CONFIG_ACPI_DEBUG)	+= -DACPI_DEBUG_OUTPUT
 
 # use acpi.o to put all files here into acpi.o modparam namespace





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux