-------- Original-Nachricht -------- > Datum: Wed, 23 Mar 2011 12:22:11 -0700 > Von: "Elliot Glaysher (Chromium)" <[email protected]> > An: Douglas Gregor <[email protected]> > CC: Sebastian Redl <[email protected]>, "[email protected]" > <[email protected]>, "[email protected]" <[email protected]>, > Daniel James <[email protected]> > Betreff: Re: [cfe-commits] [PATCH] Re: [cfe-dev] Interest in a > -Wusing-namespace-in-headers?
> On Sat, Mar 19, 2011 at 3:55 PM, Douglas Gregor <[email protected]> wrote: > > On Mar 19, 2011, at 3:27 AM, Sebastian Redl > <[email protected]> wrote: > >> 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. > > Is the attached patch sufficient, or are there other cases I should be > checking for? That's not the right way to do it, since now you would warn about this: namespace ns1 { extern "C++" { using namespace ns2; } } What you have to do is call DeclContext::getEnclosingNamespaceContext() on the context that contains the using directive, and check whether that is a TranslationUnitDecl or a NamespaceDecl. Sebastian -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
