This application removes comments from C/C++ source code.
Motivation: as I'm working from time to time with medium-to-large size third party code (pjsip, baresip) it was written to help with comparing source code of different version of projects. Most annoying thing are CVS tags in pjsip source code as once code is checked in and then checked out from own repository they are expanded/rewritten creating differences in every single file. Copyright notices are also annoying in similar way as they often may be single one detail changing between software version from different years.
What does this application do?
- processing recursively files from selected folder
- removing comments containing selected strings or all comments
- preserving file timestamps (by default) - original timestamps make comparing source easier
Files are processed in place (overwritten) - make sure to not work on main copy of the project. I've tested this tool on projects based on both pjsip (300+ kLOC) and baresip but handling of some rarely used language constructions is omitted (continuation inside single-line comments), results might be also unexpected when source code is not valid (has syntax errors). Preprocessor expression are also not evaluated thus text from "#if 0" blocks is processed and it has higher chance to trigger unexpected behavior as it may contain unclosed block comment.