Commit Graph

39 Commits

Author SHA1 Message Date
Bob Andrews 6b0afe0834
Merge pull request #1785 from acqn/Effectless
[cc65] Avoid generating asm from C code that has no observable effects
2022-07-19 17:38:03 +02:00
acqn e9545d68ee Minor clean-ups and typo fixes. 2021-04-17 11:43:03 +08:00
acqn 7f05bd797f Now the compiler tracks code that has no observable effect. 2021-02-21 16:36:29 +08:00
acqn 2d96f79bc7 Added and used new utility type functions for bit-fields.
Fixed GetUnderlyingTypeCode() for bit-fields with widths > 16.
2021-12-01 09:45:17 +08: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 9cea9ce5e2 Made the code more constness-correct with 'Type' usage. 2021-04-19 15:36:55 +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 2aad72af90 Removed trailing whitespaces. 2021-03-03 10:07:24 +01:00
acqn fb6bc275bc Fixed evaluation flags propagation to subexpressions in assignments and function calls. 2020-09-02 21:36:59 +02:00
acqn 504aee3835
Merge branch 'master' into StaticConst 2020-08-27 06:27:23 +08:00
acqn 8d225c32b1 Fixed checks on assignment to incomplete types. 2020-08-26 22:14:51 +02:00
acqn c3a6b39945 Made struct assignment less hackish. 2020-08-24 18:02:29 +02: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 0dfe9ff5fe Fixed testing 'struct->field'. 2020-08-14 08:32:22 +08:00
acqn 0fa18886c0 Fixed copying structs/unions > 4 bytes. 2020-08-13 08:59:05 +02:00
acqn 0d53806490 Avoided excess errors in incomplete struct assignment. 2020-08-12 15:01:31 +02:00
acqn 6df4f1996b Improved diagnostics with more detailed type names. 2020-08-02 23:51:11 +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 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
acqn 9f67b45ea0 Fixed returning by value structs/unions <= 4 bytes in size from functions. Larger ones are forbidden for now. 2020-07-19 10:58:33 +02:00
acqn 2108489523 Fix for Issue #1075 and #1077. 2020-07-18 12:54:29 +02:00
Greg King 0390c34e88 Changed multi-line C comments into another style.
The left side doesn't look unbalanced.
2014-06-30 16:51:07 -04:00
Oliver Schmidt 4185caf855 Normalized code. 2014-03-04 01:11:19 +01:00
Oliver Schmidt 85885001b1 Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
uz 84e288f21c Use the new function MarkedExprWithCheck.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4136 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-08 19:49:30 +00:00
uz f5ca779b9b A constant right side does not necessarily mean that no code is generated for
the right side. The expression may have had side effects. This error is also
found in several other places.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4129 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-07 14:22:27 +00:00
uz dc678e8dcb Improved the code generated for bit-fields.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4096 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-31 14:59:49 +00:00
uz 45d4771584 For bit fields contained within single bytes, try to do character operations
instead of word sized ops.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4089 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-30 09:01:04 +00:00
uz 6b4fe90928 First implementation of bit fields.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4079 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-29 21:20:13 +00:00
uz 1b29b536f3 Fixed a bug: Structure assignment was broken.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3884 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-08 16:47:43 +00:00
cuz de3a20a898 Changed the low level type representation from a strung of unsigned short
elements to a string of structs, each representing one type element. This
should fix problems on unusual architectures, since it is no longer necessary
to embedd pointers and other data converted to numbers in the string of
unsigned shorts.
Increased the TypeCode length to unsigned long to make room for more type
bits.
Inline more functions in datatype.h.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3709 b7a2c559-68d2-44c3-8de9-860c34a00d81
2006-02-19 12:29:37 +00:00
cuz 8752f0b2c1 Removed ExprLoad to LoadExpr.
Moved LoadExpr + support functions into a separate module.
Removed obsolete files.
Some cleanup and makefile adjustments.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3113 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-09 14:12:57 +00:00
cuz 8d8162eb23 Rewrite/cleanup of the complete expression flags handling.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3056 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-31 15:27:33 +00:00
cuz 2cdef2d58f Add standard names for library functions
git-svn-id: svn://svn.cc65.org/cc65/trunk@3047 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-26 13:42:19 +00:00
cuz 878e4f1352 Changed the expression parser to return the lvalue flag as part of the
ExprDesc structure, not as separate value.
WARNING: The current code does compile but does not work correctly, because
the lvalue flag is part of ExprDesc.Flags and not masked out in several tests
throughout the code.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3046 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-25 20:59:38 +00:00
cuz 14fc5c1073 Renamed exprhs to ExprLoad
git-svn-id: svn://svn.cc65.org/cc65/trunk@2426 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-29 09:16:28 +00:00
cuz 81f94afd5c Rewrote type conversions
git-svn-id: svn://svn.cc65.org/cc65/trunk@2262 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-11 20:18:30 +00:00
cuz 8810e38bb7 Move the assignment parser into a separate module.
When assigning structures, copy them using the primary register when the
size is 1, 2, or 4.
When assigning structures, allow structures by value when the size is 1,
2, or 4. These structures are expected to be in the primary register. The
only case when this can happen is by return from function, so this change
makes div() work.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1477 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-01 21:27:31 +00:00