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

305 Commits

Author SHA1 Message Date
uz
17d592352c Fixed an error with r4329: In case of a struct pointer the qualifiers of the
pointers had been used, not the qualifiers of the struct.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4340 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-08 09:54:46 +00:00
uz
9c5224165f Fixed a bug: A similar problem as that with structs does also exist for
arrays. An array element has all qualifiers from itself and from the array
declaration.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4334 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-05 18:46:39 +00:00
uz
7992bfb74a Changed solution for r4329 so that it uses less memory.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4331 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-05 18:22:28 +00:00
uz
c69e2d9f0f Fixed a bug: Function designators are converted to rvalues of type "pointer to
function", so dereferencing a function is a legal operation. The result is
immediately converted back to "pointer to function" again. Note: Because of
performance considerations, cc65 does treat functions as "pointer to function"
internally, but nevertheless dereferencing a function must be possible.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4330 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-05 17:49:45 +00:00
uz
43c89d5fd0 Fixed a bug: A struct field has all qualifiers from its definition plus the
qualifiers of the struct.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4329 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-05 17:37:45 +00:00
uz
8e35f0d9c8 The combined assignment operator (-=, +=, ...) did not check that the rhs is
actually an integer.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4297 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-01 19:41:40 +00:00
uz
b5db4cd5fa Added wide char literals, but treat them identical as normal strings.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4185 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-18 14:28:52 +00:00
uz
e68332a10b Fixed several more problems like the one in Assignment() some time ago: An
expression that yields a constant value may have side effects, and the
expression code must not be removed in this case.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4138 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-08 20:29:12 +00:00
uz
2d3b0f1146 Fixed a problem similar to the one in Assignment() some time ago: An
expression that yields a constant value may have side effects, and the
expression code must not be removed in this case.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4137 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-08 20:08:21 +00:00
uz
0c20177fce Allow to store start and end of generated code in the ExprDesc structure. New
function MarkedExprWithCheck.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4135 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-08 19:48:22 +00:00
uz
94a2223443 Use SymIsTypeDef and SymIsBitField instead of accessing Sym->Flags directly.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4123 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-06 16:51:08 +00:00
uz
944057238e Simplify code generated for the ?: operator when type conversion code for the
second operand is necessary. Instead of generating interleaved code with
several jumps, just move the code to the right place.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4105 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-01 08:57:36 +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
bd872a6324 Added code to parse bit fields and enter them into the symbol table. They're
not supported in code generation until now.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4072 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-29 17:38:53 +00:00
uz
c214fa6395 When preprocessing, all compares evaluate to constants, so don't print a
warning in this case.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4059 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-27 22:09:46 +00:00
uz
d65928829f Added a warning if the result of a compare operation is constant. This should
protect against missing parenthesis like in (si & 0x7F == 0). Hopefully
without too many false positives.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4057 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-27 22:00:18 +00:00
uz
a3eed9016f Fix problem with R3904: Chars on the lhs of opeq must still be accessed as
such.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3985 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-07-30 15:15:13 +00:00
uz
37157a31a8 Fixed problems with R3977: While the solution was correct, the generated code
is bad, since information is lost when converting functions and arrays to
pointers and cannot be regained easily. So I've reverted the change and fixed
the problem in a less general manner.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3984 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-07-30 14:45:50 +00:00
uz
4dd9c523e7 Check for division by/modulo by zero when parsing the /= and %= operators.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3937 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-17 21:09:59 +00:00
uz
c4dac550a8 Small change to avoid endless error loops (aborted by the maximum error count)
if an unexpected token is encountered in Primary().


git-svn-id: svn://svn.cc65.org/cc65/trunk@3936 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-17 20:56:13 +00:00
uz
308ceeacf9 Fixed problems with casts, where larger values weren't truncated when casting
down to char size.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3904 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-12-28 16:25:03 +00:00
uz
cc36f8a93a Moved the fascall and near/far flags from the function desriptor into the
type. Started to add general handling of address size flags in types.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3891 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-24 17:33:30 +00:00
uz
0b60ac4716 Use GlobalModeFlags() if apropriate.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3885 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-09 20:33:11 +00:00
uz
1e672a3169 Fixed a bug: The op= operators (+=, -=, etc.) worked on const qualified
objects.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3883 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-07 22:22:58 +00:00
uz
66b3f9d974 Fixed a bug: It was possible to increment or decrement const qualified
objects.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3882 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-07 22:18:12 +00:00
uz
5cd0b86a1a Indexing a string by an expression which was not a simple variable didn't
work:  "abcd"[atoi("2")];
                         


