Backport upstream patch 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 2023-04-17 14:22:40 +02:00
parent 965f5d3878
commit f35612dc80
2 changed files with 46 additions and 1 deletions

41
Singular-c99.patch Normal file
View File

@ -0,0 +1,41 @@
commit b6647a741b9091b82021ff46d4c112099d175d57
Author: Michael Orlitzky <michael@orlitzky.com>
Date: Thu Nov 10 20:59:00 2022 -0500
omalloc/omAllocSystem.c: add another include for malloc.h.
There are two branches in this file, one for HAVE_MALLOC_SIZE and one
for HAVE_MALLOC_USABLE_SIZE. The former includes malloc.h, and the
latter needs to too; otherwise, malloc_usable_size() is undefined.
This is caught by -Werror=implicit-function-declaration, which is
likely to be enabled by default in future versions of GCC and clang.
diff --git a/omalloc/omAllocSystem.c b/omalloc/omAllocSystem.c
index b70a6292acf8ed80..62e20a57b8b53472 100644
--- a/omalloc/omAllocSystem.c
+++ b/omalloc/omAllocSystem.c
@@ -30,15 +30,19 @@
*
*******************************************************************/
/* allocation of large addr */
-#if defined(HAVE_MALLOC_SIZE)
+
+#if defined(HAVE_MALLOC_SIZE) || defined(HAVE_MALLOC_USABLE_SIZE)
+ #include <stdlib.h>
#ifdef HAVE_MALLOC_H
- #include <malloc.h>
+ #include <malloc.h>
#elif defined(HAVE_MALLOC_MALLOC_H)
- #include <malloc/malloc.h>
+ #include <malloc/malloc.h>
#endif
+#endif
+
+#if defined(HAVE_MALLOC_SIZE)
#define _omSizeOfLargeAddr(addr) (malloc_size(addr))
#elif defined(HAVE_MALLOC_USABLE_SIZE)
- #include <stdlib.h>
#define _omSizeOfLargeAddr(addr) (malloc_usable_size(addr))
#else
void* omAllocLarge(size_t size)

View File

@ -16,7 +16,7 @@
Name: Singular
Version: %{downstreamver}%{?patchver}
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Computer Algebra System for polynomial computations
# License analysis:
# - The project as a whole is GPL-2.0-only OR GPL-3.0-only
@ -123,6 +123,7 @@ Patch12: %{name}-type-mismatch.patch
Patch13: %{name}-endian.patch
# Disable examples that use the network to avoid hangs on the koji builders
Patch14: %{name}-doc-hang.patch
Patch15: Singular-c99.patch
%description
Singular is a computer algebra system for polynomial computations, with
@ -457,6 +458,9 @@ make check
%changelog
* Mon Apr 17 2023 Florian Weimer <fweimer@redhat.com> - 4.3.1p1-3
- Backport upstream patch to fix C99 compatibility issue
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.1p1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild