aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/awkgram.c b/awkgram.c
index 8118c9c3..b4f71d40 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -3547,7 +3547,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 {
@@ -4984,7 +4984,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;
@@ -6861,10 +6861,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));
@@ -6873,10 +6873,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));
@@ -7846,7 +7846,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 */
@@ -8306,6 +8306,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;
@@ -8317,6 +8318,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) {
@@ -8330,8 +8336,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;
}