1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-10 13:29:50 +00:00
Commit Graph

84 Commits

Author SHA1 Message Date
acqn
8e62cbf092 Improved checks on function return types. 2023-09-13 22:26:41 +08:00
Bob Andrews
401bcaa5ff
Merge pull request #2237 from acqn/CGType
[cc65] Renamed type facility functions for deciding code generation type flags
2023-10-26 19:50:10 +02:00
acqn
20c3e994c6 Fixed compiling with pragmas in the middle of declarations or statements. 2023-10-04 21:22:04 +08:00
acqn
5fd9169904 Renamed type facility functions for deciding code generation type flags. 2022-10-12 13:10:17 +08:00
acqn
2324bd62f6 If __A__,__AX__ or __EAX__ is used, post-inc/dec within the same statement will not modify it.
Moved testcase from src/test/todo to src/test/val plus minor improvement on portability.
2021-06-08 14:16:14 +08:00
acqn
40b26f4060 Now the compiler removes code that has no observable effect. 2021-02-22 13:47:32 +08:00
acqn
7f05bd797f Now the compiler tracks code that has no observable effect. 2021-02-21 16:36:29 +08:00
acqn
43ca887263 Fixed 'case'/'default' labels in non-compound 'switch' body statement. 2021-05-16 20:43:49 +02:00
Dirk Lehmann
eb1cf750f2 -W-unreachable-code option added, alphabetic order of --list-warnings 2021-04-13 09:37:55 +02: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
Oliver Schmidt
bee559d5f4
Merge pull request #1220 from acqn/StaticConst
[cc65] Fixed constant boolean expressions
2020-08-31 08:59:25 +02:00
acqn
0a96ffc878 Fixed function parameter checking.
Fixed function return type checking.
2020-08-29 16:37:16 +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
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
Greg King
fd0a6955da Changed "IsTypeStruct() || IsTypeUnion()" expressions into shorter "IsClassStruct()" expressions.
Type-classes are groups of types that can be handled in the same way (similar syntax).
2020-07-19 14:30:22 -04: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
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
02a914625b Formatting fixes. 2018-10-02 18:49:53 +02:00
laubzega
6ad79067ac Fix a warning. 2018-10-02 18:49:53 +02:00
laubzega
c797b3b376 Proper warnings for "risky" gotos. 2018-10-02 18:49:53 +02:00
Laubzega
a4b6bb63c0 Minor changes after review. 2018-10-02 18:49:53 +02:00
Laubzega
581c46c213 Add checks for risky goto statements. 2018-10-02 18:49:53 +02:00
Greg King
1aab287189 Fixed the handling of "while (0) {}".
It's a corner case; but, conditional macroes might create it -- better safe than sorry.
2017-04-07 09:26:58 -04: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
212941ddb4 Fix consecutive false errors when a label without a following statement is
encountered.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4894 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-12-30 19:30:54 +00:00
uz
e048d2aeba Make the warning "statement has no effect" switchable.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4823 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-10-02 19:32:11 +00:00
uz
48c647b6bd Added while loop inversion.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4642 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-04-17 15:19:35 +00:00
uz
85f96a7d6f Fixed warnings generated by clang (run by Per Olofsson).
git-svn-id: svn://svn.cc65.org/cc65/trunk@4255 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-28 15:59:18 +00:00
uz
32e2eb3fad Fixed parsing a labeled-statement: A label is always part of a statement, it
is not itself one.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4166 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-13 14:36:16 +00:00
uz
84710f7227 Remember more function infos in the Function struct.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4104 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-31 20:37:54 +00:00
uz
0a9c7484ad Add a warning if a function returning something does not contain a return
statement.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4095 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-31 13:18:49 +00:00
cuz
357118697d A label must always be followed by a statement. Check for this.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3860 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-01 20:00:23 +00:00
cuz
64ec376140 Switch statement may now contain arbitrary code as the standard requires. The
compiler will now accept stuff like Duffs device.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3859 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-01 19:44:01 +00:00
cuz
9df7321d90 Cleanup in ShiftExpr.
Changed GetCodePos to also remember the stack pointer at the given location,
this removes the necessity to manipulate the stack when removing code. Since
CodeMark is now a struct, the API for most asmcode functions has changed.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3145 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-07-06 11:30:08 +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
eb388aa237 The loop code will access the stackpointer directly
git-svn-id: svn://svn.cc65.org/cc65/trunk@3106 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-06 10:52:32 +00:00
cuz
08eb9b7b0e Check for and warn on statements that don't have an effect
git-svn-id: svn://svn.cc65.org/cc65/trunk@3097 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-05 12:56:51 +00:00
cuz
104ae3a54f Move the compiler stack pointer into its own module.
Improved the inlining of standard C functions. Added more standard functions
to inline.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3095 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-05 11:35:53 +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
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
e47ed98aa7 Move the expression test code into separate modules.
The Test() and TestInParens() functions do now return information about the
expression that was tested.
An if... statement where the expression is always true will now print a
warning "Unreachable code" if it has an else clause.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2889 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-02 18:00:08 +00:00
cuz
cb8c3746f5 A continue statement within a do loop did not work. Cleaned up the loop
code a little bit.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2722 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-12-09 16:29:59 +00:00
cuz
d4bd299b5c Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@2459 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-09-30 14:40:32 +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
c8d76046cb Added better error recovery
git-svn-id: svn://svn.cc65.org/cc65/trunk@2013 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-03-13 12:35:54 +00:00