From patchwork Thu Oct 5 04:50:24 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: 729722 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp697167wrs; Wed, 4 Oct 2023 22:01:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7aqu329Vv+E2Q74siZltShsiL5pl++xDbH9ElMsaOHuhCDsSwf9+qC5N6qqhPaspQ1sF4 X-Received: by 2002:a05:620a:f0e:b0:76c:ba10:4973 with SMTP id v14-20020a05620a0f0e00b0076cba104973mr4838512qkl.37.1696482072636; Wed, 04 Oct 2023 22:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696482072; cv=none; d=google.com; s=arc-20160816; b=fKZIIv17/EBx8kT5uXZHoJFLfvgvyL8Nk1cyw6YeoFCRmdnpmG3YD38il1y5PCJL0m EffirITM8K1CwDqKIzZ09rypBJILAmZUJg7OTm2lyJO+kG80MzUhCaL610IoFiOW/cMX V2fbDPBGwU3gWC5O+YdzlnqL7DyR5LK0r08kbxsE4Hj7noTCm8rBaXSIDaLgkxTpCz1R FWr+bmRrZ6e4OByc6bUGn9PQzy5KIensw3sXtMnR+YMZy7OztSOfvc8zzwrUW0bW6+KH 72xR/GqROLiM+FsJcSzoORk09VnrvgBwha0jJEdz0+sKqrE+pPzav/zHB/PIsgMdrg/a PdHw== 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=GescFgTUfXFoVvcmAz4axPebdRl/aulbPng86nuCdlw=; fh=sJoShjc+22fNqMxUL+tIPcryN+fZ3hVRk+hhtgKxgXo=; b=lFO/4LaWiEe43OS84f0MOQBhEovTpTDCzU+6nZFP3VrpIWh5VrHKkMbXLdwXQrylDI BTLJRaGisHRt1++50OtQQIRet0wUVPXshaNEfL0FmPWTNX8MPC7cLGhZmZmJFz0VALXB gwBRDB2J5ehDiE2uRVsmhptndk8x73NMS6AKwrt2rAWsMI0WydFhHzZ/7/LEkObnVobV ML81q4Cb18hDuwpk3+6o/ucDDfriRW+VTGpoBPWLmWRYeJLUpkVj21pbYJg1j//bc4OH v+WnR0L3UzajQfdYWqQ0zCuuBGyRrRTf/+EOztggk83TVeHer2wS6DZj3cJvd+BFH8pM LTzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l7uFcOCt; 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 w28-20020a05620a0e9c00b00773a681104csi418499qkm.684.2023.10.04.22.01.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 22:01:12 -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=l7uFcOCt; 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 1qoGKm-0005sX-K0; Thu, 05 Oct 2023 00:51:36 -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 1qoGKl-0005nj-Lw for qemu-devel@nongnu.org; Thu, 05 Oct 2023 00:51:35 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoGKh-0005ax-Rg for qemu-devel@nongnu.org; Thu, 05 Oct 2023 00:51:35 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40566f89f6eso5049745e9.3 for ; Wed, 04 Oct 2023 21:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696481490; x=1697086290; 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=GescFgTUfXFoVvcmAz4axPebdRl/aulbPng86nuCdlw=; b=l7uFcOCtRzmUqLB1K42VH6z8E6Say+znLJID+2p7OkEJvXa4J8R3/GWJNxegNkQX1V 7jb3SpqONoB3PmlaZXF+Fi2dJIpGlPflSXW6BW5uA70APTNDhrMvR7/Tue5s1GHUnvqP NIY4OgeDw78G1Tw24/ZYtl5n1+g1XEFzx5o62DyyKI5ZC+9H4kj7WLA6NEKJdxAcbq9G 6x/Vtf0TSnGHI238+fdGMcAhGAObJTOp0S/SueAGQ80JyROXC9cSBDxksc4vMEcMSAvP N8qyMQ3GRezI79dmOM8eYxAW/QO36KHWP7yk917OS2QdKo6v973dxdkKB9LdYOkqOokW m7jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696481490; x=1697086290; 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=GescFgTUfXFoVvcmAz4axPebdRl/aulbPng86nuCdlw=; b=YJlHpYdNLbh7uZHwVqA0vZSLs86Dtzuexo8VOW3wP5YB27eX+nfYA7b8gXW83g0ynw 7ZSLio5sBZccf0Bq9aJ3o7skqduUsNQOcXmL51CqJYkYy3p5JmoVGPGeYt3Y7WVoLSaJ 8uXtC3Ol7CG4dT3DhntJUxX+bIyRAXf6RbTiRtIAMjQZSmmF/dfqHweUVtmAgBRJGx/T URQeaqJijaGUfPm3eQpsaYIByuiGy+7Uk2+FVCvUy4LLEt9XlM/82gpPKTMporA4aWdz euWBtHZhCq5DPdSeqw9BL9M7UiER9Yh15k/wZhaEM82u/ZNNAxkZJrrA5urUoNxyPmz3 703Q== X-Gm-Message-State: AOJu0Yz7MGc+taIF8XF7UhQfpmokFC414Kp4W2WLukGatsyUYgMszezH u+q3iDBjfpp2AI7nLIM04W5pgyEuaDZMxR6cSJw= X-Received: by 2002:a7b:ce8f:0:b0:3fe:2bb1:11ba with SMTP id q15-20020a7bce8f000000b003fe2bb111bamr4170385wmj.27.1696481490269; Wed, 04 Oct 2023 21:51:30 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-211-120.dsl.sta.abo.bbox.fr. [176.171.211.120]) by smtp.gmail.com with ESMTPSA id w21-20020a05600c015500b0040652e8ca13sm2856084wmm.43.2023.10.04.21.51.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 21:51:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Peter Maydell , Richard Henderson , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH v2 07/22] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant param) Date: Thu, 5 Oct 2023 06:50:24 +0200 Message-ID: <20231005045041.52649-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231005045041.52649-1-philmd@linaro.org> References: <20231005045041.52649-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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=unavailable 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 Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using the following coccinelle semantic patch: @match@ expression errp; constant param; constant value; @@ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value); @script:python strformat depends on match@ param << match.param; value << match.value; fixedfmt; // new var @@ fixedfmt = f'"Invalid parameter type for \'{param[1:-1]}\', expected: {value[1:-1]}"' coccinelle.fixedfmt = cocci.make_ident(fixedfmt) @replace@ expression match.errp; constant match.param; constant match.value; identifier strformat.fixedfmt; @@ - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value); + error_setg(errp, fixedfmt); Signed-off-by: Philippe Mathieu-Daudé Acked-by: Thomas Huth --- target/arm/arm-qmp-cmds.c | 3 ++- target/s390x/cpu_models_sysemu.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index b53d5efe13..3c99fd8222 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -154,7 +154,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, if (model->props) { qdict_in = qobject_to(QDict, model->props); if (!qdict_in) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); + error_setg(errp, + "Invalid parameter type for 'props', expected: dict"); return NULL; } } diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c index 63981bf36b..4507714493 100644 --- a/target/s390x/cpu_models_sysemu.c +++ b/target/s390x/cpu_models_sysemu.c @@ -111,7 +111,8 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info, if (info->props) { qdict = qobject_to(QDict, info->props); if (!qdict) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); + error_setg(errp, + "Invalid parameter type for 'props', expected: dict"); return; } }