]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
unary not now uses NOT_F with -ftrue-empty-strings
authorWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 18:04:56 +0000 (19:04 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 18:04:56 +0000 (19:04 +0100)
parser.c

index e8110bb6da6fe03bcd2477dace6d1be658410ddf..84832b8cc2d4fa9238a37da9d6a36b0583e53758 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -648,10 +648,17 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
                         out = (ast_expression*)ast_unary_new(ctx, INSTR_NOT_V, exprs[0]);
                     break;
                 case TYPE_STRING:
-                    if (CanConstFold1(exprs[0]))
-                        out = (ast_expression*)parser_const_float(parser, !ConstS(0) || !*ConstS(0));
-                    else
-                        out = (ast_expression*)ast_unary_new(ctx, INSTR_NOT_S, exprs[0]);
+                    if (CanConstFold1(exprs[0])) {
+                        if (OPTS_FLAG(TRUE_EMPTY_STRINGS))
+                            out = (ast_expression*)parser_const_float(parser, !ConstS(0));
+                        else
+                            out = (ast_expression*)parser_const_float(parser, !ConstS(0) || !*ConstS(0));
+                    } else {
+                        if (OPTS_FLAG(TRUE_EMPTY_STRINGS))
+                            out = (ast_expression*)ast_unary_new(ctx, INSTR_NOT_F, exprs[0]);
+                        else
+                            out = (ast_expression*)ast_unary_new(ctx, INSTR_NOT_S, exprs[0]);
+                    }
                     break;
                 /* we don't constant-fold NOT for these types */
                 case TYPE_ENTITY: