From patchwork Wed Oct 4 12:00:06 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: 729298 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp306041wrs; Wed, 4 Oct 2023 05:06:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFf6XlZp2MDWEcRan0BgE6aAmAINdE1rgKZLh+7v57rnlMEj69wbFPs5H/UXzWEXTB6P6GP X-Received: by 2002:a0c:8e8c:0:b0:64f:60e9:9285 with SMTP id x12-20020a0c8e8c000000b0064f60e99285mr1969939qvb.30.1696421183637; Wed, 04 Oct 2023 05:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696421183; cv=none; d=google.com; s=arc-20160816; b=yohsneUXOHeYSzGA20HkttpWOPEcsw4YedbtSYwkGWE7H8BgEMLnxzxOXVqbRi0FhW GXkIhaS3LfgV1TDNk6vyq0KDQagUgJ2aP4MW4Z5417kevfHVt+OhW4RVgY/uH34ywFkT gVz+89ijf/l8WcGEsnZFoRcL2ceZ4jEzHGaukk9/mQSaZcIv4eo9I41m1k+WESqgvMfX jY23kZmSNQK+jb6BvvsADArGSZkzWQ7pZ+YbFrUC8RO4Q3rBfpNs7sY3Ec9EhztgSPhw 65uAtTzH6CUXYInWWNaYjA+MInUsxUvYglboJ+ZXNLBN+xaRdGKE562QdMSjJINEeKgy N9fQ== 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=KXIlmQvg0u+x76lQsbY8y6+C0hwUwSmaUkTgJ1Odfb4=; fh=lpwWP27Xja+L1z8kOOsB22ji3an6MCY+bu5H988t+wQ=; b=rJvwKgp8SkmNN39e6RjUcGu1oNbpVIgbgfHq10hcBSnxiaoOcR50Q1Vh3aYSLDirWp xISYGHL3jE0t2sVvgONCGYGnPyrQdbNfD8e9jBxhXedisbrYj800KLoiewIkP1hCh1jE XfIWFTq7RFw1kfhxkzqeVEy7PfyGAzvGOofPyjbHuq7rjiNcKDxmDT6Ggi3EuO7Wukod RPTYluhTZ22H8TXKQb5NTA/+XHBQ3Ax/MeDhUT92rog10AqPyyUl1xLtC/YV6JEdRD+J kjAcxfK2OP64ILU9F0zm7KTyv5las2beGL3yRnMcgZlytu+Ad4iy6O5yeK44xcMjDMlX 1Wyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AF7y+p99; 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 j10-20020a0cf50a000000b0065af42e31e3si1351880qvm.295.2023.10.04.05.06.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 05:06:23 -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=AF7y+p99; 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 1qo0b1-0002RF-6K; Wed, 04 Oct 2023 08:03:19 -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 1qo0YY-0008UT-Bp for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:00:51 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qo0YU-0000yE-Rc for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:00:44 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-406618d0991so19638665e9.2 for ; Wed, 04 Oct 2023 05:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696420841; x=1697025641; 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=KXIlmQvg0u+x76lQsbY8y6+C0hwUwSmaUkTgJ1Odfb4=; b=AF7y+p99+WGEvLf8n4F/yA3Zlbuyy7lkmnV/AhzHjNlaNXncO7Kx1nV88DnsynhAU3 Z/2KroKdd7DqqRjOYOJowRyzlnT9pmFqcJ2832QKaI0iWWASh5tV4sJmczGOwKPJErSd V7LaHbsWMu+XaXxjGflppYjFjRQt5i7zvWqGIikZ315LNF+87h020cFqe4lI9fOnM+K/ vQC3LJYB3XW46ijrg5LhBaslD4uxOAh9Mx45KDhmJwLBgzRzO9WzQ2Fi8bJWyUvNQsk6 t7/VvSYuyuteY51luE+8f4e8u27oo+rhQocKP7hMCgHPQCUoXSIxIIqOvYbFWHd4NCAy 2phA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696420841; x=1697025641; 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=KXIlmQvg0u+x76lQsbY8y6+C0hwUwSmaUkTgJ1Odfb4=; b=RPxe9Zw3H2ivHwctvWOYHy1GcM3/IddpN6yrDLlJDh9Wp2CYTxK4NWyHYT7rgF0kKw rjl0zytVWXUkJ/adeyd7iMzdGqL2VSTyp++alSZN5m07aR+XSTi/aPpYoIVvvvzyDZ5Y ptjJFJoSJtRvXJ/HWJeOV+33T31hDcGM1k6WwHQTu0M3puMH8aT7bqDAVU2dGi2WjMWC EM0/7vIChaGoz93ZPw/F9zqRJwtYjJpAMJkwHontIveSXBFlTdHIKrx9iu/bq83SHXpL ik3x+TaJb10zS+Rlb7nwpahN82He9zSsgO7JSO2GegzIPYWpxzZu9lJXsZ7bIvrQdkMQ SOQw== X-Gm-Message-State: AOJu0YzpZfeHGoj9cQjAdV89NlqvReu0FQruW9Y24FKjhTzDAc17Kxl5 uJCgjnHs3FWdXOjI9UgwkcWc1/2bW8r4UqFOZxU= X-Received: by 2002:a7b:ce89:0:b0:402:f07c:4b48 with SMTP id q9-20020a7bce89000000b00402f07c4b48mr2067131wmj.28.1696420841055; Wed, 04 Oct 2023 05:00:41 -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 12-20020a05600c020c00b004063ea92492sm1347676wmi.22.2023.10.04.05.00.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 05:00:40 -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?= , Jason Wang Subject: [PATCH v3 03/16] net/net: Clean up global variable shadowing Date: Wed, 4 Oct 2023 14:00:06 +0200 Message-ID: <20231004120019.93101-4-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: net/net.c:1680:35: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] bool netdev_is_modern(const char *optarg) ^ net/net.c:1714:38: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] void netdev_parse_modern(const char *optarg) ^ net/net.c:1728:60: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] void net_client_parse(QemuOptsList *opts_list, 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: Thomas Huth --- include/net/net.h | 6 +++--- net/net.c | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 330d285930..2fb1c9181c 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -247,9 +247,9 @@ extern const char *host_net_devices[]; /* from net.c */ extern NetClientStateList net_clients; -bool netdev_is_modern(const char *optarg); -void netdev_parse_modern(const char *optarg); -void net_client_parse(QemuOptsList *opts_list, const char *str); +bool netdev_is_modern(const char *optstr); +void netdev_parse_modern(const char *optstr); +void net_client_parse(QemuOptsList *opts_list, const char *optstr); void show_netdevs(void); void net_init_clients(void); void net_check_clients(void); diff --git a/net/net.c b/net/net.c index 1c0bfdaa6c..c0c0cbe99e 100644 --- a/net/net.c +++ b/net/net.c @@ -1677,7 +1677,7 @@ void net_init_clients(void) * Modern syntax is to be parsed with netdev_parse_modern(). * Traditional syntax is to be parsed with net_client_parse(). */ -bool netdev_is_modern(const char *optarg) +bool netdev_is_modern(const char *optstr) { QemuOpts *opts; bool is_modern; @@ -1689,13 +1689,13 @@ bool netdev_is_modern(const char *optarg) .desc = { { } }, }; - if (optarg[0] == '{') { + if (optstr[0] == '{') { /* This is JSON, which means it's modern syntax */ return true; } opts = qemu_opts_create(&dummy_opts, NULL, false, &error_abort); - qemu_opts_do_parse(opts, optarg, dummy_opts.implied_opt_name, + qemu_opts_do_parse(opts, optstr, dummy_opts.implied_opt_name, &error_abort); type = qemu_opt_get(opts, "type"); is_modern = !g_strcmp0(type, "stream") || !g_strcmp0(type, "dgram"); @@ -1711,12 +1711,12 @@ bool netdev_is_modern(const char *optarg) * netdev_parse_modern() appends to @nd_queue, whereas net_client_parse() * appends to @qemu_netdev_opts. */ -void netdev_parse_modern(const char *optarg) +void netdev_parse_modern(const char *optstr) { Visitor *v; NetdevQueueEntry *nd; - v = qobject_input_visitor_new_str(optarg, "type", &error_fatal); + v = qobject_input_visitor_new_str(optstr, "type", &error_fatal); nd = g_new(NetdevQueueEntry, 1); visit_type_Netdev(v, NULL, &nd->nd, &error_fatal); visit_free(v); @@ -1725,9 +1725,9 @@ void netdev_parse_modern(const char *optarg) QSIMPLEQ_INSERT_TAIL(&nd_queue, nd, entry); } -void net_client_parse(QemuOptsList *opts_list, const char *optarg) +void net_client_parse(QemuOptsList *opts_list, const char *optstr) { - if (!qemu_opts_parse_noisily(opts_list, optarg, true)) { + if (!qemu_opts_parse_noisily(opts_list, optstr, true)) { exit(1); } }