Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] [gdb/testsuite] Add missing includes in gdb.trace/collection.c
Date: Wed, 27 Mar 2024 15:30:38 +0100	[thread overview]
Message-ID: <20240327143038.20021-3-tdevries@suse.de> (raw)
In-Reply-To: <20240327143038.20021-1-tdevries@suse.de>

On fedora rawhide, with test-case gdb.trace/collection.exp, I get:
...
gdb compile failed, collection.c: In function 'strings_test_func':
collection.c:227:13: error: implicit declaration of function 'malloc' \
  [-Wimplicit-function-declaration]
  227 |   longloc = malloc(500);
      |             ^~~~~~
collection.c:1:1: note: \
  include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | /* This testcase is part of GDB, the GNU debugger.

collection.c:228:3: error: implicit declaration of function 'strcpy' \
  [-Wimplicit-function-declaration]
  228 |   strcpy(longloc, ... );
      |   ^~~~~~
collection.c:1:1: note: include '<string.h>' or provide a declaration of \
  'strcpy'
  +++ |+#include <string.h>
    1 | /* This testcase is part of GDB, the GNU debugger.
collection.c:230:8: error: implicit declaration of function 'strlen' \
  [-Wimplicit-function-declaration]
  230 |   i += strlen (locstr);
      |        ^~~~~~
collection.c:230:8: note: include '<string.h>' or provide a declaration of \
  'strlen'
...

Fix this by adding the missing includes.

Tested on aarch64-linux.
---
 gdb/testsuite/gdb.trace/collection.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/testsuite/gdb.trace/collection.c b/gdb/testsuite/gdb.trace/collection.c
index efcc2e389da..8379b7d7eaf 100644
--- a/gdb/testsuite/gdb.trace/collection.c
+++ b/gdb/testsuite/gdb.trace/collection.c
@@ -19,6 +19,9 @@
  * Test program for trace collection
  */
 
+#include <string.h>
+#include <stdlib.h>
+
 /*
  * Typedefs
  */
-- 
2.35.3


  parent reply	other threads:[~2024-03-27 14:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 14:30 [PATCH 1/3] [gdb/tetsuite] Add missing include in gdb.base/ctf-ptype.c Tom de Vries
2024-03-27 14:30 ` [PATCH 2/3] [gdb/testsuite] Fix missing return type in gdb.linespec/break-asm-file.c Tom de Vries
2024-03-27 14:30 ` Tom de Vries [this message]
2024-03-28 17:21 ` [PATCH 1/3] [gdb/tetsuite] Add missing include in gdb.base/ctf-ptype.c John Baldwin
2024-03-29 10:39   ` Tom de Vries
2024-04-01 15:49   ` Tom Tromey
2024-04-02 14:23     ` Tom de Vries

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=20240327143038.20021-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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