From a6397e7eb72a9238b3a31c987602cc14b08a338f Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sat, 22 Jan 2022 11:45:01 -0500 Subject: [PATCH] ensure #define statements don't propagate comments as well --- cc_macro.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cc_macro.c b/cc_macro.c index 4f493ca..f6419cf 100644 --- a/cc_macro.c +++ b/cc_macro.c @@ -548,6 +548,23 @@ void handle_define() expansion_end->next = NULL; return; } + else if(('/' == macro_token->s[0]) && ('*' == macro_token->s[1])) + { + eat_current_token(); + continue; + } + else if(('/' == macro_token->s[0]) && ('/' == macro_token->s[1])) + { + macro_token->s = "\n"; + if(NULL == expansion_end) + { + hold->expansion = NULL; + expansion_end = macro_token; + return; + } + expansion_end->next = NULL; + return; + } if(NULL == hold) {