If a machine has no PCRE, grep fails to build grep on it du to
-Werror=unused-variable with --enable-gcc-warnings. I found it on
Fedora 21 (GCC 4.9.2).
$ ./configure --enable-gcc-warnings
$ make
make all-recursive
make[1]: Entering directory '/usr/src/gnu/grep-2.21'
Making all in po
make[2]: Entering directory '/usr/src/gnu/grep-2.21/po'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/src/gnu/grep-2.21/po'
Making all in lib
make[2]: Entering directory '/usr/src/gnu/grep-2.21/lib'
make all-am
make[3]: Entering directory '/usr/src/gnu/grep-2.21/lib'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/usr/src/gnu/grep-2.21/lib'
make[2]: Leaving directory '/usr/src/gnu/grep-2.21/lib'
Making all in doc
make[2]: Entering directory '/usr/src/gnu/grep-2.21/doc'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/src/gnu/grep-2.21/doc'
Making all in src
make[2]: Entering directory '/usr/src/gnu/grep-2.21/src'
CC pcresearch.o
pcresearch.c:43:12: error: 'empty_match' defined but not used
[-Werror=unused-variable]
static int empty_match[2];
^
cc1: all warnings being treated as errors
Makefile:1314: recipe for target 'pcresearch.o' failed
make[2]: *** [pcresearch.o] Error 1
make[2]: Leaving directory '/usr/src/gnu/grep-2.21/src'
Makefile:1254: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/src/gnu/grep-2.21'
Makefile:1195: recipe for target 'all' failed
make: *** [all] Error 2
From e1dcf10ec448bfe8cfab183c88d453959fcec072 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email protected]>
Date: Fri, 12 Dec 2014 12:46:50 +0900
Subject: [PATCH] grep: fails to build grep on a machine which has no PCRE with
--enable-gcc-warnings
src/pcresearch.c: empty_match variable is covered with HAVE_LIBPCRE guard.
NEWS (Bug fixes): Add a new entry.
---
NEWS | 5 +++++
src/pcresearch.c | 2 ++
2 files changed, 7 insertions(+)
diff --git a/NEWS b/NEWS
index 6138c4e..e0d4b8d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU grep NEWS -*- outline
-*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug fixes
+
+ A warning is no longer output --enable-gcc-warnings even if build grep
+ on a machine which has no PCRE.
+ [bug introduced in grep-2.21]
* Noteworthy changes in release 2.21 (2014-11-23) [stable]
diff --git a/src/pcresearch.c b/src/pcresearch.c
index 5451029..36cf4dd 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -38,9 +38,11 @@ static pcre_extra *extra;
# endif
#endif
+#if HAVE_LIBPCRE
/* Table, indexed by ! (flag & PCRE_NOTBOL), of whether the empty
string matches when that flag is used. */
static int empty_match[2];
+#endif
/* This must be at least 2; everything after that is for performance
in pcre_exec. */
--
2.2.0