From b89f8d68098b298bd8893141e184dcab63eb6117 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 26 Apr 2012 12:58:47 +0200 Subject: [PATCH] add some failcases... get rid of -Oassignments --- qcsrc/Makefile | 2 +- qcsrc/fteqcc-bugs.qc | 23 +++++++++++++++++++++++ qcsrc/server/command/common.qc | 6 +++++- qcsrc/server/command/sv_cmd.qc | 1 - qcsrc/server/miscfunctions.qc | 2 +- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 qcsrc/fteqcc-bugs.qc diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 27f6fc993..8961c4d41 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -3,7 +3,7 @@ FTEQCC ?= fteqcc PERL ?= perl FTEQCCFLAGS_WATERMARK ?= -DWATERMARK='"$(shell git describe)"' -DCVAR_POPCON -FTEQCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-return_only -fno-fastarrays $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK) +FTEQCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-return_only -Ono-assignment -fno-fastarrays $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK) FTEQCCFLAGS_PROGS ?= FTEQCCFLAGS_MENU ?= diff --git a/qcsrc/fteqcc-bugs.qc b/qcsrc/fteqcc-bugs.qc new file mode 100644 index 000000000..e426e93f9 --- /dev/null +++ b/qcsrc/fteqcc-bugs.qc @@ -0,0 +1,23 @@ +void error(...) = #1; + +void Oassignments(float foo) // pass 1 +{ + float bar; + bar = 2; + bar = (foo ? 0 : (foo & 1)); + if(bar == 2) + error("FTEQCC SUCKS"); +} + +void Oreturn_only(float foo) // pass 0 +{ + if(foo) + { + return; + } +} + +void Oreturn_only_trap(void) +{ + error("FTEQCC SUCKS"); +} diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index d26f3279c..13e667ad8 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -63,6 +63,7 @@ entity GetIndexedEntity(float argc, float start_index) next_token = -1; index = start_index; + selection = world; if(argc > start_index) { @@ -80,6 +81,8 @@ entity GetIndexedEntity(float argc, float start_index) tmp_number = stof(argv(index)); ++index; } + else + tmp_number = 0; } else // maybe it's ONLY a number? { @@ -123,6 +126,7 @@ entity GetFilteredEntity(string input) } else { + selection = world; FOR_EACH_CLIENT(tmp_player) if (strdecolorize(tmp_player.netname) == strdecolorize(input)) selection = tmp_player; @@ -137,7 +141,7 @@ float GetFilteredNumber(string input) entity selection = GetFilteredEntity(input); float output; - if(selection) { output = num_for_edict(selection); } + output = num_for_edict(selection); return output; } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 045409b47..10f725f32 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1425,7 +1425,6 @@ void GameCommand_trace(float request, float argc) { rint(42); // do an engine breakpoint on VM_rint so you can get the trace that errnoeously returns startsolid tracebox(start, PL_MIN, PL_MAX, end, MOVE_NOMONSTERS, world); - tracebox(p, PL_MIN, PL_MAX, q, MOVE_NOMONSTERS, world); if(trace_startsolid) { diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 3686568d8..996d217ed 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -526,7 +526,7 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo) } void GetCvars(float f) { - string s; + string s = string_null; if (f > 0) s = strcat1(argv(f)); -- 2.39.2