From nobody Fri May 17 07:47:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1695616309; cv=none; d=zohomail.com; s=zohoarc; b=J2WxiGZFKmCesIV4Z+ZZ5BIWr/lIZ89FJqwTcgfAOQA43ep1C34hyXVuVnInbrTDClGAtYHz6RGjO4+C2iIkPIyC7hTM12GUvH93XcHFy5OPIiw1amt+Fi3c1V4/W7iaqvpblymvZStpaq2ksUmWkqZa9D2SdEx5aGQCAeQVSAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695616309; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xNNI0O3SzKHU7vUAvRWqz/iywCW4aWcpOWziFo+dg/k=; b=VajZV9Q1GR+oXXRfvfCghYgIubrveFZvvAOyX/rEbEnm0KQO+A6DQ209molx4kXWDRpzEugb4G3ajxtqeQT3DE3pL6YgHmn6v/WbW4ivEN/c9rWJhZvV7zb2+9Q4woUQX98sYwmaxUgymErv4Ex/TYlMgzXVyKAsGIyryqyCcTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169561630904469.8069823144591; Sun, 24 Sep 2023 21:31:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkdF6-0002qL-Jr; Mon, 25 Sep 2023 00:30:44 -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 1qkdF3-0002pr-Of; Mon, 25 Sep 2023 00:30:41 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qkdF2-0007Vn-97; Mon, 25 Sep 2023 00:30:41 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27763d36661so391880a91.3; Sun, 24 Sep 2023 21:30:39 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id y14-20020a17090a134e00b00276fef82025sm6002161pjf.35.2023.09.24.21.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 21:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695616238; x=1696221038; 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=xNNI0O3SzKHU7vUAvRWqz/iywCW4aWcpOWziFo+dg/k=; b=fo+tZC+N3bkmMktvaNf8zyf0oyxmBCVJ6Bgnqb3E8KYnWG6hhf/0l999xm0uIFcBRt Xis9Y19fdvJI80eBSy9Ec9HnVDbGweejqvXtsWlhNnGTzpxjj8tfWFMiHb8intRAjVQI FF/ooch+mpdDdd1oBs6Kmcwrf3XjZC+6ftAsa+MZej1fjxA+Aj0ELgAOUIwxxxaTIwTU EtHLD1DAhElBOqWvQQ2dyeuR5e0XE3CRmWRx+zILklgysxyLbFDH8giuPX2zNXUeCB3h 7LmTki238h9sOUz5viR9jDDrmtUEliFggTQscVxJTjApaJ0wwlExcHiM/CKP5VboxdLo mB9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695616238; x=1696221038; 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=xNNI0O3SzKHU7vUAvRWqz/iywCW4aWcpOWziFo+dg/k=; b=McaE2xOtGDU+kApDCNdp6W8MvhM0DjZxnyzWc9EasqPGA9zVGY9RCOl9dIfB6qCD9I OeUoRHNJ1HEWGPt0p/Qu0q6zkUXiM5WJ+9SmPKkfIFWMc012NvsY5O2CNFMQ303WSTzH xn3GOCVFCE3yO7IRkOtKnkFCezU4LAs9F8bPhujbtQCG3ocZ1y2XJxxEqN+RAcZIS+ki TLfAuH4o3LGhzrEfhnPolml2P46c6Gq53vaNdz5pLtfN1t4JMxRT8KgFvszuhhQ9byr0 BRWxDg0H2Ems0gkM4Ql7hgwAc5keoE9rzMkz3+UtvGUGzUHXpAZ88wmjL3K5oKU4O5kA ROqQ== X-Gm-Message-State: AOJu0Yxut3cLANhZbNRZ+BJE+foPjmQzyDs9chdSvp/lGhu0dS2PDBjU BXuIjIlpBAfD6rT1oAVSN/8= X-Google-Smtp-Source: AGHT+IE4cBlFMyevsXFhg/gEMPofdWP6CQjh2d5+cXfcRa03uoYaD3laf9LX2mkQ7bqnT6Ip8lzZQw== X-Received: by 2002:a17:90a:4e4e:b0:268:f987:305f with SMTP id t14-20020a17090a4e4e00b00268f987305fmr5222831pjl.46.1695616238397; Sun, 24 Sep 2023 21:30:38 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: david@gibson.dropbear.id.au, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: bmeng.cn@gmail.com, alistair.francis@wdc.com, Liu Zhiwei , palmer@dabbelt.com, alistair23@gmail.com, dbarboza@ventanamicro.com, Alistair Francis , liweiwei@iscas.ac.cn, Bin Meng Subject: [PATCH 1/4] hw/riscv: opentitan: Fixup local variables shadowing Date: Mon, 25 Sep 2023 14:30:20 +1000 Message-ID: <20230925043023.71448-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925043023.71448-1-alistair.francis@wdc.com> References: <20230925043023.71448-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=alistair23@gmail.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1695616311544100005 Content-Type: text/plain; charset="utf-8" Local variables shadowing other local variables or parameters make the code needlessly hard to understand. Bugs love to hide in such code. Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail on polling error". This patch removes the local variable shadowing. Tested by adding: --extra-cflags=3D'-Wshadow=3Dlocal -Wno-error=3Dshadow=3Dlocal -Wno-err= or=3Dshadow=3Dcompatible-local' To configure Signed-off-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- hw/riscv/opentitan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 6a2fcc4ade..436503f1ba 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -227,7 +227,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_s= oc, Error **errp) IRQ_M_TIMER)); =20 /* SPI-Hosts */ - for (int i =3D 0; i < OPENTITAN_NUM_SPI_HOSTS; ++i) { + for (i =3D 0; i < OPENTITAN_NUM_SPI_HOSTS; ++i) { dev =3D DEVICE(&(s->spi_host[i])); if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi_host[i]), errp)) { return; --=20 2.41.0 From nobody Fri May 17 07:47:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1695616308; cv=none; d=zohomail.com; s=zohoarc; b=kK9ySxos1b3qWF64xSNDrwNm4iVQdr4vYelbQqYsPXunznpiaXCSHxhQoggFiB62KzZ9RSTthfBbVCtHzY8jmedyRhtJzJL9ykOyXHTj6/mWE2CugLJZ/WuqzDPaIvrqymi/tA6iMXfsqjf2ThzqIoG3CihtLwUuFP6sJpmykyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695616308; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=quOcfMT3Co7SEqVqYNSyCwXYD43DzXY03xaAdPbNQGY=; b=TlLT1gxqYx0qwlliAXglfUpWicge4Pydk5ohgMnxCRmHPhq/1r2V6tEo9viS7QzOa8YyPYAawlViYfdmncvNOI0Xb9AK5+3HCsbvjfmuIQUEmhj8s0iG12Vaxhh5T1myLTha8XESxY9vsiwgDV2BIQveAZaGvyox+R5+x0X+esk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695616308952881.2632128270916; Sun, 24 Sep 2023 21:31:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkdFC-0002rh-Jy; Mon, 25 Sep 2023 00:30:50 -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 1qkdF9-0002r8-Gj; Mon, 25 Sep 2023 00:30:48 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qkdF8-0007WI-16; Mon, 25 Sep 2023 00:30:47 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-68bed2c786eso4132161b3a.0; Sun, 24 Sep 2023 21:30:45 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id y14-20020a17090a134e00b00276fef82025sm6002161pjf.35.2023.09.24.21.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 21:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695616244; x=1696221044; 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=quOcfMT3Co7SEqVqYNSyCwXYD43DzXY03xaAdPbNQGY=; b=Kv+CQWF+I+/rGzl1Fp3KDN8u/PY4/FPsP4L85EnFO4av2yVOJT4HSHmO8kPVzw7vWA VOo9WYvOxT34KyuS66Skyy2Xy5FIfBqoc1OaKnZSMQvA/WqAIM8XK2aARLIFBZMJHHDO EAMhVbmBJoWhlBa0MXysLvOEJok2o4pPFyhKTbJB/I8tm3HtI4mJv58zLwRKu/OWJgGK 3+3RY8GnOHnVGwb/na1M4PR4EHB7HDRJxeZUBP12mWUzqud1XHGmi/0JRgmFBhKchIiQ NeZmmfe3q6vzMeUwj5J/1t7YfFHKibviTXOuQ63Fnefcdqk3BUdNNvjhuAb4jS3NPvs6 9hpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695616244; x=1696221044; 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=quOcfMT3Co7SEqVqYNSyCwXYD43DzXY03xaAdPbNQGY=; b=Z2bQoADYEIackgLrDn8GHHUDnlsssglAcJDnbzThKg6IO1PfcucGkCoLOv8dnXQZPb oCc8yeaBmkZpuI5ZHrtWeqkhKVvCOJlBKh0fq+Nioac3ZnAtmqNT53P9EjfnZYpqB0gc ZsFnJqou8h018SebgsBRvHG3I/KREbCBvxEPUkOh9XNa2WZTb38wEjBCjwU/bVOurDid ax+ivDW4AVThdm3CLFK1lBWHUI2Q0gmgJicIWEH2qHrAUMIJ+6o0JHnbfgTKNiGv1OuS OULeKAlMioBf2xWNz4CtTCXD7TvupTa027aReY/E3lzrnlSaMflbxxOSj2qA8y9m/CQu Y7Dg== X-Gm-Message-State: AOJu0YyLkUqVu20u3C7/NAs0RwvVBn9G8wUc/4pbTa6CgoGvnD8RFKL9 gS0XXp0tHytUTgbM76qGshY= X-Google-Smtp-Source: AGHT+IF/rhJonP/PIzMqWZ9YfTIVFksAkVeEsWddN4snDQtI5jiV5abSjfA7sMu180uvVsNhcPwllw== X-Received: by 2002:a05:6a20:1451:b0:134:a4e2:4ac8 with SMTP id a17-20020a056a20145100b00134a4e24ac8mr5117016pzi.39.1695616243803; Sun, 24 Sep 2023 21:30:43 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: david@gibson.dropbear.id.au, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: bmeng.cn@gmail.com, alistair.francis@wdc.com, Liu Zhiwei , palmer@dabbelt.com, alistair23@gmail.com, dbarboza@ventanamicro.com, Alistair Francis , liweiwei@iscas.ac.cn, Bin Meng Subject: [PATCH 2/4] target/riscv: cpu: Fixup local variables shadowing Date: Mon, 25 Sep 2023 14:30:21 +1000 Message-ID: <20230925043023.71448-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925043023.71448-1-alistair.francis@wdc.com> References: <20230925043023.71448-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1695616310317100001 Content-Type: text/plain; charset="utf-8" Local variables shadowing other local variables or parameters make the code needlessly hard to understand. Bugs love to hide in such code. Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail on polling error". This patch removes the local variable shadowing. Tested by adding: --extra-cflags=3D'-Wshadow=3Dlocal -Wno-error=3Dshadow=3Dlocal -Wno-err= or=3Dshadow=3Dcompatible-local' To configure Signed-off-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index eeeb08a35a..4dd1daada0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -699,7 +699,7 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,= int flags) CSR_MPMMASK, }; =20 - for (int i =3D 0; i < ARRAY_SIZE(dump_csrs); ++i) { + for (i =3D 0; i < ARRAY_SIZE(dump_csrs); ++i) { int csrno =3D dump_csrs[i]; target_ulong val =3D 0; RISCVException res =3D riscv_csrrw_debug(env, csrno, &val, 0, = 0); @@ -742,7 +742,7 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,= int flags) CSR_VTYPE, CSR_VLENB, }; - for (int i =3D 0; i < ARRAY_SIZE(dump_rvv_csrs); ++i) { + for (i =3D 0; i < ARRAY_SIZE(dump_rvv_csrs); ++i) { int csrno =3D dump_rvv_csrs[i]; target_ulong val =3D 0; RISCVException res =3D riscv_csrrw_debug(env, csrno, &val, 0, = 0); --=20 2.41.0 From nobody Fri May 17 07:47:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1695616360; cv=none; d=zohomail.com; s=zohoarc; b=aKNj5Tbhfy9sUPg/mhkHbOr8wsJCQG8VWwT7a4A6ImW56xqqP8hKh1Dsyb5D0TPFNLzGJS4iYL/zZEntObqfRfK/mdJ1wwqjc2iBLyn/aMGStL03hCm7sIGbWfo/HKd8Ohut5N1p04PC8801VH7rseeVObz99/W4c/0RG3BJHWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695616360; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vbzU6PuAtTUzb6Apd7sQVmg+mcHLI4MPchfruHrfnq4=; b=Pu9XCP+Ix0yGBFBiCMX3oKNV+Xtw7W38swpk+C0vPx4EmrKj5dVEmAGavw1pii1ETvEsbUwWYOmpYaLLMNSHgvYGQAyNHUsEY0Q6PeiaNSY5YbokchOW37ta6D/Hb6KVnaTCoRFwrfmwfspcw+7z+NDLgnhTMZtwBGs5P4ckiho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695616360948191.87632317425152; Sun, 24 Sep 2023 21:32:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkdFP-0002xw-JS; Mon, 25 Sep 2023 00:31:03 -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 1qkdFN-0002vC-Cv; Mon, 25 Sep 2023 00:31:01 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qkdFD-0007Wc-BZ; Mon, 25 Sep 2023 00:30:53 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2773523b2b6so886258a91.2; Sun, 24 Sep 2023 21:30:50 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id y14-20020a17090a134e00b00276fef82025sm6002161pjf.35.2023.09.24.21.30.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 21:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695616249; x=1696221049; 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=vbzU6PuAtTUzb6Apd7sQVmg+mcHLI4MPchfruHrfnq4=; b=CCFKEMd151qE4fEBGJzbESBuSZAkWVKr+PtMf9CMFlrvvOeVUl08zdymkICfDWmi1m fkmdtKFMLwM/MRtoy4QsgnMzyuUeLlyENE/1a2Pq7FNX3pYa61Hm+KuTjnHZd5BP6dUa 9qLpyhefA2HMKD44kHQkGjltCv7AtX4piVg9DHNdvaSIyERb3azuA0PmNp1IvMxQhcgO CcFRgtcMuvmwuzSLiEj7n2UjaHbox/DOmo4NuBCQVka1LhtebWV6l7P/QrreUpWoQ7Bw A2z28qobBjJgGCHoE4rZqxPqyJt4I2p2ZNdCbC8ZxMVtau4/Bv6G86AWz34IrjM905k7 p+Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695616249; x=1696221049; 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=vbzU6PuAtTUzb6Apd7sQVmg+mcHLI4MPchfruHrfnq4=; b=odZSudU4tRu7HM6U4eMSdG66LuAOGRVpMhDapRjqvHvt7hW+1ty7UpRRfoPJvs0oxB 3nv8IhQ76thq03PgPsE0VV8w9K3P0CVb/NZXLz6+REopvTEipCFsSmiqyiIn0+5gMEbP G+1sdsge9XevRvvqUc/yfqHd3gRC9Y+b3HJHee2eHiBSCIQyuO73j8wweRd+lbIT7iOn RnjXU83TTPoi+Iyk+KodYgWvXOgyhADJU3BJYosAIqtmK22RbJrB8ka3CHMcrhUjwBdp yPve6AW0lE+dvEkdSShU0KD8rRtqRr7+ihymABcjEttGZdQrlVkbGo4UdvWEY8qnmA+U sa3g== X-Gm-Message-State: AOJu0YyLa03N51P11Pm4X3RhRIYoijO7vj6c7DYsdUQ6wqWSNqnTXZDM /bucHS/hPWYuYfBrUgy+qpo= X-Google-Smtp-Source: AGHT+IF2MFlbGEMFluAhFsg0/sJ9YANolk5k0QJe81NJ8MLRdR9quSLqHuSpx6rHbxORHb8guZ/tQQ== X-Received: by 2002:a17:90a:f016:b0:26d:3ad:7c83 with SMTP id bt22-20020a17090af01600b0026d03ad7c83mr3241519pjb.13.1695616249409; Sun, 24 Sep 2023 21:30:49 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: david@gibson.dropbear.id.au, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: bmeng.cn@gmail.com, alistair.francis@wdc.com, Liu Zhiwei , palmer@dabbelt.com, alistair23@gmail.com, dbarboza@ventanamicro.com, Alistair Francis , liweiwei@iscas.ac.cn, Bin Meng Subject: [PATCH 3/4] target/riscv: vector_helper: Fixup local variables shadowing Date: Mon, 25 Sep 2023 14:30:22 +1000 Message-ID: <20230925043023.71448-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925043023.71448-1-alistair.francis@wdc.com> References: <20230925043023.71448-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=alistair23@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1695616361953100003 Content-Type: text/plain; charset="utf-8" Local variables shadowing other local variables or parameters make the code needlessly hard to understand. Bugs love to hide in such code. Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail on polling error". This patch removes the local variable shadowing. Tested by adding: --extra-cflags=3D'-Wshadow=3Dlocal -Wno-error=3Dshadow=3Dlocal -Wno-err= or=3Dshadow=3Dcompatible-local' To configure Signed-off-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- target/riscv/vector_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 3fb05cc3d6..cba02c1320 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -516,7 +516,7 @@ ProbeSuccess: k++; continue; } - target_ulong addr =3D base + ((i * nf + k) << log2_esz); + addr =3D base + ((i * nf + k) << log2_esz); ldst_elem(env, adjust_addr(env, addr), i + k * max_elems, vd, = ra); k++; } @@ -4791,9 +4791,10 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s= 1, void *vs2, \ uint32_t total_elems =3D vext_get_total_elems(env, desc, esz); = \ uint32_t vta =3D vext_vta(desc); = \ uint32_t vma =3D vext_vma(desc); = \ - target_ulong i_max, i; \ + target_ulong i_max, i_min, i; \ \ - i_max =3D MAX(MIN(s1 < vlmax ? vlmax - s1 : 0, vl), env->vstart); = \ + i_min =3D MIN(s1 < vlmax ? vlmax - s1 : 0, vl); = \ + i_max =3D MAX(i_min, env->vstart); = \ for (i =3D env->vstart; i < i_max; ++i) { = \ if (!vm && !vext_elem_mask(v0, i)) { \ /* set masked-off elements to 1s */ \ --=20 2.41.0 From nobody Fri May 17 07:47:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1695616348; cv=none; d=zohomail.com; s=zohoarc; b=V27+LibHUDaZUI/HBNupmG0JNuqKosRWXJLYC/XYumEDiKWC1uzWbc8/UNn6MQMl6a39+0KoVef+DDP5eVt1hVuilYYYQlozZMkvGDXZYyWp3ZGt5UIQlq3hg8IouIDaXKXjcmGMjr17T3GXEkzNK2e7nvKnNC8LKlpQq1z842U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695616348; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oAADUFg+k/c4zaXXzz1LwvW/lPNv6yL8UJ70OyvIJA8=; b=hWw8FcoVDCoIsfoYsgYOoJEeQ3IhigG31NaNAMK3v1UnznojgCjdU22kl6/3dQ1rIWco40l+aeFsvofAYTFAJQ+AyEhz/6mWmtmMBv6LFzuZaHWPdcdAq9iL+uWPBZXdYtabe5kDGAWpdc7v6U4VWgBVIJ5xSmjSF+xhlhiuQhU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695616347739897.1339663211857; Sun, 24 Sep 2023 21:32:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkdFR-0002yk-Kp; Mon, 25 Sep 2023 00:31:05 -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 1qkdFP-0002xg-12; Mon, 25 Sep 2023 00:31:03 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qkdFN-0007Wu-FT; Mon, 25 Sep 2023 00:31:02 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-578d0dcd4e1so3168539a12.2; Sun, 24 Sep 2023 21:30:55 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id y14-20020a17090a134e00b00276fef82025sm6002161pjf.35.2023.09.24.21.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 21:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695616255; x=1696221055; 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=oAADUFg+k/c4zaXXzz1LwvW/lPNv6yL8UJ70OyvIJA8=; b=jlEoysQhAqYTeSb0+lG4FbE7MAQBc/6K5kZ+j3sKnoU4WxyXhML6+pZa/1l3L0AIJK VEugGjs7NLEXKLW2xMk9y4SBizFbDu6x70f2n4l8dKJBB4r9/dSCpIbwN5QGgXmPLAH+ rG0jxKa8JlTb/iU05L9bNNREjYb0arluIYmUOLlrVxw37eCnCM5+60Nv0diHESwnMWAk UI5qGo7O2/b3BVz59YfuZRxTTSqJpmnmYrppNLR7hz/LSHJswv9E3eFlkNhPu7ACwy6t reV+msMVNJgyxLcipByXZcvKeRst6B4Zmqp9c13FyQoIwOn+dycqT6yene8/V8b7/XoX y1JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695616255; x=1696221055; 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=oAADUFg+k/c4zaXXzz1LwvW/lPNv6yL8UJ70OyvIJA8=; b=iBdQGfSJN3ZnJ9LqDBCVUaJOO0V2LHap6gYcRcvobMWOAiVoVteXC+q06v3YAuUGoH OaowJ4PhYUfTz0FTnKK19FCuh5ZFKphpBcKp+ZY8HHypbJmErC2A6sm6V0onShVuSgqP 5tTiBeCkojQDSs7xYkjDiMBz73aMyJeqCm7i0TXNgYiFZ2FvX+8yxoM4uzSCZ7SfWs9X DNP31qsIpa7IQyGJRa5T/Mh/HVbpIO7GakSfYgWwhZmrbE3sIJZI5fUcxGnjxjpGbubE CVzSFxRFKM2Vder1ftcBf8EcMF1wod4Ve0GqMI/Ec+1Z91TKW34iwLE8Sa8yYsy0e59w fJ4Q== X-Gm-Message-State: AOJu0YyS6T8Q/EWqSJKhTwtb0mZSdEhrldhJj+5j2imKjyl+xEVBk2yZ DL9jqfsq40BgqstB9tperzA= X-Google-Smtp-Source: AGHT+IEQ3uqOWrJmW0WREHy+INr2DYbEVzgejDCnr7N+Mt0pFPTNPpOmdMKCSF5RBaw9tP46UELHlQ== X-Received: by 2002:a17:90b:1d04:b0:274:7047:aa9f with SMTP id on4-20020a17090b1d0400b002747047aa9fmr3432778pjb.32.1695616254934; Sun, 24 Sep 2023 21:30:54 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: david@gibson.dropbear.id.au, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: bmeng.cn@gmail.com, alistair.francis@wdc.com, Liu Zhiwei , palmer@dabbelt.com, alistair23@gmail.com, dbarboza@ventanamicro.com, Alistair Francis , liweiwei@iscas.ac.cn, Bin Meng Subject: [PATCH 4/4] softmmu/device_tree: Fixup local variables shadowing Date: Mon, 25 Sep 2023 14:30:23 +1000 Message-ID: <20230925043023.71448-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925043023.71448-1-alistair.francis@wdc.com> References: <20230925043023.71448-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=alistair23@gmail.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1695616349425100002 Content-Type: text/plain; charset="utf-8" Local variables shadowing other local variables or parameters make the code needlessly hard to understand. Bugs love to hide in such code. Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail on polling error". This patch removes the local variable shadowing. Tested by adding: --extra-cflags=3D'-Wshadow=3Dlocal -Wno-error=3Dshadow=3Dlocal -Wno-err= or=3Dshadow=3Dcompatible-local' To configure Signed-off-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- softmmu/device_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c index 30aa3aea9f..eb5166ca36 100644 --- a/softmmu/device_tree.c +++ b/softmmu/device_tree.c @@ -418,9 +418,9 @@ int qemu_fdt_setprop_string_array(void *fdt, const char= *node_path, } p =3D str =3D g_malloc0(total_len); for (i =3D 0; i < len; i++) { - int len =3D strlen(array[i]) + 1; - pstrcpy(p, len, array[i]); - p +=3D len; + int offset =3D strlen(array[i]) + 1; + pstrcpy(p, offset, array[i]); + p +=3D offset; } =20 ret =3D qemu_fdt_setprop(fdt, node_path, prop, str, total_len); --=20 2.41.0