From patchwork Thu Apr 11 21:39:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 787970 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp437131wrm; Thu, 11 Apr 2024 14:40:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpccFvhfvz0wvRLmRAiOJ1JOt0m6dKtWp1hFx+3cdO5x2Vpwj8QDtJlXS4/qcXFUYU7+eqV62PXHSJcZM4x2oZ X-Google-Smtp-Source: AGHT+IGFOwMLviHHGBhZzBj7gaZzUA+1ktjgCycl7nvRfiZ137bdBZcg+yvTa66hniPt1vsYEGfd X-Received: by 2002:a05:6102:f94:b0:47a:42c4:4cde with SMTP id e20-20020a0561020f9400b0047a42c44cdemr1132454vsv.18.1712871629458; Thu, 11 Apr 2024 14:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712871629; cv=none; d=google.com; s=arc-20160816; b=xCvE95y6I/z90Q8GypcYCvpFo6m3SZAhlWIkj8HURYYcXh1luhBbEsSQhf5fnDLQo8 jXGLLTYlM1Ot6bpz5fCdWijgSOLbucHa0Y1FtBDIIrejWoYXGwMY0VXbPMpvcPTJyjoe ewAL2l4kaZKkjyWVvSeDRbmHSxJArbqa+mKGiZHzybOoDcldQJhBYusDIF0BvJ+TCwg1 CXbcE9AcOQF3b0smIxoOtLdmJUNHAyD50yGSfJhChWtfokqNGAyQwNWD+TLVdBp07OJn 7P7GgUioh56e8l2qRYoglJ2LwAc2P/QIVYiXeISWqm3SRXFtbpFijISB96mj1w2mPcSR PRZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9IDmcslUAelQNuuThaJDYP8czpqm/pNDa1dM39p8C5s=; fh=IeB7bcJYbf/ycy6R3IDTJMTfIW648jju7/6DjrJ05AM=; b=pZW/+agsUZSqKM3MvBy3RJwIu9nEthg4Kz+NHpD1BdqmZc6wOUv8NvPdNZvl69CwtL wgi35BxV2YCDMIICaVlvhIAvJqiqIS5Fl9mPN306k4bVGMVEX3w5rn+FU9l0y4cFuVl/ 2eamTQJ68Kaswu5ZfNeX5ODjQntqYtUsKDLoZczFye3qAEv/Q9I7HH6VYnq+Ga8feTF5 bmZJJplfqPetqEJ9w9htEtPc++qAG4HDzAWOHkfHjoyQb+QlzP1Ga4rPtmY3CtkLR3sw HpJUYSFp7HiFQXUN6Tp5fFLxOZDlV3QjuRL2Kpqew2gVXY6KqkTDzHRqKbcuWdjMrVKf 1OhA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KorOlhBB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o19-20020a05622a139300b004347d308f39si2319336qtk.626.2024.04.11.14.40.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 14:40:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KorOlhBB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rv294-0003OD-4Y; Thu, 11 Apr 2024 17:39:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rv292-0003Nw-IX for qemu-devel@nongnu.org; Thu, 11 Apr 2024 17:39:44 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rv290-0004lw-EL for qemu-devel@nongnu.org; Thu, 11 Apr 2024 17:39:43 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-417d029bf15so2059805e9.3 for ; Thu, 11 Apr 2024 14:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712871580; x=1713476380; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9IDmcslUAelQNuuThaJDYP8czpqm/pNDa1dM39p8C5s=; b=KorOlhBBxddC1Lvr3osSYu8/0zeHipMoMXkgzfbpB0GO35beE1F0im935uWsdwLWz3 11Gmttgup7QN2E29uCkStLcxyHp+N+c3IzyPA2pUIhw0BijxfDwgJ/YyuoQp++Hg/VWD fVQlF1lRofFekxtBdtrKtNjSxFcDGASXxRwBoi/fh+GwMsqQYN8rhGcD+m9+IWcR8eY5 Oh5vAxNtCbH/rI5iQO6pmo5YCQUGrrFcRbQ0C2PypAv4jbn+8kEc97FP/mioJg9hRBA5 XVPwemEAIPdgoBk/P0w6yihh5Q6cKBzZoSc25NxuCgX1IfkWiB3XUga+nerqqpfD+JvP b10g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712871580; x=1713476380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9IDmcslUAelQNuuThaJDYP8czpqm/pNDa1dM39p8C5s=; b=bA41wGGs+sui3TWRSIM6Jyd8FbYQFcnot8T//K2rf2J1SKUfVU0O/jcythqtfJKBeU LBRlu4czASKMYL1iRW9gKBfIpaY6iOjbnsq5RCRL5GBl4sUdzYQ6mCrVE+/FHDikkDz0 ApVzhk57bM4Iufpq4NtWQ85pUTUCHd6vAo/f8NOl7c45XRPMTqiXz+gPZLmao/GZZvCG eVWUTsXdbsjyj647BgBIrkqEDkYL21bfdhkURO30vNNNs6l+jEmJszH5+3i7TAbIMrjR D155ltKG+OxAWAjKmP0w7aaK4D+fF5JyJsfBxHEg9eJqE+Pw3ssbZSVwfStJDe2pOEI+ 9FOg== X-Gm-Message-State: AOJu0YzJFZ/Xj46THAlmXWAFcJuyWlIYylBNEqA2+qTWyW2yGsibMP7l Ib1svaJxsCLtpdwxfXbmS/W8rX3SGr9QWXVZ8MafDSK5bFIc8f2sy0bS4aJb+GjMrh1vIbYfbc+ TwVE= X-Received: by 2002:a05:600c:1d1b:b0:415:48b3:e270 with SMTP id l27-20020a05600c1d1b00b0041548b3e270mr649616wms.9.1712871579919; Thu, 11 Apr 2024 14:39:39 -0700 (PDT) Received: from m1.home (lfbn-bay-1-170-196.w83-193.abo.wanadoo.fr. [83.193.250.196]) by smtp.gmail.com with ESMTPSA id s12-20020a05600c45cc00b00417e8be070csm1764939wmo.9.2024.04.11.14.39.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 14:39:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 1/2] disas/m68k: Replace sprintf() by snprintf() Date: Thu, 11 Apr 2024 23:39:32 +0200 Message-ID: <20240411213933.36548-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240411213933.36548-1-philmd@linaro.org> References: <20240411213933.36548-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1, resulting in painful developper experience. Inline sprintf_vma() and use snprintf() instead of sprintf(), silencing the following warning: [38/244] Compiling C object libcommon.fa.p/disas_m68k.c.o disas/m68k.c:977:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf_vma (buf, disp); ^ Signed-off-by: Philippe Mathieu-Daudé --- include/disas/dis-asm.h | 2 -- disas/m68k.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h index b26867b641..1d8a4ce9a1 100644 --- a/include/disas/dis-asm.h +++ b/include/disas/dis-asm.h @@ -15,8 +15,6 @@ typedef void *PTR; typedef uint64_t bfd_vma; typedef int64_t bfd_signed_vma; typedef uint8_t bfd_byte; -#define sprintf_vma(s,x) sprintf (s, "%0" PRIx64, x) -#define snprintf_vma(s,ss,x) snprintf (s, ss, "%0" PRIx64, x) #define BFD64 diff --git a/disas/m68k.c b/disas/m68k.c index 800b4145ac..e8e61c7a4e 100644 --- a/disas/m68k.c +++ b/disas/m68k.c @@ -974,7 +974,7 @@ print_base (int regno, bfd_vma disp, disassemble_info *info) else (*info->fprintf_func) (info->stream, "%s@(", reg_names[regno]); - sprintf_vma (buf, disp); + snprintf(buf, sizeof(buf), "%0" PRIx64, disp); (*info->fprintf_func) (info->stream, "%s", buf); } } @@ -1069,7 +1069,7 @@ print_indexed (int basereg, (*info->fprintf_func) (info->stream, ",%s", buf); buf[0] = '\0'; } - sprintf_vma (vmabuf, outer_disp); + snprintf(vmabuf, sizeof(vmabuf), "%0" PRIx64, outer_disp); (*info->fprintf_func) (info->stream, ")@(%s", vmabuf); if (buf[0] != '\0') (*info->fprintf_func) (info->stream, ",%s", buf); From patchwork Thu Apr 11 21:39:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 787969 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp437109wrm; Thu, 11 Apr 2024 14:40:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUABGIvfqoJ6LRShlStwv+4lV2fnBNx8Exl37z1gxoF5OKT/qxbpyOtvwByGHZcPPHbG6CvT3qt9h6/8aJsiHmi X-Google-Smtp-Source: AGHT+IH9OT5Q5n8aBnFiDYcr8wgHkiY/75eEk6DYukjSBjen/2fx+TuonUb3h+RrQ5aes3avse8H X-Received: by 2002:a05:690c:6d12:b0:611:26e1:f482 with SMTP id iv18-20020a05690c6d1200b0061126e1f482mr792912ywb.32.1712871626601; Thu, 11 Apr 2024 14:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712871626; cv=none; d=google.com; s=arc-20160816; b=oEFrigfGBd/61y9kq92VLzS4oTBfpSfArhog1C2CYFrML2tC8CGSP6ZMZDVfCDFlCj JWHs6QQwn4vtZMe5QCQc8S0MlCNV/Msb4zt5gLm4CN1i7kjejxuwOl54Fw0MfCGVS553 lDD2tNFBebnZh6N2NSBYCxD5M5V2cBFJYwFUoXygpxkJ7LRxTjVWP2YBWG6D5bB9sMSz zhZzfXhZxSGihiUJ1iqMH3Lt2DHrgqFYN1+1cMHfv8jej2breMmxTiVsHVNBHN7fx064 Uqg0ed0uAyh0jcxdhmTS0GfwTvXGmNoqieo9/fL3dkKOX0CEolbw8qlk16IrTX89c0V6 jiFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HrhzeMzxNuIZGu7VGzskxIOg/oIQUJqRCAaEjVEOSZ4=; fh=IeB7bcJYbf/ycy6R3IDTJMTfIW648jju7/6DjrJ05AM=; b=EBU0ccMUJ0qreh3b9w/0fKF59KlOOBxmuzRZ+UxjnwJ7BpvA83WOusLBNOpyZPl4y/ TkxAJGs7aj3HpuNlDySh172uQmT8rsVqrB+ZwjTGIcrphGd9JHMXE7kyIOF/UZk3xl1T WeYhU1aEgHrHaXIhihA1/gzAIkkYcaeaLEJnL8U1vrALVabxAs36/gVnI/Tb4acHJtc6 ai1uru6XTZ5Yu3KAX1c2c0vU2ktqmLMAVDJkJlCP1I6Jx5XKkNelG2vImuygR5yicZNf iz44vWfZ7EMVDSoFETsQqjKvpFPg/sAA9Cdv+xYcHipMJMNoSxd50JXVBpE0zeoi00gq NpBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUy2uOPk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d16-20020a05620a137000b0078d6562dbe4si2406457qkl.97.2024.04.11.14.40.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 14:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUy2uOPk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rv296-0003Oc-QZ; Thu, 11 Apr 2024 17:39:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rv296-0003OU-3z for qemu-devel@nongnu.org; Thu, 11 Apr 2024 17:39:48 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rv294-0004mR-2Q for qemu-devel@nongnu.org; Thu, 11 Apr 2024 17:39:47 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-346b146199eso181626f8f.0 for ; Thu, 11 Apr 2024 14:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712871584; x=1713476384; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HrhzeMzxNuIZGu7VGzskxIOg/oIQUJqRCAaEjVEOSZ4=; b=mUy2uOPkLEF8rszY7JedBItwmrbtrdmFYDD7JC2pLbqRzV5uIiSwyhslz/4SaPO8ZU mAZDWUrEcb3/2+7r3/V/ORtEebPRFFluXQdVpBAwDFIZLkP3VcsSdNASFLHYqwtY5EVb J5yWAq3WBmQyAeBEI73CRnD2YJmLXZYm5Va6vK8/jaxP95J06x9HfqK9ZIBzNyAF+/R0 J9LvAMqxbPQj+rSSVayM2HXoZGaG/pNujjjZxp/DdUlEzQd9HS/pmg4kdtQrX0LQaJ3q K7gSKQ8Di5F4tKNO7yxR9n8SDbhB3PK9UBjKYmUbscOZQBzm/iaE4dkyfl/rLvdSQJY6 Eqaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712871584; x=1713476384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HrhzeMzxNuIZGu7VGzskxIOg/oIQUJqRCAaEjVEOSZ4=; b=CB03zyx53JBLSlDPXFWn+Hj49acW7xzietfYPOoV02EwKNkUnFnG7YzMIo0aRK/0/W 2+upip/2yl0RC/mwaSVmQtp2epYCtS54jU4BgxssfSF6jpWTkMJkIIPCl4B5ij5iMHiN utWsy/9SS7TTFrIJR8bz2d/CFz2NJjc4AmCfqVWuK9vzaEoxPeLEy1/m8vyXRpyniz5u palno3QAs3D8YazIvBmyMlhMOAtLW/5HGGMRiy6dhx+ao2YOOYwmVfT386K+k3dKxYGe OmKP7OPTotMollKnjjuT2bLDfWTbjEu0srY65jN5r5Fh6fcWu67FfFEd4+WEoEg+dacm +eXw== X-Gm-Message-State: AOJu0YxbxOw8aSI38pVaGEbRMpSLcG18JAa+uQapasa9Lt/fJh+pLjlf kU0JbTNMzNTwL+78QilSEJbN62oF9q+GigTAfLT47tduNpQTWnYLHaKxoWQ9YSX0s4B3nPCz6M1 QW5Q= X-Received: by 2002:a5d:68c3:0:b0:343:7f4b:6d9d with SMTP id p3-20020a5d68c3000000b003437f4b6d9dmr463738wrw.53.1712871584250; Thu, 11 Apr 2024 14:39:44 -0700 (PDT) Received: from m1.home (lfbn-bay-1-170-196.w83-193.abo.wanadoo.fr. [83.193.250.196]) by smtp.gmail.com with ESMTPSA id d15-20020a056000114f00b00346d3a626b8sm1745217wrx.3.2024.04.11.14.39.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 14:39:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 2/2] target/m68k: Remove sprintf() calls Date: Thu, 11 Apr 2024 23:39:33 +0200 Message-ID: <20240411213933.36548-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240411213933.36548-1-philmd@linaro.org> References: <20240411213933.36548-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1, resulting in painful developper experience. Since they are very few register names, use const arrays instead of trying to be clever generating the names. This silences: [2/8] Compiling C object libqemu-m68k-softmmu.fa.p/target_m68k_translate.c.o target/m68k/translate.c:92:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(p, "D%d", i); ^ sprintf(p, "A%d", i); ^ sprintf(p, "ACC%d", i); ^ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/m68k/translate.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 8a194f2f21..d0561c18fe 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -48,7 +48,6 @@ static TCGv_i32 cpu_halted; static TCGv_i32 cpu_exception_index; -static char cpu_reg_names[2 * 8 * 3 + 5 * 4]; static TCGv cpu_dregs[8]; static TCGv cpu_aregs[8]; static TCGv_i64 cpu_macc[4]; @@ -66,7 +65,15 @@ static TCGv store_dummy; void m68k_tcg_init(void) { - char *p; + static const char dreg_names[8][3] = { + "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7" + }; + static const char areg_names[8][3] = { + "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7" + }; + static const char macc_names[4][5] = { + "ACC0", "ACC1", "ACC2", "ACC3" + }; int i; #define DEFO32(name, offset) \ @@ -87,22 +94,18 @@ void m68k_tcg_init(void) offsetof(CPUState, exception_index), "EXCEPTION"); - p = cpu_reg_names; for (i = 0; i < 8; i++) { - sprintf(p, "D%d", i); cpu_dregs[i] = tcg_global_mem_new(tcg_env, - offsetof(CPUM68KState, dregs[i]), p); - p += 3; - sprintf(p, "A%d", i); + offsetof(CPUM68KState, dregs[i]), + dreg_names[i]); cpu_aregs[i] = tcg_global_mem_new(tcg_env, - offsetof(CPUM68KState, aregs[i]), p); - p += 3; + offsetof(CPUM68KState, aregs[i]), + areg_names[i]); } for (i = 0; i < 4; i++) { - sprintf(p, "ACC%d", i); cpu_macc[i] = tcg_global_mem_new_i64(tcg_env, - offsetof(CPUM68KState, macc[i]), p); - p += 5; + offsetof(CPUM68KState, macc[i]), + macc_names[i]); } NULL_QREG = tcg_global_mem_new(tcg_env, -4, "NULL");