This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] warning about empty extern "C" structures


Andrew Pinski <pinskia@physics.uc.edu> writes:

| On May 17, 2006, at 7:32 PM, Roman Kononov wrote:
| 
| > extern "C" { struct CS {}; }  // { dg-warning "" }
| > extern "C" { union  CU {}; }  // { dg-warning "" }
| 
| 
| Can you not use "" for the dg-warning and put part of the warning
| in the dg-warning so that if another warning shows up, the testcase
| can fail.
| 
| +      if (current_lang_name == lang_name_c)
| 
| Won't this cause us to warn about stuff like:
| 
| extern "C" int f(void)
| {
|    struct a{};
|    struct b : a{};
| }

Good point.

| Which seems wrong to warn about because there is not going to be
| exported
| at all.
| I think it is also wrong to warn about:
| namespace
| {
|    extern "C" { struct c{}; }
| }
| 
| But I don't remember about the linkage requirement for extern "C" for
| a struct
| in an anonymous  namespace.

As said earlier, 'extern "C"' does not change anything for structs --
no matter what Roman claims.

'extern "C"' does not behave differently for named namespace from
unnamed namespaces.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]