Apply upstream patches to fix C99 compatibility issue

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2022-12-22 12:39:03 +01:00
parent 48e84a78e9
commit 309453adb3
3 changed files with 75 additions and 1 deletions

31
radvd-c99-1.patch Normal file
View File

@ -0,0 +1,31 @@
commit ff7ab0cf445236f30e58531175ba912614fed952
Author: Sam James <sam@gentoo.org>
Date: Thu Nov 17 22:03:25 2022 +0000
Makefile.am: drop -Wno-implicit-function-declaration
1. Clang 16 makes -Wimplicit-function-declaration error by default
(and it's planned that GCC 14 will do the same) so we need to fix
the real problem. This is papering over it.
2. It's not true that there's nothing we can do about it. Fix in a follow-up
commit.
Bug: https://bugs.gentoo.org/880823
Fixes: b5e6b09cf914a960ac3b1676b77d3ea9f91821c7
Signed-off-by: Sam James <sam@gentoo.org>
diff --git a/Makefile.am b/Makefile.am
index 3a52e3a4abab088b..88b0c3514d265524 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,9 +66,6 @@ radvd_LDADD = \
scanner.c: gram.h
gram.h: gram.c
-libradvd_parser_a_CFLAGS = \
- -Wno-implicit-function-declaration
-
libradvd_parser_a_SOURCES = \
gram.h \
gram.y \

34
radvd-c99-2.patch Normal file
View File

@ -0,0 +1,34 @@
commit e0f5bcd9091a5f7abd423fce9f372c8079849a64
Author: Sam James <sam@gentoo.org>
Date: Thu Nov 17 22:03:25 2022 +0000
gram.y: Fix -Wimplicit-function-declaration
Clang 16 makes -Wimplicit-function-declaration an error by default.
For more information, see LWN.net [0] or LLVM's Discourse [1], the Gentoo wiki [2],
or the (new) c-std-porting mailing list [3].
[0] https://lwn.net/Articles/913505/
[1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
[2] https://wiki.gentoo.org/wiki/Modern_C_porting
[3] hosted at lists.linux.dev.
Bug: https://bugs.gentoo.org/880823
Signed-off-by: Sam James <sam@gentoo.org>
diff --git a/gram.y b/gram.y
index 4115390c249ab62b..2b142125e9dd05ae 100644
--- a/gram.y
+++ b/gram.y
@@ -20,6 +20,10 @@
#define YYERROR_VERBOSE 1
+int yylex (void);
+void yyset_in (FILE * _in_str);
+int yylex_destroy (void);
+
#if 0 /* no longer necessary? */
#ifndef HAVE_IN6_ADDR_S6_ADDR
# ifdef __FreeBSD__

View File

@ -1,13 +1,15 @@
Summary: A Router Advertisement daemon
Name: radvd
Version: 2.19
Release: 7%{?dist}
Release: 8%{?dist}
# The code includes the advertising clause, so it's GPL-incompatible
License: BSD with advertising
URL: http://www.litech.org/radvd/
Source0: %{url}dist/%{name}-%{version}.tar.xz
Source1: radvd.sysusers
Patch0: radvd-c99-1.patch
Patch1: radvd-c99-2.patch
BuildRequires: make
BuildRequires: gcc
@ -20,6 +22,8 @@ BuildRequires: systemd
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%{?sysusers_requires_compat}
BuildRequires: autoconf
BuildRequires: automake
%description
radvd is the router advertisement daemon for IPv6. It listens to router
@ -42,6 +46,7 @@ for F in CHANGES; do
done
%build
autoreconf -iv
export CFLAGS="$RPM_OPT_FLAGS -fPIE "
export LDFLAGS='-pie -Wl,-z,relro,-z,now,-z,noexecstack,-z,nodlopen'
%configure \
@ -94,6 +99,10 @@ make check
%{_sbindir}/radvdump
%changelog
* Thu Dec 22 2022 Florian Weimer <fweimer@redhat.com> - 2.19-8
- Apply upstream patches to fix C99 compatibility issue
- Run autoconf/automake during the build
* Thu Nov 03 2022 Martin Osvald <mosvald@redhat.com> - 2.19-7
- Use systemd-sysusers for radvd user and group (rhbz#2139755)