1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-28 19:29:53 +00:00
Commit Graph

8558 Commits

Author SHA1 Message Date
acqn
fdd120db49 Enabled to output errors and warnings about tentative definitions. 2020-08-07 10:16:33 +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
Jesse Rosenstock
cdfc1afd89 Fix vacuous comparison warning from 0df45fe
cc65/symentry.c:306:60: warning: address of array 'Sym->Name' will always evaluate to 'true' [-Wpointer-bool-conversion]
    sprintf (TypeName, "%s %s", GetBasicTypeName (T), Sym->Name ? Sym->Name : "<unknown>");
                                                      ~~~~~^~~~ ~
2020-08-05 17:48:13 +02:00
Jesse Rosenstock
d8f9201ecd LoadExpr: Optimize <= 8-bit bit-field loads
Set CF_FORCECHAR to do as many operations as char ops as possible.
Clear high byte at the end.
2020-08-05 12:49:46 +02:00
Jesse Rosenstock
0c72647edd Remove extra ED_TestDone call
Accidentally added in #1141.
2020-08-03 12:40:58 +02:00
acqn
bae431eab0 Fixed error message of CheckedPSizeOf(). 2020-08-03 06:18:28 +02:00
acqn
e3d913b81a Fixed the reference output of test/misc/goto.c (test/misc/goto.ref). 2020-08-02 23:51:11 +02:00
acqn
d6aa446b54 Error info for loading expressions of incomplete enum types.
No more "Illegal type 0016".
2020-08-02 23:51:11 +02:00
acqn
6df4f1996b Improved diagnostics with more detailed type names. 2020-08-02 23:51:11 +02:00
acqn
11a5f0edf1 No "Statement has no effect" warnings on statements with errors. 2020-08-02 23:51:11 +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
ef5a4db12e Improved warning messages on UB shifts. 2020-08-02 23:51:11 +02:00
acqn
2ab7272673 Improved warning on comparison of unsigned type < 0. 2020-08-02 23:51:11 +02:00
acqn
99ac1c46da Made errors/warnings statistic message visible when there are errors. 2020-08-02 23:51:11 +02:00
acqn
44e3080ea9 Increased upper limit of allowed errors before aborting. 2020-08-02 23:51:11 +02:00
acqn
00c16d34a4 Minor fixes for HandleSymRedefinition(). 2020-08-02 23:51:11 +02:00
acqn
80b0e57543 Changed parameter constness of TypeConversion(). 2020-08-02 18:55:46 +02:00
acqn
003d47cc8b Improved type conversion diagnostic messages.
Allowed incompatible pointer assignments with warnings.
Fixed Issue #1089.
2020-08-02 18:55:46 +02:00
acqn
d841bbe498 Utility to check for castability. 2020-08-02 18:55:46 +02:00
acqn
52051f444e Using tracked individual string buffers instead of a shared static string buffer for full type names. 2020-08-02 18:55:46 +02:00
acqn
4ccf10f3fa Utility to get full type names. 2020-08-02 18:55:46 +02:00
acqn
0df45fe2f2 Utility for getting ESU tag type symbols. 2020-08-02 18:55:46 +02:00
Oliver Schmidt
c831f40e9b Unfortunately there's no other way than using the absolute path to init the correct MSVC 2017 environment. 2020-08-02 18:44:13 +02:00
Oliver Schmidt
35d6a75b37 Fixed Windows path notation. 2020-08-02 17:49:18 +02:00
Oliver Schmidt
992596c981 Initialize MSVC 2017 environment before build. 2020-08-02 17:32:36 +02:00
Oliver Schmidt
ce19d7b84f Made use of Travis CI's Windows support.
At least for now there seems to be no point in trying to build the libraries (and run the tests) on Windows. Rather we only want to check that the MSVC solution is still valid.
2020-08-02 15:50:31 +02:00
Jesse Rosenstock
adda28f5c5 LoadExpr: Set CF_FORCECHAR if test is required
If we are testing, we do not need to load the high byte(s).
2020-08-02 12:31:57 +02:00
acqn
2a555d198c Changed 'switch' to 'if' according PR review comments. 2020-08-02 12:28:11 +02:00
acqn
30fd8592ae Avoid internal errors when using function-type objects in expressions. 2020-08-02 12:28:11 +02:00
acqn
e526cbbff6 Fixed handling multiple storage specifiers in one declaration. 2020-08-02 02:20:25 +02:00
Jesse Rosenstock
633cd17a3e Add enum size test case for #1050 2020-08-02 01:18:28 +02:00
Oliver Schmidt
e1043fac12 Adjusted to https://github.com/cc65/cc65/pull/1124. 2020-08-01 10:56:05 +02:00
Jesse Rosenstock
9c70bd44a6 Clarify comment about large shift
This is to avoid overflow on host platform.
2020-07-31 19:33:28 +02:00
Jesse Rosenstock
847982c6bf Handle bit-field test after shift/mask
Previously, bit-field tests were incorrectly combined with load in
`if (x.bitfield)`.  Delay the test until after the shift/mask
is done.  Still combine tests with load if no shift/mask is required.

