C macros get expanded in asm comments:
// GPL 2.0 or later
#define wait \
wait: \
dec a \
jp nz, wait
void vdu_sprite_init() {
__asm
;; Copy dma wait routine to himem
__endasm;
}
sdcc -mz80 -c ./macro_in_comment.c
./macro_in_comment.c:7: warning 283: function declarator with no prototype
macro_in_comment.asm:51: Error: <q> missing or improper operators, terminators, or delimiters
removing macro_in_comment.rel
_vdu_sprite_init::
;./macro_in_comment.c:12: __endasm;
;; Copy dma wait:
dec a
jp nz, wait routine to himem
;./macro_in_comment.c:13: }
ret
That's what I get for giving my macros such a poorly conceived name.
This is probably closely related to [bugs:#3512].
AFAIK, the current preprocessor simply does not know what a comment in the target assembly language looks like and therefore treats it like any other piece of assembly code, i.e. code where macros are permitted.
Related
Bugs: #3512