From: Mike Frysinger <vapier@gentoo.org>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 5/5] sim/iq2000: silence pointer-sign warnings
Date: Wed, 26 Oct 2022 14:36:58 +0545 [thread overview]
Message-ID: <Y1j1LhV/38t0H/4O@vapier> (raw)
In-Reply-To: <87r0yx8bty.fsf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1821 bytes --]
On 24 Oct 2022 16:45, Andrew Burgess wrote:
> Mike Frysinger <vapier@gentoo.org> writes:
>
> > On 12 Oct 2022 13:38, Andrew Burgess via Gdb-patches wrote:
> >> When building the iq2000 simulator I see a few warnings like this:
> >>
> >> /tmp/build/sim/../../src/sim/iq2000/iq2000.c: In function ‘fetch_str’:
> >> /tmp/build/sim/../../src/sim/iq2000/iq2000.c:50:54: error: pointer targets in passing argument 3 of ‘sim_read’ differ in signedness [-Werror=pointer-sign]
> >> 50 | sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr);
> >> | ^~~
> >> | |
> >> | char *
> >>
> >> I've silenced these warnings by casting buf to 'unsigned char *'.
> >> With this change I now see no warnings when compiling iq2000.c, so
> >> I've removed the line from Makefile.in that disables -Werror.
> >
> > i left this warning in place so someone would fix it properly rather than
> > just cast it away
>
> Sorry for not understanding that. If you'd like to expand on "properly"
> I'll take a pass at fixing it.
whatever doesn't require a lot of casting :). sprinkling casts around means
leaving landmines for ourselves in the future.
in this particular case, i think the only reasonable answer is to change the
sim_read & sim_write APIs to work on void* much like the C library funcs. i
get that void pointers are basically implicit casts, but i think that's still
the right way to go unless i'm forgetting something obvious.
i also vaguely recall that we really shouldn't be using sim_read & sim_write
in sim backends in the first place, but instead leaning on sim_core_* APIs.
-mike
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-10-26 10:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 12:38 [PATCH 0/5] Silence some build warnings in various simulators Andrew Burgess
2022-10-12 12:38 ` [PATCH 1/5] sim/cgen: mask uninitialized variable warning in cgen-run.c Andrew Burgess
2022-10-23 12:30 ` Mike Frysinger
2022-10-24 15:57 ` Andrew Burgess
2022-10-24 15:59 ` Mike Frysinger
2022-10-27 15:53 ` Andrew Burgess
2022-10-12 12:38 ` [PATCH 2/5] sim/ppc: fix warnings related to printf format strings Andrew Burgess
2022-10-12 12:46 ` Tsukasa OI
2022-10-12 13:50 ` Andrew Burgess
2022-10-23 12:20 ` Mike Frysinger
2022-10-24 15:41 ` Andrew Burgess
2022-10-12 12:38 ` [PATCH 3/5] sim/ppc: mark device_error function as ATTRIBUTE_NORETURN Andrew Burgess
2022-10-12 12:38 ` [PATCH 4/5] sim/erc32: avoid dereferencing type-punned pointer warnings Andrew Burgess
2022-10-12 14:11 ` Pedro Alves
2022-10-12 17:02 ` Lancelot SIX
2022-10-13 10:35 ` Andrew Burgess
2022-10-13 10:49 ` Pedro Alves
2022-10-23 12:34 ` Mike Frysinger
2022-10-24 15:42 ` Andrew Burgess
2022-10-12 12:38 ` [PATCH 5/5] sim/iq2000: silence pointer-sign warnings Andrew Burgess
2022-10-23 12:32 ` Mike Frysinger
2022-10-24 15:45 ` Andrew Burgess
2022-10-26 8:51 ` Mike Frysinger [this message]
2022-10-14 17:50 ` [PATCH 0/5] Silence some build warnings in various simulators Tom Tromey
2022-10-19 13:34 ` Andrew Burgess
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=Y1j1LhV/38t0H/4O@vapier \
--to=vapier@gentoo.org \
--cc=aburgess@redhat.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).