This is the mail archive of the
mailing list for the GCC project.
Re: [C++ PATCH] Warn about use of __func__ when -pedantic
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: "Doug Gregor" <doug dot gregor at gmail dot com>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: 13 Dec 2007 11:49:46 -0600
- Subject: Re: [C++ PATCH] Warn about use of __func__ when -pedantic
- References: <email@example.com>
"Doug Gregor" <firstname.lastname@example.org> writes:
| While reviewing C++0x features that GCC already provides support for,
| I noticed that we don't bother to complain about the C99 "__func__"
| feature in strict C++98 mode, even though this feature is not part of
| C++ 1998/2003. __func__ is a part of C++0x (with the same definition
| as in C99).
| We can do one of two things:
| 1) Warn about the use of __func__ in C++98 mode when -pedantic (the
| attached patch).
| 2) Never warn about __func__ (status quo, all though I'd like to
| commit the testcase in this patch).
| I don't have a strong preference regarding which way we go. Rejecting
| ill-formed code when given "-pedantic" is generally a good thing, but
| __func__ is so benign that I'm not sure I care. The warning may cause
| more harm than good, so I'm slightly leaning toward #2. Opinions?
| Either way, I'd like to commit the new testcase
| (g++.dg/cpp0x/__func__.C), which checks that __func__ doesn't cause a
| diagnostic in C++0x mode. It's fine both with and without the attached
| patch. Regardless, I'll also update gcc-4.3/cxx0x_status.html to
| reflect support for "__func__" in C++0x mode.
Testecase is OK; but the diagnostic hunk is not.