Commit Graph

110 Commits

Author SHA1 Message Date
acqn f9812930c1 More detailed diagnostic info about conflicted function types. 2021-03-30 16:47:57 +08:00
Bob Andrews 58de94edd4
Merge pull request #1560 from empathicqubit/master
Add --debug-tables <filename> option and output struct fields
2022-03-20 20:27:15 +01:00
acqn 6beb090193 Fixed anonymous bit-fields declared with typedef'ed type names. 2022-01-03 23:54:14 +08:00
Greg King 325ff9667e Used (size_t), instead of (long) where converting between pointers and integers.
(long) still is 32 bits on 64-bit Windows!
2021-12-12 19:40:43 -05:00
empathicqubit fd8d51497c Add --debug-tables <filename> option and output struct and union fields 2021-09-29 05:20:44 +02:00
acqn 5adb29ce31 Made "bit-field-ness" a type property instead of a SymbolEntry or ExprDesc property.
Fixed integer promotion and result type in certain operations.
Fixed bit-fields 'op=' and postfix inc/dec operators.
2021-06-09 08:03:12 +02:00
mrdudz 0fbf2af09d Fix the warning that is produced for unused functions 2021-05-08 01:03:43 +02:00
acqn b802efde54 Fixed ternary result type detection with pointer types.
Fixed pointer type comparison and conversion, especially regarding qualifiers.
Improved diagnostics about type comparison and conversion.
Reorganized some type-comparison/conversion functions.
2021-03-30 19:41:20 +02:00
acqn cb8fbf4772 Removed the non-existing-in-C "struct/union scope" for structs/unions.
Fixed handling of struct/union field declarations without identifiers, which do nothing.
2021-03-29 19:28:22 +02:00
acqn 2aad72af90 Removed trailing whitespaces. 2021-03-03 10:07:24 +01:00
acqn a1992702f8 Declarations of 'extern' object and function should be visible in the file scope. 2021-01-30 14:31:51 +01:00
Jesse Rosenstock 4e4e4c2d21 Allow char bit-fields
These are not required to be supported (only int, signed int, and
unsigned int are required), but most compilers support it.

https://port70.net/~nsz/c/c89/c89-draft.html#3.5.2.1
https://port70.net/~nsz/c/c89/c89-draft.html#A.6.5.8

For consistency with other integral types, plain `char` bit-fields
are unsigned, regardless of the `--signed-chars` option.

Fixes #1047
2020-09-08 14:24:04 +02:00
Jesse Rosenstock 9a0e4a35e1 Fix enum bit-field ICE #1244
This previously resulted in an ICE:
cc65: Check failed: (Entry->Type->C & T_MASK_SIGN) == T_SIGN_SIGNED,
file 'cc65/symtab.c', line 874

This CHECK is in the code that deals with changing `int` bitfields to
`unsigned int`.

Work around this by treating enum bit-fields as having their signedness
specified, so this type change code does not get called.

Fixes #1244.
2020-09-07 11:21:23 +02:00
acqn 6b64b43395 Made local static data use a separated label pool from the code label pool. 2020-08-31 09:12:03 +02:00
acqn df755df44d Warning about ESU types declared inside parameter list as they are invisble outside. 2020-08-29 16:37:16 +02:00
Jesse Rosenstock ff535b8e1a Treat signed int bit-fields as signed
Prior to this PR, `int`, `signed int`, and `unsigned int`
bitfields are all treated as `unsigned int`.

With this PR, `signed int` will be treated as `signed int`,
and the others remain unsigned.

Since `Type` does not distinguish between `int` and `signed int`,
add an extra `int* SignenessSpecified` param to `ParseTypeSpec`
so we can tell these apart for bit-fields and treat plain `int : N`
as `unsigned int : N` since it is more efficient to zero-extend
than sign-extend.

