aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-01-14 23:03:58 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2004-01-14 23:03:58 +0000
commitf560bf91ae0ba419d7445eb19c09a4d1ad341e75 (patch)
treefb2f0477c443e1bcc4e0b1c4601f9fca76be4ac1 /gcc
parent95c755e90f94c5fbeed8cf58896d114989f9c771 (diff)
downloadgcc-f560bf91ae0ba419d7445eb19c09a4d1ad341e75.zip
gcc-f560bf91ae0ba419d7445eb19c09a4d1ad341e75.tar.gz
gcc-f560bf91ae0ba419d7445eb19c09a4d1ad341e75.tar.bz2
c-parse.in (stmts_and_decls): Make label at end of compound statement a hard error.
* c-parse.in (stmts_and_decls): Make label at end of compound statement a hard error. testsuite: * gcc.dg/label-compound-stmt-1.c: New test. * gcc.c-torture/compile/950922-1.c, gcc.c-torture/compile/20000211-3.c, gcc.c-torture/compile/20000518-1.c, gcc.c-torture/compile/20021108-1.c: Avoid labels at and of compound statements. From-SVN: r75891
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-parse.in6
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20000211-3.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20000518-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20021108-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/950922-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/label-compound-stmt-1.c7
8 files changed, 29 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29bcb06..e5d5396 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-14 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * c-parse.in (stmts_and_decls): Make label at end of compound
+ statement a hard error.
+
2004-01-14 Jan Hubicka <jh@suse.cz>
* cgraph.c (create_edge): Use local.redefined_extern_inline.
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 954c370..4cdbfed 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -1,6 +1,6 @@
/* YACC parser for C syntax and for Objective C. -*-c-*-
- Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -2001,7 +2001,7 @@ stmts_and_decls:
| lineno_stmt_decl_or_labels_ending_decl
| lineno_stmt_decl_or_labels_ending_label
{
- pedwarn ("deprecated use of label at end of compound statement");
+ error ("label at end of compound statement");
}
| lineno_stmt_decl_or_labels_ending_error
;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 05a6b60..2ac3cc8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-14 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * gcc.dg/label-compound-stmt-1.c: New test.
+ * gcc.c-torture/compile/950922-1.c,
+ gcc.c-torture/compile/20000211-3.c,
+ gcc.c-torture/compile/20000518-1.c,
+ gcc.c-torture/compile/20021108-1.c: Avoid labels at and of
+ compound statements.
+
2004-01-14 Hartmut Penner <hpenner@de.ibm.com>
* gcc.dg/ppc64-abi-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c
index 7e43c8a..7a02b68 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c
@@ -3,7 +3,7 @@ void f_clos(int x)
{
switch(x) {
default:
- mumble:
+ mumble:;
}
}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c
index fda44b6..d208779 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c
@@ -6,7 +6,7 @@ extern __inline__ void test()
callit1(&&l1);
-l1:
+l1:;
}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c
index c421639..01b6e4e 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c
@@ -3,5 +3,5 @@ main()
{
l1:
return &&l1-&&l2;
-l2:
+l2:;
}
diff --git a/gcc/testsuite/gcc.c-torture/compile/950922-1.c b/gcc/testsuite/gcc.c-torture/compile/950922-1.c
index 73574f3..73c52f7 100644
--- a/gcc/testsuite/gcc.c-torture/compile/950922-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/950922-1.c
@@ -40,7 +40,7 @@ f (int ch, char *fp, char *ap)
nosign:
if (_uquad != 0 || prec != 0);
break;
- default:
+ default:;
}
if ((f & 0x100) == 0) {
} else {
@@ -64,5 +64,5 @@ f (int ch, char *fp, char *ap)
}
}
- error:
+ error:;
}
diff --git a/gcc/testsuite/gcc.dg/label-compound-stmt-1.c b/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
new file mode 100644
index 0000000..7141163
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
@@ -0,0 +1,7 @@
+/* Test that labels at ends of compound statements are hard errors. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void f(void) { g: } /* { dg-bogus "warning" "warning in place of error" } */
+/* { dg-error "label|parse|syntax" "label at end of compound statement" { target *-*-* } 6 } */