Skip to content

Commit abae26e

Browse files
committed
internal/qmp-gen: gracefully ignore the new pragma statement.
Running the generation pass pulled in some changes from upstream. Also a trivial change to qemu's strings to appease the presubmit.
1 parent a8293e2 commit abae26e

File tree

4 files changed

+1727
-834
lines changed

4 files changed

+1727
-834
lines changed

internal/qmp-gen/types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func readDefinitions(path string) ([]definition, error) {
5757
default:
5858
return nil, fmt.Errorf("unexpected part of spec file %q: %s", path, string(part))
5959
case 1:
60-
if len(fs) == 1 && part[0] == '{' {
60+
if len(fs) == 1 && part[0] == '{' && !bytes.HasPrefix(part, []byte("{ 'pragma'")) {
6161
return nil, fmt.Errorf("found type definition without a docstring in %q: %s", path, string(part))
6262
}
6363
// This part looks like a non-docstring comment, just skip it.
@@ -187,6 +187,9 @@ func parse(defs []definition) (map[name]interface{}, error) {
187187
return nil, err
188188
}
189189
ret[v.Name] = v
190+
case m["pragma"] != nil:
191+
// We ignore pragmas, they're there for the benefit of
192+
// qemu's own self-validation.
190193
default:
191194
return nil, fmt.Errorf("unknown definition kind: %q", string(def.JSON))
192195
}

qemu/string.gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)