Fixes #1095
2020-08-18 12:23:20 +02:00
acqn f206833a20 Alternative fix for Issue #1167. 2020-08-17 20:31:02 +02:00
acqn ebae994dc9 Fixed CHECK failure when calling functions defined with repeated parameter names.
Clarified the terms "parameter" vs "argument" in FunctionParamList().
2020-08-17 20:27:57 +02:00
acqn b19bb14348 Fixed checking conflitcing declarations with external vs other linkage. 2020-08-14 18:33:54 +02:00
acqn 13ed557b92 Fixed compatibility checking of function declarations by using the composite types of them. 2020-08-14 18:33:54 +02:00
acqn 8a417ff039 Improved ESU declaration failure handling. 2020-08-14 18:15:31 +02:00
acqn 03b37cf712 Fixed type comparisons of typedefs and arrays. 2020-08-12 15:04:26 +02:00
acqn b62b1650f5 Improved error messages on struct/union type multiple definitions. 2020-08-12 15:01:31 +02:00
acqn 0f1a5e0520 Set enum tag definition flags. 2020-08-09 22:12:36 +02:00
acqn 1dd899c7c9 Fixed non-file-scope multiple definition checking. 2020-08-09 22:12:36 +02:00
acqn f59d6b8f6a Redefining enums/structs/unions of 0 size is no longer treated as declarations and thus forbidden. 2020-08-07 10:16:33 +02:00
acqn 7e68a24625 Clearer warning messages on unused symbols. 2020-08-02 23:51:11 +02:00
acqn e8c2886455 Improved error messages on redefinitions of constants and bit-fields. 2020-08-02 23:51:11 +02:00
acqn 00c16d34a4 Minor fixes for HandleSymRedefinition(). 2020-08-02 23:51:11 +02:00
acqn 0df45fe2f2 Utility for getting ESU tag type symbols. 2020-08-02 18:55:46 +02:00
acqn 25d10d9d9a Fixed nested struct/union initialization.
Fixed bit-fields offsets in anonymous structs.
2020-07-30 08:38:24 +02:00
acqn d6d667a688 Improved error handling with symbol redefinitions. 2020-07-30 08:22:29 +02:00
acqn d8184fbe54 No longer insert all enums in the global symbol table. 2020-07-28 23:26:25 +02:00
acqn daa65199b3 Fixed underlying types of enums.
Made enumerator diagnostics more sensible.
Fixed Issue #1048 as a natural result.
2020-07-28 23:26:25 +02:00
acqn 07e18774f7 Added spaces around '|' with regex replacement. 2020-07-21 18:23:52 +02:00
acqn c66d0881b9 Made the enum/enumerator types clearer and improved DumpSymEntry() output. 2020-07-21 18:23:52 +02:00
acqn 18bd76bb90 Minor fixes and improvements. 2020-07-21 18:23:52 +02:00
acqn 0250c87ac6 Fixed SC_* type masks by making them all bitwise-exclusive. 2020-07-21 18:23:52 +02:00
acqn 768e03a474 Small fixes and tidy-up based on PR review.
Renamed GetReplacementType() to GetStructReplacementType().
Clarified in comments that most *Struct* facilities work for unions as well.
Made it clear in some error messages with regards to structs/unions.
2020-07-19 10:58:33 +02:00
Jesse Rosenstock 1c2edc5434 AddBitField: Rename Width arg to BitWidth
This makes the arg consistent with the SymEntry field name.
2020-06-21 01:08:44 +02:00
Lauri Kasanen a9cbb5305c Fix missing spaces 2019-04-21 12:46:03 -04:00
Lauri Kasanen 3b3b16ee9c Add support for computed gotos
This is a GCC extension that allows C to use fast jump tables.
2019-04-21 12:46:03 -04:00
Lauri Kasanen c2220f3c30 Add a goto indirect jump from pointer 2019-04-21 12:46:03 -04:00
Lauri Kasanen 37f00e6644 Export the label symbol table 2019-04-21 12:46:03 -04:00
Greg King a6b04f6e97 Changed most "backticks" (grave accents) into apostrophes.
Quotations that are embraced by tick marks now look better, in most fonts.
2019-01-05 14:57:12 -05:00
laubzega 5fa79be997 Post-review tweaks. 2018-10-16 09:55:02 +02:00
laubzega cf7f3abadd Even more optimization, cleanup, bugfix, comments. 2018-10-16 09:55:02 +02:00
laubzega d3665b263e Stack adjustment code optimizations. 2018-10-16 09:55:02 +02:00
Greg King 03e43d1fbf Changed a comment and an error message into more specific text. 2018-10-08 20:39:46 -04:00
laubzega 92defb7a2b Fix crash due to mistaken symbol identity. 2018-10-08 16:27:00 +02:00