From bcffd8eddbbcab5b00f930805396be5fdb55c5a7 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 9 Jan 2023 18:02:05 +0100 Subject: [PATCH] C99 compatibility fixes Related to: --- libvisual-c99.patch | 45 +++++++ libvisual-configure-c99.patch | 217 ++++++++++++++++++++++++++++++++++ libvisual.spec | 11 +- 3 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 libvisual-c99.patch create mode 100644 libvisual-configure-c99.patch diff --git a/libvisual-c99.patch b/libvisual-c99.patch new file mode 100644 index 0000000..596ff09 --- /dev/null +++ b/libvisual-c99.patch @@ -0,0 +1,45 @@ +Includ "lv_cpu.h" for the visual_cpu_initialize, visual_cpu_get_sse, +visual_cpu_get_3dnow functions. Add a prototype for +visual_transform_init, so that it can be called before it is defined. + +Upstream has switched to C++, which does not support implicit +function declarations at all, so the issue has already been fixed +there. + +diff --git a/libvisual/lv_libvisual.c b/libvisual/lv_libvisual.c +index 8de03ebad7d499bb..e7ef768d421aa7fa 100644 +--- a/libvisual/lv_libvisual.c ++++ b/libvisual/lv_libvisual.c +@@ -30,6 +30,7 @@ + #include + + #include "lvconfig.h" ++#include "lv_cpu.h" + #include "lv_plugin.h" + #include "lv_actor.h" + #include "lv_input.h" +diff --git a/libvisual/lv_math.c b/libvisual/lv_math.c +index cfae316d0abc8c0d..f55c11854051f145 100644 +--- a/libvisual/lv_math.c ++++ b/libvisual/lv_math.c +@@ -29,6 +29,7 @@ + #include + + #include "lv_bits.h" ++#include "lv_cpu.h" + #include "lv_math.h" + + /* This file is getting big and bloated because of the large chunks of simd code. When all is in place we'll take a serious +diff --git a/libvisual/lv_transform.c b/libvisual/lv_transform.c +index c763768c0fbb757a..58fe15fa57d2e783 100644 +--- a/libvisual/lv_transform.c ++++ b/libvisual/lv_transform.c +@@ -35,6 +35,8 @@ + #include "lv_transform.h" + #include "lv_mem.h" + ++int visual_transform_init (VisTransform *transform, const char *transformname); ++ + extern VisList *__lv_plugins_transform; + + static int transform_dtor (VisObject *object); diff --git a/libvisual-configure-c99.patch b/libvisual-configure-c99.patch new file mode 100644 index 0000000..dc19809 --- /dev/null +++ b/libvisual-configure-c99.patch @@ -0,0 +1,217 @@ +Avoid implicit function declartions in the configure script, to +improve compatibility with future compilers. + +The “check_me != 42” part is not generic and would have to be +upstreamed, but upstream has switched to CMake and no longer uses +this test, it seems. + +diff --git a/aclocal.m4 b/aclocal.m4 +index 14cd8f3560139cbb..ab8170ee0185c72a 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -1655,10 +1655,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -1672,7 +1668,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + }] + EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then +diff --git a/configure b/configure +index c4994911e224154f..3da8071a1c029507 100755 +--- a/configure ++++ b/configure +@@ -3408,7 +3408,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ +- '' \ ++ '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ +@@ -5060,8 +5060,8 @@ main () + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) +- exit(2); +- exit (0); ++ return 2; ++ return 0; + } + _ACEOF + rm -f conftest$ac_exeext +@@ -9369,10 +9369,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -9386,7 +9382,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -9467,10 +9463,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -9484,7 +9476,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -13163,10 +13155,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -13180,7 +13168,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -13261,10 +13249,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -13278,7 +13262,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -18926,10 +18910,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -18943,7 +18923,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -19024,10 +19004,6 @@ else + # endif + #endif + +-#ifdef __cplusplus +-extern "C" void exit (int); +-#endif +- + void fnord() { int i=42;} + int main () + { +@@ -19041,7 +19017,7 @@ int main () + /* dlclose (self); */ + } + +- exit (status); ++ return status; + } + EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +@@ -20546,8 +20522,8 @@ main () + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) +- exit(2); +- exit (0); ++ return 2; ++ return 0; + } + _ACEOF + rm -f conftest$ac_exeext +@@ -24621,7 +24597,7 @@ int main() + void *ret; + pthread_create (&t, $defattr, func, 0); + pthread_join (t, &ret); +- exit (check_me != 42 || ret != &check_me); ++ return check_me != 42 || ret != &check_me; + } + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext +@@ -24671,7 +24647,7 @@ int main() + void *ret; + pthread_create (&t, $defattr, func, 0); + pthread_join (t, &ret); +- exit (check_me != 42 || ret != &check_me); ++ return check_me != 42 || ret != &check_me; + } + _ACEOF + rm -f conftest$ac_exeext +diff --git a/configure.ac b/configure.ac +index 71d577304a2e5c6f..8cc30b4483a05a48 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -173,7 +173,7 @@ int main() + void *ret; + pthread_create (&t, $1, func, 0); + pthread_join (t, &ret); +- exit (check_me != 42 || ret != &check_me); ++ return check_me != 42 || ret != &check_me; + }]) + + LIBS_NOT_FOUND_1="I can't find the libraries for the thread implementation diff --git a/libvisual.spec b/libvisual.spec index c4c7bab..a804cbb 100644 --- a/libvisual.spec +++ b/libvisual.spec @@ -2,7 +2,7 @@ Name: libvisual Version: 0.4.0 -Release: 36%{?dist} +Release: 37%{?dist} Epoch: 1 Summary: Abstraction library for audio visualisation plugins License: LGPLv2+ @@ -16,6 +16,8 @@ Patch0: libvisual-0.4.0-better-altivec-detection.patch Patch1: libvisual-0.4.0-inlinedefineconflict.patch Patch2: libvisual-0.4.0-format-security.patch Patch3: libvisual-0.4.0-respect-environment-ldflags.patch +Patch4: libvisual-configure-c99.patch +Patch5: libvisual-c99.patch %description Libvisual is an abstraction library that comes between applications and @@ -46,6 +48,10 @@ This package contains the files needed to build an application with libvisual. %patch1 -p1 -b .inlinedefineconflict %patch2 -p1 -b .format-security %patch3 -p1 -b .ldflags +%patch4 -p1 +%patch5 -p1 +# Prevent re-building the autotools scripts. +touch -r aclocal.m4 configure* %build %global optflags %{optflags} -fno-strict-aliasing @@ -109,6 +115,9 @@ find %{buildroot} -type f -name "*.la" -exec rm -f {} ';' %changelog +* Mon Jan 09 2023 Florian Weimer - 1:0.4.0-37 +- C99 compatibility fixes + * Thu Jul 21 2022 Fedora Release Engineering - 1:0.4.0-36 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild