From: Stafford Horne <shorne@gmail.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: GDB patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/3] include/dis-asm.h: Fix warning: Include "string.h" for strchr
Date: Sun, 27 Jan 2019 04:22:00 -0000 [thread overview]
Message-ID: <20190127032907.GW3235@lianli.shorne-pla.net> (raw)
In-Reply-To: <a21f0654-a80a-e0e2-c826-98a966641621@ericsson.com>
On Tue, Jan 22, 2019 at 05:07:43PM +0000, Simon Marchi wrote:
> On 2018-12-02 8:05 a.m., Stafford Horne wrote:
> > I got this warning when building the OpenRISC sim target.
> >
> > Warning:
> >
> > In file included from ../../../binutils-gdb/sim/or1k/../common/cgen-trace.c:26:
> > ../../../binutils-gdb/sim/or1k/../../include/dis-asm.h: In function ânext_disassembler_optionâ:
> > ../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21: warning: implicit declaration of function âstrchrâ [-Wimplicit-function-declaration]
> > const char *opt = strchr (options, ',');
> > ^~~~~~
> > ../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21: warning: incompatible implicit declaration of built-in function âstrchrâ
> > ../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21: note: include â<string.h>â or provide a declaration of âstrchrâ
> > ../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:40:1:
> > +#include <string.h>
> >
> > ../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21:
> > const char *opt = strchr (options, ',');
> > ^~~~~~
> >
> > include/ChangeLog:
> >
> > dis-asm.h: Include "string.h"
> > ---
> > include/dis-asm.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/include/dis-asm.h b/include/dis-asm.h
> > index 84627950c0..823bba5b45 100644
> > --- a/include/dis-asm.h
> > +++ b/include/dis-asm.h
> > @@ -32,6 +32,10 @@ extern "C" {
> > #endif
> >
> > #include <stdio.h>
> > +/* For strchr. */
> > +#ifdef HAVE_STRING_H
> > +#include <string.h>
> > +#endif
> > #include "bfd.h"
> >
> > typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2;
> >
>
> Hi Stafford,
>
> It looks like this patchset fell through the cracks (I found it while searching for
> something else). A version of this patch went in, witout the HAVE_STRING_H ifdef.
> Do you think the ifdef is necessary in practice?
Sorry for the late reply, I just got back from vacation with the family in
Hawaii :).
I thought about this when I made this patch, we currently have a lot of these
HAVE_XXX_H checks throughout the sim code. I am not sure of the history, but
perhaps I can try a patch set to eliminate a few of them like HAVE_STRING_H vs
HAVE_STRINGS_H (BSD). I would think everything we need is in on every machine
in <string.h>.
I am not an expert in C/C++ compatibility. Is there at minimum standard c/c++
required for gdb? Perhaps this has changed since we moved to allow C++.
-Stafford
next prev parent reply other threads:[~2019-01-27 4:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-02 13:05 [PATCH 0/3] Fix build failure with sim-arange inlining Stafford Horne
2018-12-02 13:05 ` [PATCH 2/3] include/dis-asm.h: Fix warning: Include "string.h" for strchr Stafford Horne
2019-01-22 17:07 ` Simon Marchi
2019-01-27 4:22 ` Stafford Horne [this message]
2019-02-12 21:55 ` Tom Tromey
2018-12-02 13:05 ` [PATCH 1/3] sim/common: convert sim-arange to use sim-inline Stafford Horne
2018-12-02 13:05 ` [PATCH 3/3] sim/common: Fix warnings: "warning: implicit declaration of function..." Stafford Horne
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=20190127032907.GW3235@lianli.shorne-pla.net \
--to=shorne@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
/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).