aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-04-11 06:13:54 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-04-11 06:13:54 +0300
commit6092c101ecfd99fe59fcba000999aad9b322ba49 (patch)
tree5b8d63210d006645e73cf749416fe44dcf374e10
parente3b245bc14e812d023e589c5f6508288d7d161e4 (diff)
parentdf7f609e7de6a2d5db52dbd908767a60900565fe (diff)
downloadegawk-6092c101ecfd99fe59fcba000999aad9b322ba49.tar.gz
egawk-6092c101ecfd99fe59fcba000999aad9b322ba49.tar.bz2
egawk-6092c101ecfd99fe59fcba000999aad9b322ba49.zip
Merge branch 'gawk-4.1-stable'
-rw-r--r--ChangeLog15
-rw-r--r--mbsupport.h4
-rw-r--r--regcomp.c29
-rw-r--r--regex_internal.c6
-rw-r--r--regexec.c2
-rw-r--r--test/ChangeLog15
-rw-r--r--test/Makefile.am8
-rw-r--r--test/Makefile.in13
-rw-r--r--test/Maketests5
-rw-r--r--test/clos1way2.awk3
-rw-r--r--test/clos1way2.ok4
-rw-r--r--test/clos1way3.awk3
-rw-r--r--test/clos1way3.ok2
-rw-r--r--test/clos1way4.awk3
-rw-r--r--test/clos1way4.ok2
-rw-r--r--test/clos1way5.awk3
-rw-r--r--test/clos1way5.ok2
-rw-r--r--vms/ChangeLog4
-rw-r--r--vms/generate_config_vms_h_gawk.com3
19 files changed, 86 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index ba4eb96b..04e0103b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2016-04-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * 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.
+ * mbsupport.h (mbstate_t): Define to int.
+ Update copyright.
+
+2016-04-10 John E. Malmberg <wb8tyw@qsl.net>
+
+ * regex_internal.c: Use _GL_ATTRIBUTE_PURE macro
+
2016-04-07 Arnold D. Robbins <arnold@skeeve.com>
* awk.h (two_way_close_type): Move here from io.c.
@@ -87,7 +100,7 @@
2016-03-14 Arnold D. Robbins <arnold@skeeve.com>
* 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 <arnold@skeeve.com>
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);
diff --git a/regcomp.c b/regcomp.c
index 83fae67a..b19c2f95 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2670,19 +2670,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.
@@ -2728,10 +2715,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))
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/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)
{
diff --git a/test/ChangeLog b/test/ChangeLog
index bdf78acd..65c60388 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,18 @@
+2016-04-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * 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 <eliz@gnu.org>
+
+ * 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 <arnold@skeeve.com>
* watchpoint1: Use $(srcdir) on input file so out-of-tree
diff --git a/test/Makefile.am b/test/Makefile.am
index 8a5b669e..b0b24b7d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2224,6 +2224,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 1e9b1bd8..8eaa7299 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -2661,6 +2661,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:
@@ -3940,11 +3948,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 3b4691d2..d10c2e45 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1277,11 +1277,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/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..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.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/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.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/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.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")
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
diff --git a/vms/ChangeLog b/vms/ChangeLog
index cf5333fb..463751e0 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,7 @@
+2016-04-10 John E. Malmberg <wb8tyw@qsl.net>
+
+ * generate_config_vms_h_gawk.com: define __attribute() as macro.
+
2016-02-02 John E. Malmberg <wb8tyw@qsl.net>
* 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
$!