Skip to content

Commit a2dd7a5

Browse files
committed
fix #14352
1 parent dbc792d commit a2dd7a5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/preprocessor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList &tokenList)
10581058
continue;
10591059

10601060
const simplecpp::Token *endasm = tok3;
1061+
bool foundEndasm = false;
10611062
while ((endasm = endasm->next) != nullptr) {
10621063
if (endasm->op != '#' || sameline(endasm,endasm->previousSkipComments()))
10631064
continue;
@@ -1069,9 +1070,13 @@ void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList &tokenList)
10691070
continue;
10701071
while (sameline(endasm,endasm3))
10711072
endasm = endasm->next;
1073+
foundEndasm = true;
10721074
break;
10731075
}
10741076

1077+
if (!foundEndasm)
1078+
throw InternalError(nullptr, "syntax error: missing #pragma endasm", InternalError::SYNTAX);
1079+
10751080
const simplecpp::Token * const tok4 = tok3->next;
10761081
tok->setstr("asm");
10771082
const_cast<simplecpp::Token *>(tok2)->setstr("(");

0 commit comments

Comments
 (0)