[PATCH 3/6] dfa: reorder enum for efficiency

2018-09-18 Thread Paul Eggert
* lib/dfa.c (END): Now -1 again. Reorder other elements of the enumeration to make it easier for GCC to generate efficient code by using fewer comparisons to check for ranges of values. (atom): Take advantage of the reordering. --- ChangeLog | 9 lib/dfa.c | 130 +++

[PATCH 6/6] dfa: use more-informative function name

2018-09-18 Thread Paul Eggert
* lib/dfa.c (maybe_disable_superset_dfa): Rename from dfautf8noss. Use change. --- ChangeLog | 4 lib/dfa.c | 6 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c4b12c60..fa7a4557d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018

[PATCH 5/6] dfa: tweak allocation performance

2018-09-18 Thread Paul Eggert
* lib/dfa.c (merge_nfa_state, dfaoptimize): Prefer ptrdiff_t for indexes some more. Use char for flags, as it’s wide enough. Allocate queue and flags together, with one malloc call. No need to use xnmalloc since the multiplication and addition cannot overflow (it’s already been checked by earlier a

[PATCH 1/6] dfa: simplify initial state

2018-09-18 Thread Paul Eggert
From: Norihiro Tanaka Simplifying the initial state enables easier optimization of the NFA. * lib/dfa.c (enum token): Add new element BEG. (prtok): Adjust due to adding element BEG. (dfaparse): Put BEG at a head of tokens. (state_index): Adjust due to adding element BEG. (dfaanalyze): Concatenate

[PATCH 4/6] dfa: prune states as we go

2018-09-18 Thread Paul Eggert
* lib/dfa.c (prune): Remove. (merge_nfa_state): Prune as we go instead of at the end. Prefer ptrdiff_t for indexes, as this helps the compiler a bit. Simplify constraint checking a bit. --- ChangeLog | 5 + lib/dfa.c | 49 - 2 files changed, 21

[PATCH 2/6] dfa: optimize alternation in NFA

2018-09-18 Thread Paul Eggert
From: Norihiro Tanaka Even when similar states exist in alternation, the DFA treats them as separate items, which may complicate the transition in NFA and cause slowdown. This change assembles the states into one. For example, ab|ac is changed into a(b|c). This change speeds-up matching for ma

Re: two (and a half) more crashes in regex module

2018-09-18 Thread Jim Meyering
On Tue, Sep 18, 2018 at 3:21 PM Assaf Gordon wrote: > On 12/09/18 12:02 AM, Assaf Gordon wrote: > > $ echo 1 | grep -E "(\'|^)(\1|)" > > grep: regexec.c:1375: pop_fail_stack: Assertion `num >= 0' failed. > > Aborted > > I don't have a fix yet, but I reduced the crash to this interesti

Re: two (and a half) more crashes in regex module

2018-09-18 Thread Assaf Gordon
Hello, On 12/09/18 12:02 AM, Assaf Gordon wrote:    $ echo 1 |  grep -E "(\'|^)(\1|)"    grep: regexec.c:1375: pop_fail_stack: Assertion `num >= 0' failed.    Aborted I don't have a fix yet, but I reduced the crash to this interesting case: $ echo 1 | grep -E '(^|$)\1' 1 $ echo 1 |

acl: small fix for Cygwin

2018-09-18 Thread Bruno Haible
On Cygwin 2.9, the test-file-has-acl*.sh tests fail. The reason is that Cygwin 2.5 has added ACL functions similar to the ones in Linux libacl, that behave mostly like the Linux ones, but not exactly. See https://cygwin.com/cygwin-ug-net/ov-new.html The gnulib code has appropriate #ifs that work

Re: Gnulib: please add a check for _MSC_VER < 1900 (was: stat für win32, patches for lib/stat.c, lib/stat-w32.c)

2018-09-18 Thread Bruno Haible
Hi Paul, > I assume you meant "is very rarely tested" and installed a patch to that > effect. Yes, thanks. Bruno

Re: Gnulib: please add a check for _MSC_VER < 1900 (was: stat für win32, patches for lib/stat.c, lib/stat-w32.c)

2018-09-18 Thread Paul Eggert
On 9/18/18 12:05 PM, Bruno Haible wrote: -IRIX 6.5 is no longer tested. +IRIX 6.5 is no very rarely tested. I assume you meant "is very rarely tested" and installed a patch to that effect. If I misread it, my apologies. PS. I stopped worrying about IRIX 6.5 in 2013 when SGI stopped supporti

stat-time tests: Fix test failure on Cygwin

2018-09-18 Thread Bruno Haible
On Cygwin 2.9, test-stat-time is failure: the assertion in nap.h line 152 is reached. This fixes it. 2018-09-18 Bruno Haible stat-time tests: Fix test failure on Cygwin. * tests/nap.h (nap_get_stat): Treat Cygwin like native Windows. diff --git a/tests/nap.h b/tests/nap.h ind

Re: [PATCH] timespec: new function current_timespec

2018-09-18 Thread Paul Eggert
On 9/18/18 11:37 AM, Bruno Haible wrote: What is this code good for? Nothing. Thanks, good catch. That code came from this FreeBSD man page: https://www.freebsd.org/cgi/man.cgi?query=nanotime&manpath=FreeBSD+11.2-RELEASE+and+Ports an earlier version of which I misread long ago as specifying a

Re: Gnulib: please add a check for _MSC_VER < 1900 (was: stat für win32, patches for lib/stat.c, lib/stat-w32.c)

2018-09-18 Thread Bruno Haible
[CCing bug-gnulib] Simon Sobisch wrote: > Bison's configure.ac nearly starts with: > > # Gnulib (early checks). > gl_EARLY > > I assume this is a general check, can you please add something like the > following to gl_EARLY? > > #ifdef _MSC_VER && _MSC_VER < 1900 > #error Visual Studio i

Re: [PATCH] timespec: new function current_timespec

2018-09-18 Thread Bruno Haible
Hi Paul, > +#elif HAVE_NANOTIME >nanotime (ts); > #else What is this code good for? As far as I can see, no platform has the 'nanotime' function. 1) According to my database of exported functions of shared libraries: $ ./show-portability nanotime MISSING in aix-4.3.2 aix-5.1.0 aix-

posix_spawn tests: Fix link error on 64-bit Cygwin

2018-09-18 Thread Bruno Haible
This patch fixes a link error on 64-bit Cygwin, seen within the 'gettext' package. It's related to and relies on . 2018-09-18 Bruno Haible posix_spawn tests: Fix link error on 64-bit Cygwin. * tests/test-posi