1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-20 17:20:49 +00:00
Commit Graph

8633 Commits

Author SHA1 Message Date
acqn f289ea6c14 Avoided generating unnecessary true-case labels in logic AND/OR. 2020-08-22 11:10:17 +08:00
acqn 85ea06687b Fixed logical AND and logical OR. 2020-08-20 07:52:15 +08:00
acqn 725511131a Fixed constant expression checks with no-code requirement.
Used return-by-value initialization for ExprDesc.
2020-08-20 07:52:11 +08:00
acqn 1abb9da2b2 Moved bug250.c to test/val as it is fixed. 2020-08-26 09:40:32 +08:00
acqn 3ea3887c77 Fixed warnings on const comparison.
Warnings on expressions with no effects.
Fixed const ternary.
Fixed ternary with struct/union types as the true/false-branch expressions.
2020-08-20 07:52:06 +08:00
acqn b15ab348ba Moved bug250.c from test/misc as it is to be fixed. 2020-08-26 08:23:05 +08:00
acqn 17bbba7327 Added integer boolean type string.
No longer set the "expression tested" flag with constant results in comparison.
2020-08-20 07:52:03 +08:00
acqn c3a6b39945 Made struct assignment less hackish. 2020-08-24 18:02:29 +02:00
acqn d1995fc81a Fixed rvalue-ness of cast results. 2020-08-24 17:16:37 +02:00
acqn 63fa9a5a42 Fixed usage of "lvalue-cast" in _scanf implementation. 2020-08-24 17:16:37 +02:00
acqn 911a79796d Fixed checks and diagnostics on type-casting. 2020-08-24 17:16:37 +02:00
Jesse Rosenstock 23621f3299 Add test case for #1209
Change err/ tests to use cl65 and .prg instead of cc65 and .s
since this test only fails at the link stage.
2020-08-22 15:27:49 +02:00
acqn 0486d28abc Fixed Issue #327. 2020-08-22 13:44:18 +02:00
acqn 0536f4f9bd Minor fixes on constant expression checking and comments. 2020-08-21 23:27:41 +02:00
acqn 63256fd15d Changed negation of signed long stored in unsigned long to unsigned subtraction. 2020-08-21 23:16:17 +02:00
acqn f59c2a08d9 Added support for changing multiplications with certain negative multipliers into bit-shifts. Only enable certain kinds of signed mul replacements with shift according to the code size factor settings. 2020-08-21 23:16:17 +02:00
acqn ea7336591c Removed special-casing code for scaling up. Now it uses the normal multiplying code. 2020-08-21 23:16:17 +02:00
Greg King 75dc234988 Guarded the static_assert macro with a C standards test. 2020-08-21 15:15:19 -04:00
mrdudz 794adcc512 remove unneeded rule 2020-08-19 22:33:10 +02:00
mrdudz e6b8f4d715 move/fix bug264.c as suggested in issue #1122 2020-08-19 22:25:18 +02:00
mrdudz 1a92368aed rename bdiff.c to isequal.c, make it handle different line-endings as equal 2020-08-19 14:50:12 +02:00
Jesse Rosenstock 85e8a6cb9f Clarify docs that bss is zero-initialized
Addresses comment raised in #1202.
2020-08-19 13:24:15 +02:00
acqn 9fcde120aa Made function signatures in asm output use the parameter lists from original definitions instead of the composites. 2020-08-19 08:40:19 +02:00
Greg King 36dd82f0e6 Added g_branch() to cc65's code generator.
It uses BRA if the platform's CPU has BRA.  Else, it generates a JMP.

(Used it in the bitfield sign-extending code.)
2020-08-18 19:11:18 -04:00
mrdudz 0690a12ad2 change "the cc65 authors" to "The cc65 Authors" as per jmrs request 2020-08-18 22:41:42 +02:00
mrdudz 0c22d5011e added test related to pr #1190 2020-08-18 17:58:29 +02:00
mrdudz ab89c168de replace "Copyright 2020 Google LLC" by "Copyright 2020 the cc65 authors" 2020-08-18 17:47:35 +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
Jesse Rosenstock 55cebc7b9e Move bit-field adjustment to codegen.c
Extract functions g_testbitfield and g_extractbitfield from LoadExpr.

