From patchwork Thu Oct 5 04:50:30 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: 1843787 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=UwYDa3iM; 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 4S1K450RGzz1yq7 for ; Thu, 5 Oct 2023 15:55:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoGLU-00071Z-8b; Thu, 05 Oct 2023 00:52:20 -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 1qoGLP-0006rF-T4 for qemu-ppc@nongnu.org; Thu, 05 Oct 2023 00:52:15 -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 1qoGLN-0006bD-6P for qemu-ppc@nongnu.org; Thu, 05 Oct 2023 00:52:14 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40651a72807so5069265e9.1 for ; Wed, 04 Oct 2023 21:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696481531; x=1697086331; 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=Ce+npZH/Sy2YDK63SGGk3kjcbFRbVjeH5n2iFjnqdA8=; b=UwYDa3iMuu6rPik84qhZ03gtOzrEb6KezCgtOHSHugZde8/m6LfrVHi4J5brSq8s1+ cRg7VSjr/+zdwGoyx5uo8SfFroQyH8LcxSt9q6ZBw4S4u2war3FSiKPQNU+/isAIUK4s YJmYioQYDIsi++j6A2bxkVlAzkQDKKkpqpmgTrsUaM0wio3VksN9XAaZfxmF3YphgBqd ANJE9vUy4+uqxj87h9NHAGM+oozkGGnsudjNQ8WgtEz4GMxECt6mW382+1r4TFwKHRsI htIbOgUsSDHOlLKGp3EZ3JchV5WgtSKkOwOb2yJc1ZS+oJgNv0NOQxoP2LhcgSHsCXAF b8PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696481531; x=1697086331; 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=Ce+npZH/Sy2YDK63SGGk3kjcbFRbVjeH5n2iFjnqdA8=; b=a99jz5fW6Vpp5ODq8ZMD23gmj3USqFHxYTW32hgKkQzslULM7wkvD2Xf19fzccrYy4 PLxu2RpTKW7tV0iNW2Ko1admSICi/0JCPhbsTZlKDkUGg0VEWrW4farV6vy5d1Twr0nN w4E7os4OeF6maQd4m4LroeUSYj37kdQgYbYsJuBxpPq2ghzMOuyjIJrci/dyWMmaKb5E Rr7Qg0ff/0ursX7Jf4madbM6cxYEf0ubVFIJK5i/gB7MAymcZ6ZCYfoA9sHYWWn+E7Ru omtP7K35CQKOF2u9a3yfF6opXcNcyqIqaMkwfz1GZ9UZMUaLj4BlRC8m7o9nXcqG9Qcu RBtw== X-Gm-Message-State: AOJu0Ywy+qY4giEr7Q3hlTMdkttWGeXOPyxMCXlOLMImGP55CG2fKnyC eRAedqZZjsbg2KvuJydAiCJh4w== X-Google-Smtp-Source: AGHT+IHQTh5No1UNhttCZVVXM4ZIYyjCICDR6Jk1TYsV0h4M56Hhnecst+JkSiB26MUXPQThQWtvXQ== X-Received: by 2002:adf:fdc7:0:b0:31f:f982:5395 with SMTP id i7-20020adffdc7000000b0031ff9825395mr3820274wrs.35.1696481530920; Wed, 04 Oct 2023 21:52:10 -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 x10-20020a5d54ca000000b003200c918c81sm738225wrv.112.2023.10.04.21.52.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 21:52:10 -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?= , Stefan Berger , Michael Roth , Stefan Berger Subject: [PATCH v2 13/22] qapi: Inline and remove QERR_INVALID_PARAMETER_VALUE definition Date: Thu, 5 Oct 2023 06:50:30 +0200 Message-ID: <20231005045041.52649-14-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-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! */ Manually modify the error_report() call in softmmu/tpm.c, then use sed to mechanically transform the rest. Finally remove the definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Berger --- include/qapi/qmp/qerror.h | 3 --- qapi/opts-visitor.c | 4 ++-- qapi/qapi-visit-core.c | 4 ++-- softmmu/tpm.c | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index b723830eff..ac727d1c2d 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_INVALID_PARAMETER_VALUE \ - "Parameter '%s' expects %s" - #define QERR_IO_ERROR \ "An IO error has occurred" diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 0393704a73..844db583f4 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -441,7 +441,7 @@ opts_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp) } } } - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, + error_setg(errp, "Parameter '%s' expects %s", opt->name, (ov->list_mode == LM_NONE) ? "an int64 value" : "an int64 value or range"); return false; @@ -494,7 +494,7 @@ opts_type_uint64(Visitor *v, const char *name, uint64_t *obj, Error **errp) } } } - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, + error_setg(errp, "Parameter '%s' expects %s", opt->name, (ov->list_mode == LM_NONE) ? "a uint64 value" : "a uint64 value or range"); return false; diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 6c13510a2b..01793d6e74 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -194,7 +194,7 @@ static bool visit_type_uintN(Visitor *v, uint64_t *obj, const char *name, } if (value > max) { assert(v->type == VISITOR_INPUT); - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + error_setg(errp, "Parameter '%s' expects %s", name ? name : "null", type); return false; } @@ -262,7 +262,7 @@ static bool visit_type_intN(Visitor *v, int64_t *obj, const char *name, } if (value < min || value > max) { assert(v->type == VISITOR_INPUT); - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + error_setg(errp, "Parameter '%s' expects %s", name ? name : "null", type); return false; } diff --git a/softmmu/tpm.c b/softmmu/tpm.c index 578563f05a..8437c4efc3 100644 --- a/softmmu/tpm.c +++ b/softmmu/tpm.c @@ -120,8 +120,7 @@ static int tpm_init_tpmdev(void *dummy, QemuOpts *opts, Error **errp) i = qapi_enum_parse(&TpmType_lookup, value, -1, NULL); be = i >= 0 ? tpm_be_find_by_type(i) : NULL; if (be == NULL) { - error_report(QERR_INVALID_PARAMETER_VALUE, - "type", "a TPM backend type"); + error_report("Parameter 'type' expects a TPM backend type"); tpm_display_backend_drivers(); return 1; }