ref: 0e9f74cb67f2227f888e9a127624f77d83aee270 cproc/init.c -rw-r--r-- 6.4 KiB
Keep track of type properties in type
Implement bit-field initializers
init: Remove some unused includes
init: Improve parseinit performance for sequential initializers

Now, we only traverse the current initializer list to find the place to
insert a designated initializer. Regular initializers always go after
the previous one.

Fixes #37.
init: Error on bit-field initializers for now
Track type qualifiers separately

Using a special qualified type kind has a number of problems:
- Important fields such as size, align, and incomplete may not be set,
  since the qualified type was created before a struct was completed.
- When we don't care about type qualifiers (which is the usual case),
  we have to explicitly unqualify the type which is annoying and

Instead, in derived types, keep track of the qualifiers of the base type
alongside the base type (similar to what is done for members, parameters,
declarations, and expressions in the past few commits).
expr: Use separate fields for lvalue and decayed instead of flags
Merge headers into cc.h
Start to handle overlapping initializers
Abbreviate tag names
Allow string literals to initialize any array with character type
init: Check for incomplete types

Fixes #28.
Check for negative array lengths/indices
Fix size of incomplete array types initialized with strings

updatearray takes an index, so was allocating an extra byte.
Remove some unused variables
Some small cleanups
Don't embed anonymous struct members into parent

While this works nicely for structs, when unions are involved it
makes it impossible to find the next member to initialize without keeping
track of extra data per member.
Fix some potential uninitialized fields
Allow initializing array with longer strings
Ignore qualifiers when parsing initializers
Initial import