Commit graph

139 commits

Author SHA1 Message Date
Wolfgang Bumiller
97a74eb677 catch broken vector member access
These kinds of expressions currently cannot be handled
without pionter support in the qcvm without scanning the
ast from within ast_member::codegen for an assignments as
seen in the added test case.

This change makes code like that return a pointer type which
will cause an error that we did not get a vector or field
back. With pointer support this pointer could actually be
used instead.

So at least it shouldn't silently produce broken code
anymore.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2018-01-14 10:58:29 +01:00
Wolfgang Bumiller
f84c8ea629 add variable search order test
Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2018-01-14 09:33:05 +01:00
Dale Weiler
02b20dbd09 fix member binops on entity fields to generate STOREP, this fixes stuff like ent.vec.x += value. 2017-11-26 17:09:38 -05:00
Wolfgang Bumiller
163c4b99a4 tests: add check for vector negation 2017-06-22 08:45:38 +02:00
Wolfgang Bumiller
eb2d478770 qcvm: add stov builtin #16 2017-06-22 08:45:18 +02:00
Dale Weiler
9821b6a075 Fix fieldfuncs test and track unused variables through writes as well. 2016-11-19 12:19:00 +00:00
Wolfgang Bumiller
0b94d7583c fix access to fields of vector members
When ast_member encounters the result of an ast_entfield it
has to replace the ast_entfield's codegen as we cannot
evaluate the field access first.

We then perform the same action as ast_entfield but call
vectorMember on the field before issuing the load/address
instruction.

This effectively turns the codegen of the following ast
structure:
    member_of {
        field_of {
            entity,
            a_vector
        }
        memberid
    }
into the one of this structure:
    field_of {
        entity,
        member_of {
            a_vector
            memberid
        }
    }
2016-11-19 16:22:18 +01:00
Wolfgang Bumiller
49f4fedecf add another test that we just didn't have anywhere else yet 2015-01-25 09:29:02 +01:00
Wolfgang Bumiller
5c64437189 fix for loops 2015-01-20 20:55:27 +01:00
Wolfgang Bumiller
09109bb176 split-vectors test 2014-10-18 13:51:25 +02:00
Wolfgang Bumiller
2a00b386ba renaming the length operator to _length and fixing the lexing of that operator, generic names for operators is really a bad idea 2014-10-18 13:47:23 +02:00
Dale Weiler
859e9fe3da Fix tests 2014-09-29 03:38:08 -04:00
Dale Weiler
b08195e2da Implemented length operator. This closes #130 2014-09-27 04:15:32 -04:00
Dale Weiler
2208136403 Implement support for indirect macro expansions in the preprocessor. This closes #36 2014-09-27 01:48:03 -04:00
Dale Weiler
823b053e60 Fix T...name 2014-07-31 12:37:26 -04:00
Dale Weiler
161bbec262 Parameter omitting in fteqcc is disallowed. 2014-07-31 00:43:08 -04:00
Dale Weiler
53e9ed0d96 Merge branch 'arithmetic_exceptions' into cooking
Conflicts:
	doc/gmqcc.1
	gmqcc.ini.example
	opts.def
	parser.c
2014-05-25 03:01:47 -04:00
Dale Weiler
3945f26d92 Put this back in global scope, we have a local scope test 2014-05-24 20:36:09 -04:00
Dale Weiler
4fa694fe82 Some CLZ for other toolchains. 2014-05-24 20:33:57 -04:00
Wolfgang Bumiller
edb38ce70e local compile-time const values are now created as globals, thus they're now subject to constant-folding 2014-05-24 19:13:49 +02:00
Dale Weiler
05e20bcdda Some things. Fix testsuite as well. One test will fail (inexact). 2014-05-24 11:42:10 -04:00
Dale Weiler
bbeb2517c0 Arithmetic exception flag and a plethora of tests. 2014-05-24 10:38:02 -04:00
Wolfgang Bumiller
ba0ac97372 add tests for INSTR_STATE and -femulate-state 2014-04-08 14:35:11 +02:00
Wolfgang Bumiller
e8133893a0 Merge remote-tracking branch 'origin/master' into cooking 2014-04-07 14:23:35 +02:00
Dale Weiler
f1650c42d9 Match C's preprocessor semantics for token pasting with '##'. 2014-04-07 06:00:04 -04:00
Dale Weiler
06e2cb2b1b Add qc_pow. 2014-03-17 09:39:59 -04:00
Wolfgang Bumiller
b6b4a87cbf That's not how it should fail :P 2014-01-01 12:21:00 +01:00
Wolfgang Bumiller
acdc559d1f improved test of last attribute 2014-01-01 12:18:54 +01:00
Wolfgang Bumiller
5319caaaea definite -> last keyword; testcase updated too 2014-01-01 12:16:19 +01:00
Wolfgang Bumiller
50f905b821 adding 'final' 2013-12-06 22:41:15 +01:00
Wolfgang Bumiller
3988aae73e type and argument parsing improved to handle the field/vararg ambiguity; tests added 2013-10-18 16:28:28 +02:00
Dale Weiler
0cfc275f82 Fix 2013-10-17 20:35:56 -04:00
Dale Weiler
c210340081 Undo fix and actually use a macro in the accumulation test .. just incase. 2013-10-17 20:34:16 -04:00
Dale Weiler
c675ba8086 Does this fix it? 2013-10-17 20:25:02 -04:00
Dale Weiler
9f54610fbd Implement support for octal constants, this closes #97. 2013-10-17 05:17:30 -04:00
Dale Weiler
8a9c4edce8 Add a test for function accumulation attribute 2013-10-17 03:43:05 -04:00
Dale Weiler
b2c8f3ebc5 Vector cross product virtual instruction, now >< operator works for non-constant vectors. Thanks divVerent for the help. 2013-08-31 14:49:06 -04:00
Dale Weiler
64661f54ea Implemented >< (vector cross product operator). Currently support for constants only. 2013-08-31 13:41:25 -04:00
Dale Weiler
f8af7adcd7 Remove &~= operator from gmqccs operator table, only fteqcc supports it. 2013-08-29 07:19:19 -04:00
Dale Weiler
045bd4dbda Some style fixes for tests 2013-08-27 06:41:03 -04:00
Dale Weiler
28cd3a3f8f Forgot this one 2013-08-27 06:39:51 -04:00
Dale Weiler
f21216ecad A test for that xor stuff (the same one I used to cause the bug to manifest in the first place). 2013-08-27 06:35:58 -04:00
Wolfgang Bumiller
988b4b4960 ast_binary->right_first and an execution order check 2013-08-27 10:42:13 +02:00
Wolfgang Bumiller
147a6df629 fix testcase workarounds 2013-08-27 10:00:24 +02:00
Rudolf Polzer
e50b7a2719 Support vector bitor/bitand/bitxor.
Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
2013-08-26 18:32:28 +02:00
Dale Weiler
557ad9da1a Make COMPILER_QCC default to please the stuborn Quake community. 2013-07-27 17:56:46 +00:00
Dale Weiler
5d2b57394e Add the good old xor swap trick to the xor test, yes it works :P 2013-06-16 02:24:10 +00:00
Dale Weiler
17ae2dbe4d Make ^ legal for vector ^ vector, and vector ^ float (read the huge comment that explains why and what this does). Currently only works for constants (don't know how to do expression for multiple vector components yet). 2013-06-16 02:17:29 +00:00
Dale Weiler
a27b7ee6a5 Make them tests work now 2013-06-15 11:05:25 +00:00
Dale Weiler
a8fddbb7d3 Implemented bitwise xor operator. 2013-06-15 09:48:40 +00:00