m4
has an useful option --synclines
that outputs #line
lines to synchronize output. However, this option breaks C macro definition. Consider the following source file:
#define MACRO blabla
ifelse(`', `', `dnl
a
b
', `dnl
c
d
')
/* */
It results in the following with --synclines
:
+ /bin/bash -c 'm4 -sg test.m4'
#line 1 "test.m4"
#define MACRO blabla
a
#line 2
b
#line 2
#line 9
/* */
And without synclines:
+ /bin/bash -c 'm4 -g test.m4'
#define MACRO blabla
a
b
/* */
The resulting #line
lines inside a macro definition result in an invalid C file that can’t be compiled.
Is it possible to temporarily disable synclines for specific lines in m4?