fix(*): [[fallthrough]] ==> /* fall-thru */

Older gcc compilers generate a warning when the attribute is used.
I found out that GCC 7 will not produce a warning if comments
such as /* fall-thru */ or /* FALLTHRU */ are used instead of the
attribute [[fallthrough]]
This commit is contained in:
Leonardo de Moura 2017-05-31 21:18:47 -07:00
parent 24048c4258
commit 56215b36e8
6 changed files with 15 additions and 15 deletions

View file

@ -2511,7 +2511,7 @@ bool parser::parse_command_like() {
next();
break;
}
[[fallthrough]];
/* fall-thru */
default:
throw parser_error("command expected", pos());
}

View file

@ -303,7 +303,7 @@ void mt_task_queue::cancel_core(gtask const & t) {
switch (get_state(t).load()) {
case task_state::Waiting:
m_waiting.erase(t);
[[fallthrough]];
/* fall-thru */
case task_state::Created: case task_state::Queued:
fail(t, std::make_exception_ptr(cancellation_exception()));
handle_finished(t);

View file

@ -877,7 +877,7 @@ void vm_instr::serialize(serializer & s, std::function<name(unsigned)> const & i
break;
case opcode::BuiltinCases:
s << idx2name(m_cases_idx);
[[fallthrough]];
/* fall-thru */
case opcode::CasesN:
s << m_npcs[0];
for (unsigned j = 1; j < m_npcs[0] + 1; j++)

View file

@ -41,17 +41,17 @@ unsigned hash_str(unsigned length, char const * str, unsigned init_value) {
c += length;
switch (len) {
/* all the case statements fall through */
case 11: c+=((unsigned)str[10] << 24); [[fallthrough]];
case 10: c+=((unsigned)str[9] << 16); [[fallthrough]];
case 9 : c+=((unsigned)str[8] << 8); [[fallthrough]];
case 11: c+=((unsigned)str[10] << 24); /* fall-thru */
case 10: c+=((unsigned)str[9] << 16); /* fall-thru */
case 9 : c+=((unsigned)str[8] << 8); /* fall-thru */
/* the first byte of c is reserved for the length */
case 8 : b+=((unsigned)str[7] << 24); [[fallthrough]];
case 7 : b+=((unsigned)str[6] << 16); [[fallthrough]];
case 6 : b+=((unsigned)str[5] << 8); [[fallthrough]];
case 5 : b+=str[4]; [[fallthrough]];
case 4 : a+=((unsigned)str[3] << 24); [[fallthrough]];
case 3 : a+=((unsigned)str[2] << 16); [[fallthrough]];
case 2 : a+=((unsigned)str[1] << 8); [[fallthrough]];
case 8 : b+=((unsigned)str[7] << 24); /* fall-thru */
case 7 : b+=((unsigned)str[6] << 16); /* fall-thru */
case 6 : b+=((unsigned)str[5] << 8); /* fall-thru */
case 5 : b+=str[4]; /* fall-thru */
case 4 : a+=((unsigned)str[3] << 24); /* fall-thru */
case 3 : a+=((unsigned)str[2] << 16); /* fall-thru */
case 2 : a+=((unsigned)str[1] << 8); /* fall-thru */
case 1 : a+=str[0];
/* case 0: nothing left to add */
}

View file

@ -81,7 +81,7 @@ unsigned hash(unsigned n, H h, unsigned init_value = 31) {
a += init_value;
switch (n) {
case 2: b += h(1); [[fallthrough]];
case 2: b += h(1); /* fall-thru */
case 1: c += h(0);
}
mix(a, b, c);

View file

@ -350,7 +350,7 @@ column_is_dual_feasible(unsigned j) const {
case upper_bound:
std::cout << "upper_bound type should be switched to low_bound" << std::endl;
lean_unreachable();
[[fallthrough]];
/* fall-thru */
case free_column:
return numeric_traits<X>::is_zero(m_d[j]);
default: