From 56d2df5e65d873ca0e9841f7bb7676cab759f8da Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 27 Sep 2019 15:46:38 +0200 Subject: qapi: Improve reporting of redefinition Point to the previous definition, unless it's a built-in. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20190927134639.4284-26-armbru@redhat.com> --- scripts/qapi/common.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index bd83427..a74cd95 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1759,6 +1759,11 @@ class QAPISchema(object): # because they're liable to clash in generated C. other_ent = self._entity_dict.get(ent.name) if other_ent: + if other_ent.info: + where = QAPIError(other_ent.info, None, "previous definition") + raise QAPISemError( + ent.info, + "'%s' is already defined\n%s" % (ent.name, where)) raise QAPISemError( ent.info, "%s is already defined" % other_ent.describe()) self._entity_dict[ent.name] = ent -- cgit v1.1