This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52050] Want an option to warn about a declaration inside a for/while/if statements.
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Jan 2012 00:36:54 +0000
- Subject: [Bug c/52050] Want an option to warn about a declaration inside a for/while/if statements.
- Auto-submitted: auto-generated
- References: <bug-52050-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52050
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Summary|-Wdeclaration-after-stateme |Want an option to warn
|nt does not warn on |about a declaration inside
|declaration in for loop |a for/while/if statements.
|initialiser |
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-30 00:36:54 UTC ---
I think -Wdeclaration-after-statement would the wrong option really.
The declaration in "for (int i = 0; i < 2; i++)" is not after a statement. I
would think we should have a different warning option for this. Also the
warning option is there mostly to warn as we turn on this extension by default
for GNU C90 while the declaration inside a for loop support is not turned on
for GNU C90.