Mark some intentional fall-throughs (in a way understandable to gcc)

This silences -Wimplicit-fallthrough warnings with gcc7.

(Re-Apply without the unintended commits)
This commit is contained in:
Juergen Spitzmueller 2017-08-12 09:06:29 +02:00
parent 0120c3fc10
commit 1249e5e13e
10 changed files with 169 additions and 36 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3871,13 +3871,13 @@ void Paragraph::locateWord(pos_type & from, pos_type & to,
to = from;
return;
}
// no break here, we go to the next
// fall through
case WHOLE_WORD:
// If we are already at the beginning of a word, do nothing
if (!from || isWordSeparator(from - 1))
break;
// no break here, we go to the next
// fall through
case PREVIOUS_WORD:
// always move the cursor to the beginning of previous word

View File

@ -2070,9 +2070,8 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
if (current_view_ == 0)
createView();
}
// fall through
}
// fall through
default:
// The LFUN must be for one of GuiView, BufferView, Buffer or Cursor;
// let's try that:

View File

@ -1989,7 +1989,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
case LFUN_DIALOG_TOGGLE:
flag.setOnOff(isDialogVisible(cmd.getArg(0)));
// fall through to set "enable"
// to set "enable"
// fall through
case LFUN_DIALOG_SHOW: {
string const name = cmd.getArg(0);
if (!doc_buffer)

View File

@ -209,6 +209,8 @@ void InsetCaption::doDispatch(Cursor & cur, FuncRequest & cmd)
break;
}
}
// no "changetype":
// fall through
default:
InsetText::doDispatch(cur, cmd);

View File

@ -209,6 +209,8 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd,
flag.setEnabled(false);
return true;
}
// no subfloat:
// fall through
default:
return InsetCaptionable::getStatus(cur, cmd, flag);

View File

@ -214,6 +214,8 @@ bool InsetLabel::getStatus(Cursor & cur, FuncRequest const & cmd,
enabled = false;
break;
}
// no "changetype":
// fall through
default:
return InsetCommand::getStatus(cur, cmd, status);
}

View File

@ -441,6 +441,7 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd,
return true;
}
}
// fall through
default:
return InsetCaptionable::getStatus(cur, cmd, status);
}

View File

@ -4676,12 +4676,14 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s,
// therefore allow always left but right and center only if there is no width
case Tabular::M_ALIGN_LEFT:
flag = false;
// fall through
case Tabular::ALIGN_LEFT:
status.setOnOff(tabular.getAlignment(cur.idx(), flag) == LYX_ALIGN_LEFT);
break;
case Tabular::M_ALIGN_RIGHT:
flag = false;
// fall through
case Tabular::ALIGN_RIGHT:
status.setEnabled(!(tabular.isMultiRow(cur.idx())
&& !tabular.getPWidth(cur.idx()).zero()));
@ -4690,6 +4692,7 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s,
case Tabular::M_ALIGN_CENTER:
flag = false;
// fall through
case Tabular::ALIGN_CENTER:
status.setEnabled(!(tabular.isMultiRow(cur.idx())
&& !tabular.getPWidth(cur.idx()).zero()));
@ -4710,6 +4713,7 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s,
case Tabular::M_VALIGN_TOP:
flag = false;
// fall through
case Tabular::VALIGN_TOP:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero()
&& !tabular.isMultiRow(cur.idx()));
@ -4719,6 +4723,7 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s,
case Tabular::M_VALIGN_BOTTOM:
flag = false;
// fall through
case Tabular::VALIGN_BOTTOM:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero()
&& !tabular.isMultiRow(cur.idx()));
@ -4728,6 +4733,7 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s,
case Tabular::M_VALIGN_MIDDLE:
flag = false;
// fall through
case Tabular::VALIGN_MIDDLE:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero()
&& !tabular.isMultiRow(cur.idx()));
@ -5006,7 +5012,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
status.setEnabled(false);
return true;
}
// Fall back
// fall through
case LFUN_NEWLINE_INSERT: {
if (tabular.getPWidth(cur.idx()).zero()) {
status.setEnabled(false);
@ -5660,6 +5666,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::M_VALIGN_BOTTOM:
case Tabular::M_VALIGN_MIDDLE:
flag = false;
// fall through
case Tabular::VALIGN_TOP:
case Tabular::VALIGN_BOTTOM:
case Tabular::VALIGN_MIDDLE:
@ -5782,6 +5789,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::SET_ALL_LINES:
setLines = true;
// fall through
case Tabular::UNSET_ALL_LINES:
for (row_type r = sel_row_start; r <= sel_row_end; ++r)
for (col_type c = sel_col_start; c <= sel_col_end; ++c) {
@ -5906,6 +5914,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::UNSET_LTFIRSTHEAD:
flag = false;
// fall through
case Tabular::SET_LTFIRSTHEAD:
tabular.getRowOfLTFirstHead(row, ltt);
checkLongtableSpecial(ltt, value, flag);
@ -5914,6 +5923,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::UNSET_LTHEAD:
flag = false;
// fall through
case Tabular::SET_LTHEAD:
tabular.getRowOfLTHead(row, ltt);
checkLongtableSpecial(ltt, value, flag);
@ -5922,6 +5932,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::UNSET_LTFOOT:
flag = false;
// fall through
case Tabular::SET_LTFOOT:
tabular.getRowOfLTFoot(row, ltt);
checkLongtableSpecial(ltt, value, flag);
@ -5930,6 +5941,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::UNSET_LTLASTFOOT:
flag = false;
// fall through
case Tabular::SET_LTLASTFOOT:
tabular.getRowOfLTLastFoot(row, ltt);
checkLongtableSpecial(ltt, value, flag);
@ -5938,6 +5950,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
case Tabular::UNSET_LTNEWPAGE:
flag = false;
// fall through
case Tabular::SET_LTNEWPAGE:
tabular.setLTNewPage(row, flag);
break;

View File

@ -1028,8 +1028,8 @@ void TeXOnePar(Buffer const & buf,
break;
}
}
// fall through possible
// possible
// fall through
default:
// we don't need it for the last paragraph!!!
if (nextpar)