From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130486 invoked by alias); 29 Aug 2018 19:09:35 -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 130474 invoked by uid 89); 29 Aug 2018 19:09:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=UD:us, Hx-languages-length:868 X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Aug 2018 19:09:32 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C665804B4B9; Wed, 29 Aug 2018 19:09:31 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D9FF2166B41; Wed, 29 Aug 2018 19:09:30 +0000 (UTC) Subject: Re: [PATCH] Fix windows-nat.c for -Wnarrowing To: Tom Tromey References: <20180829174253.18507-1-tom@tromey.com> <88f0fbca-f10a-9139-f96a-7934e10a937c@redhat.com> <87in3t3sqb.fsf@tromey.com> <87efeh3snr.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <25d1c3af-a52c-121c-de5c-bbce67471376@redhat.com> Date: Wed, 29 Aug 2018 19:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <87efeh3snr.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-08/txt/msg00769.txt.bz2 On 08/29/2018 07:59 PM, Tom Tromey wrote: >>>>>> "Tom" == Tom Tromey writes: > > Tom> So, I've added a DWORD cast there as well; then restore the #if. > > That's not going to work either, is it? > Since the test is > > for (i = 0; xlate[i].them != -1; i++) > > ... and it should be for (DWORD) -1 ? > If you're going to fix it, I'd go with my earlier suggestion: It'd be easily fixable by removing that terminator entry and using range-for in the other #if 0 block. I.e., remote the -1 entry, and replace: for (i = 0; xlate[i].them != -1; i++) if (xlate[i].us == sig) { current_event.u.Exception.ExceptionRecord.ExceptionCode = xlate[i].them; with: for (const xlate_exception &x : xlate) if (x.us == sig) { current_event.u.Exception.ExceptionRecord.ExceptionCode = x.them; Thanks, Pedro Alves