Improved error handling and diagnostics with failed macro definitions.

This commit is contained in:
acqn
2022-08-22 14:31:51 +08:00
parent 8605393953
commit fd7f32ecd3

View File

@@ -1004,6 +1004,7 @@ static void DoDefine (void)
if (CurC != '.' || NextC != '.') { if (CurC != '.' || NextC != '.') {
PPError ("'...' expected"); PPError ("'...' expected");
ClearLine (); ClearLine ();
FreeMacro (M);
return; return;
} }
NextChar (); NextChar ();
@@ -1043,8 +1044,9 @@ static void DoDefine (void)
/* Check for a right paren and eat it if we find one */ /* Check for a right paren and eat it if we find one */
if (CurC != ')') { if (CurC != ')') {
PPError ("')' expected"); PPError ("')' expected for macro definition");
ClearLine (); ClearLine ();
FreeMacro (M);
return; return;
} }
NextChar (); NextChar ();