Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH c++ 12/12] ada-lang.h: Add cast in GROW_VECT
Date: Tue, 27 Oct 2015 14:55:00 -0000	[thread overview]
Message-ID: <562F6A5B.7020500@redhat.com> (raw)
In-Reply-To: <562EE2CD.6050104@polymtl.ca>

On 10/27/2015 02:34 AM, Simon Marchi wrote:
> On 26/10/15 12:50 PM, Pedro Alves wrote:

>> typeof in C is a GCC extension.  Probably not all compilers support it.
>>
>> In my branch I just have:
>>
>>   #define GROW_VECT(v, s, m)                                    \
>>  -   if ((s) < (m)) (v) = grow_vect (v, &(s), m, sizeof *(v));
>>  +   if ((s) < (m)) (v) = (char *) grow_vect (v, &(s), m, sizeof *(v));
>>
>> Because that works for all current uses of GROW_VECT.
>>
>> If we wanted to make this work for random types, then we could add
>> a type parameter to the GROW_VECT macro, like:
>>
>> - #define GROW_VECT(v, s, m)                                    \
>> -   if ((s) < (m)) (v) = grow_vect (v, &(s), m, sizeof *(v));
>> + #define GROW_VECT(t, v, s, m)                                    \
>> +   if ((s) < (m)) (v) = (t *) grow_vect (v, &(s), m, sizeof *(v));
>>
>> Not sure it's worth it though.  It then raises the question of
>> "why not replace this home grown GROW_VECT stuff with a VEC instead".

> I thought about changing it for a proper VEC, but it's not really in the scope of
> the C++ changes.  If I side-track on things like this, it will take an eternity!
> And I feel that at this moment, it would be a risk of introducing bugs without
> added value.
> 
> Is it ok if I simply push your version that adds the (char *) in the macro?  It
> seems like the most efficient fix given the situation.

It's certainly fine with me.

Thanks,
Pedro Alves


  reply	other threads:[~2015-10-27 12:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 10:23 [PATCH c++ 11/12] target.c: Add a cast and change a type Simon Marchi
2015-10-26 10:38 ` [PATCH c++ 12/12] ada-lang.h: Add cast in GROW_VECT Simon Marchi
2015-10-26 23:09   ` Pedro Alves
2015-10-27  9:54     ` Simon Marchi
2015-10-27 14:55       ` Pedro Alves [this message]
2015-10-27 16:00         ` Simon Marchi
2015-10-27  9:54 ` [PATCH c++ 11/12] target.c: Add a cast and change a type Simon Marchi

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=562F6A5B.7020500@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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