Patch for C99 "for (int i = 0; i < 10; i++)"

Geoff Keating geoffk@geoffk.org
Sat Nov 18 15:13:00 GMT 2000


"Joseph S. Myers" <jsm28@cam.ac.uk> writes:

> This patch adds support for C99 declarations in for loops ("for (int i
> = 0; i < 10; i++)").  They are only allowed in C99 mode (-std=c99 /
> -std=gnu99) since they only really make sense with the C99 scope
> surrounding the for loop.
> 
> Bootstrapped with no regressions on i686-pc-linux-gnu.  OK to commit?
> 
> 2000-11-18  Joseph S. Myers  <jsm28@cam.ac.uk>
> 
> 	* c-decl.c (check_for_loop_decls): New function.
> 	* c-parse.in (for_init_stmt): New.
> 	(select_or_iter_stmt): Use for_init_stmt.
> 	* c-tree.h (check_for_loop_decls): New declaration.
> 
> 2000-11-18  Joseph S. Myers  <jsm28@cam.ac.uk>
> 
> 	* gcc.dg/c90-fordecl-1.c, gcc.dg/c99-fordecl-1.c,
> 	gcc.dg/c99-fordecl-2.c: New tests.

OK.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


More information about the Gcc-patches mailing list