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-08 18:31:38


#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:6 johnmaddock]:
> >On unsupported compilers (or in non-C++11 mode in Clang) it expands to
 "do {} while(0)", which requires a semicolon as well. This construct was
 meant to look and behave consistently with 'break;' statement, which it
 can be an alternative to in many cases. So requiring a semicolon after it
 seems to be reasonable.
>
> "do{}while(0)" generates a "Conditional expression is constant" warning
 on MSVC.
>
> Defining to "(void)" might do it, but it wouldn't surprise me if some
 compiler warned about that too in future :-(

 How about a separate define for Clang with C++11, and a separate one for
 MSVC? All others can use "do{}while(0)".

 As an idea for compilers that warn on "do{}while(0)", we could use a
 function call without trailing semicolon:
 {{{
 void boost_fallthrough() {}
 #define BOOST_FALLTHROUGH boost_fallthrough()
 }}}

 Then all implementations will require a trailing semicolon, which will
 help to avoid at least one type of errors in usages of this macro.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8408#comment:7>
Boost C++ Libraries <http://www.boost.org/>
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