From fd7f32ecd3c3bcb331612a17b79e25a8f1ee8b99 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 22 Aug 2022 14:31:51 +0800 Subject: [PATCH] Improved error handling and diagnostics with failed macro definitions. --- src/cc65/preproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cc65/preproc.c b/src/cc65/preproc.c index f1328c4d0..ffae5baa6 100644 --- a/src/cc65/preproc.c +++ b/src/cc65/preproc.c @@ -1004,6 +1004,7 @@ static void DoDefine (void) if (CurC != '.' || NextC != '.') { PPError ("'...' expected"); ClearLine (); + FreeMacro (M); return; } NextChar (); @@ -1043,8 +1044,9 @@ static void DoDefine (void) /* Check for a right paren and eat it if we find one */ if (CurC != ')') { - PPError ("')' expected"); + PPError ("')' expected for macro definition"); ClearLine (); + FreeMacro (M); return; } NextChar ();