I'm just curious if anybody could help with finding good tool for the task. I have large program in C/C++ which needs to be ported from Win32 to Linux. As "wrapping" (i.e. the most OS-sensitive) part was successfully isolated from insides of the program this task only involves going through its "internals". Some things works, some cause small compile time problems but there is one HUGE inconvenient part - macro usage.
Basically most of the internals look like this:
START_MAIN( ... )
SOME_MACRO( ... )
ANOTHER_MACRO( ... )
WRITE_SOMETHING()
END_MAIN()
This makes C/C++ look like Pascal but gives also lots of terrible pain while trying to figure out "what's wrong".
Are there ANY tools to help with parsing this kind of sources to get to the root of problems?
I'm slowly (manually) approaching "compilability" of this program but anything what could help me see through this (artificially structured) mess would be really appreciated.
If you need to manually adjust the compiling, output and stuff (i.e. looking for a customizable C++ parser), clang is a good tool to start with.
In case you just want to see the preprocessed code (with macros expanded), you can use compiler flags:
MSVC: add /P to C++ compiler flags (Project -> Properties -> C/C++ -> Command Line)
GCC, Clang: Add the -E compiler flag
This question about preprocessing C++ code contains some answers you might find useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With