Open agners opened 6 years ago
how do you use simplecpp? on the command line like this:
simplecpp 1.c
?
I would personally prefer that you use the token list output instead but that might be more complex for you. you then have to write a c++ program (you can just tweak simplecpp/main.cpp) that uses simplecpp.
I think that we want to have 2 different behaviors. For debugging I want to see what tokens are created so I want to have the extra space. Users do not want to have extra spaces. So I need to add some debug flag that I can use.
If you want to try to fix this the feel free to look at it. I believe that you can just tweak simplecpp::TokenList::stringify
in simplecpp.cpp.
I try to use it as drop in replacement for GCC's preprocessor to preprocess Linux kernel device trees. The GCC command looks like this:
cpp -nostdinc -x assembler-with-cpp -I../linux/include/ -o output.dts.tmp input.dts
The simplecpp command looks like this:
simplecpp -D__DTS__ -I../linux/include/ input.dts > output.dts.tmp
Why not use gcc? The text output is for debugging purposes. It is tricky to get the spacing exactly as gcc and I rather not worry about if the debug output is exactly like gcc or not.
To me this is currently a low prio issue.
When trying to reuse the simplecpp for device tree it turns out that simplecpp changes spacing such that the output can't be read by the device tree compiler. simplepcc inserts a space between the ampersand and the label, such that they can not be read by dtc, e.g.
& gpio
).It would be nice to have an option which preserves spaces as much as possible.