git-svn-id: svn://svn.cc65.org/cc65/trunk@3880 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-05 21:20:42 +00:00
uz
9127774a4d Pass a complete ExprDesc and not just the Flags field to GlobalModeFlags to
allow for better debugging (output) in case of problems.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3879 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-05 21:11:26 +00:00
uz
dbb9a31fd9 Fixed wrong code generation for
((unsigned char *)(&shadow))[reg & 0x0f] = value;


git-svn-id: svn://svn.cc65.org/cc65/trunk@3875 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-05 19:47:57 +00:00
uz
3482a9e7ce Fixed a comment
git-svn-id: svn://svn.cc65.org/cc65/trunk@3868 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-03 20:09:03 +00:00
cuz
52c0c284da Calling an undefined function is an error in C99.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3857 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-07-31 18:30:33 +00:00
cuz
10c949062b Fixed a bug: The compiler evaluated constant expressions internally always
using signed integers as data types. This led to wrong results for mod, div
and compares.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3797 b7a2c559-68d2-44c3-8de9-860c34a00d81
2007-08-26 18:53:46 +00:00
cuz
80a4c8c02b Fix type of "&array" - it will actually generate pointer to array, not pointer
to element. This will make some valid code work but emits now errors for
questionable code.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3775 b7a2c559-68d2-44c3-8de9-860c34a00d81
2007-03-18 19:15:35 +00:00
cuz
9601baf6ec Fixed internal compiler error on invalid input code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3768 b7a2c559-68d2-44c3-8de9-860c34a00d81
2007-02-03 18:11:37 +00:00
cuz
eb745b3d1b Fixed a problem with undefined identifiers in #if expressions: If the
identifier is not the last token on the line, the compiler will run into
an error.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3744 b7a2c559-68d2-44c3-8de9-860c34a00d81
2006-05-29 20:38:44 +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
64921852dd Parse the C99 "restrict" keyword correctly (but ignore it otherwise).
git-svn-id: svn://svn.cc65.org/cc65/trunk@3706 b7a2c559-68d2-44c3-8de9-860c34a00d81
2006-02-17 20:19:35 +00:00
cuz
e4ec9014d2 Reversed accidentally checked in changes
git-svn-id: svn://svn.cc65.org/cc65/trunk@3613 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-08-31 21:49:12 +00:00
cuz
d6c50c1826 Added HuC6280 cpu (will be treated as a 65C02)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3612 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-08-31 21:48:08 +00:00
cuz
c218639977 Fixed a bug: The compiler aborted with an internal error if a non function
was called as a function after printing the diagnostic.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3526 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-07-17 09:49:34 +00:00
cuz
b01c0cf2b7 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@3511 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-05-11 13:54:22 +00:00
cuz
e06d9d0d84 Fixed a bug (hopefully).
The ArrayRef() does really need a rewrite, now since we have better
expression info.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3364 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-01-09 21:17:19 +00:00
cuz
40d01eb4ce Fixed bug with braces in initializer lists
git-svn-id: svn://svn.cc65.org/cc65/trunk@3193 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-09-23 17:34:03 +00:00
cuz
366d066375 Fixed the last fix
git-svn-id: svn://svn.cc65.org/cc65/trunk@3171 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-08-02 17:19:52 +00:00
cuz
123677c802 In a function call for all parameters not covered by a prototype, convert
arrays to pointer to first element, and functions to pointer to function.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3169 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-08-02 16:39:55 +00:00
cuz
104f041111 Add dummy return value to avoid a wcc warning
git-svn-id: svn://svn.cc65.org/cc65/trunk@3162 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-07-17 22:16:02 +00:00
cuz
0ba074995c Check for invalid function names before trying to compare the name against
the names of known standard functions.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3154 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-07-11 13:47:57 +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
e354d269f6 Remove shifts from kcalc
git-svn-id: svn://svn.cc65.org/cc65/trunk@3139 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-29 20:44:50 +00:00
cuz
809d1408ce Move shift expression evaluation into a separate module. More checks and
improvements for shift expressions.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3138 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-29 20:44:01 +00:00
cuz
daf8e0d1e6 Added license information preproc.h
git-svn-id: svn://svn.cc65.org/cc65/trunk@3135 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-29 20:26:27 +00:00
cuz
d8279302a9 Make the -O and --codesize options stackable.
Copy the current optimization settings into a code segment on creation.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3129 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-15 20:29:49 +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
8425d988fe Removed debug code
git-svn-id: svn://svn.cc65.org/cc65/trunk@3110 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-06 18:36:15 +00:00
cuz
f500a641c5 Added support for floating point constants in the scanner and Primary()
git-svn-id: svn://svn.cc65.org/cc65/trunk@3108 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-06 15:59:44 +00:00
cuz
9fc71c5e93 Renamed ExprDesc.Val to ExprDesc.IVal. Added an FVal field for a floating
point constant.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3107 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-06 14:48:59 +00:00
cuz
5586527fcc Move the test flags into the Flags bitset of struct ExprDesc
git-svn-id: svn://svn.cc65.org/cc65/trunk@3101 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-05 20:29:47 +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
87d0d88986 Check the InlineStdFuncs flag later
git-svn-id: svn://svn.cc65.org/cc65/trunk@3086 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-04 14:37:50 +00:00
cuz
8c4b3599a2 Fixed a typo
git-svn-id: svn://svn.cc65.org/cc65/trunk@3073 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-03 12:09:24 +00:00
cuz
2fa9b6e5ac Improved code generation
git-svn-id: svn://svn.cc65.org/cc65/trunk@3072 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-03 12:08:49 +00:00
cuz
01104d26ea Fixed generation of non optimal code in StructRef()
git-svn-id: svn://svn.cc65.org/cc65/trunk@3071 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-03 11:10:30 +00:00
cuz
6e34e386cb Rewrote code generation for the strlen standard function. Added code for
other standard functions in several places.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3069 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-02 21:33:35 +00:00
cuz
111c69a826 String literals can be handled as static data in most cases
git-svn-id: svn://svn.cc65.org/cc65/trunk@3062 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-31 19:51:13 +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
fedb566ff1 Some renaming and restructuring
git-svn-id: svn://svn.cc65.org/cc65/trunk@3050 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-26 16:15:28 +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
89fc8f3df7 Fixed a bug: The volatile keyword was not accepted in type casts or as
argument to the sizeof operator, if the type spec is starting with this
keyword.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2921 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-13 22:37:13 +00:00
cuz
d0ea9f34b6 Made several options that can be changed by #pragmas stackable.
Added new #pragma regvars.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2902 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-07 21:53:35 +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
f4e5baa444 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@2437 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-09-14 11:12:27 +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
7989e202a6 Fixed a type conversion bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@2419 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-27 19:40:40 +00:00
cuz
aef8789873 Fixed several type conversion issues
git-svn-id: svn://svn.cc65.org/cc65/trunk@2380 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-20 08:32:07 +00:00
cuz
e20bda21b3 Fixed type conversion problems
git-svn-id: svn://svn.cc65.org/cc65/trunk@2371 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-19 20:31:10 +00:00
cuz
a70d466e3e Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@2351 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-17 15:20:18 +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
73dfa23c98 Fixed a bug that caused problems locating the last parameter of a function
git-svn-id: svn://svn.cc65.org/cc65/trunk@2259 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-10 17:05:18 +00:00
cuz
d5b3ff4bca Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@2234 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-07-26 07:31:15 +00:00
cuz
8b3ab210be Fixed a bug in character literal handling
git-svn-id: svn://svn.cc65.org/cc65/trunk@2029 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-03-17 20:18:58 +00:00
cuz
c008e555b2 Fixed a bug in sign extension of constant values
git-svn-id: svn://svn.cc65.org/cc65/trunk@1998 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-03-04 10:46:27 +00:00
cuz
c5868d30c0 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1922 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-02-02 21:05:39 +00:00
cuz
abcc981253 Move the Debug flag into a new module "debugflag" in the common directory.
Remove the const qualifier from the argument of xfree().


