Bill Currie
66b8ab6890
[qfcc] Rework method ivar access
...
While expression symbols worked for what they are, they weren't so good
for ivar access because every ivar of a class (and its super classes)
would be accessed at method scope creation, generating spurious access
errors if any were private. That is, when the access checks worked at
all.
2020-03-05 18:45:47 +09:00
Bill Currie
669c8f43d8
whitespace
2020-03-05 14:48:49 +09:00
Bill Currie
0bb4279a9f
[qfcc] Handle bitwise not of enums
...
It looks like I need to handle other unary expressions too, but another
time.
2020-03-05 01:45:38 +09:00
Bill Currie
4fa203852a
[qfcc] Use offset alias offset when creating alias of offset alias
...
Yes, that's correct. It happens when casting the address of a structure
field (for the test case this fixes, vector field).
2020-03-04 00:55:31 +09:00
Bill Currie
16223098e5
[qfcc] Fix ivar visibility
...
It was broken by the big rewrite and I forgot to fix it.
2020-03-03 10:42:05 +09:00
Bill Currie
8a4de6fea6
[qfcc] Fix segmentation fault for parameter errors
2020-03-02 22:38:12 +09:00
Bill Currie
544d7de1ec
[qfcc] Implement @protocol(foo)
...
Unlike gcc, qfcc requires foo to be defined, not just declared (I
suspect this is a bug in gcc, or even the ObjC spec), because allowing
forward declarations causes an empty (no methods) protocol to be
emitted, and then when the protocol is actually defined, one with
methods, resulting in two different versions of the same protocol, which
comments in the gnu objc runtime specifically state is a problem but is
not checked because it "never happens in practice" (found while
investigating gcc's behavior with @protocol and just what some of the
comments about static instance lists meant).
2020-03-02 10:42:26 +09:00
Bill Currie
caa297b756
[qfcc] Remove type alias encoding
...
It proved to be too fragile in its current implementation. It broke
pointers to incomplete structs and switch enum checking, and getting it
to work for other things was overly invasive. I still want the encoding,
but need to come up with something more robust.a
2020-03-01 16:13:18 +09:00
Bill Currie
b4aebc120e
[qfcc] Treat { } as nil for initializing compound types
2020-02-27 20:30:39 +09:00
Bill Currie
4cec3bbff6
Unalias types when checking cast-compatibility
...
This fixes the problem with passing typedefs to function parameters.
2020-02-26 17:49:09 +09:00
Bill Currie
9528c1176e
Rename cast_expr's type vars for better clarity
2020-02-26 17:45:08 +09:00
Bill Currie
5c36c60005
Use type check helpers some more
2020-02-26 17:41:45 +09:00
Bill Currie
d6752c254c
Move short-circuit boolean code to its own file
2020-02-24 01:20:24 +09:00
Bill Currie
f387b9aa47
Propagate implicit for negating double constants
2020-02-23 23:41:12 +09:00
Bill Currie
607fd2e30e
Allow constant initialized globals in advanced code
...
Use -C const-initializers to enable (or no-const-initializers to disable
in traditional/extended code).
2020-02-23 22:51:00 +09:00
Bill Currie
ea3af84baa
Fix ICE when const-folding doubles
...
I really need to rework that system.
2020-02-23 20:49:56 +09:00
Bill Currie
e7b4eedc07
Fix segfault in dereferencing undefined field containers
2020-02-22 14:04:10 +09:00
Bill Currie
1b43046c8a
Handle aliased types when building function calls
2020-02-19 21:41:46 +09:00
Bill Currie
fd2b7ee6f9
Use more type checking helper functions
2020-02-19 21:41:46 +09:00
Bill Currie
9610788dea
Fix some more type aliasing issues
...
Getting there... (I knew this would be a big job)
2020-02-19 21:41:46 +09:00
Bill Currie
b00c866c4e
Allow casting between string and pointer types
2020-02-19 21:41:46 +09:00
Bill Currie
4c40928112
Remove what appears to be a redundant check
...
It was long wrong anyway as it checked past the end of the function's
parameters, which caused a segfault when calling varargs functions with
no formal parameters.
2020-02-19 02:53:38 +09:00
Bill Currie
e4eb793fb3
Treat aliased values as constant
...
One step closer to cast address initializers working.
2020-02-15 23:49:12 +09:00
Bill Currie
ce9902baed
Don't short-circuit aliased values
...
Not sure why I thought it was a good idea as it turns out this is why
cast pointer initializers were being lost.
2020-02-15 23:49:12 +09:00
Bill Currie
7e09a94469
Fix "casts" between signed and unsigned int
2020-02-15 23:49:12 +09:00
Bill Currie
533fb8acc9
Implement double constants
2020-02-15 23:49:12 +09:00
Bill Currie
2cd62fe01b
Fix several double-related bug
...
float is promoted to double through ... for non-v6 code.
PR_Sprintf has custom param access via P_*, messed up doubles.
2020-02-15 23:49:12 +09:00
Bill Currie
df7c08a010
Add support for doubles to Ruamoko
...
Only as scalars, I still need to think about what to do for vectors and
quaternions due to param size issues. Also, doubles are not yet
guaranteed to be correctly aligned.
2020-02-15 23:49:12 +09:00
Bill Currie
a5ee58cebb
Support 2d vector expressions
...
[x, y] expands to [x, y, 0] (for now, might add a 2d vector type).
2019-06-18 11:54:45 +09:00
Bill Currie
dd52b7fea1
Merge aliased alias expressions
...
This comes up when accessing struct fields nested in another struct.
Fixes the nested struct fields test.
2019-06-17 22:48:42 +09:00
Bill Currie
b18a744288
Use offset alias expressions
...
They are not quite working yet as the operand generator does not use the
offset yet.
2019-06-10 23:55:16 +09:00
Bill Currie
913b9f52e0
Add an offset alias expression
...
This should make dealing with def elements (vector etc) easier.
2019-06-10 18:13:28 +09:00
Bill Currie
efdfc7436f
Move ev_types into types.[ch]
...
No wonder I couldn't find it the other day...
2019-06-10 18:04:25 +09:00
Bill Currie
08ab42fc15
Handle vector expressions as sub-expressions
...
Now my little game builds again :)
2019-06-10 15:50:35 +09:00
Bill Currie
ef4ad52239
Make binary_expr fold constants
...
This is where constant folding should have happened all along. While
unary_expr should fold constants too, it seems to already try to do so
and it's a bit much of a mess to clean up right now.
2019-06-10 00:36:13 +09:00
Bill Currie
00f12263ca
Fix casting arrays to pointers
2019-06-09 22:55:38 +09:00
Bill Currie
227ac46ffe
Clean up array expression processing
...
And make sure constants are folded since fold_constants is no longer
recursive.
2019-06-09 22:25:55 +09:00
Bill Currie
f49303e774
Emit code for address expressions
...
It helps if the necessary code is actually emitted in the first place.
2019-06-09 21:37:46 +09:00
Bill Currie
e849c2d1ce
Mark block expr result as rvalue when used as one
...
At least for return. There may be other cases that need it, but this
fixes comma-expr.r (minus int->float promotion issues).
2019-06-09 19:29:21 +09:00
Bill Currie
ec89149b29
Build for loop decl inits correctly
...
The multiple expressions are chained together and evaluate in left to
right order.
2019-06-09 13:54:03 +09:00
Bill Currie
e217bdd55f
Assign vector expressions to a temp for return
...
Rather than direct to .return, allowing return of vector expressions
with function calls without trashing the vector.
2019-06-08 13:36:03 +09:00
Bill Currie
ebab6574b9
Allow taking the address of a temporary variable
2019-06-08 13:35:47 +09:00
Bill Currie
ff5c1cd4c2
Clean up redundant type parameter to initialize_def.
2018-10-15 22:11:20 +09:00
Bill Currie
302934a1e4
Remove some dead code.
2018-10-15 20:52:46 +09:00
Bill Currie
6c53be928b
Support returning vector expressions.
...
Currently fails due to a scheduling problem when the vector expression
contains functions.
2018-10-13 23:32:53 +09:00
Bill Currie
aaab18c9a7
Nuke a dead field.
...
It looks like ex_temp_t.expr was never really used, and I have no idea
what I had intended (not surprising after ~17 years).
2018-10-13 12:07:50 +09:00
Bill Currie
78e0a8dc52
Support assigning non-constant vector expressions.
2018-10-12 22:05:17 +09:00
Bill Currie
f58c2fef5a
Switch QF's quaterions from wxyz to xyzw.
...
After messing with SIMD stuff for a little, I think I now understand why
the industry went with xyzw instead of the mathematical wxyz. Anyway, this
will make for less pain in the future (assuming I got everything).
2018-10-12 14:33:55 +09:00
Bill Currie
34bcf7faab
Do a pure/const/noreturn/format attribute pass.
...
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie
59e85b7d5e
Fix a pile of dead assignments.
...
Some were actual bugs!
2018-09-08 22:23:57 +09:00