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: 729703 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp694994wrs; Wed, 4 Oct 2023 21:53:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF60+0g1Zj79K7SqvcowagrABPW3+eYYP7fJgGSBLSqmXo6sGo3GrSZVWyoZP/aFwulmx2J X-Received: by 2002:a05:622a:1ba9:b0:401:e0b4:a93f with SMTP id bp41-20020a05622a1ba900b00401e0b4a93fmr4205667qtb.41.1696481592897; Wed, 04 Oct 2023 21:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696481592; cv=none; d=google.com; s=arc-20160816; b=Rw0AhqG07rX/6om+lGKE9wg+KSeh1A6oB7dp3vmp7CFs4T5FTlg46UNJKx28pxyTrO TRc6hG0tDn4GfCXyXx400X92M4rcq4bSUn0AObpf/AfCZGD7xur0CSquoidy6CQsEjXI DZb2y7SiACWfilLT9Njy+9WSBU0qEbsEAI9WAmARLg9Scu+yoo0939xTRGVrB/n/+er3 rEenJYNoLe4/OBD5CQFm6IJIDVVIuTOKNMNxKPH/dI16rmcwBdYePl10Hhguv3EQbiG/ IpgOz9ukOXcYa2H9xWeOVuOkkM3COlwNpxDvxkISlycXO0V+3f6Ojq1YqMim3M0WAq9r Kj2A== 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=Ce+npZH/Sy2YDK63SGGk3kjcbFRbVjeH5n2iFjnqdA8=; fh=oTVVnlHUp5QE/wOIiIgepm05fDtHARCE1EdcJ6poEF0=; b=KnSQG5KzXija8S16kIgTfc3LFheU0OgKh7VhrQGyHBP9PK9eDrZVDWvNflDd/VdNlP LuQgaGgxk31Nc6Z70LKsKA9U8eCjmJg8+jXl8dgmbm1BaDar7FN5ikJ3NxaHjOpAe33E dm7Th41Kn6U/7K/GPsK0vbtZNQ8OctEakVmXqYGjZYLdvyx0sKiZUj4zuDNyo4gxRfaw QNjBtyez2dlGevwTar9xReCDdKWsAoaSUUw+kCX80G+/RzzYZe/itansSBlxsAXd4POC CpcVEgADLq48Atgsmnz+/IFzpQ5rF5rmORSZm0es2kHVm34YXrEIaMo6roCyhGpcZoJx 95uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UwYDa3iM; 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 c14-20020ac87d8e000000b004180a838585si418923qtd.661.2023.10.04.21.53.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 21:53: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=UwYDa3iM; 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 1qoGMA-0007zu-Kv; Thu, 05 Oct 2023 00:53:05 -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 1qoGLd-0007c1-0c for qemu-devel@nongnu.org; Thu, 05 Oct 2023 00:52:30 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoGLN-0006cc-CG for qemu-devel@nongnu.org; Thu, 05 Oct 2023 00:52:28 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-317c3ac7339so549912f8f.0 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=cpi6H3eFahWjLfVlMfvtdN5rTv/bvQePjro4dVRIEJsD2ELcyv2uz3OiefhI9zsYSd LLhJ3gqxBnW/afsoJYlLtUDY8bsW15a4/dGMgLE/p0fK/bXmo7Qgtumw8zD2jHVllxOI ZWN5U5Gf1yCBzphp1GFNr24+CGdDoVxzlD9wLxMw+yZKV/L2QPbB8KBVh9E9Y19dfQLG OpAiMX6BI8vq/p5+qabSwd8pS4UuERrfCxmmRxY6Uvn0b4FYVBoqHEP72BmmRCke3TTc ewBJfBMTM4HRdbL7ToP7WHMbOvzEYmXG4HA4K6bCVuMqptNndgi6frIGMDLGDSfjFKPW ZD7w== X-Gm-Message-State: AOJu0YwFytCh0vLV15eHDZWAXfbV5JsyTjsGou9LuJfjgbF3BxRPK/QC uT0uAlNH0XbQj+9+8ev4M37jXBf7JDktoT2Dyj8= 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::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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, 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! */ 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; }