Commit graph

73 commits

Author SHA1 Message Date
Bill Currie
789a11d2d8 don't print the file or line number for "warnings treated as errors" 2001-09-23 04:08:28 +00:00
Bill Currie
805c1bd242 foo (snafu, bar (baz)) no longer uses a temp for bar's return value 2001-08-24 23:22:02 +00:00
Bill Currie
f16886b7f1 missed a need to increment the users of the temp for chained functions 2001-08-24 22:29:06 +00:00
Bill Currie
cee850e499 remove debug 2001-08-24 22:03:50 +00:00
Bill Currie
8166ee7bfb fix a whitespace snafu (gee, vim can be a pain somethings) 2001-08-24 21:57:07 +00:00
Bill Currie
ea451ab02d Remove unnecessary temps from function return values. This has one
*/CRITICAL/* implication: DO NOT /EVER/ RELY ON EVALUATION ORDER. This
isn't /really/ that bad: evaluation order will be consistent for similar
expressions, but for (eg) foo() + bar()*2, bar will be called first.
2001-08-24 21:47:52 +00:00
Bill Currie
08f73bed78 better code generation for foo(bar(baz)). foo(snafu,bar(baz)) isn't optimal
yet, but the code is at least correct
2001-08-24 21:14:04 +00:00
Bill Currie
eeec89e6ba don't put function args in temps when not needed. still need to take care
of the return value, but that can possibly be taken care of in an optimiser
pass.
2001-08-24 05:40:48 +00:00
Bill Currie
0eda635483 fix temp reference counting on function call args 2001-08-22 23:21:47 +00:00
Bill Currie
4c48851096 fix a buffer overflow in new_label_expr
use reference counting for temp defs and call PR_FreeTempDefs at the end
of emit_sub_expr as well as emit_expr.
fix a (relatively harmless) bug in type processesing of foo.bar =
2001-08-22 21:55:01 +00:00
Bill Currie
2af74aedca fix a segfault due to type mangling for ... functions 2001-08-20 18:23:47 +00:00
Bill Currie
cf4ca286f0 implement pre and post increment operators (++ and --) 2001-08-20 06:22:28 +00:00
Bill Currie
cd59628199 move the chained funcion support out of emit_function_expr into funciton_expr 2001-08-20 04:56:00 +00:00
Bill Currie
79ce6c56ca fix assignops with entity fields by cloning e1 rather than just re-using it 2001-08-11 22:02:59 +00:00
Bill Currie
c2d3d8f3ab temp def expressions and ?:
seems to work :)
2001-08-11 21:15:24 +00:00
Adam Olsen
6414897dae got a few new operators for qc :)
<< >> % which all act like their C counterparts
+= -= *= /= &= ^= |= <<= >>= %= which just expand into the obvious,
also like the C versions.
2001-08-10 16:17:00 +00:00
Bill Currie
081d8f3c47 ^ and ~ operators for qc (^ from Rhamphoryncus) and clean up the punctuation
line in qc-lex.l (why didn't I think to do that in the first place?!?)
2001-08-09 16:34:46 +00:00
Bill Currie
b341529fce more --id support 2001-08-07 16:50:22 +00:00
Bill Currie
1e1cb06a1f disable integers for --id. probably not thorough enough yet :/ 2001-08-03 07:47:15 +00:00
Bill Currie
28b1598e7e break the emit_* functions out of expr.c into emit.c 2001-07-26 05:15:34 +00:00
Bill Currie
7718ca4c96 various little cleanups 2001-07-26 05:08:27 +00:00
Bill Currie
d44f60f17c drasticly simplify emit_assign_expr now that I have a much better
understanding of when an explicit assigment is needed. seems to work for
everything I throw at it.
Also, fix ! unary ops (caused by the - unary op fix:/)
2001-07-25 21:47:05 +00:00
Bill Currie
0c2cd8633c fix -expr handling. generates sucky code atm, but at least it's generating
code now:P
2001-07-25 18:36:36 +00:00
Bill Currie
9ad075b02e make if/while/for use test_expr, make test_expr fix the new exp line/file,
fix some string const issues
2001-07-24 22:30:31 +00:00
Bill Currie
576123060a warn on passing integer constants into ... functions. Again, this will need
an option later
2001-07-24 20:43:18 +00:00
Bill Currie
d9cde786b3 use ev_type_count instead of ev_void for bad types so things like void
functions being used in expressions don't cause ICEs
2001-07-24 19:51:44 +00:00
Bill Currie
6d1671950a expr.c:
warn for int const / int const. this will probably want an option for newer
	games
qfcc.c:
	clean up temp files when errors have occured
2001-07-24 04:45:53 +00:00
Bill Currie
a47a4d8038 make print_expr's output readable by mere mortals 2001-07-23 06:15:33 +00:00
Bill Currie
d2c266775c fix a seg on return type mismatch 2001-07-23 05:46:00 +00:00
Bill Currie
4b744b6be5 fix numberous integer <-> float errors
type check function args in the correct order
2001-07-23 05:31:49 +00:00
Bill Currie
b8874cab1c function return checking 2001-07-23 02:27:46 +00:00
Bill Currie
50fadb6866 function arg type checking with int->float /constant/ cooecion. 2001-07-23 01:56:49 +00:00
Bill Currie
c248372e20 Initial integer type support. qfcc /is/ partially broken when it comes to
integer constants and float function args/return values.

pr_comp.h:
	o  add the integer opcodes to pr_opcode_e
pr_edict.c:
	o  add "quaternion" and "integer" to type_name[]
	o  support quatnernion and integers types when printing values
	o  support the integer opcodes when bounds checking
pr_exec.c
	o  enable the integer opcodes
pr_opcode:
	o  add the integer opcodes to the opcode table
	o  logical operators all result in an integer rather than a value
expr.h:
	o  rename int_val to integer_val
qfcc.h:
	o  kill another magic number
expr.c:
	o  move the opcode to string conversion out of type_mismatch and into
	   get_op_string
	o  rename int_val to integer_val
	o  general integer type support.
	o  generate an internal comipiler error for null opcodes rather than
	   segging.
pr_imm.c:
	o  rename int_val to integer_val
	o  support integer constants, converting to float when needed.
pr_lex.c:
	o  magic number death and support quaternions and integers in type_size[]
qc-lex.l
	o  rename int_val to integer_val
	o  support quaternion and integer type keywords
qc-parse.y:
	o  rename int_val to integer_val
	o  use binary_expr instead of new_binary_expr for local initialized
	   variables
builtins.c:
	o  rename int_val to integer_val
	o  fix most (all?) of the INT related FIXMEs
defs.qc:
	o  use integer instead of float where it makes sense
main.c:
	o  read_result is now integer rather than float
main.qc:
	o  float -> integer where appropriate
	o  new test for int const to float arg
2001-07-23 01:31:22 +00:00
Bill Currie
55ac55c7ac rename ev_int and ex_int to ev_integer and ex_integer. create type_integer
and def_integer (do I need that?), clean up and or coment on XXX and FIXME
2001-07-22 06:59:12 +00:00
Bill Currie
00d409e80c fix constant folding for | 2001-07-19 03:00:35 +00:00
Bill Currie
10ad8bebbd Make files.dat actually useful. I really dislike the hardcoding, but it /is/
useful. Also, fix a bug in PrecacheModel where it was checking MAX_SOUNDS and
numsounds instead of models.
2001-07-18 17:23:42 +00:00
Bill Currie
c9af1575d3 fix emit_assign_expr to emit an explicit assignment statement whenever
emit_sub_expr returns a temporary def. this fixes a = b = c; expressions when
entities are involved.
2001-07-18 16:33:31 +00:00
Bill Currie
098305d649 fix (expr_type1 && expr_type2). this involed type completing expressions :/ 2001-07-18 06:37:14 +00:00
Bill Currie
5d5d3f1416 well, that explains the loss of line number onfo on return statements :P 2001-07-16 03:53:45 +00:00
Bill Currie
ae9ee57666 change the type of opcode->type to etype_t, clean up the resulting mess, and
rename all of the opcodes to (eg) mul.f instead of MUL_F
2001-07-14 01:52:05 +00:00
Bill Currie
64e50e1ebd Basic debug info generation, just line numbers and local defs for each
function.
2001-07-14 01:15:40 +00:00
Bill Currie
8bbef35197 fix `a = b = b + c;' (probably d + c, too). Caused by forgetting to emit
an assignment for `a ='.
2001-07-12 18:56:43 +00:00
Bill Currie
8000c86e35 /much/ better type mismatch error reporting
eg:
./main.qc:55: type mismatch: float == entity
2001-07-09 18:17:04 +00:00
Jeff Teunissen
35f5118803 warning/error message cleanups. Well, at least *I* think they make more
sense. :)
2001-07-06 02:43:39 +00:00
Bill Currie
1edf1e0b39 format checking for error and warning + needed fixes
try to give name of object when calling non-function
2001-07-03 20:53:49 +00:00
Bill Currie
f2bb7ace41 add an option (--warn=error) to treat warnings as errors 2001-06-28 23:15:10 +00:00
Bill Currie
6dfee9968b /much/ better error handling 2001-06-28 21:26:40 +00:00
Bill Currie
eef9e8e2dc be more accurate about the operator involved 2001-06-28 17:44:50 +00:00
Bill Currie
0271afbb10 warn about the dangers of (!foo & bar) 2001-06-28 15:20:31 +00:00
Bill Currie
768c4a49d3 fix . type checking 2001-06-27 21:43:10 +00:00