[ovs-dev] [PATCH] Fix some -Wimplicit-fallthrough warnings building with GCC 7

Ben Pfaff blp at ovn.org
Tue Jul 11 20:07:24 UTC 2017


On Fri, Jun 23, 2017 at 06:12:49PM +0200, Timothy Redaelli wrote:
> -Wimplicit-fallthrough warns when a switch case falls through and since this
> warning is enabled by -Wextra it breaks building with --enable-Werror.
> 
> Added "/* fall through */" comment when needed in order to avoid the warning.
> 
> Signed-off-by: Timothy Redaelli <tredaelli at redhat.com>
> ---
> 
> From GCC 7 Release Note:                                                        
> -Wimplicit-fallthrough warns when a switch case falls through.                  
> This warning has five different levels.                                         
> The compiler is able to parse a wide range of fallthrough comments,             
> depending on the level.                                                         
> It also handles control-flow statements, such as ifs.                           
> It's possible to suppress the warning by either adding a fallthrough comment,   
> or by using a null statement: __attribute__ ((fallthrough));                    
> (C, C++), or [[fallthrough]]; (C++17), or [[gnu::fallthrough]]; (C++11/C++14).  
> This warning is enabled by -Wextra.

Thanks!

I guess that since -Wextra enables this, we don't need to add any new
options ourselves?

I applied this to master.


More information about the dev mailing list