On Feb 27, 2013, at 7:19 AM, Nico Weber <[email protected]> wrote: > On Wed, Feb 27, 2013 at 3:32 PM, Nico Weber <[email protected]> wrote: >> On Tue, Feb 26, 2013 at 11:37 PM, John McCall <[email protected]> wrote: >>> On Feb 26, 2013, at 2:36 PM, Rafael Espíndola <[email protected]> >>> wrote: >>>>> We should just not cache visibility for types. >>>> >>>> Can do. I will send a patch. >>> >>> Thanks! As you're doing so, please change it to use the same LinkageInfo >>> structure that NamedDecl uses. You'll need to make it a non-member type >>> and possibly pull it into its own header. >> >> As of clang r176164 chromium's components build works again, with just >> 6 additional explicit EXPORTs on predeclared types used in template >> instantiations. Thanks for the help! > > …while the clang build is happy with these changes, the gcc build > breaks with them because gcc warns > > test.cc:6: warning: type attributes ignored after type is already defined > > on code like > > $ cat test.cc > #define EXPORT __attribute__((visibility("default"))) > > class Layer; > class EXPORT Layer { > }; > class EXPORT Layer; > > Due to the template instantiation requiring the EXPORT on the > declaration of Layer happening in one header and the definition of > Layer happening in another, it depends on header include order if gcc > is happy or not. > > Do you have a better suggestion than putting the EXPORTed declaration > of Layer into an #ifdef __clang__ block? Requiring this would be > pretty ugly. (It's only 3 files for us so we'll live, but the user > experience is a lot worse than in gcc / msvc.)
Maybe use an EXPORT_FORWARD_DECL macro? That seems like a good bug to file against GCC, by the way. There's no reason for them to warn about a *redundant* attribute on a redeclaration. John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
