From patchwork Fri Oct 6 11:36:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 729987 Delivered-To: patch@linaro.org Received: by 2002:a5d:4005:0:b0:31d:da82:a3b4 with SMTP id n5csp456649wrp; Fri, 6 Oct 2023 04:39:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh1ASZdStIE5HpSyUcjkXWKVUSHdVEHNlm8k4UFds56I9MYNXCz5PnZ8NhrUNMeTVrBstb X-Received: by 2002:a05:6214:4253:b0:655:935b:ca85 with SMTP id ne19-20020a056214425300b00655935bca85mr7463484qvb.48.1696592398962; Fri, 06 Oct 2023 04:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696592398; cv=none; d=google.com; s=arc-20160816; b=Xh3nDt2KhiIosBSP0kouzo8mRJ01bt/V0FWP6wj0sOUO0IAq9X+qS4TbWXwc08aj2O StSvIgubwPpQkdA7KsAPqZVaps6PuPX3P+tUSybmNvodztmNWXuXI8kdgRcUERxRKEXJ BJPViqjv3jsSwNWV1HljMaLNiUs1H3QGLErYSGrIxTyver7/hgBQaPaM8zN9Q9hlYi8j +F25wilmHF0iBso0YiLnbiHncT7YA8gZtx5IB7LcIJafrleldIwnp1n4deD9Q4brFnXt fcwXfYNL2mgo/7zXh+5+I7imS+fA/R+esu1DebHdL0s8livqw/y/wLQ7ZUgBa3wQDthP gbVg== 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=Dp18yDfa0xSGbMJbUgqL8hFOVcmn22n/M/o33Bq6pZ0=; fh=kFeeQCZHOWMjM3PvFVR/cFiybISAQy4MaQRyjN/+tkQ=; b=TvvyY/Vz3IdGIBh0i9lFfGQewzqhhy+ARQj3dkLD11SNzbY8ffrQDj+nRLU2IIjs3z N6JYzHeJY8j2b1QJb1emgFepilNyWlMN+ZpP0ieMufkq68TbvtolzVgPx2le46ifl4xi /qJVIo5MhSii7xg1opgolb4UMgq6n8Jx1+pul0Z+KFzcJwuBbupdHttCTlHd2IeEVhvf +n2VbRGJZLrfzHJUIh99HaFyAF/3DLV3s+vnGMGi2lai7fed50BVXc9MT7q0VRBNjx9z 8wgSCkBTsbuU/6IK2jn+w1PmsbTo/llbZWI3qEfHj5fklGNuMfG9lj0c67yGf+RSJjzo 3KWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hihujg3d; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n3-20020a0c8c03000000b0065afe121fc8si2190699qvb.150.2023.10.06.04.39.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Oct 2023 04:39:58 -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=@redhat.com header.s=mimecast20190719 header.b=hihujg3d; 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=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoj9T-0005D8-Cv; Fri, 06 Oct 2023 07:37:51 -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 1qoj93-00053B-0O for qemu-devel@nongnu.org; Fri, 06 Oct 2023 07:37:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoj8u-00008g-0Q for qemu-devel@nongnu.org; Fri, 06 Oct 2023 07:37:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696592227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dp18yDfa0xSGbMJbUgqL8hFOVcmn22n/M/o33Bq6pZ0=; b=hihujg3d4DHhLlA+F13p3bAIWAqtv/4LaC0mb0zjipbhbqBRKSMVBZPmg6lpnBI6J3Weae 3K2ScDJT4RhNahry79ILO4yqnHUE7ciftqjTq4oKgGVUzRkPP5AoybZCmvC8umQZfDVi/p ozD9Bs9w/Jh0QhgTvW5qre02ZeBDj5Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-QtCohzAOPA6tYsfsq0Ty-Q-1; Fri, 06 Oct 2023 07:37:01 -0400 X-MC-Unique: QtCohzAOPA6tYsfsq0Ty-Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC039858F1C; Fri, 6 Oct 2023 11:37:00 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FC8A140E963; Fri, 6 Oct 2023 11:37:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9766821E6887; Fri, 6 Oct 2023 13:36:57 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 23/32] softmmu/vl: Clean up global variable shadowing Date: Fri, 6 Oct 2023 13:36:48 +0200 Message-ID: <20231006113657.3803180-24-armbru@redhat.com> In-Reply-To: <20231006113657.3803180-1-armbru@redhat.com> References: <20231006113657.3803180-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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 From: Philippe Mathieu-Daudé 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é Message-ID: <20231004120019.93101-15-philmd@linaro.org> Reviewed-by: Richard Henderson Reviewed-by: Markus Armbruster [Tweak two parameter names] Signed-off-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..13c1b24706 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 *str) { DisplayOptions *opts; Visitor *v; - v = qobject_input_visitor_new_str(optarg, "type", &error_fatal); + v = qobject_input_visitor_new_str(str, "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 *str) { QemuOpts *opts; const char *type; Visitor *v; - if (optarg[0] == '{') { - QObject *obj = qobject_from_json(optarg, &error_fatal); + if (str[0] == '{') { + QObject *obj = qobject_from_json(str, &error_fatal); v = qobject_input_visitor_new(obj); qobject_unref(obj); } else { opts = qemu_opts_parse_noisily(qemu_find_opts("object"), - optarg, true); + str, true); if (!opts) { exit(1); }