File gdb-testsuite-add-missing-include-in-gdb.base-ctf-pt.patch of Package gdb-debuginfod

From 4e9077b7e451bd87e48e9868519079a5a7070106 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 2 Apr 2024 16:22:46 +0200
Subject: [PATCH 29/48] [gdb/testsuite] Add missing include in
 gdb.base/ctf-ptype.c

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 cc4e98a234f..0cea44701b9 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);
-- 
2.35.3

openSUSE Build Service is sponsored by