Fixes #1139
2020-07-31 19:33:28 +02:00
Jesse Rosenstock
d0c7108dcf Change copyright notice to "The cc65 Authors" 2020-07-30 19:17:11 +02:00
Jesse Rosenstock
3df6c383c0 Add support for static_assert
Add C11's _Static_assert and static_assert macro.

This is like #error, but is handled at a later stage
of translation, so it is possible to check sizes of
types, values of enums, etc.

https://en.cppreference.com/w/c/language/_Static_assert
https://port70.net/~nsz/c/c11/n1570.html#6.7.10
2020-07-30 19:17:11 +02:00
Jesse Rosenstock
c72fa735b9 Add test for #1139 2020-07-30 19:13:19 +02:00
Jesse Rosenstock
2d5fd0fc63 Use char ops if possible for bit-field loads
Set CF_FORCECHAR and change type to char once we have
shifted into a char.

This saves some unnecessary ldx #0 instructions.
2020-07-30 14:59:23 +02:00
acqn
e38f601fcc Fixed padding at the ends of structs with bit-fields. 2020-07-30 08:38:24 +02:00
acqn
8a511bb63d Fixed nested array initializers. 2020-07-30 08:38:24 +02:00
acqn
9075a853dc Allows one trailing comma before the closing curly of a struct/union initializer. 2020-07-30 08:38:24 +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
92de4fa0d0 Enabled to recognize labels when parsing local variable declarations. 2020-07-30 08:22:29 +02:00
acqn
19c81ed866 Fixed type mask usage. 2020-07-30 08:13:23 +02:00
Jesse Rosenstock
fb9b50ff9c Move type checks before bit-field width parsing 2020-07-30 08:10:38 +02:00
Jesse Rosenstock
aaa0cf5448 Add err tests for bitfield width errors
! ../../bin/cc65 -o ../../testwrk/err/bitfield-named-zero-width.s bitfield-named-zero-width.c
bitfield-named-zero-width.c(27): Error: Zero width for named bit-field
! ../../bin/cc65 -o ../../testwrk/err/bitfield-negative-width.s bitfield-negative-width.c
bitfield-negative-width.c(26): Error: Negative width in bit-field
! ../../bin/cc65 -o ../../testwrk/err/bitfield-too-wide.s bitfield-too-wide.c
bitfield-too-wide.c(26): Error: Width of bit-field exceeds its type
2020-07-30 08:10:38 +02:00
Jesse Rosenstock
a2561d07f3 Remove special-case bit-field width code
cbb33f8 restricted allowed bit-field types to int,
so this is equivalent for now, but forward-compatible.

Fixes FIXME

Also move the int type check before parsing the colon.
2020-07-30 08:10:38 +02:00
Jesse Rosenstock
74dda01919 Add test that plain int bitfields are unsigned
We want to make sure this doesn't change when #1095 is fixed;
unsigned is much more efficient.
2020-07-29 16:43:17 +02:00