!17 fix build error caused by upgrading gcc to 12.3.0

From: @chen-jan 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
This commit is contained in:
openeuler-ci-bot 2023-07-13 12:05:43 +00:00 committed by Gitee
commit 8b7b5bf1ae
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 7dfe940d9a54d458e73c3485b53b8612cad6bb27 Mon Sep 17 00:00:00 2001
From: chen-jan <chen_aka_jan@163.com>
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 <ruby.h>
+#include <ruby/version.h> /* 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

View File

@ -0,0 +1,28 @@
From 76d5a9ec270a763c892ae28070e391cf99e0b7cd Mon Sep 17 00:00:00 2001
From: William S Fulton <wsf@fultondesigns.co.uk>
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

View File

@ -1,6 +1,6 @@
Name: swig Name: swig
Version: 4.0.2 Version: 4.0.2
Release: 5 Release: 6
Summary: Links C/C++/Objective C to languages for some advanced programing Summary: Links C/C++/Objective C to languages for some advanced programing
License: GPLv3+ and BSD License: GPLv3+ and BSD
URL: http://swig.sourceforge.net/ URL: http://swig.sourceforge.net/
@ -11,6 +11,8 @@ Patch1: backport-PCRE2.patch
Patch2: backport-Few-more-PCRE-to-PCRE2-changes.patch Patch2: backport-Few-more-PCRE-to-PCRE2-changes.patch
Patch3: backport-configure.ac-Add-missing-shell-quoting.patch Patch3: backport-configure.ac-Add-missing-shell-quoting.patch
Patch4: Backport-php-8-support-from-upstream.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: perl-interpreter pcre2-devel python3-devel autoconf automake gawk dos2unix
BuildRequires: gcc-c++ help2man perl-devel perl(base) perl(Config) perl(Devel::Peek) 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* %{_mandir}/man1/swig.1*
%changelog %changelog
* Thu Jul 13 2023 chenchen <chen_aka_jan@163.com> - 4.0.2-6
- fix build error caused by upgrading gcc to 12.3.0
* Mon Jun 05 2023 misaka00251 <liuxin@iscas.ac.cn> - 4.0.2-5 * Mon Jun 05 2023 misaka00251 <liuxin@iscas.ac.cn> - 4.0.2-5
- Type:enhancement - Type:enhancement
- ID:NA - ID:NA