remove all useless NOTREACHED comments from the scanner

This commit is contained in:
anon
2024-11-15 18:49:59 +01:00
parent 2f1821d603
commit f25f2eadb6

View File

@ -224,14 +224,12 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
/* the current #if must not have an #else or #elif */ /* the current #if must not have an #else or #elif */
if (elseelif == true) { if (elseelif == true) {
goto endif; goto endif;
/* NOTREACHED */
} }
pseudoelif = true; pseudoelif = true;
BEGIN(INITIAL); BEGIN(INITIAL);
yyless(1); /* rescan all but the line ending */ yyless(1); /* rescan all but the line ending */
yy_set_bol(1); yy_set_bol(1);
goto eol; goto eol;
/* NOTREACHED */
} }
\n{wsnl}* { /* an #endif with no #if right after it */ \n{wsnl}* { /* an #endif with no #if right after it */
endif: endif:
@ -245,7 +243,6 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
yyless(1); yyless(1);
yy_set_bol(1); yy_set_bol(1);
goto eol; goto eol;
/* NOTREACHED */
} }
} }
@ -275,13 +272,11 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
} }
} }
goto more; goto more;
/* NOTREACHED */
} }
\( { /* count unmatched left parentheses for function templates */ \( { /* count unmatched left parentheses for function templates */
++parens; ++parens;
goto more; goto more;
/* NOTREACHED */
} }
\) { \) {
if (--parens <= 0) { if (--parens <= 0) {
@ -293,7 +288,6 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
template = false; template = false;
} }
goto more; goto more;
/* NOTREACHED */
} }
= { /* if a global definition initializer */ = { /* if a global definition initializer */
if (!my_yytext) { return(LEXERR); } if (!my_yytext) { return(LEXERR); }
@ -302,7 +296,6 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
initializer = true; initializer = true;
} }
goto more; goto more;
/* NOTREACHED */
} }
: { /* a if global structure field */ : { /* a if global structure field */
if (!my_yytext) { return(LEXERR); } if (!my_yytext) { return(LEXERR); }
@ -310,7 +303,6 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
structfield = true; structfield = true;
} }
goto more; goto more;
/* NOTREACHED */
} }
\, { \, {
if (braces == initializerbraces) { if (braces == initializerbraces) {
@ -319,7 +311,6 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
} }
structfield = false; structfield = false;
goto more; goto more;
/* NOTREACHED */
} }
; { /* if the enum/struct/union was not a definition */ ; { /* if the enum/struct/union was not a definition */
if (braces == 0) { if (braces == 0) {
@ -337,7 +328,6 @@ ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
structfield = false; structfield = false;
initializer = false; initializer = false;
goto more; goto more;
/* NOTREACHED */
} }
<IN_PREPROC>{ <IN_PREPROC>{
@ -348,7 +338,6 @@ if{ws}+ { /* #if directive */
if (pseudoelif == true) { if (pseudoelif == true) {
pseudoelif = false; pseudoelif = false;
goto elif; goto elif;
/* NOTREACHED */
} }
/* make sure there is room for the current brace count */ /* make sure there is room for the current brace count */
if (iflevel == miflevel) { if (iflevel == miflevel) {
@ -361,7 +350,6 @@ if{ws}+ { /* #if directive */
maxifbraces[iflevel++] = 0; maxifbraces[iflevel++] = 0;
BEGIN(INITIAL); BEGIN(INITIAL);
goto more; goto more;
/* NOTREACHED */
} }
else({ws}.*)? { /* #else --- eat up whole line */ else({ws}.*)? { /* #else --- eat up whole line */
elseelif = true; elseelif = true;
@ -376,7 +364,6 @@ else({ws}.*)? { /* #else --- eat up whole line */
} }
BEGIN(INITIAL); BEGIN(INITIAL);
goto more; goto more;
/* NOTREACHED */
} }
elif{ws}+ { /* #elif */ elif{ws}+ { /* #elif */
/* elseelif = true; --- HBB I doubt this is correct */ /* elseelif = true; --- HBB I doubt this is correct */
@ -392,7 +379,6 @@ elif{ws}+ { /* #elif */
} }
BEGIN(INITIAL); BEGIN(INITIAL);
goto more; goto more;
/* NOTREACHED */
} }
endif([^a-zA-Z0-9_$\n].*)? { /* #endif */ endif([^a-zA-Z0-9_$\n].*)? { /* #endif */
/* delay treatment of #endif depending on whether an /* delay treatment of #endif depending on whether an
@ -419,7 +405,6 @@ include{ws}*<[^>\n]+> { /* #include file */
} }
BEGIN(INITIAL); BEGIN(INITIAL);
return(INCLUDE); return(INCLUDE);
/* NOTREACHED */
} }
define{ws}+{identifier} { define{ws}+{identifier} {
@ -442,19 +427,16 @@ define{ws}+{identifier} {
last = my_yyleng; last = my_yyleng;
BEGIN(INITIAL); BEGIN(INITIAL);
goto definition; goto definition;
/* NOTREACHED */
} }
\n { /* unknown preprocessor line */ \n { /* unknown preprocessor line */
BEGIN(INITIAL); BEGIN(INITIAL);
++myylineno; ++myylineno;
goto more; goto more;
/* NOTREACHED */
} }
. | . |
{identifier} { /* unknown preprocessor line */ {identifier} { /* unknown preprocessor line */
BEGIN(INITIAL); BEGIN(INITIAL);
goto more; goto more;
/* NOTREACHED */
} }
} }
@ -464,7 +446,6 @@ define{ws}+{identifier} {
yyless(5); /* eat up 'class', and re-scan */ yyless(5); /* eat up 'class', and re-scan */
yy_set_bol(0); yy_set_bol(0);
goto more; goto more;
/* NOTREACHED */
} }
("enum"|"struct"|"union") { ("enum"|"struct"|"union") {
@ -507,7 +488,6 @@ if{wsnl}*\( { /* ignore 'if' */
BEGIN(WAS_IDENTIFIER); BEGIN(WAS_IDENTIFIER);
ident_start = first; ident_start = first;
goto more; goto more;
/* NOTREACHED */
} }
<WAS_IDENTIFIER>{ <WAS_IDENTIFIER>{
@ -528,27 +508,22 @@ if{wsnl}*\( { /* ignore 'if' */
fcndef = true; fcndef = true;
token = FCNDEF; token = FCNDEF;
goto fcn; goto fcn;
/* NOTREACHED */
} }
goto fcncal; goto fcncal;
/* NOTREACHED */
} }
{function_call} { /* function call */ {function_call} { /* function call */
fcncal: if (fcndef == true || ppdefine == true || rules == true) { fcncal: if (fcndef == true || ppdefine == true || rules == true) {
token = FCNCALL; token = FCNCALL;
goto fcn; goto fcn;
/* NOTREACHED */
} }
if (template == false) { if (template == false) {
templateparens = parens; templateparens = parens;
template = true; template = true;
} }
goto ident; goto ident;
/* NOTREACHED */
} }
("*"|{wsnl})+{identifier} { /* typedef name or modifier use */ ("*"|{wsnl})+{identifier} { /* typedef name or modifier use */
goto ident; goto ident;
/* NOTREACHED */
} }
.|\n { /* general identifer usage */ .|\n { /* general identifer usage */
char *s; char *s;
@ -655,7 +630,6 @@ if{wsnl}*\( { /* ignore 'if' */
} }
/* my_yymore(); */ /* my_yymore(); */
return(token); return(token);
/* NOTREACHED */
} }
} }
} }
@ -663,19 +637,16 @@ if{wsnl}*\( { /* ignore 'if' */
\[ { /* array dimension (don't worry or about subscripts) */ \[ { /* array dimension (don't worry or about subscripts) */
arraydimension = true; arraydimension = true;
goto more; goto more;
/* NOTREACHED */
} }
\] { \] {
arraydimension = false; arraydimension = false;
goto more; goto more;
/* NOTREACHED */
} }
\\\n { /* preprocessor statement is continued on next line */ \\\n { /* preprocessor statement is continued on next line */
/* save the '\\' to the output file, but not the '\n': */ /* save the '\\' to the output file, but not the '\n': */
yyleng = 1; yyleng = 1;
my_yymore(); my_yymore();
goto eol; goto eol;
/* NOTREACHED */
} }
\n { /* end of the line */ \n { /* end of the line */
if (ppdefine == true) { /* end of a #define */ if (ppdefine == true) { /* end of a #define */
@ -729,38 +700,31 @@ if{wsnl}*\( { /* ignore 'if' */
\' { /* character constant */ \' { /* character constant */
if (filetype == FILETYPE_SDL) { BEGIN(IN_SQUOTE); } if (filetype == FILETYPE_SDL) { BEGIN(IN_SQUOTE); }
goto more; goto more;
/* NOTREACHED */
} }
<IN_SQUOTE>\' { <IN_SQUOTE>\' {
BEGIN(INITIAL); BEGIN(INITIAL);
goto more; goto more;
/* NOTREACHED */
} }
\" { /* string constant */ \" { /* string constant */
BEGIN(IN_DQUOTE); BEGIN(IN_DQUOTE);
goto more; goto more;
/* NOTREACHED */
} }
<IN_DQUOTE>\" { <IN_DQUOTE>\" {
BEGIN(INITIAL); BEGIN(INITIAL);
goto more; goto more;
/* NOTREACHED */
} }
<IN_DQUOTE,IN_SQUOTE>{ <IN_DQUOTE,IN_SQUOTE>{
\n { /* syntax error: unexpected EOL */ \n { /* syntax error: unexpected EOL */
BEGIN(INITIAL); BEGIN(INITIAL);
goto eol; goto eol;
/* NOTREACHED */
} }
\\. | \\. |
. { . {
goto more; goto more;
/* NOTREACHED */
} }
\\\n { /* line continuation inside a string! */ \\\n { /* line continuation inside a string! */
myylineno++; myylineno++;
goto more; goto more;
/* NOTREACHED */
} }
} }
@ -794,7 +758,6 @@ if{wsnl}*\( { /* ignore 'if' */
} else { } else {
++myylineno; ++myylineno;
} }
/* NOTREACHED */
} }
"*"+"/" { "*"+"/" {
/* replace the comment by a single blank */ /* replace the comment by a single blank */
@ -806,7 +769,6 @@ if{wsnl}*\( { /* ignore 'if' */
"//".*\n? { "//".*\n? {
/* C++-style one-line comment */ /* C++-style one-line comment */
goto eol; goto eol;
/* NOTREACHED */
} }
{number} | /* number */ {number} | /* number */