Fix C99 compatibility issue

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>

Upstream commit:
  300b460970
This commit is contained in:
DJ Delorie 2023-02-21 00:39:04 -05:00
parent 5129b23286
commit c555c50533
2 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,72 @@
From 300b460970f538ab515835f14650785e88808a8f Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 4 Nov 2022 04:04:46 +0000
Subject: acinclude.m4: fix -Wimplicit-function-declaration
-Wimplicit-function-declaration will become an error by default
in Clang 16.
Fixes errors like:
```
error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
```
Signed-off-by: Sam James <sam@gentoo.org>
DJ: Added pre-configure'd configure
diff --git a/acinclude.m4 b/acinclude.m4
index df8abe148..71e22c8d4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -471,6 +471,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
if test "$ipv6" != "no" ; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define INET6
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h> ]], [[
/* AF_INET6 available check */
@@ -492,6 +493,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
AC_MSG_CHECKING([whether struct sockaddr_storage has an ss_family member])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define INET6
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h> ]], [[
/* test if the ss_family member exists in struct sockaddr_storage */
@@ -504,6 +506,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define INET6
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h> ]], [[
/* test if the __ss_family member exists in struct sockaddr_storage */
diff -rup a/configure b/configure
--- a/configure 2023-02-05 21:12:47.000000000 -0500
+++ b/configure 2023-02-20 21:21:46.496776406 -0500
@@ -25824,6 +25824,7 @@ fi
/* end confdefs.h. */
#define INET6
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
int
@@ -25866,6 +25867,7 @@ $as_echo_n "checking whether struct sock
/* end confdefs.h. */
#define INET6
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
int
@@ -25895,6 +25897,7 @@ else
/* end confdefs.h. */
#define INET6
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
int

View File

@ -18,7 +18,7 @@
Summary: Scanner access software
Name: sane-backends
Version: 1.2.1
Release: 1%{?dist}
Release: 2%{?dist}
# lib/ is LGPLv2+, backends are GPLv2+ with exceptions
# Tools are GPLv2+, docs are public domain
# see LICENSE for details
@ -43,6 +43,8 @@ Patch2: sane-backends-1.0.23-sane-config-multilib.patch
# 2139882 - Plustek 8100 scanner not detected
# sent upstream as https://gitlab.com/sane-project/backends/-/merge_requests/767
Patch3: sane-genesys-plustek7600i-8100-support.patch
# Fix for c99
Patch4: sane-backends-1.2.1-fedora-c99.patch
URL: http://www.sane-project.org
@ -164,6 +166,8 @@ access image acquisition devices available on the local host.
%prep
%autosetup -S git
# To avoid needing to run aclocal et al
touch -r acinclude.m4 aclocal.m4 configure Makefile.in
%build
CFLAGS="%optflags -fno-strict-aliasing"
@ -386,6 +390,9 @@ udevadm hwdb --update >/dev/null 2>&1 || :
%{_unitdir}/saned@.service
%changelog
* Tue Feb 21 2023 DJ Delorie <dj@redhat.com> - 1.2.1-2
- Fix C99 compatibility issue
* Fri Feb 17 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1.2.1-1
- 2167250 - sane-backends-1.2.1 is available