1
0
mirror of https://github.com/cc65/cc65.git synced 2024-05-31 22:41:32 +00:00
Commit Graph

285 Commits

Author SHA1 Message Date
Jeff Tranter
2bf8be5b3b Fix some commonly made spelling errors in comments. 2022-02-21 15:44:31 -05:00
acqn
25a35d6b59 Fixed result type of certain operations, which was broken with the bit-field fix. 2021-06-10 21:54:32 +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
acqn
dcacba472a Moved ArithmeticConvert() from cc65/expr.c to cc65/datatype.c.
Reorganized a few functions in cc65/datatype.c.
Added SignedType() and UnsignedType() for future usage.
Made LimitExprValue() external so that it can be used more often.
2021-06-09 08:03:12 +02:00
acqn
1450f146a5 Fixed '[]', '()' '.' and '->' operators following a postfix increment/decrement. 2021-05-16 20:43:49 +02:00
acqn
dfba8d77ca Error messages shouldn't raise warnings about unused expressions by themselves. 2021-05-14 10:48:17 +02:00
mrdudz
18f94d1fe0 rework to use a magic value instead of a flag, as suggested by Oliver 2021-05-11 14:00:49 +02:00
mrdudz
c9f242e566 Extend #pragma wrapped-call to support "bank" argument 2021-05-05 14:42:29 +02:00
acqn
71bd6415d6 No more unnecessary jump-over labels generated for logical OR false cases. 2021-04-24 23:53:26 +02:00
acqn
9cea9ce5e2 Made the code more constness-correct with 'Type' usage. 2021-04-19 15:36:55 +02:00
acqn
24d36854d2 Minor cleanups with array element qualifiers. 2021-04-19 15:36:55 +02:00
acqn
bfb7c936aa Preparation for constness-correction. 2021-04-19 15:36:55 +02:00
acqn
6e61093e79 Fixed pointer subtraction in certain very rare cases. 2021-04-17 11:14:37 +02:00
acqn
bd8eae67f1 Fixed local struct field access via the address of the struct. 2021-04-05 15:49:54 +02:00
acqn
1a3628df1a Fixed the term 'argument' vs 'parameter' in function parser. 2021-04-03 17:50:46 +02:00
acqn
91fd30611a Fixed ICE on error cases such as '&func + int a'. 2021-04-03 17:45:52 +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
f273b1ebcb Fixed crash with non-inlined __fastcall__ function invocation with no arguments. 2021-03-26 11:02:46 +08:00
acqn
3755e4a863 Replaced checking for __fastcall__ aginst AutoCDecl etc. with IsFastcallFunc(). 2021-03-24 14:35:44 +08:00
acqn
3c2e7ce41c More reliable test for true/false with addresses for AND, OR and ternary operators.
Minor comment typo fix.
2021-03-20 01:39:32 +01:00
acqn
325b7b4ab3 Enabled 'a ? b, c : d'. 2021-03-20 00:09:47 +01:00
acqn
a51d6d40de Ternary fix for some obscure cases. 2021-03-20 00:09:47 +01:00
acqn
6974c1ff12 Fixed and cleaned up codegen logic with arithmetic conversion in addition and subtraction. 2021-03-19 16:35:03 +01:00
acqn
8eeaaa3f36 Made certain types of comparison between addresses in constant expressions work. 2021-03-16 22:29:20 +01:00
acqn
99c7fe0ada Reusing code from parseadd() for ArrayRef().
Now index[ptr] works in constant expressions.
Fixed codegen for cast type in constant expressions.
Calls on swapstk in 'i[ptr]' is avoided when possible.
2021-03-16 22:29:20 +01:00
acqn
f5972dfd08 Made int+pointer work in constant expressions.
Fixed codegen for cast type addition in constant expressions.
Calls on swapstk in 'i+ptr' is avoided when possible.
2021-03-16 22:29:20 +01:00
acqn
aa6fdf58b8 Addresses in constant subtraction expressions now work.
Fixed codegen for cast type subtraction in constant expressions.
2021-03-16 22:29:20 +01:00
acqn
3caceb8174 Fixed result type in certain contant expression addition cases. 2021-02-26 19:45:46 +01:00
acqn
f2eed38fc8 Fixed expression type of the result of numeric constant comparison. 2021-02-26 19:45:46 +01:00
acqn
ea0c634e12 Improved codegen for unsigned char type comparison with numeric constants. 2021-02-23 22:06:21 +01:00
acqn
d628772cd1 Fixed signed char type comparison with unsigned numeric constants. 2021-02-23 22:06:21 +01:00
acqn
f1c715c455 Fixed a bug that pointer subtraction results from two absolute addresses are calculated as unsigned long. 2021-02-22 14:14:59 -05:00
acqn
81d6321cd7 Fixed internal representation of calculated constant results.
Minor clean-up.
2021-02-22 14:14:59 -05:00
acqn
eadaf2fef8 Fixed deferred post-inc and post-dec in unevaluated context such as 'sizeof(i++)'. 2021-02-22 11:02:47 +01:00
acqn
bfc7a51a44 Fixed Issue #1265 according to C89/C99 standards. 2021-01-30 14:31:51 +01:00
Greg King
8b42f570e9 Fixed code that caused a seg-fault after parsing a (deferred) post-count argument followed by a (nested) function-call argument.
The old broken code defers the count until the end of the (parent function's) argument list.  But, a nested function call clears the pointer to the deferred type.  That leads to an access violation.
The new code defers only until the end of each argument.  Fixes #1320.
2020-11-20 17:45:14 -05:00
Polluks
bd6e5927c4 Fixed #1341 2020-11-18 10:28:19 +01:00
Jesse Rosenstock
060417b0dc Adjust type of int constants that fit in char
When there is an integral constant like `3` in an expression, it has
type `int` according to the C spec, even though it can be represented
as an `unsigned char`.  Change codegen (`hie_internal` and `typeadjust`)
to treat it as `unsigned char` instead of `int` so that faster,
unsigned operations can be used.

For the test case in #1298, reduces the cycles per iteration from
4311 to 1884.  This is a great improvement, but still much worse than
the 1053 cycles/iter from `c4698df~`, so more work remains to be done.

Further partial fix for #1298 and #1308.
2020-11-16 00:56:19 +01:00
acqn
5c43d1e04f Changed codegen for postfix inc/dec operations by deferring them till sequence points.
This usually allows faster & smaller code.
Note that deferred operations must still be called at sequence points even if the whole expressions containing them had constant values.
2020-10-20 22:01:55 +02:00
acqn
86ced2bd4c Avoided unnecessarily boosting the code label numbers with boolean AND. 2020-09-18 08:59:56 +02:00
acqn
ab7e9f8424 Hotfix for Issue #1250. 2020-09-08 16:28:21 +02:00
acqn
e2f950b15e Avoided referencing string literals with sizeof so that they are not output if unused elsewhere. 2020-09-05 13:21:21 +02:00
acqn
903e84c24c Std-functions are no longer inlined if they are unevaluated. 2020-09-05 13:21:21 +02:00
acqn
f849de6769 Object addresses as non-NULL for comparison with NULL. 2020-09-04 19:50:32 +02:00
acqn
8e0b2f0833 Object addresses as non-NULL in boolean context. 2020-09-04 19:50:32 +02:00
acqn
bc5570b708 Fixed logical-NOT in constant context. 2020-09-04 19:50:32 +02:00
acqn
fb6bc275bc Fixed evaluation flags propagation to subexpressions in assignments and function calls. 2020-09-02 21:36:59 +02:00
acqn
2379504449 Fixed AND/OR in certain cases where the 'E_NEED_TEST' flag set for usage only in subexpressions should be cleared. 2020-09-02 21:36:59 +02:00
acqn
28de3423eb Merged some switch cases in code generation subroutines. 2020-08-31 09:12:03 +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