Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] [gdb/tetsuite] Add missing include in gdb.base/ctf-ptype.c
@ 2024-03-27 14:30 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
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tom de Vries @ 2024-03-27 14:30 UTC (permalink / raw)
  To: gdb-patches

On fedora rawhide, when running test-case gdb.base/ctf-ptype.exp, I get:
...
gdb compile failed, ctf-ptype.c: In function 'main':
ctf-ptype.c:242:29: error: implicit declaration of function 'malloc' \
  [-Wimplicit-function-declaration]
  242 |   v_char_pointer = (char *) malloc (1);
      |                             ^~~~~~
ctf-ptype.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | /* This test program is part of GDB, the GNU debugger.
...

Fix this by adding the missing include.

Tested on aarch64-linux.
---
 gdb/testsuite/gdb.base/ctf-ptype.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/ctf-ptype.c b/gdb/testsuite/gdb.base/ctf-ptype.c
index 4d2df33c53c..ca347893349 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.c
+++ b/gdb/testsuite/gdb.base/ctf-ptype.c
@@ -24,6 +24,8 @@
  *	First the basic C types.
  */
 
+#include <stdlib.h>
+
 #if !defined (__STDC__) && !defined (_AIX)
 #define signed  /**/
 #endif
@@ -234,9 +236,6 @@ func_type v_func_type;
 
 int main ()
 {
-  /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */
-/*  extern char *malloc();*/
-
   /* Some of the tests in ptype.exp require invoking malloc, so make
      sure it is linked in to this program.  */
   v_char_pointer = (char *) malloc (1);

base-commit: 18d2988e5da8919514c76b83e2c0b56e439018bd
-- 
2.35.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-02 14:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/3] [gdb/testsuite] Add missing includes in gdb.trace/collection.c Tom de Vries
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox