PLEASE REVIEW: modularize: new preprocessor conditional directive checking feature
Thompson, John
John_Thompson at playstation.sony.com
Tue Jun 11 13:23:30 PDT 2013
Hi,
I've made a first stab at a feature for the modularize tool for finding preprocessor conditionals that might be problematic for modules.
It uses a derived PPCallbacks class (thanks of the info on this, Sean) to track the preprocessing of files, and if it finds conditional directives (#if, #elif, #ifdef, #ifndef) whose conditionals resolve differently in other instances of the header being processed, it produces messages like this:
warning: The instances of header InconsistentSubHeader.h have different contents after preprocessing:
When included or nested in these top-level headers:
InconsistentHeader1.h
This preprocessor directive is mismatched (the parentheses show the condition after macro substitution):
InconsistentSubHeader.h:9:1: #if SYMBOL == 1 (#if 1 == 1)
When included or nested in these top-level headers:
InconsistentHeader2.h
This preprocessor directive is mismatched (the parentheses show the condition after macro substitution):
InconsistentSubHeader.h:9:1: #if SYMBOL == 1 (#if 2 == 1)
I've enclose both a patch relative to tools/clang/tools/extra, and a zip file, if the latter is easier to read for new files.
Thanks.
-John Thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130611/e7769683/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: modularize_1_patch.txt
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130611/e7769683/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mod_2013_06_11.zip
Type: application/x-zip-compressed
Size: 59598 bytes
Desc: mod_2013_06_11.zip
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130611/e7769683/attachment.bin>
More information about the cfe-commits
mailing list