1. 14 12月, 2018 1 次提交
  2. 31 5月, 2018 1 次提交
  3. 19 2月, 2016 1 次提交
    • E
      qapi: Forbid 'any' inside an alternate · 46534309
      Eric Blake 提交于
      The whole point of an alternate is to allow some type-safety while
      still accepting more than one JSON type.  Meanwhile, the 'any'
      type exists to bypass type-safety altogether.  The two are
      incompatible: you can't accept every type, and still tell which
      branch of the alternate to use for the parse; fix this to give a
      sane error instead of a Python stack trace.
      
      Note that other types that can't be alternate members are caught
      earlier, by check_type().
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1455778109-6278-4-git-send-email-eblake@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      46534309
  4. 06 5月, 2015 2 次提交
    • E
      qapi: Tighten checking of unions · 44bd1276
      Eric Blake 提交于
      Previous commits demonstrated that the generator had several
      flaws with less-than-perfect unions:
      - a simple union that listed the same branch twice (or two variant
      names that map to the same C enumerator, including the implicit
      MAX sentinel) ended up generating invalid C code
      - an anonymous union that listed two branches with the same qtype
      ended up generating invalid C code
      - the generator crashed on anonymous union attempts to use an
      array type
      - the generator was silently ignoring a base type for anonymous
      unions
      - the generator allowed unknown types or nested anonymous unions
      as a branch in an anonymous union
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      44bd1276
    • E
      qapi: Add some union tests · 3d0c4829
      Eric Blake 提交于
      Demonstrate that the qapi generator doesn't deal well with unions
      that aren't up to par. Later patches will update the expected
      reseults as the generator is made stricter.  A few tests work
      as planned, but most show poor or missing error messages.
      
      Of particular note, qapi-code-gen.txt documents 'base' only for
      flat unions, but the tests here demonstrate that we currently allow
      a 'base' to a simple union, although it is exercised only in the
      testsuite.  Later patches will remove this undocumented feature, to
      give us more flexibility in adding other future extensions to union
      types.  For example, one possible extension is the idea of a
      type-safe simple enum, where added fields tie the discriminator to
      a user-defined enum type rather than creating an implicit enum from
      the names in 'data'.  But adding such safety on top of a simple
      enum with a base type could look ambiguous with a flat enum;
      besides, the documentation also mentions how any simple union can
      be represented by an equivalent flat union.  So it will be simpler
      to just outlaw support for something we aren't using.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3d0c4829
  5. 29 7月, 2013 3 次提交