This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH/C++/diagnostic] Be extra pedantic about stray semicolons
- From: Dirk Mueller <dmueller at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Mar 2007 00:30:28 +0100
- Subject: [PATCH/C++/diagnostic] Be extra pedantic about stray semicolons
Hi,
recently I've been pointed out that there is an inconsistency in the "stray
semicolon" pedwarn. While it warns about stray semicolons here:
void foo()
{
}; // <- warning
it does not warn if its inside a class:
class bla {
void foo()
{
}; // <- no warning
};
Fixing that is straight forward, however causes about 120 regressions, which
are all really boring, except one: g++.old-deja/g++.brendan/warnings2.C.
This testcase reads:
=== Cut ===
// { dg-do assemble }
// GROUPS passed warnings
class K {
public:
void f() {
}; // there should be no warning about this semicolon
};
=== Cut ===
Given that it doesn't define dg-options, it gets default options, which
contains among other flags -pedantic -pedantic-errors, and will therefore
trigger a failure now.
I couldn't figure out via mailing list searching or svn log why this testcase
is there, it has been added longer ago than the svn history serves. I think
it should test that there is no warning by default, e.g. even when
using -Wall -Wextra.
The patch below changes the testcase accordingly. Comments? Opinions?
Ok for trunk?
2007-03-15 Dirk Mueller <dmueller@suse.de>
* g++.old-deja/g++.brendan/warnings2.C: Compile
with -Wall -Wextra -Werror, not with -pedantic.
--- g++.old-deja/g++.brendan/warnings2.C
+++ g++.old-deja/g++.brendan/warnings2.C
@@ -1,4 +1,5 @@
-// { dg-do assemble }
+// { dg-do compile }
+// { dg-options "-Wall -Wextra -Werror" }
// GROUPS passed warnings
class K {
public: