[cfe-dev] Interest in a -Wusing-namespace-in-headers?
Douglas Gregor
dgregor at apple.com
Wed Mar 16 16:00:34 PDT 2011
On Mar 16, 2011, at 3:54 PM, Elliot Glaysher (Chromium) wrote:
> On Wed, Mar 16, 2011 at 3:33 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> Are there other constructs that we should warn about in headers? If so, should they be grouped under the same warning flag?
>
> Off the top of my head, the only other warning I can think of is:
>
> namespace {} // expect-warning {{code in anonymous namespaces in
> headers may be compiled in multiple translation units}}
Okay. I'm mainly concerned that there's a steady stream of such opt-in warnings, and that users would be better served by having them grouped under some more-general "-Wheader-hygiene" flag, rather than having to find all of the individual -W flags that they want to turn on.
>> I'd prefer if the warning referred to these entities as "using directives" (both for the warning flag and in the text), since that's the term the standard uses.
>
> I can do that. I included the phrase "using namespace" as I was
> worried about users think this would ban UsingDecl, not just
> UsingDirectiveDecl.
Yeah. Actually, I think "using namespace directive" is fine in the warning text, but let's keep the warning option name precise (-Wusing-directive-in-system-header) or go ahead with the -Wheader-hygiene idea.
- Doug
More information about the cfe-dev
mailing list