[cfe-commits] [PATCH] Re: [cfe-dev] Interest in a -Wusing-namespace-in-headers?

Douglas Gregor dgregor at apple.com
Sat Mar 19 15:55:35 PDT 2011



Sent from my iPhone

On Mar 19, 2011, at 3:27 AM, Sebastian Redl <sebastian.redl at getdesigned.at> wrote:

> 
> On 18.03.2011, at 17:15, Douglas Gregor wrote:
> 
>> 
>> On Mar 17, 2011, at 11:05 AM, Elliot Glaysher (Chromium) wrote:
>> 
>>> Adds a -Wheader-hygiene warning for warnings that should only trigger
>>> in #included files.
>>> 
>>> The first -Wheader-hygiene check is to make sure a using directive
>>> isn't placed in the global context in a header.
>>> 
>>> On Wed, Mar 16, 2011 at 6:15 PM, Douglas Gregor <dgregor at apple.com> wrote:
>>>> You don't need to perform the getDiagnosticLevel() check yourself, because the diagnostic system will handle warning suppression itself.
>>>> 
>>>> However, I do suggest performing the CurContext->getDeclKind() == Decl::TranslationUnit check before the isFromMainFile() check, since the former is cheaper.
>>> 
>>> Done.
>> 
>> Committed in r127881, thanks!
> 
> Do we want to warn about this?
> 
> extern "C++" {
>  using namespace foo;
> }
> 
> Because the fact that extern blocks are decl contexts has bitten me before, and the above suggestion would fall prey to the same issue.

Good point! Yes, we do want to warn about that.



More information about the cfe-commits mailing list