Repository navigation
Name a record declared without a tag by its typedef - #281
Merged
estebanzimanyi merged 1 commit intoNov 19, 2026
Merged
estebanzimanyi merged 1 commit into
estebanzimanyi merged 1 commit into
Conversation
MEOS declares four structures without a tag, `typedef struct {...} GeomVal;` and `Pixel`,
`ways_record` and `SERIALIZED_PATCH` the same way. C names such a record by its typedef alone, while
libclang spells it `struct (unnamed at meos_raster.h:130:9)`. _canonical_spelling replaces the
`(unnamed at ...)` part by the typedef and keeps the keyword before it, so a slot reads
`struct GeomVal *`, a tag no header declares, which a binding spelling the type as C does cannot
compile (GoMEOS's cgo `C.struct_GeomVal`). And parse_meos takes as a record's typedef any typedef
whose type contains the record, so a callback taking a `ways_record *` (`ways_fetch_fn`) can stand
for the layout of `ways_record`.
_canonical_spelling replaces the keyword with the `(unnamed ...)` part, in every form libclang
writes it, and parse_meos takes as a record's typedef only a typedef whose type is that record.
Witness: the catalog of MobilityDB 87c8d33e4d, generated by master's parser, spells those four
records by a tag 13 times (`struct GeomVal`, `struct Pixel`, `struct ways_record`,
`struct SERIALIZED_PATCH`, with and without a pointer).
Measured: the same catalog generated by this branch spells them by a tag 0 times and by their
typedef 30 times, the `STBox` control unchanged at 2469. tests/test_anonymous_records.py (4 tests)
checks the spellings libclang gives and the catalog's slots and structures. The suite runs 700
passed against master's 696 on that catalog, and the 6 tests that fail on master (test_family,
test_struct_layout, test_typerecover) fail the same with this branch and none other.
Why: the owner's ruling of 2026-11-19 ("as you recommend") that this fix, kept from a worktree
sweep, becomes a pull request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MEOS declares four structures without a tag,
typedef struct {...} GeomVal;andPixel,ways_recordandSERIALIZED_PATCHthe same way. C names such a record by its typedef alone, whilelibclang spells it
struct (unnamed at meos_raster.h:130:9). _canonical_spelling replaces the(unnamed at ...)part by the typedef and keeps the keyword before it, so a slot readsstruct GeomVal *, a tag no header declares, which a binding spelling the type as C does cannotcompile (GoMEOS's cgo
C.struct_GeomVal). And parse_meos takes as a record's typedef any typedefwhose type contains the record, so a callback taking a
ways_record *(ways_fetch_fn) can standfor the layout of
ways_record._canonical_spelling replaces the keyword with the
(unnamed ...)part, in every form libclangwrites it, and parse_meos takes as a record's typedef only a typedef whose type is that record.
Witness: the catalog of MobilityDB 87c8d33e4d, generated by master's parser, spells those four
records by a tag 13 times (
struct GeomVal,struct Pixel,struct ways_record,struct SERIALIZED_PATCH, with and without a pointer).Measured: the same catalog generated by this branch spells them by a tag 0 times and by their
typedef 30 times, the
STBoxcontrol unchanged at 2469. tests/test_anonymous_records.py (4 tests)checks the spellings libclang gives and the catalog's slots and structures. The suite runs 700
passed against master's 696 on that catalog, and the 6 tests that fail on master (test_family,
test_struct_layout, test_typerecover) fail the same with this branch and none other.
Why: the owner's ruling of 2026-11-19 ("as you recommend") that this fix, kept from a worktree
sweep, becomes a pull request.