Skip to content

Commit

Permalink
ParmParse: Fix a GCC warning (#4168)
Browse files Browse the repository at this point in the history
The default section of the switch statement, if reached, had an
out-of-bound access to the state name array.
  • Loading branch information
WeiqunZhang authored Sep 27, 2024
1 parent 467dd68 commit 1541713
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions Src/Base/AMReX_ParmParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@ enum lexState
LIST
};

const char* const
state_name[] =
{
"START",
"STRING",
"QUOTED_STRING",
"IDENTIFIER",
"LIST"
};

int
eat_garbage (const char*& str)
{
Expand Down Expand Up @@ -348,7 +338,7 @@ getToken (const char*& str, std::string& ostr, int& num_linefeeds)
break;
default:
amrex::ErrorStream() << "ParmParse::getToken(): invalid string = " << ostr << '\n'
<< "STATE = " << state_name[state]
<< "STATE = " << static_cast<int>(state)
<< ", next char = " << ch << '\n'
<< ", rest of input = \n" << str << '\n';
amrex::Abort();
Expand Down

0 comments on commit 1541713

Please sign in to comment.