From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118481 invoked by alias); 27 Oct 2015 12:13:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 118466 invoked by uid 89); 27 Oct 2015 12:13:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 27 Oct 2015 12:13:18 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id EF1A9C0B590B; Tue, 27 Oct 2015 12:13:16 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9RCDFfo027880; Tue, 27 Oct 2015 08:13:16 -0400 Message-ID: <562F6A5B.7020500@redhat.com> Date: Tue, 27 Oct 2015 14:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH c++ 12/12] ada-lang.h: Add cast in GROW_VECT References: <1445831362-18789-1-git-send-email-simon.marchi@polymtl.ca> <1445831362-18789-2-git-send-email-simon.marchi@polymtl.ca> <562E59DF.9040407@redhat.com> <562EE2CD.6050104@polymtl.ca> In-Reply-To: <562EE2CD.6050104@polymtl.ca> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-10/txt/msg00614.txt.bz2 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