Commit c698258
Read a structure from its definition, not from a declaration before it
A structure the headers declare before they define it is read from its
definition: its record keeps the place where the parse first meets the
structure, and its fields, offsets and file are those of the definition.
A structure the headers only declare, an opaque one such as NumericData,
keeps its declaration and states no field.
Why. A binding laying a structure out reads its fields and offsets from
the catalog. meos.h declares MeosArray and SkipList, which
meos_internal.h defines; read from the first record the parse meets, the
declaration, they carry no field, and neither would varlena once
pg_basetypes.h declares struct varlena ahead of the splice defining it,
which MobilityDB #2893 does.
Measured. Over MobilityDB d5e3e9946e, three structures gain their
fields and nothing else changes: MeosArray five, read in meos_internal.h
for meos.h, SkipList fourteen, read in meos_internal.h for meos.h, and
PCSCHEMA eleven, read in pc_api.h for meos_pointcloud.h. Over MobilityDB
#2893 (dd0426728b) varlena keeps its two fields, and that catalog differs
from master's only in where its structures and typedefs sit: NumericData
is found in pg_basetypes.h instead of pg_numeric.h, so it no longer reads
as vendored, and the structures come in another order.
Witness. tests/test_struct_layout.py reads MeosArray, SkipList and
varlena with their fields from the catalog, and parses a header
declaring one structure before a second header defines it, beside one
only declared: the first carries its fields and the second none. The
suite floor goes from 341 to 343.1 parent 0455a59 commit c698258
3 files changed
Lines changed: 46 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
189 | 205 | | |
190 | | - | |
| 206 | + | |
191 | 207 | | |
192 | 208 | | |
193 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
82 | 109 | | |
83 | 110 | | |
84 | 111 | | |
0 commit comments