From: Lukas Krickl Date: Fri, 29 Dec 2023 06:36:19 +0000 (+0100) Subject: Ensuring that comments still appear in listing X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=7828c119e5af8a5739ff28ac67f9decc71982c28;p=ulas%2F.git Ensuring that comments still appear in listing --- diff --git a/src/ulas.c b/src/ulas.c index 26b3268..8f03ed9 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -708,6 +708,7 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line, int read = 0; int first_tok = 1; int skip_next_tok = 0; + int comment_seen = 0; // go through all tokens, see if a define matches the token, // if so expand it @@ -727,11 +728,11 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line, } else if (pp->tok.buf[0] == ULAS_TOK_COMMENT) { // if its a comment at the end of a preproc statement // just bail now - break; + comment_seen = 1; } first_tok = 0; - if (def) { + if (def && !comment_seen) { // if so... expand now and leave switch (def->type) { case ULAS_PPDEF: {