Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85121 - in trunk/boost/xpressive: . detail/dynamic
From: eric_at_[hidden]
Date: 2013-07-23 00:46:55


Author: eric_niebler
Date: 2013-07-23 00:46:55 EDT (Tue, 23 Jul 2013)
New Revision: 85121
URL: http://svn.boost.org/trac/boost/changeset/85121

Log:
make xpressive play nice with clang's -Wimplicit-fallthrough diagnostic, refs #8474

Text files modified:
   trunk/boost/xpressive/detail/dynamic/parse_charset.hpp | 5 ++++-
   trunk/boost/xpressive/detail/dynamic/parser_traits.hpp | 5 +++--
   trunk/boost/xpressive/match_results.hpp | 3 ++-
   trunk/boost/xpressive/regex_compiler.hpp | 37 ++++++++++++++++++++++++++-----------
   4 files changed, 35 insertions(+), 15 deletions(-)

Modified: trunk/boost/xpressive/detail/dynamic/parse_charset.hpp
==============================================================================
--- trunk/boost/xpressive/detail/dynamic/parse_charset.hpp Tue Jul 23 00:03:37 2013 (r85120)
+++ trunk/boost/xpressive/detail/dynamic/parse_charset.hpp 2013-07-23 00:46:55 EDT (Tue, 23 Jul 2013) (r85121)
@@ -13,6 +13,7 @@
 # pragma once
 #endif
 
+#include <boost/config.hpp>
 #include <boost/integer.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/throw_exception.hpp>
@@ -246,6 +247,7 @@
             case token_charset_hyphen:
             case token_charset_invert:
                 begin = iprev2; // un-get these tokens and fall through
+ BOOST_FALLTHROUGH;
             case token_literal:
                 ch_next = *begin++;
                 BOOST_XPR_ENSURE_(ch_prev <= ch_next, error_range, "invalid charset range");
@@ -264,7 +266,8 @@
                     chset.set_range(ch_prev, esc.ch_, rxtraits, icase);
                     continue;
                 }
- case token_charset_end: // fall through
+ BOOST_FALLTHROUGH;
+ case token_charset_end:
             default: // not a range.
                 begin = iprev; // backup to hyphen token
                 chset.set_char(ch_prev, rxtraits, icase);

Modified: trunk/boost/xpressive/detail/dynamic/parser_traits.hpp
==============================================================================
--- trunk/boost/xpressive/detail/dynamic/parser_traits.hpp Tue Jul 23 00:03:37 2013 (r85120)
+++ trunk/boost/xpressive/detail/dynamic/parser_traits.hpp 2013-07-23 00:46:55 EDT (Tue, 23 Jul 2013) (r85121)
@@ -15,6 +15,7 @@
 
 #include <string>
 #include <climits>
+#include <boost/config.hpp>
 #include <boost/assert.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/xpressive/regex_error.hpp>
@@ -394,9 +395,9 @@
         case BOOST_XPR_CHAR_(char_type, 'm'): this->flag_(!set, single_line); break;
         case BOOST_XPR_CHAR_(char_type, 's'): this->flag_(!set, not_dot_newline); break;
         case BOOST_XPR_CHAR_(char_type, 'x'): this->flag_(set, ignore_white_space); break;
- case BOOST_XPR_CHAR_(char_type, ':'): ++begin; // fall-through
+ case BOOST_XPR_CHAR_(char_type, ':'): ++begin; BOOST_FALLTHROUGH;
         case BOOST_XPR_CHAR_(char_type, ')'): return token_no_mark;
- case BOOST_XPR_CHAR_(char_type, '-'): if(false == (set = !set)) break; // else fall-through
+ case BOOST_XPR_CHAR_(char_type, '-'): if(false == (set = !set)) break; BOOST_FALLTHROUGH;
         default: BOOST_THROW_EXCEPTION(regex_error(error_paren, "unknown pattern modifier"));
         }
         while(BOOST_XPR_ENSURE_(++begin != end, error_paren, "incomplete extension"));

Modified: trunk/boost/xpressive/match_results.hpp
==============================================================================
--- trunk/boost/xpressive/match_results.hpp Tue Jul 23 00:03:37 2013 (r85120)
+++ trunk/boost/xpressive/match_results.hpp 2013-07-23 00:46:55 EDT (Tue, 23 Jul 2013) (r85121)
@@ -1096,11 +1096,12 @@
             case BOOST_XPR_CHAR_(char_type, ':'):
                 if(metacolon)
                 {
+ BOOST_FALLTHROUGH;
             case BOOST_XPR_CHAR_(char_type, ')'):
                     ++cur;
                     return out;
                 }
- // else fall-through
+ BOOST_FALLTHROUGH;
 
             default:
                 *out++ = *cur++;

Modified: trunk/boost/xpressive/regex_compiler.hpp
==============================================================================
--- trunk/boost/xpressive/regex_compiler.hpp Tue Jul 23 00:03:37 2013 (r85120)
+++ trunk/boost/xpressive/regex_compiler.hpp 2013-07-23 00:46:55 EDT (Tue, 23 Jul 2013) (r85121)
@@ -16,6 +16,7 @@
 #endif
 
 #include <map>
+#include <boost/config.hpp>
 #include <boost/assert.hpp>
 #include <boost/next_prior.hpp>
 #include <boost/range/begin.hpp>
@@ -282,7 +283,7 @@
             break;
         case 2:
             seq = detail::make_dynamic<BidiIter>(alternate_matcher()) | seq;
- // fall-through
+ BOOST_FALLTHROUGH;
         default:
             seq |= this->parse_sequence(tmp, end);
         }
@@ -322,13 +323,15 @@
             break;
 
         case token_negative_lookahead:
- negative = true; // fall-through
+ negative = true;
+ BOOST_FALLTHROUGH;
         case token_positive_lookahead:
             lookahead = true;
             break;
 
         case token_negative_lookbehind:
- negative = true; // fall-through
+ negative = true;
+ BOOST_FALLTHROUGH;
         case token_positive_lookbehind:
             lookbehind = true;
             break;
@@ -342,10 +345,16 @@
             {
                 switch(this->traits_.get_token(begin, end))
                 {
- case token_group_end: return this->parse_atom(begin, end);
- case token_escape: BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
- case token_literal: ++begin;
- default:;
+ case token_group_end:
+ return this->parse_atom(begin, end);
+ case token_escape:
+ BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
+ BOOST_FALLTHROUGH;
+ case token_literal:
+ ++begin;
+ break;
+ default:
+ break;
                 }
             }
             break;
@@ -688,11 +697,17 @@
         {
             switch(this->traits_.get_token(begin, end))
             {
- case token_quote_meta_end: return string_type(old_begin, old_end);
- case token_escape: BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
+ case token_quote_meta_end:
+ return string_type(old_begin, old_end);
+ case token_escape:
+ BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
+ BOOST_FALLTHROUGH;
             case token_invalid_quantifier:
- case token_literal: ++begin;
- default:;
+ case token_literal:
+ ++begin;
+ break;
+ default:
+ break;
             }
         }
         return string_type(old_begin, begin);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk