Fix C99 compatibility issue in the configure script

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2023-01-03 15:52:33 +01:00
parent d45159f404
commit e9c80f0c51
2 changed files with 51 additions and 1 deletions

46
grep-configure-c99.patch Normal file
View File

@ -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 <zackw@panix.com>
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): Dont 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

View File

@ -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 <fweimer@redhat.com> - 3.8-2
- Fix C99 compatibility issue in the configure script
* Mon Sep 5 2022 Jaroslav Škarvada <jskarvad@redhat.com> - 3.8-1
- New version
Resolves: rhbz#2123935