Ensuring that comments still appear in listing
authorLukas Krickl <lukas@krickl.dev>
Fri, 29 Dec 2023 06:36:19 +0000 (07:36 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 29 Dec 2023 06:36:19 +0000 (07:36 +0100)
src/ulas.c

index 26b3268779376ea910017183ee50f3ef67915c8f..8f03ed9198a474b54be84dc6cb7e5635a2b80dbf 100644 (file)
@@ -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: {