[cfe-commits] [patch][pr11822] Error on mismatched #pragma GCC visibility push/pop

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jan 30 06:25:29 PST 2012


> Is it possible to error on the #prama, even when diagnosing the case about
> the namespace end? That would be ideal...

Not sure what you mean. We do error on:

// GCC 4.6 accepts this, but the "hidden" leaks past the namespace end.
namespace test2 __attribute__((visibility("hidden"))) {
#pragma GCC visibility push(protected) // expected-note{{#pragma started here}}
} // expected-error{{#pragma visibility push matches a namespace end}}

> If not possible (and I can see reasons why it may not be) I would reverse
> the wording in the message:
>
> "namespace ends inside a still-open pragma visibility"
>
> I'm not entirely happy with the error message, as reading the errors I don't
> actually know what's gone wrong. ;] However, I don't know whats gone wrong
> reading the code either, so I'm hoping Richard can suggest more descriptive
> messages?

The high level description is that an opening "#pragma GCC visibility
push" is being closed with a "}" or a namespace with explicit
visibility is being closed with a "#pragma GCC visibility pop".



More information about the cfe-commits mailing list