[C++ PATCH] Warn about use of __func__ when -pedantic
Gabriel Dos Reis
gdr@cs.tamu.edu
Thu Dec 13 17:46:00 GMT 2007
"Doug Gregor" <doug.gregor@gmail.com> 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.
-- Gaby
More information about the Gcc-patches
mailing list