diff --git a/grep-configure-c99.patch b/grep-configure-c99.patch new file mode 100644 index 0000000..11a6516 --- /dev/null +++ b/grep-configure-c99.patch @@ -0,0 +1,46 @@ +Work around a recent regression in C99 compatibility in autoconf. +The configure script was generated with an autoconf prerelease, +and the issue has been fixed upstream with this commit: + +commit bf5a75953b6d504f0405b1ca33b039b8dd39eef4 +Author: Zack Weinberg +Date: Thu Nov 10 12:05:30 2022 -0500 + + More fixes for compilers that reject K&R function definitions. + + This fixes all of the remaining failures exposed by running the + testsuite with GCC 12 and + CC='cc -Wimplicit-function-declaration -Wold-style-definition + -Wimplicit-int -Werror' + . + + * lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Don’t use K&R function + definitions. + * lib/autoconf/specific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise. + (AC_FUNC_MKTIME): Declare functions taking no arguments as ‘fn (void)’ + not ‘fn ()’. + * lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): Declare free(). + +diff --git a/configure b/configure +index 51bd10995a6f57e8..4bdd3ecca7d2c793 100755 +--- a/configure ++++ b/configure +@@ -3954,9 +3954,7 @@ struct stat; + /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ + struct buf { int x; }; + struct buf * (*rcsopen) (struct buf *, struct stat *, int); +-static char *e (p, i) +- char **p; +- int i; ++static char *e (char **p, int i) + { + return p[i]; + } +@@ -4007,6 +4005,7 @@ extern int puts (const char *); + extern int printf (const char *, ...); + extern int dprintf (int, const char *, ...); + extern void *malloc (size_t); ++extern void free (void *); + + // Check varargs macros. These examples are taken from C99 6.10.3.5. + // dprintf is used instead of fprintf to avoid needing to declare diff --git a/grep.spec b/grep.spec index ffa10dc..3953e13 100644 --- a/grep.spec +++ b/grep.spec @@ -1,7 +1,7 @@ Summary: Pattern matching utilities Name: grep Version: 3.8 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: https://www.gnu.org/software/grep/ @@ -12,6 +12,7 @@ Source3: GREP_COLORS Source4: grepconf.sh # upstream ticket 39445 Patch0: grep-3.5-help-align.patch +Patch1: grep-configure-c99.patch BuildRequires: gcc BuildRequires: pcre2-devel @@ -83,6 +84,9 @@ make check %{_libexecdir}/grepconf.sh %changelog +* Tue Jan 3 2023 Florian Weimer - 3.8-2 +- Fix C99 compatibility issue in the configure script + * Mon Sep 5 2022 Jaroslav Škarvada - 3.8-1 - New version Resolves: rhbz#2123935