On Tue, Oct 22, 2013 at 11:09 PM, Joern Rennecke <joern.renne...@embecosm.com> wrote:
> I wonder what it'd take to have a cpp extension to include a file in > such a manner as to > emit a diagnostic if the items declared / #defined inside are used > directly by a file > that includes the file that does the thus guarded include. > We already have some tracking of where source comes from now for the purposes > of printing include backtraces... > Woud probably want to re-set the usable scope if there is a later include of > the > same file, mutliple-include-guards notwithstanding... You are describing something very similar to the IWYU tool: https://code.google.com/p/include-what-you-use/ It's harder than it looks. I spent some time working on it when we were developing it as a GCC plugin. It's now a proper clang client, but it's not foolproof. I have not looked into it in years, so I don't know what the current state is. Diego.