From patchwork Tue Mar 12 14:13:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779738 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043494wrt; Tue, 12 Mar 2024 07:15:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXz3bGw2Nv4sWBaPfNcLKlRszmRzKVN5H88OD9DSAxeEAkIVvETmHyVCdqiCSm/LWq9507ZJ61jUUOJqudZ1tn9 X-Google-Smtp-Source: AGHT+IHVUN/8cnZiSvKc+7A5FIkCykaSa+t6aK7EY3uI1mpwENK+WdZO39lOIGKki3pw534mtAzL X-Received: by 2002:a05:6214:1886:b0:690:b73c:8de8 with SMTP id cx6-20020a056214188600b00690b73c8de8mr13164410qvb.31.1710252946481; Tue, 12 Mar 2024 07:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252946; cv=none; d=google.com; s=arc-20160816; b=ibV5i/VCzpUyG3ii6X8vt8/qJk+r+lk8Ocnn1HJPs/WLwexxpIuv9OmgEP6zSA+A9H MPK8iAMybid1bMaTO6Toi0JGRqhMlkJ67ms+0iQWqgRfInvljWuG1nEs3lr6XG7LEhHb pXlRVrswYNla5xP2g91nQhmZ/IxFwghntn8LqDi3Yys5oLSMj4IOQ3QUrGR6d/kBlk12 SIUp+9eLTKbhIdrJdqewbdx2FdXjqTfJWD/XSVArqkGs0R3D6lHC9Lha6SnQN/j1jVUG wK8nMh4raK1rBYkg4KgYwq9KCl3XYagy3rs5TN/+U076b2YcxWrXIAzizKCmXnoZCGDK hD6g== 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=vq1eEcFrbjb0Qt2i2P9FwIaIMPJ4L5ayjl9JWacBAY4=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=v+GgLtR3i9dyWPC6HnAmGMQ1W0GSbbGZTehjRXHt8huKYTsVslIjm56+3odKhbl0yo 0xPQL7Vbc1eBcUmOX350gqjoK++GF/PF9WIenN+Sx5bYUZuqnudkp5VlBzn6qdEaQR/W e+oDofZSoze7/RYV3QWkzfweD913t8mS8CRfY8+PQIC8zy24duuLjeMCKQlJfVkS7acu 2S+l/RIyMMFXlyPlt6W9GcIDwl7BwLRoYGdut1mqojEpwAHhPZQO1xUQ0EUt13uqTBTF YvAB9XZWisrzw71X39lfDGBj50oogHA1Dxs1hsIoSQvpTaBCPCRlK+GaA5zItnKmif9v de5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="SAHSQSd/"; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id mf5-20020a0562145d8500b0068f756764cbsi7499104qvb.281.2024.03.12.07.15.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:15:46 -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=@redhat.com header.s=mimecast20190719 header.b="SAHSQSd/"; 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=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tq-0001AI-G3; Tue, 12 Mar 2024 10:14:38 -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 1rk2tG-0000ch-Mo for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t3-00029v-CV for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vq1eEcFrbjb0Qt2i2P9FwIaIMPJ4L5ayjl9JWacBAY4=; b=SAHSQSd/p+SrAnt4hlKDR8L3unMi0HmkSJbEBaRDYr/ZXYQyjSzPQWVV2zNovK5ajysFML xGjvCMQKPJ+C4ZxwvCuiyLxID1yfeE/S/8vaVONYMTTOe+LPW3pOht9wAlg1aO2gRMbUAV lmpsuB7hDFSjRpbaSSYjvWM89AS/48A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-wHH_0IfqNmmxV31z09X2Gw-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: wHH_0IfqNmmxV31z09X2Gw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C09683814EB5; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A3AEC01600; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3B58721E6891; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 07/10] qapi: Inline and remove QERR_INVALID_PARAMETER_TYPE definition Date: Tue, 12 Mar 2024 15:13:40 +0100 Message-ID: <20240312141343.3168265-8-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Philippe Mathieu-Daudé 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! */ Manual changes (escaping the format in qapi/visit.py). Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- qom/object.c | 4 ++-- scripts/qapi/visit.py | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 63ab775dc5..b723830eff 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_INVALID_PARAMETER_TYPE \ - "Invalid parameter type for '%s', expected: %s" - #define QERR_INVALID_PARAMETER_VALUE \ "Parameter '%s' expects %s" diff --git a/qom/object.c b/qom/object.c index 3d96818f7d..44ec8f6460 100644 --- a/qom/object.c +++ b/qom/object.c @@ -23,7 +23,6 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/forward-visitor.h" #include "qapi/qapi-builtin-visit.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" #include "trace.h" @@ -1912,7 +1911,8 @@ static Object *object_resolve_link(Object *obj, const char *name, } else if (!target) { target = object_resolve_path(path, &ambiguous); if (target || ambiguous) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type); + error_setg(errp, "Invalid parameter type for '%s', expected: %s", + name, target_type); } else { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", path); diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index c56ea4d724..a21b7b1468 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -278,8 +278,8 @@ def gen_visit_alternate(name: str, variants: QAPISchemaVariants) -> str: abort(); default: assert(visit_is_input(v)); - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", - "%(name)s"); + error_setg(errp, "Invalid parameter type for '%%s', expected: %(name)s", + name ? name : "null"); /* Avoid passing invalid *obj to qapi_free_%(c_name)s() */ g_free(*obj); *obj = NULL; @@ -356,7 +356,6 @@ def _begin_user_module(self, name: str) -> None: self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qapi/error.h" -#include "qapi/qmp/qerror.h" #include "%(visit)s.h" ''', visit=visit))