]> git.draconx.ca Git - cdecl99.git/commitdiff
libcdecl: Combine identifier and struct allocation.
authorNick Bowler <nbowler@draconx.ca>
Sun, 23 Jul 2023 19:06:29 +0000 (15:06 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sun, 23 Jul 2023 19:13:11 +0000 (15:13 -0400)
Whenever the parser uses an identifier token, it is always to stuff
it into a newly-allocated declarator or declspec structure.

So we can reduce the amount of work that needs to be done in the
parser actions by by pre-allocating a declarator structure in the
scanner.  By using a union, we can also use this same allocation
for the declspec case.

And by happy accident, some of the structure members are identical
between both cases, and GCC at least recognizes that it doesn't need
to do anything to copy e.g., declarator.u.ident to declspec.ident
within the union.


No differences found