From 22b550f985e356d4036b5ff724a50249d3816025 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 Apr 2016 17:53:04 +0300 Subject: Fix the test suite for MinGW. --- test/ChangeLog | 9 +++++++++ test/clos1way2.awk | 3 ++- test/clos1way2.ok | 2 +- test/clos1way3.awk | 3 ++- test/clos1way4.awk | 3 ++- test/clos1way5.awk | 3 ++- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index 59e26897..d45091aa 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,12 @@ +2016-04-08 Eli Zaretskii + + * clos1way2.awk: + * clos1way3.awk: + * clos1way4.awk: + * clos1way5.awk: Use "&&" instead of ";" to chain commands, so + that it works with stock MS-Windows shells as well. + * clos1way2.ok: Adjust the error message to the change in command. + 2016-04-08 Arnold D. Robbins * watchpoint1: Use $(srcdir) on input file so out-of-tree diff --git a/test/clos1way2.awk b/test/clos1way2.awk index 5794bec5..c734c142 100644 --- a/test/clos1way2.awk +++ b/test/clos1way2.awk @@ -1,5 +1,6 @@ { - cmd = "cat - 1>&2; sleep 2" + # We use "&&" and not ";" so it works with Windows shells as well. + cmd = "cat - 1>&2 && sleep 2" print |& cmd; close(cmd, "to") fflush(cmd) print |& cmd; print ERRNO diff --git a/test/clos1way2.ok b/test/clos1way2.ok index 67240ac9..f6d7bcd7 100644 --- a/test/clos1way2.ok +++ b/test/clos1way2.ok @@ -1,4 +1,4 @@ -gawk: clos1way2.awk:4: (FILENAME=- FNR=1) warning: fflush: cannot flush: two-way pipe `cat - 1>&2; sleep 2' has closed write end +gawk: clos1way2.awk:4: (FILENAME=- FNR=1) warning: fflush: cannot flush: two-way pipe `cat - 1>&2 && sleep 2' has closed write end test gawk: clos1way2.awk:5: (FILENAME=- FNR=1) fatal: print: attempt to write to closed write end of two-way pipe EXIT CODE: 2 diff --git a/test/clos1way3.awk b/test/clos1way3.awk index f69f6675..2c4a6f4f 100644 --- a/test/clos1way3.awk +++ b/test/clos1way3.awk @@ -1,5 +1,6 @@ BEGIN { - cmd = "cat - 1>&2; sleep 2" + # We use "&&" and not ";" so it works with Windows shells as well. + cmd = "cat - 1>&2 && sleep 2" print "test1" |& cmd close(cmd, "to") print "test2" |& cmd diff --git a/test/clos1way4.awk b/test/clos1way4.awk index 6c68c5c8..106e4467 100644 --- a/test/clos1way4.awk +++ b/test/clos1way4.awk @@ -1,5 +1,6 @@ BEGIN { - cmd = "cat - 1>&2; sleep 2" + # We use "&&" and not ";" so it works with Windows shells as well. + cmd = "cat - 1>&2 && sleep 2" printf "%s\n", "test1" |& cmd close(cmd, "to") printf "%s\n", "test2" |& cmd diff --git a/test/clos1way5.awk b/test/clos1way5.awk index ca1bd94c..0af19093 100644 --- a/test/clos1way5.awk +++ b/test/clos1way5.awk @@ -1,5 +1,6 @@ BEGIN { - cmd = "echo test1; echo test2; sleep 2" + # We use "&&" and not ";" so it works with Windows shells as well. + cmd = "echo test1&& echo test2&& sleep 2" cmd |& getline x print x close(cmd, "from") -- cgit v1.2.3 From 51b4e6f84be3ba3d48ee7406633d136b588537e9 Mon Sep 17 00:00:00 2001 From: John Malmberg Date: Sun, 10 Apr 2016 16:34:18 -0500 Subject: Fix the build on VMS --- ChangeLog | 6 +++++- regex_internal.c | 6 +++--- vms/ChangeLog | 4 ++++ vms/generate_config_vms_h_gawk.com | 3 +++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00dda864..42fc8073 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-04-10 John E. Malmberg + + * regex_internal.c: Use _GL_ATTRIBUTE_PURE macro + 2016-04-07 Arnold D. Robbins * awk.h (two_way_close_type): Move here from io.c. @@ -40,7 +44,7 @@ 2016-03-14 Arnold D. Robbins * io.c (socketopen): For SOCK_DGRAM, set read_len to sizeof - remote_addr. Makes UDP more or less work again. + remote_addr. Makes UDP more or less work again. Thanks to Juergen Kahrs for the fix. 2016-03-10 Arnold D. Robbins diff --git a/regex_internal.c b/regex_internal.c index 759c7c81..f6b2574f 100644 --- a/regex_internal.c +++ b/regex_internal.c @@ -840,7 +840,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) } static unsigned char -internal_function __attribute ((pure)) +internal_function _GL_ATTRIBUTE_PURE re_string_peek_byte_case (const re_string_t *pstr, int idx) { int ch, off; @@ -1372,7 +1372,7 @@ re_node_set_insert_last (re_node_set *set, int elem) return 1 if SET1 and SET2 are equivalent, return 0 otherwise. */ static int -internal_function __attribute ((pure)) +internal_function _GL_ATTRIBUTE_PURE re_node_set_compare (const re_node_set *set1, const re_node_set *set2) { int i; @@ -1387,7 +1387,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2) /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ static int -internal_function __attribute ((pure)) +internal_function _GL_ATTRIBUTE_PURE re_node_set_contains (const re_node_set *set, int elem) { unsigned int idx, right, mid; diff --git a/vms/ChangeLog b/vms/ChangeLog index 203dd9ae..6b8791df 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,7 @@ +2016-04-10 John E. Malmberg + + * generate_config_vms_h_gawk.com: define __attribute() as macro. + 2016-02-02 John E. Malmberg * descrip.mms: Add gawk_debug target. diff --git a/vms/generate_config_vms_h_gawk.com b/vms/generate_config_vms_h_gawk.com index 805b764f..83a64636 100644 --- a/vms/generate_config_vms_h_gawk.com +++ b/vms/generate_config_vms_h_gawk.com @@ -291,6 +291,9 @@ $ write cvh "" $ write cvh "#define TIME_T_UNSIGNED 1" $ write cvh "#include ""custom.h""" $ write cvh "" +$ write cvh "#define __attribute(a)" +$ write cvh "" +$ $! $! Close out the file $! -- cgit v1.2.3 From b0955bbeff0cf5548ec8009b75da51ae233a18ef Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 11 Apr 2016 05:58:49 +0300 Subject: Fix mainline test suite. --- test/ChangeLog | 5 +++++ test/clos1way2.ok | 4 ++-- test/clos1way3.ok | 2 +- test/clos1way4.ok | 2 +- test/clos1way5.ok | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index d45091aa..742c1787 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2016-04-11 Arnold D. Robbins + + * clos1way2.ok, clos1way3.ok, clos1way4.ok, clos1way5.ok: Update + after Eli's code changes. + 2016-04-08 Eli Zaretskii * clos1way2.awk: diff --git a/test/clos1way2.ok b/test/clos1way2.ok index f6d7bcd7..c13a79c3 100644 --- a/test/clos1way2.ok +++ b/test/clos1way2.ok @@ -1,4 +1,4 @@ -gawk: clos1way2.awk:4: (FILENAME=- FNR=1) warning: fflush: cannot flush: two-way pipe `cat - 1>&2 && sleep 2' has closed write end +gawk: clos1way2.awk:5: (FILENAME=- FNR=1) warning: fflush: cannot flush: two-way pipe `cat - 1>&2 && sleep 2' has closed write end test -gawk: clos1way2.awk:5: (FILENAME=- FNR=1) fatal: print: attempt to write to closed write end of two-way pipe +gawk: clos1way2.awk:6: (FILENAME=- FNR=1) fatal: print: attempt to write to closed write end of two-way pipe EXIT CODE: 2 diff --git a/test/clos1way3.ok b/test/clos1way3.ok index b0157fa1..6677fdf0 100644 --- a/test/clos1way3.ok +++ b/test/clos1way3.ok @@ -1,3 +1,3 @@ test1 -gawk: clos1way3.awk:5: fatal: print: attempt to write to closed write end of two-way pipe +gawk: clos1way3.awk:6: fatal: print: attempt to write to closed write end of two-way pipe EXIT CODE: 2 diff --git a/test/clos1way4.ok b/test/clos1way4.ok index e30aa7f6..132a4b95 100644 --- a/test/clos1way4.ok +++ b/test/clos1way4.ok @@ -1,3 +1,3 @@ test1 -gawk: clos1way4.awk:5: fatal: printf: attempt to write to closed write end of two-way pipe +gawk: clos1way4.awk:6: fatal: printf: attempt to write to closed write end of two-way pipe EXIT CODE: 2 diff --git a/test/clos1way5.ok b/test/clos1way5.ok index 1ff15402..58205982 100644 --- a/test/clos1way5.ok +++ b/test/clos1way5.ok @@ -1,3 +1,3 @@ test1 -gawk: clos1way5.awk:6: fatal: getline: attempt to read from closed read end of two-way pipe +gawk: clos1way5.awk:7: fatal: getline: attempt to read from closed read end of two-way pipe EXIT CODE: 2 -- cgit v1.2.3 From e8fcc3fbc7e9c51e90233fecb2584b851260b565 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 11 Apr 2016 06:00:43 +0300 Subject: Disable pty1 test on z/OS. --- test/ChangeLog | 1 + test/Makefile.am | 8 ++++++++ test/Makefile.in | 13 ++++++++----- test/Maketests | 5 ----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index 742c1787..52c520c5 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -2,6 +2,7 @@ * clos1way2.ok, clos1way3.ok, clos1way4.ok, clos1way5.ok: Update after Eli's code changes. + * Makefile.am (pty1): Disable test on z/OS. 2016-04-08 Eli Zaretskii diff --git a/test/Makefile.am b/test/Makefile.am index 9eebba73..dfc9bbed 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2132,6 +2132,14 @@ watchpoint1: @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk $(srcdir)/$@.in < $(srcdir)/$@.script >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +pty1: + @echo $@ + @case `uname` in \ + openedition*) : ;; \ + *) AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ ; \ + $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ;; \ + esac + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index d3e745ae..77c8a60a 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -2570,6 +2570,14 @@ watchpoint1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk $(srcdir)/$@.in < $(srcdir)/$@.script >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +pty1: + @echo $@ + @case `uname` in \ + openedition*) : ;; \ + *) AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ ; \ + $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ;; \ + esac Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -3824,11 +3832,6 @@ procinfs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -pty1: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - regnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 08d05952..16b1e826 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1252,11 +1252,6 @@ procinfs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -pty1: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - regnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ -- cgit v1.2.3 From 8ba34e95809188fb1c11fe8e581661caf7b8546f Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 11 Apr 2016 06:05:57 +0300 Subject: Stamp out __attribute. --- ChangeLog | 4 ++++ regexec.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 42fc8073..eec2d1e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-04-11 Arnold D. Robbins + + * regexec.c: Stamp out last remaining use of __attribute. + 2016-04-10 John E. Malmberg * regex_internal.c: Use _GL_ATTRIBUTE_PURE macro diff --git a/regexec.c b/regexec.c index 7355aad3..2182371c 100644 --- a/regexec.c +++ b/regexec.c @@ -1032,7 +1032,7 @@ prune_impossible_nodes (re_match_context_t *mctx) since initial states may have constraints like "\<", "^", etc.. */ static inline re_dfastate_t * -__attribute ((always_inline)) internal_function +__attribute__ ((always_inline)) internal_function acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, int idx) { -- cgit v1.2.3 From 6db77c0a45815f33b7dadb23ee6ba2c70a739345 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 11 Apr 2016 06:06:29 +0300 Subject: Revert 2016-01-24 change parsing single byte ranges. --- ChangeLog | 3 +++ regcomp.c | 29 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index eec2d1e6..8915aff3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2016-04-11 Arnold D. Robbins * regexec.c: Stamp out last remaining use of __attribute. + * regcomp.c: Undo change of 2016-01-24 when parsing single-byte + ranges. Go back to treating them as bytes and not as characters. + The change broke things on Windows in non-UTF-8 character sets. 2016-04-10 John E. Malmberg diff --git a/regcomp.c b/regcomp.c index c2fe06b1..11c94fc1 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2682,19 +2682,6 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, #define BRACKET_NAME_BUF_SIZE 32 #ifndef _LIBC - -# ifdef RE_ENABLE_I18N -/* Convert the byte B to the corresponding wide character. In a - unibyte locale, treat B as itself if it is an encoding error. - In a multibyte locale, return WEOF if B is an encoding error. */ -static wint_t -parse_byte (unsigned char b, re_charset_t *mbcset) -{ - wint_t wc = __btowc (b); - return wc == WEOF && !mbcset ? b : wc; -} -#endif - /* Local function for parse_bracket_exp only used in case of NOT _LIBC. Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. @@ -2740,10 +2727,22 @@ build_range_exp (reg_syntax_t syntax, bitset_t sbcset, end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0] : 0)); +#ifdef GAWK + /* + * Fedora Core 2, maybe others, have broken `btowc' that returns -1 + * for any value > 127. Sigh. Note that `start_ch' and `end_ch' are + * unsigned, so we don't have sign extension problems. + */ start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM) - ? parse_byte (start_ch, mbcset) : start_elem->opr.wch); + ? start_ch : start_elem->opr.wch); end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM) - ? parse_byte (end_ch, mbcset) : end_elem->opr.wch); + ? end_ch : end_elem->opr.wch); +#else + start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM) + ? __btowc (start_ch) : start_elem->opr.wch); + end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM) + ? __btowc (end_ch) : end_elem->opr.wch); +#endif if (start_wc == WEOF || end_wc == WEOF) return REG_ECOLLATE; else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0)) -- cgit v1.2.3 From df7f609e7de6a2d5db52dbd908767a60900565fe Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 11 Apr 2016 06:12:38 +0300 Subject: Fix mbsupport.h for DJGPP. --- ChangeLog | 2 ++ mbsupport.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8915aff3..63bc2866 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ * regcomp.c: Undo change of 2016-01-24 when parsing single-byte ranges. Go back to treating them as bytes and not as characters. The change broke things on Windows in non-UTF-8 character sets. + * mbsupport.h (mbstate_t): Define to int. + Update copyright. 2016-04-10 John E. Malmberg diff --git a/mbsupport.h b/mbsupport.h index f4e1a821..8c99b430 100644 --- a/mbsupport.h +++ b/mbsupport.h @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2004, 2005, 2011, 2012 the Free Software Foundation, Inc. + * Copyright (C) 2004, 2005, 2011, 2012, 2016 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -43,6 +43,8 @@ #define wcslen strlen #define wctob(wc) (EOF) +#define mbstate_t int + extern wctype_t wctype(const char *name); extern int iswctype(wint_t wc, wctype_t desc); extern int wcscoll(const wchar_t *ws1, const wchar_t *ws2); -- cgit v1.2.3