[gdb/testsuite] Fix local-static.exp with gcc-4.8
authorTom de Vries <tdevries@suse.de>
Fri, 4 Oct 2019 14:23:24 +0000 (16:23 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 4 Oct 2019 14:23:24 +0000 (16:23 +0200)
With gdb.cp/local-static.exp and gcc 4.8, I see:
...
gdb compile failed, src/gdb/testsuite/gdb.cp/local-static.c: In function 'main':
src/gdb/testsuite/gdb.cp/local-static.c:148:3: error: 'for' loop initial \
  declarations are only allowed in C99 mode
   for (int i = 0; i < 1000; i++)
   ^
src/gdb/testsuite/gdb.cp/local-static.c:148:3: note: use option -std=c99 or \
  -std=gnu99 to compile your code
UNTESTED: gdb.cp/local-static.exp: c: failed to prepare
...

Fix this by moving the declaration of int i out of the for loop.

gdb/testsuite/ChangeLog:

2019-10-04  Tom de Vries  <tdevries@suse.de>

* gdb.cp/local-static.c (main): Move declaration of int i out of the
for loop.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/local-static.c

index f42a0a3c83c689c9b0bb3c606cb1158a829bd65c..0eeb8c6fbdf18d80f3b0d1218fd647243c57fe5a 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-04  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.cp/local-static.c (main): Move declaration of int i out of the
+       for loop.
+
 2019-10-03  Tom Tromey  <tom@tromey.com>
 
        PR rust/24976:
index 33ab2e352d2ed6dea5f164307b10fa1b1797b8f2..6d9c368c87b54f9c58f93639fcf888a4a80167a8 100644 (file)
@@ -145,7 +145,9 @@ free_inline_func (void)
 int
 main ()
 {
-  for (int i = 0; i < 1000; i++)
+  int i;
+
+  for (i = 0; i < 1000; i++)
     {
       free_func ();
       free_inline_func ();
This page took 0.030759 seconds and 4 git commands to generate.