This helps prepare for #1192, since g_extractbitfield will get much
longer and call AddCodeLine.
2020-08-18 10:55:31 +02:00
acqn 56b659c0be Made char type a distinct type. 2020-08-18 10:48:38 +02:00
acqn 87889df9e9 Fixed type checking in relation operations. 2020-08-18 09:39:43 +02:00
mrdudz 2663561c62 added test related to pr #1135 2020-08-18 00:41:35 +02:00
mrdudz 6d8860b9de added test related to issue #1145 2020-08-18 00:41:07 +02:00
mrdudz cf41fccc0a added test related to issue #1143 2020-08-18 00:40:29 +02:00
acqn f206833a20 Alternative fix for Issue #1167. 2020-08-17 20:31:02 +02:00
acqn 0afa1a9a95 Fixed function signatures in asm output.
Improved full type name production.
2020-08-17 20:30:32 +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
Bob Andrews 531de44c95 Merge pull request #1193 from jmr/bitfield-union-bug
Add test of union of bit-field from mailing list
2020-08-17 14:33:51 +02:00
Jesse Rosenstock 6db93d58cf Add test of union of bit-field from mailing list
https://sourceforge.net/p/cc65/mailman/message/36152700/

This currently works, but add a test to prevent future regressions.
2020-08-17 09:54:31 +02:00
acqn 15f28c3a8c Fixed getting the basic raw type names. 2020-08-17 00:00:03 +02:00
acqn 11cd3e5cbd Utility for checking general datatype categories, incomplete ESU types and arrays of unknown sizes. 2020-08-17 00:00:03 +02:00
Jesse Rosenstock 7e61b11f23 Add _Static_assert docs to cc65 extensions
Fixes #1149.
2020-08-16 21:57:04 +02:00
Jesse Rosenstock 1cf9404c19 Support C2X _Static_assert(expr) syntax
This makes the message in _Static_assert(expr, message) optional.

Fixes #1188.
2020-08-16 11:38:20 +02:00
Jesse Rosenstock c4698dfd07 Use C89 semantics for integer conversions
Previously, the following rules were used for binary operators:
* If one of the values is a long, the result is long.
* If one of the values is unsigned, the result is also unsigned.
* Otherwise the result is an int.

C89 specifies the "usual arithmetic conversions" as:
* The integral promotions are performed on both operands.
* Then the following rules are applied:
  * If either operand has type unsigned long int, the other operand is
    converted to unsigned long int.
  * Otherwise, if one operand has type long int and the other has type
    unsigned int, if a long int can represent all values of an unsigned int,
    the operand of type unsigned int is converted to long int; if a long int
    cannot represent all the values of an unsigned int, both operands are
    converted to unsigned long int.
  * Otherwise, if either operand has type long int, the other operand is
    converted to long int.
  * Otherwise, if either operand has type unsigned int, the other operand is
    converted to unsigned int.
  * Otherwise, both operands have type int.
https://port70.net/~nsz/c/c89/c89-draft.html#3.2.1.5

As one example, these rules give a different result for an operator
with one long operand and one unsigned int operand.  Previously,
the result type was unsigned long.  With C89 semantics, it is just long,
since long can represent all unsigned ints.

Integral promotions convert types shorter than int to int (or unsigned int).
Both char and unsigned char are promoted to int since int can represent
all unsigned chars.
https://port70.net/~nsz/c/c89/c89-draft.html#3.2.1.1

Rename promoteint to ArithmeticConvert, since this is more accurate.

Fixes #170
2020-08-15 19:14:31 +02:00
mrdudz 8197e3c7cd make it actually compile again :) 2020-08-14 21:07:39 +02:00
mrdudz f0e4053a0d added test related to issue #1178 2020-08-14 19:58:58 +02:00
acqn 1d28e8e3de Improved test case for Issue #191. 2020-08-14 18:33:54 +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 44d52935da Utility for getting the composite types of functions. 2020-08-14 18:33:54 +02:00