From nobody Fri Nov 7 04:18:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1545989334311482.5661540005226; Fri, 28 Dec 2018 01:28:54 -0800 (PST) Received: from localhost ([127.0.0.1]:57750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcoRl-0002xO-P6 for importer@patchew.org; Fri, 28 Dec 2018 04:28:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcoP3-0000Vw-1l for qemu-devel@nongnu.org; Fri, 28 Dec 2018 04:26:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcoP1-00035o-4O for qemu-devel@nongnu.org; Fri, 28 Dec 2018 04:26:00 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:49209 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gcoP0-00034c-SD for qemu-devel@nongnu.org; Fri, 28 Dec 2018 04:25:59 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 1EE051A2140; Fri, 28 Dec 2018 10:25:55 +0100 (CET) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id DA5161A1E0A; Fri, 28 Dec 2018 10:25:54 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Fri, 28 Dec 2018 10:25:18 +0100 Message-Id: <1545989148-13582-12-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545989148-13582-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1545989148-13582-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PULL 11/41] disas: nanoMIPS: Fix types and format strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Weil Use POSIX types and format strings. Reviewed-by: Aleksandar Markovic Signed-off-by: Aleksandar Markovic Signed-off-by: Stefan Weil --- disas/nanomips.cpp | 20 ++++++++++++-------- disas/nanomips.h | 10 +++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index 1238c2f..28d78d6 100644 --- a/disas/nanomips.cpp +++ b/disas/nanomips.cpp @@ -258,7 +258,7 @@ namespace img std::string to_string(img::address a) { char buffer[256]; - sprintf(buffer, "0x%08llx", a); + sprintf(buffer, "0x%" PRIx64, a); return buffer; } =20 @@ -284,7 +284,8 @@ uint64 NMD::renumber_registers(uint64 index, uint64 *re= gister_list, } =20 throw std::runtime_error(img::format( - "Invalid register mapping index %d, size of list =3D %d= ", + "Invalid register mapping index %" PRIu64 + ", size of list =3D %zu", index, register_list_size)); } =20 @@ -501,7 +502,8 @@ std::string NMD::GPR(uint64 reg) return gpr_reg[reg]; } =20 - throw std::runtime_error(img::format("Invalid GPR register index %d", = reg)); + throw std::runtime_error(img::format("Invalid GPR register index %" PR= Iu64, + reg)); } =20 =20 @@ -518,7 +520,8 @@ std::string NMD::FPR(uint64 reg) return fpr_reg[reg]; } =20 - throw std::runtime_error(img::format("Invalid FPR register index %d", = reg)); + throw std::runtime_error(img::format("Invalid FPR register index %" PR= Iu64, + reg)); } =20 =20 @@ -532,26 +535,27 @@ std::string NMD::AC(uint64 reg) return ac_reg[reg]; } =20 - throw std::runtime_error(img::format("Invalid AC register index %d", r= eg)); + throw std::runtime_error(img::format("Invalid AC register index %" PRI= u64, + reg)); } =20 =20 std::string NMD::IMMEDIATE(uint64 value) { - return img::format("0x%x", value); + return img::format("0x%" PRIx64, value); } =20 =20 std::string NMD::IMMEDIATE(int64 value) { - return img::format("%d", value); + return img::format("%" PRId64, value); } =20 =20 std::string NMD::CPR(uint64 reg) { /* needs more work */ - return img::format("CP%d", reg); + return img::format("CP%" PRIu64, reg); } =20 =20 diff --git a/disas/nanomips.h b/disas/nanomips.h index 84cc9a6..71428b3 100644 --- a/disas/nanomips.h +++ b/disas/nanomips.h @@ -24,14 +24,14 @@ =20 #include =20 -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; +typedef int64_t int64; +typedef uint64_t uint64; +typedef uint32_t uint32; +typedef uint16_t uint16; =20 namespace img { - typedef unsigned long long address; + typedef uint64_t address; } =20 =20 --=20 2.7.4