This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52050] Want an option to warn about a declaration inside a for/while/if statements.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]