Skip to content

cpp's CTAGS_CLASS_KINDS missing union kind (same pattern as the c fix) #1877

Closed

Description

@squid-protocol

Summary

While resolving the c tri-comparison ledger backlog (#1876), found CTAGS_CLASS_KINDS["c"] was struct-only when GitGalaxy's own C class_start regex covers struct|union|enum -- fixed by adding g/u (enum/union) kinds.

tests/tools/ctags_reader.py's CTAGS_CLASS_KINDS["cpp"] has the same shape of gap, unfixed:

"cpp": {"c", "s"},  # class, struct

GitGalaxy's own C++ class_start regex (gitgalaxy/standards/language_standards.py:3186-3191) matches class|struct|union|enum class|enum struct -- union is real, matched syntax GitGalaxy detects, but ctags' u (union) kind isn't in the map. Confirmed ctags --list-kinds-full=C++ has a real u union kind, same as C's.

Nuance -- NOT a copy-paste of the C fix

Unlike C's plain enum, GitGalaxy's C++ regex only matches scoped enums (enum class Foo/enum struct Foo), not a bare enum Foo { ... }. ctags' g (enum) kind almost certainly doesn't distinguish scoped from unscoped -- naively adding "g" the way C's fix added it could introduce a NEW mismatch (ctags counting plain enums GitGalaxy correctly excludes) rather than fix one. This needs verification against real C++ corpus data (does language-crucible/data/cpp/ have real union declarations currently missing from the tri-comparison? does it have plain-vs-scoped enums to check the "g" kind against?) before deciding whether "g" belongs in the map at all.

Suggested scope

  • Add "u" to CTAGS_CLASS_KINDS["cpp"] -- low-risk, matches the confirmed-safe C precedent exactly.
  • Investigate (don't assume) whether "g" should also be added, and if so, whether it needs a scoped-vs-unscoped filter analogous to how _get_node_name/similar per-language special-casing already exists elsewhere in this codebase.

Scope note

Same category as the C fix -- this is test-harness/tri-comparison-tooling accuracy (tests/tools/ctags_reader.py), not GitGalaxy's own engine or a risk-scoring concern.

🤖 Found while capstone-reviewing the c language sweep, tri-comparison-ledger-sweep skill

Activity

  1. added
    testing
    on Aug 19, 2026
  2. squid-protocol commented on Aug 22, 2026

    @squid-protocol
    OwnerAuthor

    Fixed as part of a broader tri-comparison-ledger-sweep on cpp (2026-08-21), landed in PR #2015. CTAGS_CLASS_KINDS["cpp"] is now {"c", "s", "u", "g"} (class, struct, union, enum).

    Your predicted nuance was exactly right: "g" (enum) needed the scoped-vs-unscoped guard, since ctags' "g" kind doesn't distinguish enum class Foo/enum struct Foo (which GitGalaxy's own class_start regex counts) from a plain enum Foo {} (which it doesn't). Implemented as _is_cpp_unscoped_enum in tests/tools/ctags_reader.py — checks the tag's own verbatim matched source line for a scoped-enum keyword before admitting it, gated per-tag rather than blanket-adding the kind.

    Confirmed via real corpus data: godot/node.h's union MTFlag/MTNumeric and godot/object.h's enum class AncestralClass (plus several sibling scoped enums across powertoys/FancyZones.cpp/mlir/flatbuffer_export.cc) were all previously invisible to ctags in the tri-comparison and are now correctly matched.

  3. added this to the v2.4.9 milestone on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testing

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions