When compiling code that uses for loop initial declarations with -Wc90-c99-compat, no diagnostic is issued.
Confirmed. This should not be hard to add. The error message while compiling for C90 is emitted from check_for_loop_decls which should be easy to add a warning there when -Wc90-c99-compat is turned on.
Author: mpolacek Date: Thu Jun 7 19:15:45 2018 New Revision: 261293 URL: https://gcc.gnu.org/viewcvs?rev=261293&root=gcc&view=rev Log: PR c/85318 * c-decl.c (check_for_loop_decls): Add -Wc90-c99-compat warning about for loop initial declarations. * gcc.dg/Wc90-c99-compat-10.c: New test. * gcc.dg/Wc90-c99-compat-11.c: New test. * gcc.dg/Wc90-c99-compat-12.c: New test. * gcc.dg/Wc90-c99-compat-9.c: New test. Added: trunk/gcc/testsuite/gcc.dg/Wc90-c99-compat-10.c trunk/gcc/testsuite/gcc.dg/Wc90-c99-compat-11.c trunk/gcc/testsuite/gcc.dg/Wc90-c99-compat-12.c trunk/gcc/testsuite/gcc.dg/Wc90-c99-compat-9.c Modified: trunk/gcc/c/ChangeLog trunk/gcc/c/c-decl.c trunk/gcc/testsuite/ChangeLog
Fixed for GCC 9.