Linux 5.3 Enables "-Wimplicit-fallthrough" Compiler Flag

Written by Michael Larabel in Linux Kernel on 11 July 2019 at 07:18 AM EDT. 7 Comments
LINUX KERNEL
The recent work on enabling "-Wimplicit-fallthrough" behavior for the Linux kernel has culminated in Linux 5.3 with actually being able to universally enable this compiler feature.

The -Wimplicit-fallthrough flag on GCC7 and newer warns of cases where switch case fall-through behavior could lead to potential bugs / unexpected behavior.

Gustavo A. R. Silva who took on this initiative to enable the implicit-fallthrough warning for the Linux kernel had to first go through the kernel's thousands of switch statements in evaluating their behavior to ensure any fall-throughs were expected and not leading to potentially unexpected behavior.

After evaluating all of the current warnings generated and marking the current fall-throughs as safe, the flag is now set universally when building the Linux kernel.

That batch of work can be found via this pull request for the Linux 5.3 merge window.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week