m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File extensions to use pre-processing C source?


From: Raphael 'kena' Poss
Subject: Re: File extensions to use pre-processing C source?
Date: Wed, 23 Apr 2014 09:48:44 +0200

Dear Daniel,

here at UvA we have developed a C extension which requires m4 preprocessing, so 
I wanted to share the experience. Maybe you will find something for you there.

In our setting we use m4 *after* the C preprocessor. 
So the chain is:

   .c -> (cpp) -> .i -> (m4) -> .i.c -> (gcc) -> .o

The reason is that we want to expand m4 macros in all headers imported from 
#include.
Also m4 macro uses may be generated as a result of expanding C macros.
To manage the compile chain of course you can write Makefiles, but for our 
application I found it easier to write a custom compiler driver that invokes 
the right tools depending on the type of files given on the command line.

Also any way you choose, you may want to care about line numbers. The format 
used by m4 is slightly different from the one expected/used by gcc. Especially 
if you run cpp first, you want m4 to "know" about custom line number 
information. I made a patch to m4 in that direction, posted on the m4-patches 
mailing list in 2009/2010, but it has not been merged yet. Ping me if you are 
interested.

Best regards,


-- 
Raphael 'kena' Poss ยท address@hidden
http://staff.science.uva.nl/~poss/










reply via email to

[Prev in Thread] Current Thread [Next in Thread]