[Bug c++/51440] Improve message and add an option for warning for an unnamed struct member: TYPE has a field FIELD whose type uses the anonymous namespace

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 26 20:26:00 GMT 2013


Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-26
                 CC|                            |manu at gcc dot gnu.org
            Summary|C++ compiler produces       |Improve message and add an
                   |warning for an unnamed      |option for warning for an
                   |struct member: TYPE has a   |unnamed struct member: TYPE
                   |field FIELD whose type uses |has a field FIELD whose
                   |the anonymous namespace     |type uses the anonymous
                   |                            |namespace
     Ever Confirmed|0                           |1

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-03-26 20:26:15 UTC ---
(In reply to comment #3)
> +1 for the ability to disable this warning.

1) Invent a descriptive name for the warning, say "bla"
2) Add -Wbla to gcc/c-family/c.opt, document it in gcc/doc/invoke.texi
3) Change:

decl2.c-2335       if (!in_main_input_context ())
decl2.c-2336-         warning (0, "\
decl2.c-2336+         warning (OPT_Wbla, "\
decl2.c:2337:%qT has a field %qD whose type uses the anonymous namespace",
decl2.c-2338                  type, t);
decl2.c-2339     }

4) bootstrap

5) run testsuite, fix failing tests, submit patch to gcc-patches, profit.

+ Bonus points for improving the message to explain user what is exactly the
potential problem.

++ Extra bonus points if the explanation does not include the words "internal

(Note that you can do steps 1-4 in your own copy, but it will be broken again
in the next release, so it is better to contribute your patch).

More information about the Gcc-bugs mailing list