Re: [Boost-bugs] [Boost C++ Libraries] #8408: Boost is not compatible with Clang's -Wimplicit-fallthrough diagnostic

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8408: Boost is not compatible with Clang's -Wimplicit-fallthrough diagnostic
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-10 00:40:18

#8408: Boost is not compatible with Clang's -Wimplicit-fallthrough diagnostic
  Reporter: Alexander Kornienko <alexfh@…> | Owner: johnmaddock
      Type: Patches | Status: new
 Milestone: To Be Determined | Component: config
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:

Comment (by Alexander Kornienko <alexfh@…>):

 Replying to [comment:9 viboes]:
> I think John is right. It would be better if the macro contains the ';'
 so that there is no risk in introducing a new warning.

 I'm happy to change the macro to not require a semicolon, but first I'd
 like to share my arguments for the opposite solution:

 1. Consistency with break/return/continue/throw/goto:
 return xxx;
 // but without semicolon it looks alien:

 2. More generally, C++ statements usually end with a semicolon or closing
 brace, and a standalone identifier doesn't look like a separate valid C++
 statement; this makes code less readable.

 3. For the same reason as 2. this can confuse various tools, such as code
 editors, code formatters, linters etc. E.g. vim treats the next line after
 a standalone identifier as a continuation, and adds extra indent to it.
 clang-format - the new C++ formatter - is not going to format this
 correctly too.

 4. If the macro doesn't require a semicolon, but a developer inserts it by
 mistake, presence of this extra null-statement will lead to two warnings
 on Clang with -Wimplicit-fallthrough: fallthrough annotation is not
 immediately before a fallthrough and fallthrough is not annotated. On
 other compilers this will only warn if a compiler complains about null-
 statements. I consider this a worse situation than when a macro requires a
 semicolon, and all compilers will warn if a developer forgets it.

 That's it. Now it's up to you to decide what is better for Boost.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC