From patchwork Wed Oct 4 17:31:42 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: 1843552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=dAtVN/H7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S128P3QBRz1yqD for ; Thu, 5 Oct 2023 04:42:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo5k0-0003Yq-1v; Wed, 04 Oct 2023 13:32:56 -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 1qo5jz-0003Xq-8J for qemu-ppc@nongnu.org; Wed, 04 Oct 2023 13:32:55 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qo5jw-00012J-29 for qemu-ppc@nongnu.org; Wed, 04 Oct 2023 13:32:54 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40572aeb6d0so463715e9.1 for ; Wed, 04 Oct 2023 10:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696440769; x=1697045569; 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=MGJIXDRJu9nRlkvT0HuUW6wiDMZ2EXW42Fkcow2Wmmc=; b=dAtVN/H72dd5veYTUlbJ78N8jmDPHy/V65XrqcC9foxksc1IWZHI+MuW3vZonXwRJ9 U6zkUMdHm9ZH6/sLzvhVjs4rSLhnMf4LXNE1WPL+Hq/iaqySJ4J12o2Rsi1bwTXrVF9E R+oOk+vrhhVUvboaymYaOFYpuF4AaukL5lE+G9Mj7BUrBQYxZ8In7cflTmhuzfbZBWGp 3FlimrnvVmMcAV7OI9AnJ6/oc24lGHTOxphfM3lPl1D3CK8A2i0MqW1lPXS0ySIZ3vU+ 6+6sFqYSrHxZkS5KRSFNvSTp6SXobHqXIO+xzg8RAgj/+y6zPS0LkakIepVQjY20/CdD /86Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696440769; x=1697045569; 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=MGJIXDRJu9nRlkvT0HuUW6wiDMZ2EXW42Fkcow2Wmmc=; b=Y4CCSzwZiuMZte7G0yFGcdyJgxDIC6WBd8JGfuBbPdvnNMgFITALmeLHYR9iu7lUBt mgWKqJvqjhnotk+ZWq23D+GVanc0v98VY3DbM+3zYymvkeBA5WydUBF1rA8+Xf8LMy30 hCEg4tk5KlZRTYtbqoNr4P1KvuU40T8E3hp0v69xkf4XeVGGbi5znxVWblvfvT0ImAZY F8I5vJnkThBxvmxGZl82+5SY6cVRR3DHKMAvbQklsKF9Va/Fv6M7tJr/rKY7T6qPc/3v 5BYCj0toI/v011UCtDGjm3AdVX394RYXZlSDpcB/6moAopEMLDs+4+/mEo9j4eJhnkqX OqcA== X-Gm-Message-State: AOJu0YzNkeFcQGtvjVpUpBD9M+2UnCLT+SMkjB3O86/1InmJjtWjN8kP yzlS3UenRA764+fEljJykS29OA== X-Google-Smtp-Source: AGHT+IEbkOhMaEJy/rCsBI/FeDf+daJgpixyA4ZYMBpatjF919qpdEZDy8miCs2E+T3QGJpDEQrG9g== X-Received: by 2002:a1c:4c13:0:b0:406:7d74:a29b with SMTP id z19-20020a1c4c13000000b004067d74a29bmr2907167wmf.13.1696440769157; Wed, 04 Oct 2023 10:32:49 -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 w21-20020a05600c015500b0040652e8ca13sm2011782wmm.43.2023.10.04.10.32.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 10:32:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth Subject: [PATCH 07/21] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant param) Date: Wed, 4 Oct 2023 19:31:42 +0200 Message-ID: <20231004173158.42591-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231004173158.42591-1-philmd@linaro.org> References: <20231004173158.42591-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.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é --- 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; } }