git-svn-id: svn://svn.cc65.org/cc65/trunk@1877 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-01-04 16:59:51 +00:00
cuz
ed2bb59bcb Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1862 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-12-29 21:23:28 +00:00
cuz
4e2110a7a9 Fixed the inlined strlen function
git-svn-id: svn://svn.cc65.org/cc65/trunk@1738 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-12-12 17:40:58 +00:00
cuz
ede471904c Reenable register variables
git-svn-id: svn://svn.cc65.org/cc65/trunk@1625 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-24 23:31:54 +00:00
cuz
b6898c3f1e Check register before static
git-svn-id: svn://svn.cc65.org/cc65/trunk@1624 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-24 21:07:39 +00:00
cuz
89f00263af Fixed a problem with the test expression in a for loop: It was not evaluated
correctly if it did not contain an explicit comparison operator.
Removed an old hack from the test subroutine that did no longer work.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1619 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-24 18:18:16 +00:00
cuz
ca1386e9d4 Removed unused code
git-svn-id: svn://svn.cc65.org/cc65/trunk@1522 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-14 22:52:29 +00:00
cuz
dadd136ae1 Use constants for datatype sizes
git-svn-id: svn://svn.cc65.org/cc65/trunk@1480 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-02 12:39:10 +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
cuz
5548b6fd56 Work on better type casts - not yet finished
git-svn-id: svn://svn.cc65.org/cc65/trunk@1476 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-01 15:16:16 +00:00
cuz
4389b0c438 Fixed a small bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1426 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-10-03 09:00:57 +00:00
cuz
257005696f Improve type casts for ints.
Allow the second and third operand of the :? operator to be of type int.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1395 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-09-18 20:14:51 +00:00
cuz
8d8458032d Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1371 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-07-26 19:27:55 +00:00
cuz
02c26efdd3 Replace calls to memset with _bzero if the fill value is zero and -Oi in
effect.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1359 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-07-16 11:01:51 +00:00
cuz
7c9bf720d8 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1350 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-07-12 08:45:42 +00:00
cuz
f93eb903ba Fixed/worked around a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1343 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-07-10 21:04:02 +00:00
cuz
a96da498f5 Renamed the functions working with "struct Function".
Fixed a problem with K&R functions: In a function with no return type
specified, the compiler did not allow a simple "return" statement. However,
there was no "void" type at that time, so it was not possible to specify
something else. The solution is to allow omission of a return value in a
K&R function with an implicit int type. Other types or an explicit int is
still checked.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1302 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-06-12 12:12:04 +00:00
cuz
21afe25e90 Indirect fastcall functions with no parameters may be called as if it were
cdecl functions, this generates better code.
Remove a small error that caused indirect non fastcall function to always be
handled as variadic, which meant a useless load of the Y register was added.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1292 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-05-26 11:08:17 +00:00
cuz
3292569a89 One less bug in sizeof ("ABC").
git-svn-id: svn://svn.cc65.org/cc65/trunk@1274 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-05-16 17:05:36 +00:00
cuz
c6fe12ef6b Fixed a code generation bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1215 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-04-06 14:51:27 +00:00
cuz
83e73742c8 Prepare for separate ASM name in symbol table entry
git-svn-id: svn://svn.cc65.org/cc65/trunk@1202 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-03-18 20:04:03 +00:00
cuz
0355c34199 Fixed problems with incomplete types (structs and arrays) that could cause
internal compiler errors in several places.
An old cc65 extension (variables of type void) was broken and did no longer
work. Fixed that.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1184 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-03-10 20:44:58 +00:00
cuz
3d838849da Fixed an error in struct assignment
git-svn-id: svn://svn.cc65.org/cc65/trunk@1169 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-03-06 07:56:33 +00:00
cuz
0a4799c975 Fixed several const related bugs
git-svn-id: svn://svn.cc65.org/cc65/trunk@1165 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-03-06 06:38:48 +00:00
cuz
3b5808788b Add #pragma charmap()
Cosmetical changes.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1162 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-02-18 08:40:11 +00:00
cuz
940fba4d54 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1105 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-11-07 10:32:51 +00:00
cuz
e17ab75ab3 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@1023 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-10-11 09:52:02 +00:00
cuz
c8415fc17c More source splitting.
Remove the -Wno-unused-parameter in favour of __atribute__((unused)).


