grep: -P now rejects invalid input sequences in UTF-8 locales

See <http://bugs.gnu.org/17245> and <http://bugs.exim.org/1468>.
* NEWS: Document this.
* src/pcresearch.c (Pexecute): Do not use PCRE_NO_UTF8_CHECK,
as this leads to undefined behavior when the input is not UTF-8.
* tests/pcre-infloop, tests/pcre-invalid-utf8-input:
Exit status is now 2, not 1, when grep -P is given invalid UTF-8
data in a UTF-8 locale.
grep: may also use Boyer-Moore algorithm for case-insensitive matching

* src/kwset.c (BM_DELTA2_SEARCH, LAST_SHIFT, TRANS): New macro.
(bmexec): Use character translation table.
(kwsexec): Call bmexec for case-insensitive matching.
(kwsprep): Change the `if' condition.
kwset: simplify Boyer-Moore with unibyte -i

This change doesn't significantly affect performance on my platform,
and should make the code easier to maintain.
* src/kwset.c (BM_DELTA2_SEARCH, LAST_SHIFT, TRANS):
Remove these macros, in favor of ...
(tr, bm_delta2_search): New functions.  All uses changed.
The latter function is inline because this improves code size and
runtime CPU slightly on x86-64 with gcc -O2 (GCC 4.9.0).
(bmexec): Prefer tr when that's simpler.
grep: speed-up by using memchr() in Boyer-Moore searching

memchr() of glibc is faster than seeking by delta1 on some platforms.
When there is no chance to match for a while, use it on them.
* src/kwset.c (bmexec): Use memchr() in Boyer-Moore searching.
kwset: simplify and speed up Boyer-Moore unibyte -i in some cases

This improves the performance of, for example,
yes jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj | head -10000000 | grep -i jk
in a unibyte locale.
* src/kwset.c (memchr_trans): New function.
(bmexec): Use it.  Simplify the code and remove some of the
confusing gotos and breaks and labels.  Do not treat glibc memchr
as a special case; if non-glibc memchr is slow, that is lower
priority and I suppose we can try to work around the problem in
gnulib.
dfa: omit static variables that limited dfaexec to one struct dfa

Problem reported by Aharon Robbins in: http://bugs.gnu.org/17328
* src/dfa.c (struct dfa): New member mbs.
mb_follows is now a position_set, not a pointer to one;
this simplifies memory allocation.  All uses changed.
(mbs_to_wchar): Put DFA arg at the end, in place of the mbstate_t *arg,
since the DFA now contains an mbstate_t.  All uses changed.
(mbs): Remove static variable.
(dfaexec): Remove static bool that attempted to optimize memory
allocation, as this wasn't correct for Gawk.  Perhaps we can think
of a better way to optimize memory.
tests: use consistent spelling for locale name, en_US.UTF-8

* tests/pcre-infloop: Spell locale name, en_US.UTF-8, consistently,
converting this one use from "en_US.utf8", which would provoke a
test failure on OS/X.
dfa: fix memory leak reintroduced by previous patch

Reported by Norihiro Tanaka in <http://bugs.gnu.org/17328#16>.
* src/dfa.c (dfaexec): Allocate mb_match_lens and mb_follows only
if not already allocated.
(free_mbdata): Null out mb_match_lens to mark it as being freed.
build: suppress unsafe-loop-optimizations warnings

I ran into one of these while trying out GCC 4.9.0's new
-fsanitize=undefined option.  The warning told me that GCC didn't
do an unsafe optimization, but in 'grep' this is not typically a
symptom of a programming error.
* configure.ac (WERROR_CFLAGS): Suppress -Wunsafe-loop-optimizations.