Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved compilation scheme for enums.
Now that we allow choosing values for enum constants, there are two compilation schemes for enums (i.e., data types where no constructor takes arguments). - C11 enums, i.e., `typedef enum { A = 0xff, ... } t;`. These are mandated to have type `int` in C11; C23 allows choosing the width, but we don't yet assume C23. We assume `sizeof int == 4` and error out if any of the user-chosen constants exceed the range of `int`. - Macros. We cannot represent arithmetic on enum constants, so there are no issues about integer promotions, or a constant being sign-extended for the wrong reasons. We just print out integer literals, and try the first type that fits all possible values for the enum type, with a preference for unsigned types. This fixes AeneasVerif/eurydice#123
- Loading branch information