[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-631
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-631-gf5df7fa |
Date: |
Mon, 06 Apr 2015 07:57:33 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.1-stable has been updated
via f5df7fad8c8b864c3d817d8eb4f9fa3596c2a14b (commit)
from 8ff976cd49eab84fcc0891e94a8896c2017b5275 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=f5df7fad8c8b864c3d817d8eb4f9fa3596c2a14b
commit f5df7fad8c8b864c3d817d8eb4f9fa3596c2a14b
Author: Arnold D. Robbins <address@hidden>
Date: Mon Apr 6 10:57:10 2015 +0300
Minor code cleanups.
diff --git a/ChangeLog b/ChangeLog
index 910a8e8..c60ad62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-06 Arnold D. Robbins <address@hidden>
+
+ * awk.h (force_number): Add `!= 0' check to bitwise operation.
+ * awkgram.y: Same, many places.
+ (check_special): Simplify code for checking extension flags.
+
2015-04-05 Arnold D. Robbins <address@hidden>
* awkgram.y (install_builtins): If do_traditional is true, do not
diff --git a/awk.h b/awk.h
index 4ac32e4..5c3d76a 100644
--- a/awk.h
+++ b/awk.h
@@ -1769,7 +1769,7 @@ unref(NODE *r)
static inline NODE *
force_number(NODE *n)
{
- return (n->flags & NUMCUR) ? n : str2number(n);
+ return (n->flags & NUMCUR) != 0 ? n : str2number(n);
}
#endif /* GAWKDEBUG */
diff --git a/awkgram.c b/awkgram.c
index 8313afc..4fd53ce 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -3299,7 +3299,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 {
@@ -4719,7 +4719,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;
@@ -6449,10 +6449,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));
@@ -6461,10 +6461,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));
@@ -7421,7 +7421,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 */
@@ -7881,6 +7881,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;
@@ -7892,6 +7893,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) {
@@ -7905,8 +7911,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;
}
diff --git a/awkgram.y b/awkgram.y
index 71ca0a8..fad2b96 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1342,7 +1342,7 @@ common_exp
if ($1->lasti->opcode == Op_concat) {
/* multiple (> 2) adjacent strings optimization */
- is_simple_var = ($1->lasti->concat_flag & CSVAR);
+ is_simple_var = ($1->lasti->concat_flag & CSVAR) != 0;
count = $1->lasti->expr_count + 1;
$1->lasti->opcode = Op_no_op;
} else {
@@ -2380,7 +2380,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;
@@ -4110,10 +4110,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));
@@ -4122,10 +4122,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));
@@ -5082,7 +5082,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 */
@@ -5542,6 +5542,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;
@@ -5553,6 +5554,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) {
@@ -5566,8 +5572,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;
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
awk.h | 2 +-
awkgram.c | 23 ++++++++++++++---------
awkgram.y | 23 ++++++++++++++---------
4 files changed, 35 insertions(+), 19 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-631-gf5df7fa,
Arnold Robbins <=