From d7bc17c602f128bb358376e6976b3b5dee1ad732 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 27 Sep 2019 15:46:22 +0200 Subject: qapi: Improve reporting of invalid name errors Split check_name() into check_name_is_str() and check_name_str(), keep check_name() as a wrapper. Move add_name()'s call into its caller check_exprs(), and inline. This permits delaying check_name_str() there, so its error message gains an "in definition" line. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20190927134639.4284-10-armbru@redhat.com> --- tests/qapi-schema/bad-ident.err | 1 + tests/qapi-schema/command-int.err | 1 + tests/qapi-schema/redefined-builtin.err | 1 + tests/qapi-schema/redefined-command.err | 1 + tests/qapi-schema/redefined-event.err | 1 + tests/qapi-schema/redefined-type.err | 1 + tests/qapi-schema/reserved-command-q.err | 1 + tests/qapi-schema/reserved-type-kind.err | 1 + tests/qapi-schema/reserved-type-list.err | 1 + 9 files changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/qapi-schema/bad-ident.err b/tests/qapi-schema/bad-ident.err index c419060..6878889 100644 --- a/tests/qapi-schema/bad-ident.err +++ b/tests/qapi-schema/bad-ident.err @@ -1 +1,2 @@ +tests/qapi-schema/bad-ident.json: In struct '*oops': tests/qapi-schema/bad-ident.json:2: 'struct' does not allow optional name '*oops' diff --git a/tests/qapi-schema/command-int.err b/tests/qapi-schema/command-int.err index 0f93006..56b45bf 100644 --- a/tests/qapi-schema/command-int.err +++ b/tests/qapi-schema/command-int.err @@ -1 +1,2 @@ +tests/qapi-schema/command-int.json: In command 'int': tests/qapi-schema/command-int.json:2: built-in 'int' is already defined diff --git a/tests/qapi-schema/redefined-builtin.err b/tests/qapi-schema/redefined-builtin.err index b275722..67775fd 100644 --- a/tests/qapi-schema/redefined-builtin.err +++ b/tests/qapi-schema/redefined-builtin.err @@ -1 +1,2 @@ +tests/qapi-schema/redefined-builtin.json: In struct 'size': tests/qapi-schema/redefined-builtin.json:2: built-in 'size' is already defined diff --git a/tests/qapi-schema/redefined-command.err b/tests/qapi-schema/redefined-command.err index 82ae256..b77a05d 100644 --- a/tests/qapi-schema/redefined-command.err +++ b/tests/qapi-schema/redefined-command.err @@ -1 +1,2 @@ +tests/qapi-schema/redefined-command.json: In command 'foo': tests/qapi-schema/redefined-command.json:3: command 'foo' is already defined diff --git a/tests/qapi-schema/redefined-event.err b/tests/qapi-schema/redefined-event.err index 35429cb..fd02d38 100644 --- a/tests/qapi-schema/redefined-event.err +++ b/tests/qapi-schema/redefined-event.err @@ -1 +1,2 @@ +tests/qapi-schema/redefined-event.json: In event 'EVENT_A': tests/qapi-schema/redefined-event.json:3: event 'EVENT_A' is already defined diff --git a/tests/qapi-schema/redefined-type.err b/tests/qapi-schema/redefined-type.err index 06ea78c..89acc82 100644 --- a/tests/qapi-schema/redefined-type.err +++ b/tests/qapi-schema/redefined-type.err @@ -1 +1,2 @@ +tests/qapi-schema/redefined-type.json: In enum 'foo': tests/qapi-schema/redefined-type.json:3: struct 'foo' is already defined diff --git a/tests/qapi-schema/reserved-command-q.err b/tests/qapi-schema/reserved-command-q.err index f939e04..0844e14 100644 --- a/tests/qapi-schema/reserved-command-q.err +++ b/tests/qapi-schema/reserved-command-q.err @@ -1 +1,2 @@ +tests/qapi-schema/reserved-command-q.json: In command 'q-unix': tests/qapi-schema/reserved-command-q.json:5: 'command' uses invalid name 'q-unix' diff --git a/tests/qapi-schema/reserved-type-kind.err b/tests/qapi-schema/reserved-type-kind.err index 0a38efa..8d21479 100644 --- a/tests/qapi-schema/reserved-type-kind.err +++ b/tests/qapi-schema/reserved-type-kind.err @@ -1 +1,2 @@ +tests/qapi-schema/reserved-type-kind.json: In enum 'UnionKind': tests/qapi-schema/reserved-type-kind.json:2: enum 'UnionKind' should not end in 'Kind' diff --git a/tests/qapi-schema/reserved-type-list.err b/tests/qapi-schema/reserved-type-list.err index 4510fa6..2bdd7d8 100644 --- a/tests/qapi-schema/reserved-type-list.err +++ b/tests/qapi-schema/reserved-type-list.err @@ -1 +1,2 @@ +tests/qapi-schema/reserved-type-list.json: In struct 'FooList': tests/qapi-schema/reserved-type-list.json:5: struct 'FooList' should not end in 'List' -- cgit v1.1