diff --git a/0001-Ruby-Fix-deprecation-warnings-with-Ruby-3.x.patch b/0001-Ruby-Fix-deprecation-warnings-with-Ruby-3.x.patch new file mode 100644 index 0000000000000000000000000000000000000000..e80fe28a4add0f672e8cd86951825ac1de4b0d71 --- /dev/null +++ b/0001-Ruby-Fix-deprecation-warnings-with-Ruby-3.x.patch @@ -0,0 +1,45 @@ +From 7dfe940d9a54d458e73c3485b53b8612cad6bb27 Mon Sep 17 00:00:00 2001 +From: chen-jan +Date: Thu, 13 Jul 2023 17:07:22 +0800 +Subject: [PATCH] Ruby-Fix-deprecation-warnings-with-Ruby-3.x + +reference: https://github.com/swig/swig/commit/7dfe940d9a54d458e73c3485b53b8612cad6bb27 +--- + Lib/ruby/rubyhead.swg | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg +index bf4e362..42871ce 100644 +--- a/Lib/ruby/rubyhead.swg ++++ b/Lib/ruby/rubyhead.swg +@@ -1,4 +1,5 @@ + #include ++#include /* For RUBY_API_VERSION_CODE */ + + /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which + * breaks using rb_intern as an lvalue, as SWIG does. We work around this +@@ -100,9 +101,9 @@ + /* + * The following macros are used for providing the correct type of a + * function pointer to the Ruby C API. +- * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being +- * defined) these macros act transparently due to Ruby's moving away from +- * ANYARGS and instead employing strict function signatures. ++ * ++ * Starting with Ruby 2.7 these macros act transparently due to Ruby's moving ++ * moving away from ANYARGS and instead employing strict function signatures. + * + * Note: In case of C (not C++) the macros are transparent even before + * Ruby 2.7 due to the fact that the Ruby C API used function declarators +@@ -126,7 +127,7 @@ + * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like st_foreach(). + */ +-#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL) ++#if defined(__cplusplus) && RUBY_API_VERSION_CODE < 20700 + # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) + # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) + # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) +-- +2.39.1 + diff --git a/0001-gcc-12-warning-fix-in-test-case.patch b/0001-gcc-12-warning-fix-in-test-case.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc8b9a5fd0e7233f981649b1049e1d2c38229f0d --- /dev/null +++ b/0001-gcc-12-warning-fix-in-test-case.patch @@ -0,0 +1,28 @@ +From 76d5a9ec270a763c892ae28070e391cf99e0b7cd Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Tue, 18 Jan 2022 21:37:02 +0000 +Subject: [PATCH] gcc-12 warning fix in test-case + +Closes #2145 + +reference: https://github.com/swig/swig/commit/76d5a9ec270a763c892ae28070e391cf99e0b7cd +--- + Examples/test-suite/nested_class.i | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Examples/test-suite/nested_class.i b/Examples/test-suite/nested_class.i +index b10c33949..c778a12cf 100644 +--- a/Examples/test-suite/nested_class.i ++++ b/Examples/test-suite/nested_class.i +@@ -201,7 +201,7 @@ struct Outer { + Integer xx; + } MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2]; + +-#if defined(__GNUC__) || defined(_MSC_VER) || defined(SWIG) ++#if (defined(__GNUC__) && __GNUC__ < 12) || defined(_MSC_VER) || defined(SWIG) + /* some compilers do not accept these */ + struct : public InnerMultiple { + Integer xx; +-- +2.39.1 + diff --git a/swig.spec b/swig.spec index eaecab5f7365ae746c03e693a88781000d1fafd1..d5d9c9094271695bf40cc5ef595cdaec47aced94 100644 --- a/swig.spec +++ b/swig.spec @@ -1,6 +1,6 @@ Name: swig Version: 4.0.2 -Release: 5 +Release: 6 Summary: Links C/C++/Objective C to languages for some advanced programing License: GPLv3+ and BSD URL: http://swig.sourceforge.net/ @@ -11,6 +11,8 @@ Patch1: backport-PCRE2.patch Patch2: backport-Few-more-PCRE-to-PCRE2-changes.patch Patch3: backport-configure.ac-Add-missing-shell-quoting.patch Patch4: Backport-php-8-support-from-upstream.patch +Patch5: 0001-Ruby-Fix-deprecation-warnings-with-Ruby-3.x.patch +Patch6: 0001-gcc-12-warning-fix-in-test-case.patch BuildRequires: perl-interpreter pcre2-devel python3-devel autoconf automake gawk dos2unix BuildRequires: gcc-c++ help2man perl-devel perl(base) perl(Config) perl(Devel::Peek) @@ -104,6 +106,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_mandir}/man1/swig.1* %changelog +* Thu Jul 13 2023 chenchen - 4.0.2-6 +- fix build error caused by upgrading gcc to 12.3.0 + * Mon Jun 05 2023 misaka00251 - 4.0.2-5 - Type:enhancement - ID:NA