Index: boost/config/compiler/clang.hpp =================================================================== --- boost/config/compiler/clang.hpp (revision 83820) +++ boost/config/compiler/clang.hpp (working copy) @@ -38,6 +38,16 @@ # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default"))) #endif +// +// The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through +// between switch labels. +// +#if __cplusplus >= 201103L && defined(__has_warning) +# if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") +# define BOOST_FALLTHROUGH [[clang::fallthrough]] +# endif +#endif + #if !__has_feature(cxx_auto_type) # define BOOST_NO_CXX11_AUTO_DECLARATIONS # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS Index: boost/config/suffix.hpp =================================================================== --- boost/config/suffix.hpp (revision 83820) +++ boost/config/suffix.hpp (working copy) @@ -885,6 +885,17 @@ #endif // +// Helper macro BOOST_FALLTHROUGH +// Fallback definition of BOOST_FALLTHROUGH macro used to mark intended +// fall-through between case labels in a switch statement. We use a definition +// that requires a semicolon after it to avoid at least one type of misuse even +// on unsupported compilers. +// +#ifndef BOOST_FALLTHROUGH +# define BOOST_FALLTHROUGH ((void)0) +#endif + +// // constexpr workarounds // #if defined(BOOST_NO_CXX11_CONSTEXPR) Index: libs/config/doc/html/boost_config/acknowledgements.html =================================================================== --- libs/config/doc/html/boost_config/acknowledgements.html (revision 83820) +++ libs/config/doc/html/boost_config/acknowledgements.html (working copy) @@ -3,7 +3,7 @@
+ BOOST_FALLTHROUGH
+
+ The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through + between switch labels: +
+switch (x) { + case 40: + case 41: + if (truth_is_out_there) { + ++x; + BOOST_FALLTHROUGH; // Use instead of/along with annotations in + // comments. + } else { + return x; + } + case 42: + ... ++
+ As shown in the example above, the BOOST_FALLTHROUGH macro should + be followed by a semicolon. It is designed to mimic control-flow + statements like 'break;', so it can be placed in most places where + 'break;' can, but only if there are no statements on the execution + path between it and the next switch label. +
+
+ When compiled with Clang >3.2 in C++11 mode, the BOOST_FALLTHROUGH
+ macro is expanded to [[clang::fallthrough]]
+ attribute, which is analysed when performing switch labels fall-through
+ diagnostic ('-Wimplicit-fallthrough'). See clang documentation
+ on language extensions for details: http://clang.llvm.org/docs/LanguageExtensions.html#clang__fallthrough
+
+ When used with unsupported compilers, the BOOST_FALLTHROUGH macro + has no effect on diagnostics. +
++ In either case this macro has no effect on runtime behavior and + performance of code. +
+
BOOST_EXPLICIT_TEMPLATE_TYPE(t)
BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t,v)
BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t,v)
Table of Contents
-Last revised: February 19, 2013 at 16:25:18 GMT |
+Last revised: April 05, 2013 at 23:29:41 GMT |