Page MenuHomePhabricator

modularize - Add checks for #include in 'extern "C/C++" {}' or 'namespace (name) {}' blocks
ClosedPublic

Authored by jtsoftware on Sep 11 2013, 1:27 PM.

Details

Summary

It's a potential problem for modules (and headers in general) if '#include' directives occur inside 'extern "C/C++" {}' or 'namespace (name) {}' blocks, because that can produce different underlying definitions if other sources include the header outside of such blocks. This patch to modularize checks for these cases, treating them as errors, and produces error message referencing both the offending '#include' and the enclosing 'extern "C/C++" {}' or 'namespace (name) {}' block.

Diff Detail

Event Timeline

doug.gregor accepted this revision.Sep 25 2013, 11:55 AM

Very nice check. LGTM.

jtsoftware closed this revision.May 5 2014, 6:09 PM

Committed in r190950.

modularize/PreprocessorTracker.cpp
934

Fixed typo "with" => "within"