qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] dad1fc: qapi script: remember explicitly defi


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] dad1fc: qapi script: remember explicitly defined enum valu...
Date: Wed, 12 Mar 2014 05:00:05 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: dad1fcab91bf101a02151069036d416367b59c5c
      
https://github.com/qemu/qemu/commit/dad1fcab91bf101a02151069036d416367b59c5c
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/comments.out
    M tests/qapi-schema/qapi-schema-test.out

  Log Message:
  -----------
  qapi script: remember explicitly defined enum values

Later other scripts will need to check the enum values.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 4b35991a3bd5f9e03333d5b1bd4a7bcf9941aac5
      
https://github.com/qemu/qemu/commit/4b35991a3bd5f9e03333d5b1bd4a7bcf9941aac5
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/duplicate-key.err
    A tests/qapi-schema/duplicate-key.exit
    A tests/qapi-schema/duplicate-key.json
    A tests/qapi-schema/duplicate-key.out

  Log Message:
  -----------
  qapi script: add check for duplicated key

It is bad that same key was specified twice, especially when a union has
two branches with same condition. This patch can prevent it.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 515b943a91db6c9faf9e35377c18db9ca32ecb40
      
https://github.com/qemu/qemu/commit/515b943a91db6c9faf9e35377c18db9ca32ecb40
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi script: remember line number in schema parsing

Before this patch, 'QAPISchemaError' scans whole input until 'pos'
to get error line number. After this patch, the scan is avoided since
line number is remembered in schema parsing. This patch also benefits
other error report functions, which would be introduced later.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: b86b05ed60d8d49c5770851860d4e6b89c133e7e
      
https://github.com/qemu/qemu/commit/b86b05ed60d8d49c5770851860d4e6b89c133e7e
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/flat-union-invalid-branch-key.err
    A tests/qapi-schema/flat-union-invalid-branch-key.exit
    A tests/qapi-schema/flat-union-invalid-branch-key.json
    A tests/qapi-schema/flat-union-invalid-branch-key.out
    A tests/qapi-schema/flat-union-invalid-discriminator.err
    A tests/qapi-schema/flat-union-invalid-discriminator.exit
    A tests/qapi-schema/flat-union-invalid-discriminator.json
    A tests/qapi-schema/flat-union-invalid-discriminator.out
    A tests/qapi-schema/flat-union-no-base.err
    A tests/qapi-schema/flat-union-no-base.exit
    A tests/qapi-schema/flat-union-no-base.json
    A tests/qapi-schema/flat-union-no-base.out
    A tests/qapi-schema/union-invalid-base.err
    A tests/qapi-schema/union-invalid-base.exit
    A tests/qapi-schema/union-invalid-base.json
    A tests/qapi-schema/union-invalid-base.out

  Log Message:
  -----------
  qapi script: check correctness of union

Since line info is remembered as QAPISchema.line now, this patch
uses it as additional info for every expr in QAPISchema inside qapi.py,
then improves error message with it in checking of exprs.

For common union the patch will check whether base is a valid complex
type if specified. For flat union it will check whether base presents,
whether discriminator is found in base, whether the key of every branch
is correct when discriminator is an enum type.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 6299659f54420955419c4995283f7dd770367939
      
https://github.com/qemu/qemu/commit/6299659f54420955419c4995283f7dd770367939
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi script: code move for generate_enum_name()

Later both qapi-types.py and qapi-visit.py need a common function
for enum name generation.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: b0b58195e4a3039b6a473124dc27ed707db50240
      
https://github.com/qemu/qemu/commit/b0b58195e4a3039b6a473124dc27ed707db50240
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi script: use same function to generate enum string

Prior to this patch, qapi-visit.py used custom code to generate enum
names used for handling a qapi union. Fix it to instead reuse common
code, with identical generated results, and allowing future updates to
generation to only need to touch one place.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: bceae7697ff1711675c26f715b945737bc6849ae
      
https://github.com/qemu/qemu/commit/bceae7697ff1711675c26f715b945737bc6849ae
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/flat-union-reverse-define.err
    A tests/qapi-schema/flat-union-reverse-define.exit
    A tests/qapi-schema/flat-union-reverse-define.json
    A tests/qapi-schema/flat-union-reverse-define.out

  Log Message:
  -----------
  qapi script: support enum type as discriminator in union

By default, any union will automatically generate a enum type as
"[UnionName]Kind" in C code, and it is duplicated when the discriminator
is specified as a pre-defined enum type in schema. After this patch,
the pre-defined enum type will be really used as the switch case
condition in generated C code, if discriminator is an enum field.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 59ca664ef86c8a9078157336b566e832fc5466e2
      
https://github.com/qemu/qemu/commit/59ca664ef86c8a9078157336b566e832fc5466e2
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M qapi-schema.json

  Log Message:
  -----------
  qapi: convert BlockdevOptions to use enum discriminator

