)]}'
{
  "commit": "85c7cb3c4b70cc484ecf3d72a116503876a28f0a",
  "tree": "41c352a475613a9d0719130375c066c872c7ace7",
  "parents": [
    "8034b0baeac1b209b1742b3e8fa25015191b57b8"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Mon Feb 20 13:14:55 2023 +0000"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Mon Feb 27 14:14:24 2023 +0000"
  },
  "message": "gdb: don\u0027t treat empty enums as flag enums\n\nIn C++ it is possible to use an empty enum as a strong typedef.  For\nexample, a user could write:\n\n  enum class my_type : unsigned char {};\n\nNow my_type can be used like \u0027unsigned char\u0027 except the compiler will\nnot allow implicit conversion too and from the native \u0027unsigned char\u0027\ntype.\n\nThis is used in the standard library for things like std::byte.\n\nCurrently, when GDB prints a value of type my_type, it looks like\nthis:\n\n  (gdb) print my_var\n  $1 \u003d (unknown: 0x4)\n\nWhich isn\u0027t great.  This gets worse when we consider something like:\n\n  std::vector\u003cmy_type\u003e vec;\n\nWhen using a pretty-printer, this could look like this:\n\n  std::vector of length 2, capacity 2 \u003d {(unknown: 0x2), (unknown: 0x4)}\n\nClearly not great.  This is described in PR gdb/30148.\n\nThe problem here is in dwarf2/read.c, we assume all enums are flag\nenums unless we find an enumerator with a non-flag like value.\nClearly an empty enum contains no non-flag values, so we assume the\nenum is a flag enum.\n\nI propose adding an extra check here; that is, an empty enum should\nnever be a flag enum.\n\nWith this the above cases look more like:\n\n  (gdb) print my_var\n  $1 \u003d 4\n\nand:\n\n  std::vector of length 2, capacity 2 \u003d {2, 4}\n\nWhich look much better.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d30148\n\nReviewed-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "69b2310be1f202c5a492a4ff2db3ba710311296d",
      "old_mode": 33188,
      "old_path": "gdb/dwarf2/read.c",
      "new_id": "038f31cb06b35809c5ec0a291e72437f983baae8",
      "new_mode": 33188,
      "new_path": "gdb/dwarf2/read.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "1a0eeced710bdd323a77e08e0b757798d4dde3b0",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.cp/empty-enum.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "83cb8cb3973bb59a9272b45ddc6b83593a4d8662",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.cp/empty-enum.exp"
    }
  ]
}
