Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] [gdb/tetsuite] Add missing include in gdb.base/ctf-ptype.c
Date: Thu, 28 Mar 2024 13:21:13 -0400	[thread overview]
Message-ID: <364a5861-a4a2-47ba-9253-5c564c41ebe3@FreeBSD.org> (raw)
In-Reply-To: <20240327143038.20021-1-tdevries@suse.de>

On 3/27/24 10:30 AM, Tom de Vries wrote:
> 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.

Patches 2 and 3 look obvious to me (so Approved-By on this is fine by me)

> ---
>   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();*/
> -

This certainly seems curious.  Nothing in the commit log for when this was added
gives any clue to why this comment is here, nor why the prototype is commented
out.  Other comments later in this function mention limitations of the linker on
AIX, which makes me wonder how it was tested originally.  Did you confirm that
the test program compiled contained CTF but not DWARF when the test passed?

-- 
John Baldwin


  parent reply	other threads:[~2024-03-28 17:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
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 ` John Baldwin [this message]
2024-03-29 10:39   ` [PATCH 1/3] [gdb/tetsuite] Add missing include in gdb.base/ctf-ptype.c 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=364a5861-a4a2-47ba-9253-5c564c41ebe3@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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