]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
Removed -fenhanced-diagnostics - it's now --correct, which makes sense since it doesn...
[xonotic/gmqcc.git] / parser.c
index 32e9427bc49be1bb6c14e261fa8fe30a7ca6cc74..3ed0f08eeeaaa61ff9cdc089f405c9307a059bbe 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1713,6 +1713,10 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
         else if (parser->tok == TOKEN_DOTS)
         {
             ast_expression *va;
+            if (!OPTS_FLAG(VARIADIC_ARGS)) {
+                parseerror(parser, "cannot access varargs (try -fvariadic-args)");
+                goto onerr;
+            }
             if (wantop) {
                 parseerror(parser, "expected operator or end of statement");
                 goto onerr;
@@ -1791,7 +1795,7 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
                      * We should also consider adding correction tables for
                      * other things as well.
                      */
-                    if (OPTS_FLAG(ENHANCED_DIAGNOSTICS)) {
+                    if (opts.correction) {
                         correction_t corr;
                         correct_init(&corr);
 
@@ -3776,7 +3780,7 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
         return false;
     }
 
-    if (var->expression.flags & AST_FLAG_VARIADIC) {
+    if (!OPTS_FLAG(VARIADIC_ARGS) && var->expression.flags & AST_FLAG_VARIADIC) {
         if (parsewarning(parser, WARN_VARIADIC_FUNCTION,
                          "variadic function with implementation will not be able to access additional parameters"))
         {
@@ -4012,7 +4016,7 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
         func->argc = argc;
     }
 
-    if (var->expression.flags & AST_FLAG_VARIADIC) {
+    if (OPTS_FLAG(VARIADIC_ARGS) && var->expression.flags & AST_FLAG_VARIADIC) {
         char name[1024];
         ast_value *varargs = ast_value_new(ast_ctx(var), "reserved:va_args", TYPE_ARRAY);
         varargs->expression.flags |= AST_FLAG_IS_VARARG;
@@ -4191,6 +4195,9 @@ static ast_expression *array_field_setter_node(
         if (!subscript)
             return NULL;
 
+        subscript->expression.next = ast_type_copy(ast_ctx(subscript), (ast_expression*)subscript);
+        subscript->expression.vtype = TYPE_FIELD;
+
         entfield = ast_entfield_new_force(ctx,
                                           (ast_expression*)entity,
                                           (ast_expression*)subscript,
@@ -5011,7 +5018,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
                     goto cleanup;
                     */
                 }
-                if (opts.standard == COMPILER_QCC &&
+                if ((opts.standard == COMPILER_QCC || opts.standard == COMPILER_FTEQCC) &&
                     (old = parser_find_global(parser, var->name)))
                 {
                     parseerror(parser, "cannot declare a field and a global of the same name with -std=qcc");