From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9YI+HHq3kGCqVAAAWB0awg (envelope-from ) for ; Mon, 03 May 2021 22:54:50 -0400 Received: by simark.ca (Postfix, from userid 112) id 659F91F11C; Mon, 3 May 2021 22:54:50 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BC15B1E813 for ; Mon, 3 May 2021 22:54:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E0C0386FC0D; Tue, 4 May 2021 02:54:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E0C0386FC0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620096889; bh=Donm9F0N67QoKC6zWNdkxvoY7MPELo87ssxYTG4o00g=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bAbFtre6AHrCxSz9atTmhCtZR4k/Cfcnc2bvf5reVAsGxoSITsXyo9YcWv3wL2Fk0 AJ7MCuF2lsRGcWNL0RZYVj5/N34tSuZq1Z9uT7RvP3jcGUQnHQ/qQ7trkyyexJf7yu 2NzWmgWTwydWN/LnIoZO3BZJJH9gp5nOFSXNQy+U= Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id B70F7386FC0D for ; Tue, 4 May 2021 02:54:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B70F7386FC0D Received: from vapier (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F39F4335C78; Tue, 4 May 2021 02:54:44 +0000 (UTC) Date: Mon, 3 May 2021 22:54:44 -0400 To: Christian Biesinger , gdb-patches Subject: Re: [PATCH/committed] sim: rx: cast bfd_vma when printing Message-ID: Mail-Followup-To: Christian Biesinger , gdb-patches References: <20210501202929.29766-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 03 May 2021 20:47, Mike Frysinger via Gdb-patches wrote: > On 03 May 2021 16:47, Christian Biesinger via Gdb-patches wrote: > > On Mon, May 3, 2021 at 3:57 PM Mike Frysinger wrote: > > > On 03 May 2021 11:20, Christian Biesinger wrote: > > > > On Sat, May 1, 2021, 15:29 Mike Frysinger wrote: > > > > > A bit of a hack, but it's what we've been doing so far when printing > > > > > bfd_vma's since bfd doesn't provide PRI helper types for us to use. > > > > > > > > > > --- a/sim/rx/load.c > > > > > +++ b/sim/rx/load.c > > > > > @@ -151,7 +151,7 @@ rx_load (bfd *prog, host_callback *callback) > > > > > } > > > > > if (bfd_bread (buf, size, prog) != size) > > > > > { > > > > > - fprintf (stderr, "Failed to read %lx bytes\n", size); > > > > > + fprintf (stderr, "Failed to read %lx bytes\n", (long) size); > > > > > > > > Wouldn't it be better to use "long long", especially for mingw? > > > > > > not sure why mingw is special here. but let's ignore that. > > > > mingw (and msvc) is special because sizeof(long) is 4, even on a 64-bit system. > > https://stackoverflow.com/questions/22344388/size-of-long-int-and-int-in-c-showing-4-bytes > > we have ILP32 models on mips/n32 [2000], x86_64/x32 [2011], and aarch64 [2016], > so i don't think mingw does anything that unique anymore. > > we've long known that long is inappropriate for things that could be 64-bit. > the trouble is when we half implement the suite like just coming up with a > typedef and skimping on printf formats :(. looks like i'm just bad at grepping for things i don't know about. i could find bad examples, but that's because i knew the form they took. a patch on the binutils list points out the format already exists, albeit with a more verbose name: BFD_VMA_FMT. so i can clean up the sim code to use that. -mike