From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69066 invoked by alias); 28 Oct 2015 20:34:01 -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 69052 invoked by uid 89); 28 Oct 2015 20:34:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f52.google.com Received: from mail-qg0-f52.google.com (HELO mail-qg0-f52.google.com) (209.85.192.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 28 Oct 2015 20:33:59 +0000 Received: by qgbb65 with SMTP id b65so17383599qgb.2 for ; Wed, 28 Oct 2015 13:33:57 -0700 (PDT) X-Received: by 10.140.133.10 with SMTP id 10mr63198720qhf.95.1446064436848; Wed, 28 Oct 2015 13:33:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.75.66 with HTTP; Wed, 28 Oct 2015 13:33:27 -0700 (PDT) In-Reply-To: <1446062352-27859-1-git-send-email-palves@redhat.com> References: <1446062352-27859-1-git-send-email-palves@redhat.com> From: Simon Marchi Date: Thu, 29 Oct 2015 13:03:00 -0000 Message-ID: Subject: Re: [PATCH] Add cast to VEC_iterate To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-10/txt/msg00672.txt.bz2 On 28 October 2015 at 15:59, Pedro Alves wrote: > Fixes this in C++: > > ../../src/gdb/break-catch-sig.c: In function =E2=80=98int VEC_gdb_signal= _type_iterate(const VEC_gdb_signal_type*, unsigned int, gdb_signal_type*)= =E2=80=99: > ../../src/gdb/common/vec.h:576:12: error: invalid conversion from =E2=80= =98int=E2=80=99 to =E2=80=98gdb_signal_type {aka gdb_signal}=E2=80=99 [-fpe= rmissive] > *ptr =3D 0; \ > ^ > ../../src/gdb/common/vec.h:417:1: note: in expansion of macro =E2=80=98D= EF_VEC_FUNC_P=E2=80=99 > DEF_VEC_FUNC_P(T) \ > ^ > ../../src/gdb/break-catch-sig.c:37:1: note: in expansion of macro =E2=80= =98DEF_VEC_I=E2=80=99 > DEF_VEC_I (gdb_signal_type); > ^ > > I actually carried a different fix in the C++ branch that removed this > assignment and then adjusted all callers that depended on it. The > thinking was that this is for the case where we're returning false, > indicating end of iteration. But that results in a much larger and > tricker patch; looking back it seems quite pointless. I looked at the > history of GCC's C++ conversion and saw that they added this same cast > to their version of vec.h, FWIW. (GCC's vec.h is completely different > nowadays, having been converted to templates meanwhile.) > > gdb/ChangeLog: > 2015-10-28 Pedro Alves > > * common/vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T. > --- > gdb/common/vec.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/common/vec.h b/gdb/common/vec.h > index 2564485..6189283 100644 > --- a/gdb/common/vec.h > +++ b/gdb/common/vec.h > @@ -573,7 +573,7 @@ static inline int VEC_OP (T,iterate) = \ > } = \ > else = \ > { = \ > - *ptr =3D 0; = \ > + *ptr =3D (T) 0; = \ > return 0; = \ > } = \ > } = \ > -- > 1.9.3 > LGTM.