diff mbox

Fix PR57630

Message ID 20130617093906.GI20883@redhat.com
State New
Headers show

Commit Message

Marek Polacek June 17, 2013, 9:39 a.m. UTC
This improves the diagnostics messages in case we're using initial
declarations in the for loop, but we're not using C99 or newer standard;
in this case we shouldn't forget about =c11 and =gnu11, where the
initial declaration is fine as well.

Ok for trunk?

2013-06-17  Marek Polacek  <polacek@redhat.com>

	PR c/57630
	* c-decl.c (check_for_loop_decls): Improve diagnostics messages.


	Marek

Comments

Joseph Myers June 17, 2013, 2:35 p.m. UTC | #1
On Mon, 17 Jun 2013, Marek Polacek wrote:

> This improves the diagnostics messages in case we're using initial
> declarations in the for loop, but we're not using C99 or newer standard;
> in this case we shouldn't forget about =c11 and =gnu11, where the
> initial declaration is fine as well.
> 
> Ok for trunk?
> 
> 2013-06-17  Marek Polacek  <polacek@redhat.com>
> 
> 	PR c/57630
> 	* c-decl.c (check_for_loop_decls): Improve diagnostics messages.

OK.
diff mbox

Patch

--- gcc/c/c-decl.c.mp2	2013-06-17 11:23:18.007191155 +0200
+++ gcc/c/c-decl.c	2013-06-17 11:32:47.410472006 +0200
@@ -8503,11 +8503,12 @@  check_for_loop_decls (location_t loc, bo
 	 the C99 for loop scope.  This doesn't make much sense, so don't
 	 allow it.  */
       error_at (loc, "%<for%> loop initial declarations "
-		"are only allowed in C99 mode");
+		"are only allowed in C99 or C11 mode");
       if (hint)
 	{
 	  inform (loc,
-		  "use option -std=c99 or -std=gnu99 to compile your code");
+		  "use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 "
+		  "to compile your code");
 	  hint = false;
 	}
       return NULL_TREE;