aboutsummaryrefslogtreecommitdiff
path: root/decl.c
AgeCommit message (Collapse)Author
2021-10-20expr: Add support for wide string literalsMichael Forney
Thanks to Nihal Jere for his initial patches implementing this feature. Fixes #35.
2021-10-03qbe: Remove some unused includesMichael Forney
We now hard-code the float precision in the format string instead of using the float.h macros. The other headers were never used (except maybe prior to the first commit).
2021-09-29Rename uint64_t field of constant union to uMichael Forney
This will prepare us for adding a signed int64_t field called i.
2021-09-29Use unsigned long long for sizes and offsetsMichael Forney
We don't need exact-width integer types here.
2021-09-13Revert "Add stringconcat function to concatenate adjacent string literals"Michael Forney
This reverts commit c16f07acf655b9f4fb006d8256b4027fb5a13aa8. This incorrectly allows octal escapes to span between adjacent string literals (e.g. "\0" "1" is not the same as "\01").
2021-09-07decl: Include location for _Complex/_Atomic error messagesMichael Forney
2021-09-06decl: Relax restrictions for 0-length array memberMichael Forney
Zero-length array members are quite common in linux UAPI headers, where they don't follow the restrictions of flexible array members. Since they are non-standard, relax the error checking for them, rather than considering them the same as a flexible array member.
2021-09-06Fix type-checking of va_list arguments to varargs built-insMichael Forney
If the argument was a function parameter, its type has already been adjusted. So on x86_64, we can't just ignore the automatic array-to-pointer conversion, since it was never a pointer to begin with. Instead, keep track of the adjusted va_list type, and check that the arguments to varargs built-ins match that type.
2021-08-15decl: Don't accept abstract function declarator when disallowedMichael Forney
When declarator() is called with allowabstract == false, the caller can assume that it will always return the identifier being declared. However, abstract function declarators were incorrectly accepted in this case with name set to NULL instead of erroring out due to invalid syntax. To fix this, only skip forward to function declarator parsing for abstract declarators, since this is the only case where we can't immediately tell whether we have a parenthesized declarator or a function declarator. Fixes #74.
2021-07-02qbe: Remove repr from struct value and use per-instruction class insteadMichael Forney
This way we avoid leaking backend-specific details of type representation outside qbe.c. It also facilitates some future simplifications.
2021-07-01decl: Check that the flexible array member (if present) is lastMichael Forney
2021-07-01decl: Disallow members with incomplete typesMichael Forney
Make an exception for flexible array members, though we should also check that the flexible array member, if any, is last.
2021-07-01decl: Check that struct/union has at least one memberMichael Forney
2021-06-28Add stringconcat function to concatenate adjacent string literalsMichael Forney
This function also ensures that the string prefixes (if any) are compatible. It should make it easier to implement wide string support.
2021-04-11decl: Allow _Static_assert in struct declarationMichael Forney
2021-04-11decl: Allow _Alignas(0)Michael Forney
C11 6.7.5p6 says "An alignment specification of zero has no effect".
2020-06-03Revert "decl: Allow out-of-range enum constants when they don't change type"Michael Forney
This reverts commit 6229709b8ae21d7722fef48ad8a9f2f10b900030. I still don't understand how out-of-range enum constants are supposed to work.
2020-06-03decl: Allow out-of-range enum constants when they don't change typeMichael Forney
gcc and clang allow enum constants out of range of int, but this means that the type of enumerator may differ inside and outside the enum specifier. Instead, only allow out-of-range enum constants when their types are compatible with the final enum type.
2020-06-02decl: Improve error message for out-of-range enum constantsMichael Forney
2020-03-16decl: Simplify struct tag parsing slightlyMichael Forney
2020-01-30decl: Better check for inline definitionsMichael Forney
2020-01-30decl: Use list link to determine presence in tentative definition listMichael Forney
2019-11-19decl: Parse array size as an assignment-expressionMichael Forney
Even though we don't support VLAs yet, we should still be parsing the VLA syntax, then failing after if it was not a constant expression.
2019-08-13decl: Allow _Static_assert with no messageMichael Forney
This is accepted for C2X[0]. [0] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2265.pdf
2019-08-13decl: Separate _Static_assert handling to its own functionMichael Forney
2019-08-11decl: Allow enumerator values up to UINT_MAXMichael Forney
2019-07-10decl: Display message when _Static_assert failsMichael Forney
2019-06-18decl: _Thread_local is not yet supportedMichael Forney
2019-06-04Fix non-adjacent bit-fieldsMichael Forney
2019-06-02decl: Disallow enumerator values that aren't representable as 'int'Michael Forney
2019-05-19decl: Allow zero length arraysMichael Forney
gcc allows this, and glibc uses it in some headers instead of flexible array members.
2019-05-18decl: Give a better error message when a VLA is usedMichael Forney
2019-05-16decl: Qualifiers of array type are for element typeMichael Forney
2019-05-16decl: extern storage class with initializer is still a definitionMichael Forney
2019-05-15Implement asm labelsMichael Forney
2019-05-15decl: Don't emit function if inline is specified without static or externMichael Forney
This partially addresses #42. Now, no duplicate definitions will be emitted, but we also don't emit a definition when a later declaration is specified with extern.
2019-05-14Use correct terminology in error messageMichael Forney
2019-05-14decl: Factor out some code common to function and object declarationsMichael Forney
2019-05-12Improve error message and simplify slightlyMichael Forney
2019-04-27Unnamed bit-fields don't contribute to size or alignment of unions, or size ↵Michael Forney
of structs
2019-04-27Fix some function declarator corner casesMichael Forney
2019-04-24Use a common member for expression baseMichael Forney
2019-04-24Free functions when we're done with themMichael Forney
2019-04-24Disallow struct members with function typeMichael Forney
2019-04-21Keep track of type properties in typeMichael Forney
2019-04-20Make basic types have their own kindMichael Forney
2019-04-20Shorten some names with 'long'Michael Forney
2019-04-17Merge map.h and tree.h into util.hMichael Forney
2019-04-17Just use a single mapkey functionMichael Forney
2019-04-17htab -> mapMichael Forney