)]}'
{
  "commit": "9f08c8ec73878122ad4b061ed334f0437afaaa32",
  "tree": "51643e376c6477366f6085576d2095a83f24bc98",
  "parents": [
    "49823c4b4304a3e4aa5d67e089946b12d6a52d64"
  ],
  "author": {
    "name": "Eric Blake",
    "email": "eblake@redhat.com",
    "time": "Mon Oct 12 22:22:28 2015 -0600"
  },
  "committer": {
    "name": "Markus Armbruster",
    "email": "armbru@redhat.com",
    "time": "Thu Oct 15 08:39:08 2015 +0200"
  },
  "message": "qapi: Lazy creation of array types\n\nCommit ac88219a had several TODO markers about whether we needed\nto automatically create the corresponding array type alongside\nany other type.  It turns out that most of the time, we don\u0027t!\n\nThere are a few exceptions: 1) We have a few situations where we\nuse an array type in internal code but do not expose that type\nthrough QMP; fix it by declaring a dummy type that forces the\ngenerator to see that we want to use the array type.\n\n2) The builtin arrays (such as intList for QAPI [\u0027int\u0027]) must\nalways be generated, because of the way our QAPI_TYPES_BUILTIN\ncompile guard works: we have situations (at the very least\ntests/test-qmp-output-visitor.c) that include both top-level\n\"qapi-types.h\" (via \"error.h\") and a secondary\n\"test-qapi-types.h\". If we were to only emit the builtin types\nwhen used locally, then the first .h file would not include all\ntypes, but the second .h does not declare anything at all because\nthe first .h set QAPI_TYPES_BUILTIN, and we would end up with\ncompilation error due to things like unknown type \u0027int8List\u0027.\n\nActually, we may need to revisit how we do type guards, and\nchange from a single QAPI_TYPES_BUILTIN over to a different\nusage pattern that does one #ifdef per qapi type - right now,\nthe only types that are declared multiple times between two qapi\n.json files for inclusion by a single .c file happen to be the\nbuiltin arrays.  But now that we have QAPI \u0027include\u0027 statements,\nit is logical to assume that we will soon reach a point where\nwe want to reuse non-builtin types (yes, I\u0027m thinking about what\nit will take to add introspection to QGA, where we will want to\nreuse the SchemaInfo type and friends).  One #ifdef per type\nwill help ensure that generating the same qapi type into more\nthan one qapi-types.h won\u0027t cause collisions when both are\nincluded in the same .c file; but we also have to solve how to\navoid creating duplicate qapi-types.c entry points.  So that\nis a problem left for another day.\n\nGenerated code for qapi-types and qapi-visit is drastically\nreduced; less than a third of the arrays that were blindly\ncreated were actually needed (a quick grep shows we dropped\nfrom 219 to 69 *List types), and the .o files lost more than\n30% of their bulk.  [For best results, diff the generated\nfiles with \u0027git diff --patience --no-index pre post\u0027.]\n\nInterestingly, the introspection output is unchanged - this is\nbecause we already cull all types that are not indirectly\nreachable from a command or event, so introspection was already\nusing only a subset of array types.  The subset of types\nintrospected is now a much larger percentage of the overall set\nof array types emitted in qapi-types.h (since the larger set\nshrunk), but still not 100% (evidence that the array types\nemitted for our new Dummy structs, and the new struct itself,\ndon\u0027t affect QMP).\n\nSigned-off-by: Eric Blake \u003ceblake@redhat.com\u003e\nMessage-Id: \u003c1444710158-8723-9-git-send-email-eblake@redhat.com\u003e\n[Moved array info tracking to a later patch]\nSigned-off-by: Markus Armbruster \u003carmbru@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a386605b6a349153494045d494be8d67a9d65de7",
      "old_mode": 33188,
      "old_path": "qapi-schema.json",
      "new_id": "702b7b5dbd4817e06928a8c631956a1d6cbd1090",
      "new_mode": 33188,
      "new_path": "qapi-schema.json"
    },
    {
      "type": "modify",
      "old_id": "d7cf0f37147459fc35bed562f6f094c0f4ea90a3",
      "old_mode": 33188,
      "old_path": "scripts/qapi.py",
      "new_id": "9e017050c04e565689c3398bb6328c1ced1a3f6e",
      "new_mode": 33188,
      "new_path": "scripts/qapi.py"
    },
    {
      "type": "modify",
      "old_id": "b48c6bd740c5cd17e2b203172c1d56f387ad7707",
      "old_mode": 33188,
      "old_path": "tests/qapi-schema/qapi-schema-test.json",
      "new_id": "4e2d7c20630f6a76f3568672ecbab25a1d9b7c2d",
      "new_mode": 33188,
      "new_path": "tests/qapi-schema/qapi-schema-test.json"
    },
    {
      "type": "modify",
      "old_id": "93f62503e7e2b56c9fe18f93f89807fe51f485bf",
      "old_mode": 33188,
      "old_path": "tests/qapi-schema/qapi-schema-test.out",
      "new_id": "a6c80e04d7a6a4121536585d39ae2ef18b7cf00b",
      "new_mode": 33188,
      "new_path": "tests/qapi-schema/qapi-schema-test.out"
    }
  ]
}
