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);