After this patch, hidden enum type BlockdevOptionsKind will not
be generated, and other API can use enum BlockdevDriver.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 5223070c47c6fc35ee000b2392ae76d9fab54f16
      
https://github.com/qemu/qemu/commit/5223070c47c6fc35ee000b2392ae76d9fab54f16
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M docs/qapi-code-gen.txt
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/flat-union-string-discriminator.err
    A tests/qapi-schema/flat-union-string-discriminator.exit
    A tests/qapi-schema/flat-union-string-discriminator.json
    A tests/qapi-schema/flat-union-string-discriminator.out
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  qapi script: do not allow string discriminator

Since enum based discriminators provide better type-safety and
ensure that future qapi additions do not forget to adjust dependent
unions, forbid using string as discriminator from now on.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 5d371f41b4db8e47c89626ecf9d9914119583e23
      
https://github.com/qemu/qemu/commit/5d371f41b4db8e47c89626ecf9d9914119583e23
  Author: Wenchao Xia <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M include/qapi/qmp/qerror.h
    M scripts/qapi.py
    M target-i386/cpu.c

  Log Message:
  -----------
  qapi script: do not add "_" for every capitalized char in enum

Now "enum AIOContext" will generate AIO_CONTEXT instead of A_I_O_CONTEXT,
"X86CPU" will generate X86_CPU instead of X86_C_P_U.

Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 2a7a1a56d1e30de07cf7d7636a35bf7706b9500e
      
https://github.com/qemu/qemu/commit/2a7a1a56d1e30de07cf7d7636a35bf7706b9500e
  Author: Luiz Capitulino <address@hidden>
  Date:   2014-03-11 (Tue, 11 Mar 2014)

  Changed paths:
    M tests/test-qmp-commands.c

  Log Message:
  -----------
  tests: test-qmp-commands: Fix double free

The ret variable is freed twice, but on the second time we actually want
to free ret3 instead. Don't know why this didn't explode.

Reported-by: Peter Maydell <address@hidden>
Tested-by: Peter Maydell <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 613c12ec28573b10cae0cd91139ba69b964f347c
      
https://github.com/qemu/qemu/commit/613c12ec28573b10cae0cd91139ba69b964f347c
  Author: Peter Maydell <address@hidden>
  Date:   2014-03-12 (Wed, 12 Mar 2014)

  Changed paths:
    M docs/qapi-code-gen.txt
    M include/qapi/qmp/qerror.h
    M qapi-schema.json
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M target-i386/cpu.c
    M tests/Makefile
    M tests/qapi-schema/comments.out
    A tests/qapi-schema/duplicate-key.err
    A tests/qapi-schema/duplicate-key.exit
    A tests/qapi-schema/duplicate-key.json
    A tests/qapi-schema/duplicate-key.out
    A tests/qapi-schema/flat-union-invalid-branch-key.err
    A tests/qapi-schema/flat-union-invalid-branch-key.exit
    A tests/qapi-schema/flat-union-invalid-branch-key.json
    A tests/qapi-schema/flat-union-invalid-branch-key.out
    A tests/qapi-schema/flat-union-invalid-discriminator.err
    A tests/qapi-schema/flat-union-invalid-discriminator.exit
    A tests/qapi-schema/flat-union-invalid-discriminator.json
    A tests/qapi-schema/flat-union-invalid-discriminator.out
    A tests/qapi-schema/flat-union-no-base.err
    A tests/qapi-schema/flat-union-no-base.exit
    A tests/qapi-schema/flat-union-no-base.json
    A tests/qapi-schema/flat-union-no-base.out
    A tests/qapi-schema/flat-union-reverse-define.err
    A tests/qapi-schema/flat-union-reverse-define.exit
    A tests/qapi-schema/flat-union-reverse-define.json
    A tests/qapi-schema/flat-union-reverse-define.out
    A tests/qapi-schema/flat-union-string-discriminator.err
    A tests/qapi-schema/flat-union-string-discriminator.exit
    A tests/qapi-schema/flat-union-string-discriminator.json
    A tests/qapi-schema/flat-union-string-discriminator.out
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    A tests/qapi-schema/union-invalid-base.err
    A tests/qapi-schema/union-invalid-base.exit
    A tests/qapi-schema/union-invalid-base.json
    A tests/qapi-schema/union-invalid-base.out
    M tests/test-qmp-commands.c
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  tests: test-qmp-commands: Fix double free
  qapi script: do not add "_" for every capitalized char in enum
  qapi script: do not allow string discriminator
  qapi: convert BlockdevOptions to use enum discriminator
  qapi script: support enum type as discriminator in union
  qapi script: use same function to generate enum string
  qapi script: code move for generate_enum_name()
  qapi script: check correctness of union
  qapi script: remember line number in schema parsing
  qapi script: add check for duplicated key
  qapi script: remember explicitly defined enum values

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/be813ef02d18...613c12ec2857

reply via email to

[Prev in Thread] Current Thread [Next in Thread]