Skip to content

Commit

Permalink
Updated the no start state error message to include only parser name
Browse files Browse the repository at this point in the history
Signed-off-by: Pitchumani Sivanupandi <[email protected]>
  • Loading branch information
psivanup committed Mar 5, 2025
1 parent bf2aa7b commit 585f0a6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontends/p4/validateParsedProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ValidateParsedProgram final : public Inspector {
void postorder(const IR::P4Parser *parser) override {
auto start = parser->states.getDeclaration(IR::ParserState::start);
if (!start) {
::P4::error(ErrorType::ERR_INVALID, "Parser %1% has no 'start' state", parser);
::P4::error(ErrorType::ERR_INVALID, "Parser %1% has no 'start' state", parser->name);
}
container(parser);
distinctParameters(parser->getTypeParameters(), parser->getApplyParameters(),
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_errors_outputs/accept_e.p4-stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
accept_e.p4(18): [--Werror=invalid] error: Invalid parser state: accept should not be implemented, it is built-in
state accept { // reserved name
^^^^^^
accept_e.p4(16): [--Werror=invalid] error: Parser parser p has no 'start' state
accept_e.p4(16): [--Werror=invalid] error: Parser p has no 'start' state
parser p()
^
2 changes: 1 addition & 1 deletion testdata/p4_16_errors_outputs/issue3338.p4-stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
issue3338.p4(1): [--Werror=invalid] error: Parser parser MyParser1 has no 'start' state
issue3338.p4(1): [--Werror=invalid] error: Parser MyParser1 has no 'start' state
parser MyParser1(){
^^^^^^^^^
2 changes: 1 addition & 1 deletion testdata/p4_16_errors_outputs/nostart.p4-stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nostart.p4(17): [--Werror=invalid] error: Parser parser p has no 'start' state
nostart.p4(17): [--Werror=invalid] error: Parser p has no 'start' state
parser p() {
^

0 comments on commit 585f0a6

Please sign in to comment.