public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/testsuite] Fix local-static.exp with gcc-4.8
Date: Fri, 04 Oct 2019 14:23:00 -0000	[thread overview]
Message-ID: <20191004142333.98264.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4dbbb47c168a617ce27c1bdb05ebbd7842fceada

commit 4dbbb47c168a617ce27c1bdb05ebbd7842fceada
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Oct 4 16:23:24 2019 +0200

    [gdb/testsuite] Fix local-static.exp with gcc-4.8
    
    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.

Diff:
---
 gdb/testsuite/ChangeLog             | 5 +++++
 gdb/testsuite/gdb.cp/local-static.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f42a0a3c..0eeb8c6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -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:
diff --git a/gdb/testsuite/gdb.cp/local-static.c b/gdb/testsuite/gdb.cp/local-static.c
index 33ab2e3..6d9c368 100644
--- a/gdb/testsuite/gdb.cp/local-static.c
+++ b/gdb/testsuite/gdb.cp/local-static.c
@@ -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 ();


                 reply	other threads:[~2019-10-04 14:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191004142333.98264.qmail@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).