git-svn-id: svn://svn.cc65.org/cc65/trunk@986 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-30 21:56:45 +00:00
cuz
5d0a52b7ac Finished indirect function calls.
Debugged zero page location tracking.


git-svn-id: svn://svn.cc65.org/cc65/trunk@968 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-25 10:30:48 +00:00
cuz
f4fbbc3dcc Track usage of the sreg and several other zero page registers and remove
unused stores into these registers.
Because of this, the old code using regsave does no longer work. Started
to rewrite it.


git-svn-id: svn://svn.cc65.org/cc65/trunk@966 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-24 22:36:35 +00:00
cuz
8f057fd84d Fixed a few warnings
git-svn-id: svn://svn.cc65.org/cc65/trunk@936 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-15 12:13:33 +00:00
cuz
c322febd66 Cosmetic change
git-svn-id: svn://svn.cc65.org/cc65/trunk@896 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-12 18:20:42 +00:00
cuz
23fbf3ff2a Adding functionality to StrBuf
git-svn-id: svn://svn.cc65.org/cc65/trunk@885 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-09 20:49:20 +00:00
cuz
56b8ead112 Move inline asm parsing into a separate module
git-svn-id: svn://svn.cc65.org/cc65/trunk@880 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-09 09:33:06 +00:00
cuz
d799cc283f Add special routines for processing the boolean || and && operators in
preprocessor mode to work around limitations in the existing ones (constant
expressions are not detected).


