1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 02:29:32 +00:00

Prevent missed .ENDMACRO in included file

This commit is contained in:
Marco Aurelio da Costa 2021-04-27 08:21:06 -03:00 committed by Oliver Schmidt
parent b9a3c78888
commit 04cd884f8f

View File

@ -491,6 +491,23 @@ void MacDef (unsigned Style)
*/
while (1) {
/* Check for include */
if (CurTok.Tok == TOK_INCLUDE) {
/* Include another file */
NextTok ();
/* Name must follow */
if (CurTok.Tok != TOK_STRCON) {
ErrorSkip ("String constant expected");
} else {
SB_Terminate (&CurTok.SVal);
if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) {
/* Error opening the file, skip remainder of line */
SkipUntilSep ();
}
}
NextTok ();
}
/* Check for end of macro */
if (Style == MAC_STYLE_CLASSIC) {
/* In classic macros, only .endmacro is allowed */
@ -510,22 +527,6 @@ void MacDef (unsigned Style)
}
}
if (CurTok.Tok == TOK_INCLUDE) {
/* Include another file */
NextTok ();
/* Name must follow */
if (CurTok.Tok != TOK_STRCON) {
ErrorSkip ("String constant expected");
} else {
SB_Terminate (&CurTok.SVal);
if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) {
/* Error opening the file, skip remainder of line */
SkipUntilSep ();
}
}
NextTok ();
}
/* Check for a .LOCAL declaration */
if (CurTok.Tok == TOK_LOCAL && Style == MAC_STYLE_CLASSIC) {