From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Kil+EgrW52Igex4AWB0awg (envelope-from ) for ; Mon, 01 Aug 2022 09:32:58 -0400 Received: by simark.ca (Postfix, from userid 112) id 3D54F1EA05; Mon, 1 Aug 2022 09:32:58 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=kh2TIxgn; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 C9B311EA03 for ; Mon, 1 Aug 2022 09:32:57 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A0693858435 for ; Mon, 1 Aug 2022 13:32:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A0693858435 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659360777; bh=KmRsoAAwGwBLXETiqSeC8KCDiNznURdxNQN6o1x5tRY=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=kh2TIxgnKPxmxX2VJFTRmbgdaWVRCS8tLsu/tMOOJgvxtc6ZAHE+WuLY3gGa5Fkno DMDP08bGF4sTCvjQK8dGq6ZUAYJHu5Kp+Yn+Ykcj6CgYDWSsSPwW7PUCjDzXY1qfb+ jxsGaCRIB1jjz2LJI3LcFaxox7fODcOPhDP0CeAo= Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id D8E0B3858D39; Mon, 1 Aug 2022 13:32:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D8E0B3858D39 Received: by mail-pj1-x1031.google.com with SMTP id q7-20020a17090a7a8700b001f300db8677so12009947pjf.5; Mon, 01 Aug 2022 06:32:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KmRsoAAwGwBLXETiqSeC8KCDiNznURdxNQN6o1x5tRY=; b=TBfpKwsJXuYQg3ln0bpokwzfYHJGZbxroh9ZsL/VVyB+m381RaLI5HkyT3XMs16Pse UnZIXyldWnuePT/qR9nG21oQ6FN/ecu9ppMtKjnC9SWCzqrV9QB8mFes8uapgNm7ZyvQ 7iVYTyECNZlqBTIBlQjyLTfuor3mnC6aMT6lwbSu1UqSHJ8VG1oXXXEkS3E4yW0HVKId CSc/4GqofsqvqerXkCASRqj04RHHXaXIR+YBDicQ3zJDghOdsQfqq3eUf1c9m2hSU6CZ H575BDloCFU9wJcZQvUHeIaExIeJ5I1++XsWaNIIreCK8U90R2mKKivvhPusm/Dn+YgW 51Ug== X-Gm-Message-State: ACgBeo34V5vWovFrXGxf1faiuxAaifnQkVIUZPk5UdF6R/3J0zZ8Mh00 lMpQ+VhpcPr04yAKkrnjY1KTqIS9BQ8= X-Google-Smtp-Source: AA6agR5Z2OfUUP3cazWUL62fKo1DsKFX3kIdEj+2CThity0kI6V3Y5ixnCr49D96C8exYCHJzEYmOA== X-Received: by 2002:a17:90b:1d0b:b0:1f5:72f:652c with SMTP id on11-20020a17090b1d0b00b001f5072f652cmr4087619pjb.38.1659360756596; Mon, 01 Aug 2022 06:32:36 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:a191:bba5:dc6e:aa52]) by smtp.gmail.com with ESMTPSA id a4-20020a170902ecc400b0016d6963cb12sm9698255plh.304.2022.08.01.06.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 06:32:36 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 9E5461140177; Mon, 1 Aug 2022 23:02:33 +0930 (ACST) Date: Mon, 1 Aug 2022 23:02:33 +0930 To: Jan Beulich Subject: Re: Get rid of fprintf_vma and sprintf_vma Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Alan Modra via Gdb-patches Reply-To: Alan Modra Cc: binutils@sourceware.org, gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Mon, Aug 01, 2022 at 11:01:57AM +0200, Jan Beulich wrote: > On 01.08.2022 06:33, Alan Modra via Binutils wrote: > > --- a/gas/config/tc-i386.c > > +++ b/gas/config/tc-i386.c > > @@ -2377,15 +2377,8 @@ offset_in_range (offsetT val, int size) > > } > > > > if ((val & ~mask) != 0 && (-val & ~mask) != 0) > > - { > > - char val_buf[128]; > > - char masked_buf[128]; > > - > > - /* Coded this way in order to ease translation. */ > > - sprintf_vma (val_buf, val); > > - sprintf_vma (masked_buf, val & mask); > > - as_warn (_("0x%s shortened to 0x%s"), val_buf, masked_buf); > > - } > > + as_warn (_("0x%" PRIx64 " shortened to 0x%" PRIx64), > > + (uint64_t) val, (uint64_t) (val & mask)); > > > > return val & mask; > > } > > @@ -4913,12 +4906,8 @@ md_assemble (char *line) > > i.types[j].bitfield.disp32 = 0; > > if (i.types[j].bitfield.baseindex) > > { > > - char number_buf[128]; > > - > > - /* Coded this way in order to allow for ease of translation. */ > > - sprintf_vma (number_buf, exp->X_add_number); > > - as_bad (_("0x%s out of range of signed 32bit displacement"), > > - number_buf); > > + as_bad (_("0x%" PRIx64 " out of range of signed 32bit displacement"), > > + (uint64_t) exp->X_add_number); > > return; > > } > > } > > Just as a general remark / question, seeing these changes: Wouldn't > it be slightly better to use the # modifier in cases like these? It's > one byte less of literal string space and results in zero to be > printed as plain "0" (no 0x prefix)? Yes, that would be nicer. I do have a nagging suspicion that some compilers complain about unknown format specifier if you write "%#" PRIx64. Maybe that was with "%#" BFD_VMA_FMT "x", I can't remember exactly where I saw the warning. Or possibly it was some random development version of gcc I happened to be using, in which case it's not a problem. -- Alan Modra Australia Development Lab, IBM