aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-01 17:02:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-01 17:02:16 +0200
commitc49b0e8ca53928cc20e9d4832536baaeee6d7a9d (patch)
tree91c980addf8ddc0c04feebb93699488e4385918b
parentfebcacdb5a60d37c2a56c9aad7b636be799940cd (diff)
Fix GCC 7 -fimplicit-fallthrough warnings
-rw-r--r--build2/algorithm.cxx21
-rw-r--r--build2/cc/lexer.cxx10
-rw-r--r--build2/lexer.cxx6
-rw-r--r--build2/target.cxx3
-rw-r--r--build2/test/script/parser.cxx38
5 files changed, 36 insertions, 42 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index fc71c1a..a532d7c 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -499,8 +499,9 @@ namespace build2
if (try_match)
return make_pair (false, target_state::unknown);
- // Fall through (to issue diagnostics).
+ // To issue diagnostics ...
}
+ // Fall through.
case target::offset_touched:
{
// Match.
@@ -521,9 +522,8 @@ namespace build2
// t.state_ is not yet set.
//
return make_pair (true, target_state::unknown);
-
- // Fall through.
}
+ // Fall through.
case target::offset_matched:
{
// Apply.
@@ -653,14 +653,16 @@ namespace build2
if ((r = g.group_members (a)).members != nullptr)
break;
- // Fall through to apply.
+ // To apply ...
}
- // @@ Doing match without execute messes up our target_count. Does
- // not seem like it will be easy to fix (we don't know whether
- // someone else will execute this target).
- //
+ // Fall through.
case target::offset_matched:
{
+ // @@ Doing match without execute messes up our target_count. Does
+ // not seem like it will be easy to fix (we don't know whether
+ // someone else will execute this target).
+ //
+
// Apply (locked).
//
if (match_impl (a, l, true).second == target_state::failed)
@@ -669,10 +671,11 @@ namespace build2
if ((r = g.group_members (a)).members != nullptr)
break;
- // Unlock and fall through to execute.
+ // Unlock and to execute ...
//
l.unlock ();
}
+ // Fall through.
case target::offset_applied:
{
// Execute (unlocked).
diff --git a/build2/cc/lexer.cxx b/build2/cc/lexer.cxx
index e904921..8a64ce7 100644
--- a/build2/cc/lexer.cxx
+++ b/build2/cc/lexer.cxx
@@ -462,8 +462,8 @@ namespace build2
{
if (n > 1 && id[1] == '8')
++i;
- // Fall through.
}
+ // Fall through.
case 'L':
case 'U':
{
@@ -980,12 +980,8 @@ namespace build2
switch (c)
{
case '\n':
- {
- if (!nl)
- break;
-
- // Fall through.
- }
+ if (!nl) break;
+ // Fall through.
case ' ':
case '\t':
case '\r':
diff --git a/build2/lexer.cxx b/build2/lexer.cxx
index 09064d2..e35b99d 100644
--- a/build2/lexer.cxx
+++ b/build2/lexer.cxx
@@ -257,7 +257,7 @@ namespace build2
{
// NOTE: remember to update mode() if adding new special characters.
//
- case '\n': fail (c) << "newline in evaluation context";
+ case '\n': fail (c) << "newline in evaluation context" << endf;
case ':': return make_token (type::colon);
case '{': return make_token (type::lcbrace);
case '}': return make_token (type::rcbrace);
@@ -515,6 +515,7 @@ namespace build2
break;
case quote_type::double_:
qtype = quote_type::mixed;
+ // Fall through.
case quote_type::mixed:
qcomp = false;
break;
@@ -549,6 +550,7 @@ namespace build2
break;
case quote_type::single:
qtype = quote_type::mixed;
+ // Fall through.
case quote_type::mixed:
qcomp = false;
break;
@@ -689,8 +691,8 @@ namespace build2
break; // Ignore.
unget (c);
- // Fall through.
}
+ // Fall through.
default:
return r; // Not a space.
}
diff --git a/build2/target.cxx b/build2/target.cxx
index 64ab412..0dab7e2 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -522,9 +522,8 @@ namespace build2
if (c != target::count_applied () && c != target::count_executed ())
break;
-
- // Fall through.
}
+ // Fall through.
case run_phase::execute:
{
if (group_state ())
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index b02c009..19bcb5c 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -462,10 +462,8 @@ namespace build2
case line_type::cmd_elifn:
case line_type::cmd_else:
case line_type::cmd_end:
- {
- next (t, tt); // Skip to start of command.
- // Fall through.
- }
+ next (t, tt); // Skip to start of command.
+ // Fall through.
case line_type::cmd:
{
pair<command_expr, here_docs> p;
@@ -484,8 +482,8 @@ namespace build2
switch (st)
{
- case type::plus: fail (t) << t << " after setup command";
- case type::minus: fail (t) << t << " after teardown command";
+ case type::plus: fail (t) << t << " after setup command" << endf;
+ case type::minus: fail (t) << t << " after teardown command" << endf;
}
}
@@ -554,7 +552,7 @@ namespace build2
case line_type::cmd_else:
case line_type::cmd_end:
{
- fail (ll) << lt << " without preceding 'if'";
+ fail (ll) << lt << " without preceding 'if'" << endf;
}
case line_type::cmd_if:
case line_type::cmd_ifn:
@@ -566,9 +564,8 @@ namespace build2
return l.type == line_type::cmd;
}) != ls_data.end ())
break;
-
- // Fall through.
}
+ // Fall through.
case line_type::var:
{
// If there is a semicolon after the variable then we assume
@@ -674,15 +671,15 @@ namespace build2
switch (tt)
{
case type::colon:
- fail (ll) << "description inside test";
+ fail (ll) << "description inside test" << endf;
case type::eos:
case type::rcbrace:
case type::lcbrace:
- fail (ll) << "expected another line after ';'";
+ fail (ll) << "expected another line after ';'" << endf;
case type::plus:
- fail (ll) << "setup command in test";
+ fail (ll) << "setup command in test" << endf;
case type::minus:
- fail (ll) << "teardown command in test";
+ fail (ll) << "teardown command in test" << endf;
default:
semi = pre_parse_line (t, tt, d, ls);
assert (tt == type::newline); // End of last test line.
@@ -881,15 +878,15 @@ namespace build2
switch (tt)
{
case type::colon:
- fail (ll) << "description inside " << bt;
+ fail (ll) << "description inside " << bt << endf;
case type::eos:
case type::rcbrace:
case type::lcbrace:
- fail (ll) << "expected closing 'end'";
+ fail (ll) << "expected closing 'end'" << endf;
case type::plus:
- fail (ll) << "setup command inside " << bt;
+ fail (ll) << "setup command inside " << bt << endf;
case type::minus:
- fail (ll) << "teardown command inside " << bt;
+ fail (ll) << "teardown command inside " << bt << endf;
}
// Parse one line. Note that this one line can still be multiple
@@ -3220,11 +3217,8 @@ namespace build2
case line_type::cmd_elif:
case line_type::cmd_elifn:
case line_type::cmd_else:
- {
- if (end) break;
-
- // Fall through.
- }
+ if (end) break;
+ // Fall through.
case line_type::cmd_end: return j;
default: break;
}