mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-20 18:32:01 +00:00
Parameter omitting in fteqcc is disallowed.
This commit is contained in:
parent
c33755b007
commit
161bbec262
8 changed files with 31 additions and 21 deletions
4
parser.c
4
parser.c
|
@ -4675,6 +4675,10 @@ static ast_value *parse_parameter_list(parser_t *parser, ast_value *var)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_FTEQCC && param->name[0] == '<') {
|
||||
parseerror(parser, "parameter name omitted %s %d", param->name, vec_size(params));
|
||||
goto on_error;
|
||||
}
|
||||
vec_push(params, param);
|
||||
if (param->expression.vtype >= TYPE_VARIANT) {
|
||||
char tname[1024]; /* typename is reserved in C++ */
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
// builtins. I no event shall you even consider adding
|
||||
// these individually per test.
|
||||
|
||||
void (string, ...) print = #1;
|
||||
string (float) ftos = #2;
|
||||
entity () spawn = #3;
|
||||
void (entity) kill = #4;
|
||||
string (vector) vtos = #5;
|
||||
void (string) error = #6;
|
||||
float (vector) vlen = #7;
|
||||
string (entity) etos = #8;
|
||||
float (string) stof = #9;
|
||||
string (...) strcat = #10;
|
||||
float (string, string) strcmp = #11;
|
||||
vector (vector) normalize = #12;
|
||||
float (float) sqrt = #13;
|
||||
float (float) floor = #14;
|
||||
float (float, float) pow = #15;
|
||||
void (string str, ...) print = #1;
|
||||
string (float val) ftos = #2;
|
||||
entity () spawn = #3;
|
||||
void (entity ent) kill = #4;
|
||||
string (vector vec) vtos = #5;
|
||||
void (string str) error = #6;
|
||||
float (vector vec) vlen = #7;
|
||||
string (entity ent) etos = #8;
|
||||
float (string str) stof = #9;
|
||||
string (...) strcat = #10;
|
||||
float (string str1, string str2) strcmp = #11;
|
||||
vector (vector vec) normalize = #12;
|
||||
float (float val) sqrt = #13;
|
||||
float (float val) floor = #14;
|
||||
float (float val1, float val2) pow = #15;
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
#endif
|
||||
|
||||
void (...) print = #1;
|
||||
string (float) ftos = #2;
|
||||
|
||||
string (float val) ftos = #2;
|
||||
|
||||
NORETURN void error(...) = #6;
|
||||
|
||||
|
|
3
tests/paramomit.qc
Normal file
3
tests/paramomit.qc
Normal file
|
@ -0,0 +1,3 @@
|
|||
void foo(float) {
|
||||
|
||||
}
|
4
tests/paramomit.tmpl
Normal file
4
tests/paramomit.tmpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
I: paramomit.qc
|
||||
D: test parameter omit
|
||||
T: -fail
|
||||
C: -std=fteqcc
|
|
@ -1,7 +1,7 @@
|
|||
var float foo = 0;
|
||||
|
||||
void funcall() {}
|
||||
void bar(string) {}
|
||||
void bar(string str) {}
|
||||
|
||||
void main(string str) {
|
||||
string pl;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
typedef void(...) ptype;
|
||||
typedef string(float) funcsf;
|
||||
typedef void(...) ptype;
|
||||
typedef string(float a) funcsf;
|
||||
|
||||
ptype print = #1;
|
||||
funcsf ftos = #2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
void nbva(float a, string...count) {
|
||||
void nbva(float a, ...count) {
|
||||
print("You gave me ", ftos(count), " additional parameters\n");
|
||||
print("First: ", ...(0, string), "\n");
|
||||
print("You chose: ", ...(a, string), "\n");
|
||||
|
|
Loading…
Reference in a new issue