diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-04-07 20:53:30 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-04-07 20:53:30 +0300 |
commit | 6fb4bb6c7339cd325ca34faa0872ac3a9834918e (patch) | |
tree | 207ab5982099c8bd1551785488a08a05061bd280 /awkgram.c | |
parent | 23d8a1b0772871c4c7549ac2ff93bfd1d069ed82 (diff) | |
parent | c3da76a825a0dcf14af22948b8bc1fd23e329ee0 (diff) | |
download | egawk-6fb4bb6c7339cd325ca34faa0872ac3a9834918e.tar.gz egawk-6fb4bb6c7339cd325ca34faa0872ac3a9834918e.tar.bz2 egawk-6fb4bb6c7339cd325ca34faa0872ac3a9834918e.zip |
Merge branch 'master' into feature/wasted-byte
Diffstat (limited to 'awkgram.c')
-rw-r--r-- | awkgram.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -3377,7 +3377,7 @@ regular_print: if ((yyvsp[-1])->lasti->opcode == Op_concat) { /* multiple (> 2) adjacent strings optimization */ - is_simple_var = ((yyvsp[-1])->lasti->concat_flag & CSVAR); + is_simple_var = ((yyvsp[-1])->lasti->concat_flag & CSVAR) != 0; count = (yyvsp[-1])->lasti->expr_count + 1; (yyvsp[-1])->lasti->opcode = Op_no_op; } else { @@ -4813,7 +4813,7 @@ add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_incl if (stype == SRC_CMDLINE || stype == SRC_STDIN) return do_add_srcfile(stype, src, NULL, thisfile); - path = find_source(src, & sbuf, &errno_val, stype == SRC_EXTLIB); + path = find_source(src, & sbuf, & errno_val, stype == SRC_EXTLIB); if (path == NULL) { if (errcode) { *errcode = errno_val; @@ -6675,10 +6675,10 @@ valinfo(NODE *n, Func_print print_func, FILE *fp) { if (n == Nnull_string) print_func(fp, "uninitialized scalar\n"); - else if (n->flags & STRING) { + else if ((n->flags & STRING) != 0) { pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false); print_func(fp, "\n"); - } else if (n->flags & NUMBER) { + } else if ((n->flags & NUMBER) != 0) { #ifdef HAVE_MPFR if (is_mpg_float(n)) print_func(fp, "%s\n", mpg_fmt("%.17R*g", ROUND_MODE, n->mpg_numbr)); @@ -6687,10 +6687,10 @@ valinfo(NODE *n, Func_print print_func, FILE *fp) else #endif print_func(fp, "%.17g\n", n->numbr); - } else if (n->flags & STRCUR) { + } else if ((n->flags & STRCUR) != 0) { pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false); print_func(fp, "\n"); - } else if (n->flags & NUMCUR) { + } else if ((n->flags & NUMCUR) != 0) { #ifdef HAVE_MPFR if (is_mpg_float(n)) print_func(fp, "%s\n", mpg_fmt("%.17R*g", ROUND_MODE, n->mpg_numbr)); @@ -7658,7 +7658,7 @@ optimize_assignment(INSTRUCTION *exp) switch (i2->opcode) { case Op_concat: if (i2->nexti->opcode == Op_push_lhs /* l.h.s is a simple variable */ - && (i2->concat_flag & CSVAR) /* 1st exp in r.h.s is a simple variable; + && (i2->concat_flag & CSVAR) != 0 /* 1st exp in r.h.s is a simple variable; * see Op_concat in the grammer above. */ && i2->nexti->memory == exp->nexti->memory /* and the same as in l.h.s */ @@ -8118,6 +8118,7 @@ check_special(const char *name) { int low, high, mid; int i; + int non_standard_flags = 0; #if 'a' == 0x81 /* it's EBCDIC */ static bool did_sort = false; @@ -8129,6 +8130,11 @@ check_special(const char *name) } #endif + if (do_traditional) + non_standard_flags |= GAWKX; + if (do_posix) + non_standard_flags |= NOT_POSIX; + low = 0; high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1; while (low <= high) { @@ -8142,8 +8148,7 @@ check_special(const char *name) else if (i > 0) /* token > mid */ low = mid + 1; else { - if ((do_traditional && (tokentab[mid].flags & GAWKX)) - || (do_posix && (tokentab[mid].flags & NOT_POSIX))) + if ((tokentab[mid].flags & non_standard_flags) != 0) return -1; return mid; } |