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

121 Commits

Author SHA1 Message Date
acqn
0b7d9d8216 Fixed missing calling convention and address size qualifiers in diagnosis on function types. 2024-01-01 14:48:05 +08:00
acqn
f734f43a35 Removed extra 'const' qualifier in array-to-pointer and function-to-pointer conversions. 2024-01-01 14:48:05 +08:00
acqn
f3199e4308 Fixed type name output with K&R-style functions. 2024-01-01 14:48:03 +08:00
acqn
6434176909 Fixed constness of bit-fields. 2023-11-29 12:27:01 +08:00
Bob Andrews
f381d23001
Merge pull request #2236 from acqn/TypeFix
[cc65] Fixed some type-related bugs which don't have any impact yet
2023-10-29 12:37:07 +01:00
acqn
e57c409894 Fixed TypeHasAttrData(), GetSignedType() and GetUnsignedType(), none in use yet though. 2022-10-12 13:13:15 +08:00
acqn
45da20e770 Fixed CheckedSizeOf() for unknown-size types (no such use case yet though). 2022-10-12 13:13:37 +08:00
Bob Andrews
05cd805cbc
Merge pull request #2085 from bbbradsmith/numerical_constant_errors-float
Numerical constant errors and improvements (float)
2023-08-25 22:30:07 +02:00
bbbradsmith
dbdadaa3f3 accidental tabs, printf long expectts explicit %ld 2023-05-03 16:59:48 -04:00
bbbradsmith
7ff74b2c47 Give a better error for unsupported floating point arithmetic, instead of internal "Precondition violated" error. 2023-05-03 16:48:02 -04:00
Bob Andrews
ae7a1416fe
Revert "Revert "Forbid 3-byte struct pass/return by value, document struct value pass/return"" 2023-05-03 20:02:12 +02:00
Bob Andrews
6ffc4004d7
Revert "Forbid 3-byte struct pass/return by value, document struct value pass/return" 2023-05-03 14:24:13 +02:00
bbbradsmith
e7046a02ff Disallow pass/return of 3-byte struct (#2022), document capability added in #1102. 2023-05-02 19:00:34 -04:00
acqn
1dccd1333b Added more type utility functions.
Changed result of GetBasicTypeName() for unknown types from "type" to "<type>".
2022-10-12 13:10:17 +08:00
acqn
a4a1230c62 Renamed some C type facility and fixed a few comments.
Added some new C type code facility.
Removed some unused type predicates.
2022-10-12 13:10:17 +08:00
acqn
75be73cc8d Added utility functions to acquire bit width of types. 2022-11-12 12:32:27 +08:00
acqn
feaedc5b50 Better organized stuff related to C types. 2022-10-12 13:10:17 +08:00
acqn
164eb198ce Moved type facility functions for deciding code generation type flags. 2022-10-12 13:10:17 +08:00
acqn
a2dfa7c721 More consistent names for SymEntry functions. 2022-10-12 13:10:17 +08:00
acqn
2cda47cd36 More descriptive names for SymEntry usage. 2022-10-11 14:14:48 +08:00
acqn
924fcf5d06 Replaced several occurance of PtrConversion() with StdConversion().
Variadic arguments of functions should be default-promoted.
2021-06-08 09:32:58 +08:00
acqn
fdded33097 Made it easier to support 0-size structs in the future. 2020-08-15 06:27:11 +08:00
acqn
4f4487cb03 Added supports for long bit-fields. 2022-01-04 18:23:04 +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
mrdudz
3c1bb85b8e remove dangling spaces 2022-04-17 16:07:09 +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
Greg King
e5813cfb1a Removed two duplicate TYPEDEFs from a header.
The first one is replaced by an #include of the header that has its original TYPEDEF.
The second one is replaced by its base type.

That change allows pedantic C90-compliant compilers to accept the header.
2021-05-13 00:24:32 -04:00
acqn
f901adba22 Predefined type strings for inlined std function parameters. 2021-04-19 15:36:55 +02:00
acqn
9cea9ce5e2 Made the code more constness-correct with 'Type' usage. 2021-04-19 15:36:55 +02:00
acqn
328345b9c3 Removed a helper function that is no longer used. 2021-04-19 15:36:55 +02:00
acqn
896f463a23 Used more specific pointers instead of the "arbitary attribute pointer" used in type strings. 2021-04-19 15:36:55 +02:00
acqn
3755e4a863 Replaced checking for __fastcall__ aginst AutoCDecl etc. with IsFastcallFunc(). 2021-03-24 14:35:44 +08:00
acqn
047d0f479b Comments format fix. 2021-03-03 10:07:24 +01:00
acqn
bfc7a51a44 Fixed Issue #1265 according to C89/C99 standards. 2021-01-30 14:31:51 +01:00
Oliver Schmidt
116682c190 Avoid C99 idioms. 2020-11-16 18:08:00 +01: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
f1161daee9 Recursively checking for incomplete/unknown-sized types. 2020-08-30 17:33:36 +02:00
acqn
8541f18340 Improved diagnostic info on assignment to void types. 2020-08-30 17:33:36 +02:00
acqn
504aee3835
Merge branch 'master' into StaticConst 2020-08-27 06:27:23 +08:00
acqn
43cb092a68 Fixed CHECK failures on certain usage of incomplete enums. 2020-08-26 22:14:51 +02: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
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
acqn
56b659c0be Made char type a distinct type. 2020-08-18 10:48:38 +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
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
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
acqn
13ed557b92 Fixed compatibility checking of function declarations by using the composite types of them. 2020-08-14 18:33:54 +02:00