Skip to content

Commit

Permalink
Add error messages to unreachable ends of switch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ggujjula authored and westes committed Apr 25, 2024
1 parent ccbd9f6 commit 80d7564
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/c99-flex.skl
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,8 @@ int yyinput (yyscan_t yyscanner)
case EOB_ACT_CONTINUE_SCAN:
yyscanner->yy_c_buf_p = yyscanner->yytext_ptr + offset;
break;
default:
yypanic("unexpected return value from yy_get_next_buffer()", yyscanner);
}
}
}
Expand Down Expand Up @@ -2371,6 +2373,8 @@ m4_ifdef([[M4_MODE_FIND_ACTION_REJECT_OR_INTERACTIVE]], [[
yy_cp = yyscanner->yy_c_buf_p;
yy_bp = yyscanner->yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
default:
yypanic("unexpected return value from yy_get_next_buffer()", yyscanner);
} /* end EOB inner switch */
} /* end if */
break;
Expand Down
4 changes: 4 additions & 0 deletions src/cpp-flex.skl
Original file line number Diff line number Diff line change
Expand Up @@ -2271,6 +2271,8 @@ m4_ifdef([[M4_MODE_FIND_ACTION_REJECT_OR_INTERACTIVE]], [[
yy_cp = YY_G(yy_c_buf_p);
yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
goto yy_find_action;
default:
YY_FATAL_ERROR("unexpected return value from yy_get_next_buffer()");
} /* end EOB inner switch */
} /* end if */
break;
Expand Down Expand Up @@ -2795,6 +2797,8 @@ int yyFlexLexer::yyinput()
case EOB_ACT_CONTINUE_SCAN:
YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
break;
default:
YY_FATAL_ERROR("unexpected return value from yy_get_next_buffer()");
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/go-flex.skl
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,8 @@ int yyinput(FlexLexer *yyscanner)
case EOB_ACT_CONTINUE_SCAN:
yyscanner->yyCBufP = yyscanner->yytext_ptr + offset;
break;
default:
yypanic("unexpected return value from yy_get_next_buffer()", yyscanner);
}
}
}
Expand Down Expand Up @@ -2217,6 +2219,8 @@ m4_ifdef([[M4_MODE_FIND_ACTION_REJECT_OR_INTERACTIVE]], [[
yyCp = yyscanner->yyCBufP;
yyBp = yyscanner->yytext_ptr + YY_MORE_ADJ;
goto yyFindActionLabel;
default:
yypanic("unexpected return value from yy_get_next_buffer()", yyscanner);
} /* end EOB inner switch */
} /* end if */
break;
Expand Down

0 comments on commit 80d7564

Please sign in to comment.