I'm looking for an open source tool to compare two C++ sources and tell me if they are the same after disregarding comments, formatting and identifier renames.
The purpose is NOT to detect plagiarism, as some tools I've found do. The purpose is to automatically detect whether a cosmetic change to the source code is really purely cosmetic, i.e. whether it changes something other than formatting, comments or variable names (or other identifiers). Obviously a regular text diff tool can't efficiently help here; this needs a language-specific tool.
Preferably, if the tool finds a difference, it should indicate it and then continue analysis, so that I can evaluate myself whether that constitutes a cosmetic change or not (e.g.
int i; for (i ...) ->
for (int i ...)). I'm not asking for these kinds of changes to be automatically detected an ignored by the tool; it would be cool but it's not a requisite.
One possibility I have thought of, is to use a source minifier and compare the minified versions, but I haven't found a C++ minifier that is also able to deal with local identifiers.