[gdb/testsuite] Handle for loop initial decl with gcc 4.8.5
authorTom de Vries <tdevries@suse.de>
Mon, 3 Jan 2022 14:36:36 +0000 (15:36 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 3 Jan 2022 14:36:36 +0000 (15:36 +0100)
commitb19f4f61785c8bf81b6a4a3dada9c446998aad35
tree5acb0ba8ac24018102db7808034d28899e465e77
parent1eeb0316304f2d4e2c48aa8887e28c936bfe4f4d
[gdb/testsuite] Handle for loop initial decl with gcc 4.8.5

When running test-case gdb.threads/schedlock-thread-exit.exp on a system with
system compiler gcc 4.8.5, I run into:
...
src/gdb/testsuite/gdb.threads/schedlock-thread-exit.c:33:3: error: \
  'for' loop initial declarations are only allowed in C99 mode
...

Fix this by:
- using -std=c99, or
- using -std=gnu99, in case that's required, or
- in the case of the jit test-cases, rewriting the for loops.

Tested on x86_64-linux, both with gcc 4.8.5 and gcc 7.5.0.
gdb/testsuite/gdb.base/inferior-args.exp
gdb/testsuite/gdb.base/jit-elf-util.h
gdb/testsuite/gdb.base/run-attach-while-running.exp
gdb/testsuite/gdb.mi/interrupt-thread-group.exp
gdb/testsuite/gdb.python/py-format-string.exp
gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
gdb/testsuite/gdb.threads/schedlock-thread-exit.exp