This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: C++-compat clean build
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: 'Mark Kettenis' <mark dot kettenis at xs4all dot nl>, "ooprala at redhat dot com" <ooprala at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 1 Oct 2013 12:53:05 +0000
- Subject: RE: C++-compat clean build
- Authentication-results: sourceware.org; auth=none
- References: <524AB12E dot 8090209 at redhat dot com> <201310011204 dot r91C4QVo006124 at glazunov dot sibelius dot xs4all dot nl>
Thanks Ondrej for taking the initiative!
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Mark Kettenis
> Sent: Tuesday, October 01, 2013 02:04 PM
> To: ooprala@redhat.com
> Cc: gdb-patches@sourceware.org
> Subject: Re: C++-compat clean build
>
> Rejected. Introducing all these casts can't be right. They hide type
> conversion issues and make the code unreadable.
>
Afaik, some casts are required to some extend as C++ does no implicit from/to void *
conversion. But in general I agree about using casts too vast.
@@ -1598,7 +1598,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels. */
int fixup_sentinel_space = len;
- gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
This looks OK to me and could be replaced with a type save new[] once C++ is used.
@@ -1178,7 +1178,7 @@ amd64_linux_syscall_record (struct regcache *regcache)
{
int ret;
ULONGEST syscall_native;
- enum gdb_syscall syscall_gdb = -1;
+ enum gdb_syscall syscall_gdb = (enum gdb_syscall) -1;
... whereas this looks wrong to me in both cases before/after. Here we should
add something like SYSCALL_INVALID/UNKNOWN to enum gdb_syscall.
Thanks again for your efforts Ondrej.
-Sanimir
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Mark Kettenis
> Sent: Tuesday, October 01, 2013 02:04 PM
> To: ooprala@redhat.com
> Cc: gdb-patches@sourceware.org
> Subject: Re: C++-compat clean build
>
> > Date: Tue, 01 Oct 2013 13:25:34 +0200
> > From: Ondrej Oprala <ooprala@redhat.com>
> >
> > Hi,
> > this is the first of a few patches I intend to write to make gdb code
> > compile cleanly with -Wc++-compat.
> > The idea is to make separate patches for respective subdirs under gdb/,
> > unless someone objects ofc.
> >
> > Thanks in advance for any advice/criticism.
>
> Rejected. Introducing all these casts can't be right. They hide type
> conversion issues and make the code unreadable.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052