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] Warn about use of __func__ when -pedantic


"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


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