git-svn-id: svn://svn.cc65.org/cc65/trunk@864 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-08 13:59:32 +00:00
cuz
254948fcfe Minor changes
git-svn-id: svn://svn.cc65.org/cc65/trunk@835 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-08-03 06:45:30 +00:00
cuz
f249ae345e More renaming. Remove the case label limit by using a collection to store
the switch entries.


git-svn-id: svn://svn.cc65.org/cc65/trunk@807 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-07-17 21:53:17 +00:00
cuz
c571214513 More renaming
git-svn-id: svn://svn.cc65.org/cc65/trunk@806 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-07-17 21:29:21 +00:00
cuz
cc83744882 Renamed struct expent
git-svn-id: svn://svn.cc65.org/cc65/trunk@805 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-07-17 21:24:19 +00:00
cuz
84f85293f1 Fixed more E_MCONST issues
git-svn-id: svn://svn.cc65.org/cc65/trunk@758 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-24 18:26:20 +00:00
cuz
b0324b6041 Bugfix
git-svn-id: svn://svn.cc65.org/cc65/trunk@757 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-24 09:16:11 +00:00
cuz
3a272d93af More polishing to get the line info right
git-svn-id: svn://svn.cc65.org/cc65/trunk@742 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-22 16:54:47 +00:00
cuz
0e80187cec Added the lineinfo module. Changed the complete code generation to use the
supplied data structures. Re-added the -T option which is much more exact
now because of the better line info stuff.
Cleanups in the scanner (remove old #defines).


git-svn-id: svn://svn.cc65.org/cc65/trunk@740 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-22 09:32:24 +00:00
cuz
c1b6680a92 Working
git-svn-id: svn://svn.cc65.org/cc65/trunk@737 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-21 06:43:46 +00:00
cuz
a961f00997 Several bug fixes
git-svn-id: svn://svn.cc65.org/cc65/trunk@720 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-07 22:07:59 +00:00
cuz
8a3bacd7f4 Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@707 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-03 20:16:41 +00:00
cuz
239cbdcb2b Working on the backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@702 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-01 16:57:43 +00:00
cuz
9d1940a124 Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@700 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-01 09:21:32 +00:00
cuz
9cb63b679c Renamed GetLabel to GetLocalLabel
git-svn-id: svn://svn.cc65.org/cc65/trunk@692 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-04-19 06:49:08 +00:00
cuz
67aed641db Fixed an internal error on too few params in function call
git-svn-id: svn://svn.cc65.org/cc65/trunk@685 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-04-04 20:20:48 +00:00
cuz
2eab65ad24 Remove the hardcoded limit from the literal pool.
git-svn-id: svn://svn.cc65.org/cc65/trunk@678 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-26 21:57:07 +00:00
cuz
2fead58243 Allow a more exact specification which growth factor is allowed when
generating code and favouring speed over size.


git-svn-id: svn://svn.cc65.org/cc65/trunk@668 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-24 23:33:38 +00:00
cuz
c18453ebcb Inline parameter frame building
git-svn-id: svn://svn.cc65.org/cc65/trunk@661 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-24 13:00:16 +00:00
cuz
59bcc726b6 Make AddConstSym from AddEnumSym
git-svn-id: svn://svn.cc65.org/cc65/trunk@660 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-23 21:27:48 +00:00
cuz
544705e6f4 * Added several type casts to increase C++ compatibility.
* __fixargs__ is now an actual function symbol and no longer handled in the
   scanner.
 * Additional symbol __argsize__ that is a constant in normal functions and
   a const local variable for variadic functions. Using this symbol, the
   va_arg macro gets a lot simpler and smaller.
 * Added special code to handle the fixed parameters of a variadic function.
   The code has some overhead, but the va_fix macro is no longer needed (and
   the compiler generated code is better than va_fix anyway).


git-svn-id: svn://svn.cc65.org/cc65/trunk@652 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-23 19:17:04 +00:00
cuz
594a941ee9 Make __fixargs__ an actual symbol table entry. Add a new pseudo variable
__argsize__.


git-svn-id: svn://svn.cc65.org/cc65/trunk@646 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-23 10:16:50 +00:00
cuz
00706daa49 Fix a compiler crash that happens after a function definition with two or
more identical parameter names. The input is of course wrong, but the
compiler shouldn't crash.


git-svn-id: svn://svn.cc65.org/cc65/trunk@644 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-22 20:54:52 +00:00
cuz
4d34ce83d7 Remove unused flags
git-svn-id: svn://svn.cc65.org/cc65/trunk@577 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-12-09 21:09:52 +00:00
cuz
0ab45f63f0 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@550 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-12-04 21:01:50 +00:00
cuz
f6768466be Fix several errors: The address operator on functions (resulting in a
pointer-to-function type) was not possible. It is redundant but allowed.
A cast with a function on the right side resulted in an internal compiler
error, since the implicit cast from function to pointer-to-function was
missing in this case.
An assignment of a function to a void pointer was not possible because the
same implicit conversion was missing.


git-svn-id: svn://svn.cc65.org/cc65/trunk@482 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-11-24 10:46:04 +00:00
cuz
0333dbbd85 Fixed a typo
git-svn-id: svn://svn.cc65.org/cc65/trunk@481 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-11-24 07:36:08 +00:00
cuz
d341e0ad76 Removed error numbers in favour of literal error messages. The error numbers
were harder to manage, made the code harder to read, and lead no less
verbose messages, since it was effort to add a new message. The new approach
has the drawback that it's more difficult to translate, but this won't
happen anyway.


git-svn-id: svn://svn.cc65.org/cc65/trunk@428 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-11-02 21:22:33 +00:00
cuz
221ef5a9c2 Error handling cleanup/changes.
git-svn-id: svn://svn.cc65.org/cc65/trunk@369 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-10-15 19:52:01 +00:00
cuz
2bd62669ce Fixed a bug in explicit type casts
git-svn-id: svn://svn.cc65.org/cc65/trunk@354 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-10-10 20:40:36 +00:00
cuz
25f5c69efa Reworked type comparison and handling of type qualifiers
git-svn-id: svn://svn.cc65.org/cc65/trunk@285 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-08-14 22:18:26 +00:00
cuz
d171b3dac9 Check for const in function parameters (first level only).
Place local static const data into the RODATA segment.


git-svn-id: svn://svn.cc65.org/cc65/trunk@253 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-08-01 19:05:24 +00:00
cuz
85417b6d1b Some changes in the way, types and type strings are handled.
Check for and honour const in several places: Assignment to const is flagged
with an error. Const data is placed in the rodata segment.


git-svn-id: svn://svn.cc65.org/cc65/trunk@252 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-08-01 18:45:08 +00:00
cuz
e133416d05 Moved the check module to the common dir.
Replaced the type constants by something more expandable.


git-svn-id: svn://svn.cc65.org/cc65/trunk@248 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-08-01 15:04:35 +00:00
cuz
04ee693c00 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@91 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-21 21:02:44 +00:00
cuz
c31008c78a Remove io.*, some cleanup
git-svn-id: svn://svn.cc65.org/cc65/trunk@87 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-15 19:03:01 +00:00
cuz
aa8737733f Use the xmalloc module from the common directory.
Rewrote the include file management, keeping a list of all include files
and cleaning up the code while going.


git-svn-id: svn://svn.cc65.org/cc65/trunk@82 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-14 21:01:37 +00:00
cuz
9cc25f13b6 Added support for old style (K&R) function declarations.
Several renames for better readibility.
Removed separate struct and enum symbol tables in favour of one tag table.
Check for some more error conditions or dubious constructs.


git-svn-id: svn://svn.cc65.org/cc65/trunk@62 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-12 18:31:40 +00:00
cuz
97c9226c1e Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@43 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-10 10:24:28 +00:00
uz
53dd513176 This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-05-28 13:40:48 +00:00