aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2008-08-27 23:54:36 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2008-08-27 23:54:36 +0000
commite9527cfd9665e3cb0887682ccb0d17d040732799 (patch)
treea771c38af9403eafeab5a23860be3f703a4512d1 /gcc/c-decl.c
parent4ccd12e5aae640a352129fd387657da8e4d0f95b (diff)
downloadgcc-e9527cfd9665e3cb0887682ccb0d17d040732799.zip
gcc-e9527cfd9665e3cb0887682ccb0d17d040732799.tar.gz
gcc-e9527cfd9665e3cb0887682ccb0d17d040732799.tar.bz2
re PR c/31673 ("`for' loop initial declaration used outside C99 mode" is confusing)
2008-08-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/31673 * c-decl.c (check_for_loop_decls): Improve error message. Give hint. testsuite/ * gcc.dg/c90-fordecl-1.c: Update. From-SVN: r139681
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 056cb38..ee04d9a 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -6796,13 +6796,19 @@ check_for_loop_decls (void)
tree one_decl = NULL_TREE;
int n_decls = 0;
-
if (!flag_isoc99)
{
+ static bool hint = true;
/* If we get here, declarations have been used in a for loop without
the C99 for loop scope. This doesn't make much sense, so don't
allow it. */
- error ("%<for%> loop initial declaration used outside C99 mode");
+ error ("%<for%> loop initial declarations are only allowed in C99 mode");
+ if (hint)
+ {
+ inform (input_location,
+ "use option -std=c99 or -std=gnu99 to compile your code");
+ hint = false;
+ }
return NULL_TREE;
}
/* C99 subclause 6.8.5 paragraph 3: