check the storage of C99 for-loop initializers
commit44632081a3b54299e8899954efcd7133ef093259
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Sun, 5 Mar 2017 19:21:51 +0000 (5 20:21 +0100)
committerChristopher Li <sparse@chrisli.org>
Mon, 6 Mar 2017 00:51:22 +0000 (6 08:51 +0800)
tree839621fa83d0e8cd5bbe3eff06182133c53648c9
parentd4b88ffd878ca151cd03969d02522c456a264a7a
check the storage of C99 for-loop initializers

In C99, it is valid to declare a variable inside a
for-loop initializer but only when the storage is local
(automatic or register). Until now this was not enforced.

Fix this, when parsing declarations in a for-loop context,
by calling external_decl() with a validate method doing the
appropriate check of the storage.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
parse.c
validation/c99-for-loop-decl.c