This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Include file visibility scopes? (Was: Re: [RFC] Include file structuring.)
- From: Diego Novillo <dnovillo at google dot com>
- To: Joern Rennecke <joern dot rennecke at embecosm dot com>
- Cc: Andrew MacLeod <amacleod at redhat dot com>, Jeff Law <law at redhat dot com>, GCC <gcc at gcc dot gnu dot org>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Wed, 23 Oct 2013 08:02:30 -0400
- Subject: Re: Include file visibility scopes? (Was: Re: [RFC] Include file structuring.)
- Authentication-results: sourceware.org; auth=none
- References: <CAMqJFCryJgrdOcOuKuCrZ5Tcx-1n2vLNt=3GhYnjn4Em9PZX0w at mail dot gmail dot com>
On Tue, Oct 22, 2013 at 11:09 PM, Joern Rennecke
<joern.rennecke@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.