]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking
authorDale Weiler <weilercdale@gmail.com>
Thu, 31 Jul 2014 04:43:42 +0000 (00:43 -0400)
committerDale Weiler <weilercdale@gmail.com>
Thu, 31 Jul 2014 04:43:42 +0000 (00:43 -0400)
parser.c
tests/defs.qh
tests/noreturn.qc
tests/paramomit.qc [new file with mode: 0644]
tests/paramomit.tmpl [new file with mode: 0644]
tests/pointlife.qc
tests/typedefs.qc
tests/varargs.qc

index b7d4bf56ae560296063261be7609ce112d43cc04..0d251d1f66e08077c0016de15944ac7daaa04c39 100644 (file)
--- a/parser.c
+++ b/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++ */
index ed8a5df96b552bd1ded7923e5e994f457f120e35..f6ea408ad9ed7f26ff6b812f07a7de719dd82095 100644 (file)
@@ -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;
index ae614e77b5f27177728cf088d303baefb20e702c..4bd8d154bdedb8028fbcf40ae2642ba58d0de6c8 100644 (file)
@@ -3,8 +3,7 @@
 #endif
 
 void   (...)            print     = #1;
-string (float)          ftos      = #2;
-
+string (float val)      ftos      = #2;
 
 NORETURN void error(...)  = #6;
 
diff --git a/tests/paramomit.qc b/tests/paramomit.qc
new file mode 100644 (file)
index 0000000..48d8d59
--- /dev/null
@@ -0,0 +1,3 @@
+void foo(float) {
+
+}
diff --git a/tests/paramomit.tmpl b/tests/paramomit.tmpl
new file mode 100644 (file)
index 0000000..50c5373
--- /dev/null
@@ -0,0 +1,4 @@
+I: paramomit.qc
+D: test parameter omit
+T: -fail
+C: -std=fteqcc
index 5225a7c6ae2c11c0d88582363beac197d9dacc7f..e32795a22ffc7ad1e47b5e97cc8d0b0e9568add2 100644 (file)
@@ -1,7 +1,7 @@
 var float foo = 0;
 
 void funcall() {}
-void bar(string) {}
+void bar(string str) {}
 
 void main(string str) {
     string pl;
index e9bc13b1b48efbabee4a2de9c3f0a8c3f60079a7..a51844413803533e7213b68d67e6dafd97c9ee44 100644 (file)
@@ -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;
index 4b0d80686e079be78b63f3c0a2f95e0768062a83..eceec4a5ac693a824ead8f758a262207515fb678 100644 (file)
@@ -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");