From patchwork Wed Oct 4 12:00:17 2023 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: 729295 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp304200wrs; Wed, 4 Oct 2023 05:04:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjIum95P+vL/fg5wnvvoFlnVIqZmQMK5U9tQEEzYM6H9ubeCc+mEfZrRXYnPXDi446ZOBZ X-Received: by 2002:a05:622a:1ca:b0:403:abf5:6865 with SMTP id t10-20020a05622a01ca00b00403abf56865mr2152355qtw.18.1696421051863; Wed, 04 Oct 2023 05:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696421051; cv=none; d=google.com; s=arc-20160816; b=yMm0EIiEbj7SkT4j9Utz6XeJhytsCWcSKdrGTDUIBpDKHhkityntpaZohf/NHBgZdj HaIWbS8xyerFZ05P4P9/ePyzDF+rknGvh+bodWBYp5V09jaRKR0yktDhJmPY1u6ivLDt 91hGxeJupNE6oa8CyU6roXQUsIO/5iCFhn3vtiwDKg+oQ39tBQgOj8IEOIsAIpItZOLJ SqLU9CCfj7JoMkfhUgqRbIZZUocMCgz7elLDCkkyeGT9OF3kavPvinVMOC9vERcGnLX7 mDuqMqJ4N8nzDJWuJfgv+Embqs5dVtw6ujeZmdV3/cpCrlZYOUYt5T0p+iFgjr5m+6Q5 o7hw== 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=VbE/h6HUxHm1fKUuktISJWotuykVg/wSDPAOtZyCrGc=; fh=DGsemwhdqtom3k1xyp/Ay3eBo/+/1/cVk5wggzCgk24=; b=dssishoMzAXxi5ypm+0kbJzxM0mU7Z8BnJiYxqDEqLQIfEPKgwXSosIvkKyp6MCvh+ sV4vhqqKY6sFgiBW8/SofG8L00WgDn0TRQkUnvcYhZu4Jh+RiOAFA2gi5peQCnxKYJPQ rHANDT8iL3LvNbYAj2BgqFedxO6Hy7wC9Ja3JxTM8WUGeTmLOLrhrwM555YyQVZrVbHX XNDQi1dhvRnWV8wrtOH+klncSnFVBcV17ijCXW6ThQ3Uml0NeqRJolRQE94NXclrmQlO 7RtKI7Sxw8P5RZwMwf/46jQHQm8I08rywU0NaFwhCR1Gocm1Qr9wdTCZ7Cy5b6m49tFe AJww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hdDcmOio; 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 j8-20020ac85c48000000b00419661408acsi1437967qtj.347.2023.10.04.05.04.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 05:04:11 -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=hdDcmOio; 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 1qo0bK-0003nl-Q0; Wed, 04 Oct 2023 08:03:42 -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 1qo0Ze-0000WB-Jz for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:02:02 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qo0ZZ-0001CB-HK for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:01:53 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3231df68584so1912410f8f.1 for ; Wed, 04 Oct 2023 05:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696420907; x=1697025707; 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=VbE/h6HUxHm1fKUuktISJWotuykVg/wSDPAOtZyCrGc=; b=hdDcmOioNI1LwLw1KWdoNWmvMAdoxQ5O3opOQmCc2efN0ryEmuV3wIJPTjJQEGHtwr rvt7M+wXW7pb6dwH8UqG9zfuak4cmMdzUK0NFGhP9eccAwPQuL0yPRrHnSbCRnyqZ30c OZdGcW6WQJYkIYNpnC/YCKLhtvuaWT8bzXYF35uNNBzJvpeesnWdC7YA2/MyJHgxHR3m Fy5ueucVPXHDgz50r31kgo4jVEqeyHe6rsPiw6pxcmVnvIAymyzQzSK6QbmBfnJFGH2X LhXCBNZ/bjKuKdjQTZCLDn/AssShD90taR3i6WrkyAzx+7c6u6GABR0Qwb46xWmm7j6V y0vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696420907; x=1697025707; 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=VbE/h6HUxHm1fKUuktISJWotuykVg/wSDPAOtZyCrGc=; b=LFm4gzsh+rD4ILzc1fAH1sTKSk8HrCI5ejbp2hyuf8kY57s51f6cB2y854hAXztTA7 n+LJwMVGJaz1jBnPoxuAJqPYBHBqqper2S7OanYGvstSRZG6gnbwO9jDS2af6sXM3Rhk lV/c9GAPK0sLn6cERjznCdfqS3W5JhIwKdEHVgIYhriQokVk4fmfB3vK6BLwu9gRizYR ey45Im7ei9p05sa1i+JBlxo2ttp7I0nEePgaESsVvRELdmx4804Uvg3XchXrDuN9Cxbr PWeVJFU0w5OEk6VXvk2ihB87C0+Ild3sKWsav1YHyOPx0P8nic+yKCxsuUCoVgEHrAX5 l/gA== X-Gm-Message-State: AOJu0YzvSkykVa/oovUyM0xObD34U7ev6MZ0LcPMtUi6cq90xr7cSiUJ Jbc5dOdkh8a2AT66h/Ry9gZPqPo07CcdhK9SH9o= X-Received: by 2002:adf:d4cb:0:b0:31a:ed75:75e9 with SMTP id w11-20020adfd4cb000000b0031aed7575e9mr2097115wrk.13.1696420906827; Wed, 04 Oct 2023 05:01:46 -0700 (PDT) Received: from m1x-phil.lan (5ep85-h01-176-173-163-52.dslam.bbox.fr. [176.173.163.52]) by smtp.gmail.com with ESMTPSA id w10-20020adfd4ca000000b0031ad5470f89sm3894894wrk.18.2023.10.04.05.01.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 05:01:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Markus Armbruster , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini Subject: [PATCH v3 14/16] softmmu/vl: Clean up global variable shadowing Date: Wed, 4 Oct 2023 14:00:17 +0200 Message-ID: <20231004120019.93101-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231004120019.93101-1-philmd@linaro.org> References: <20231004120019.93101-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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 Fix: softmmu/vl.c:1069:44: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] static void parse_display_qapi(const char *optarg) ^ softmmu/vl.c:1224:39: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] static void monitor_parse(const char *optarg, const char *mode, bool pretty) ^ softmmu/vl.c:1634:17: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] const char *optarg = qdict_get_try_str(qdict, "type"); ^ softmmu/vl.c:1784:45: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] static void object_option_parse(const char *optarg) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/getopt.h:77:14: note: previous declaration is here extern char *optarg; /* getopt(3) external variables */ ^ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- softmmu/vl.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 98e071e63b..ae1ff9887d 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1066,12 +1066,12 @@ static void select_vgahw(const MachineClass *machine_class, const char *p) } } -static void parse_display_qapi(const char *optarg) +static void parse_display_qapi(const char *optstr) { DisplayOptions *opts; Visitor *v; - v = qobject_input_visitor_new_str(optarg, "type", &error_fatal); + v = qobject_input_visitor_new_str(optstr, "type", &error_fatal); visit_type_DisplayOptions(v, NULL, &opts, &error_fatal); QAPI_CLONE_MEMBERS(DisplayOptions, &dpy, opts); @@ -1221,21 +1221,21 @@ static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp) return monitor_init_opts(opts, errp); } -static void monitor_parse(const char *optarg, const char *mode, bool pretty) +static void monitor_parse(const char *str, const char *mode, bool pretty) { static int monitor_device_index = 0; QemuOpts *opts; const char *p; char label[32]; - if (strstart(optarg, "chardev:", &p)) { + if (strstart(str, "chardev:", &p)) { snprintf(label, sizeof(label), "%s", p); } else { snprintf(label, sizeof(label), "compat_monitor%d", monitor_device_index); - opts = qemu_chr_parse_compat(label, optarg, true); + opts = qemu_chr_parse_compat(label, str, true); if (!opts) { - error_report("parse error: %s", optarg); + error_report("parse error: %s", str); exit(1); } } @@ -1631,13 +1631,13 @@ static const QEMUOption *lookup_opt(int argc, char **argv, static MachineClass *select_machine(QDict *qdict, Error **errp) { - const char *optarg = qdict_get_try_str(qdict, "type"); + const char *machine_type = qdict_get_try_str(qdict, "type"); GSList *machines = object_class_get_list(TYPE_MACHINE, false); MachineClass *machine_class; Error *local_err = NULL; - if (optarg) { - machine_class = find_machine(optarg, machines); + if (machine_type) { + machine_class = find_machine(machine_type, machines); qdict_del(qdict, "type"); if (!machine_class) { error_setg(&local_err, "unsupported machine type"); @@ -1781,20 +1781,20 @@ static void object_option_add_visitor(Visitor *v) QTAILQ_INSERT_TAIL(&object_opts, opt, next); } -static void object_option_parse(const char *optarg) +static void object_option_parse(const char *optstr) { QemuOpts *opts; const char *type; Visitor *v; - if (optarg[0] == '{') { - QObject *obj = qobject_from_json(optarg, &error_fatal); + if (optstr[0] == '{') { + QObject *obj = qobject_from_json(optstr, &error_fatal); v = qobject_input_visitor_new(obj); qobject_unref(obj); } else { opts = qemu_opts_parse_noisily(qemu_find_opts("object"), - optarg, true); + optstr, true); if (!opts) { exit(1); }