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; to = from;
return; return;
} }
// no break here, we go to the next // fall through
case WHOLE_WORD: case WHOLE_WORD:
// If we are already at the beginning of a word, do nothing // If we are already at the beginning of a word, do nothing
if (!from || isWordSeparator(from - 1)) if (!from || isWordSeparator(from - 1))
break; break;
// no break here, we go to the next // fall through
case PREVIOUS_WORD: case PREVIOUS_WORD:
// always move the cursor to the beginning of 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) if (current_view_ == 0)
createView(); createView();
} }
// fall through
} }
// fall through
default: default:
// The LFUN must be for one of GuiView, BufferView, Buffer or Cursor; // The LFUN must be for one of GuiView, BufferView, Buffer or Cursor;
// let's try that: // let's try that:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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