From 5a53f0765316cb20f06256356b81e8da6fcf7a70 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 23 Jan 2024 12:50:48 +0100 Subject: [PATCH] 4.2.0 bump (rhbz#2256296) --- .gitignore | 1 + sources | 2 +- ...ndling-friend-constructor-destructor.patch | 105 ++++++++ swig-Friends-testcase-fix.patch | 30 +++ ...tor_classes-testcase-failures-on-x86.patch | 228 ------------------ ...case-director_finalizer-with-PHP-8.3.patch | 40 --- ...n-fix-add-in-missing-SwigPyIterator_.patch | 39 +++ swig-Ruby-Adjust-external-runtime-fix.patch | 108 +++++++++ ...Ruby-Tcl-Fix-external-runtime-output.patch | 90 +++++++ swig-configure-c99.patch | 52 ---- swig-octave-8.1.patch | 81 ------- swig-python-3.12.patch | 22 -- swig.spec | 30 ++- 13 files changed, 391 insertions(+), 437 deletions(-) create mode 100644 swig-Fix-seg-fault-handling-friend-constructor-destructor.patch create mode 100644 swig-Friends-testcase-fix.patch delete mode 100644 swig-PHP-Fix-director_classes-testcase-failures-on-x86.patch delete mode 100644 swig-PHP-Fix-testcase-director_finalizer-with-PHP-8.3.patch create mode 100644 swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch create mode 100644 swig-Ruby-Adjust-external-runtime-fix.patch create mode 100644 swig-Ruby-Tcl-Fix-external-runtime-output.patch delete mode 100644 swig-configure-c99.patch delete mode 100644 swig-octave-8.1.patch delete mode 100644 swig-python-3.12.patch diff --git a/.gitignore b/.gitignore index 7e4e128..d3d48ad 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ swig-2.0.0.tar.gz /swig-4.0.2.tar.gz /swig-4.1.0.tar.gz /swig-4.1.1.tar.gz +/swig-4.2.0.tar.gz diff --git a/sources b/sources index fbb7d4d..6c6bc19 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (swig-4.1.1.tar.gz) = 1cea1918455a75ebc9b2653dd1715bd5dcd974554955f324295c6a6f14c0a715651b221b85fad4a8af5197e0c75bfe7b590bc6ba7178c26245fbbd9a7e110100 +SHA512 (swig-4.2.0.tar.gz) = b7f508b25bc6e882ed6123f6c7ad12b02a7b74de09ac6e5789968e9c2f51407d1e3dafd5ea495087b4fb0f447ecce17e6070471479c67c4265166d8342a10862 diff --git a/swig-Fix-seg-fault-handling-friend-constructor-destructor.patch b/swig-Fix-seg-fault-handling-friend-constructor-destructor.patch new file mode 100644 index 0000000..2ebc211 --- /dev/null +++ b/swig-Fix-seg-fault-handling-friend-constructor-destructor.patch @@ -0,0 +1,105 @@ +From c7ab6a01c6582b92db9328e2f3daa67081f05f6e Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Fri, 12 Jan 2024 08:45:26 +0000 +Subject: [PATCH] Fix seg fault handling friend constructor/destructor + declarations + +Closes #2749 +--- + CHANGES.current | 3 ++ + Examples/test-suite/friends.i | 34 +++++++++++++++++++++++ + Examples/test-suite/php/friends_runme.php | 2 +- + Source/CParse/parser.y | 5 +++- + 4 files changed, 42 insertions(+), 2 deletions(-) + +#diff --git a/CHANGES.current b/CHANGES.current +#index 030aa0b19..f235d9a09 100644 +#--- a/CHANGES.current +#+++ b/CHANGES.current +#@@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ +# Version 4.2.1 (in progress) +# =========================== +# +#+2024-01-12: wsfulton +#+ #2749 Fix seg fault handling friend constructor/destructor declarations. +#+ +# 2024-01-12: olly +# [Ruby,Tcl] #2751 Fix -external-runtime output to define +# SWIG_snprintf (bug introduced in 4.2.0). +diff --git a/Examples/test-suite/friends.i b/Examples/test-suite/friends.i +index a2a5151e0..879f3b3bc 100644 +--- a/Examples/test-suite/friends.i ++++ b/Examples/test-suite/friends.i +@@ -148,6 +148,40 @@ + } + } + ++%inline %{ ++ class CModelParameterSpecies; ++ class CModelParameterCompartment { ++ CModelParameterSpecies *species; ++ public: ++ int getSpeciesVal(); ++ CModelParameterCompartment(); ++ ~CModelParameterCompartment(); ++ }; ++ class CModelParameterSpecies ++ { ++ int private_val; ++ public: ++ // Friend function-declarations are silently ignored (including constructor and destructor declarations) ++ friend CModelParameterCompartment::~CModelParameterCompartment(); ++ friend CModelParameterCompartment::CModelParameterCompartment(); ++ friend int CModelParameterCompartment::getSpeciesVal(); ++ }; ++%} ++ ++%{ ++CModelParameterCompartment::~CModelParameterCompartment() { ++ species = new CModelParameterSpecies(); ++ species->private_val = 1; ++} ++CModelParameterCompartment::CModelParameterCompartment() { ++ species->private_val = 0; ++ delete species; ++} ++int CModelParameterCompartment::getSpeciesVal() { ++ return species->private_val; ++} ++%} ++ + // Use this version with extra qualifiers to test SWIG as some compilers accept this + namespace ns1 { + namespace ns2 { +diff --git a/Examples/test-suite/php/friends_runme.php b/Examples/test-suite/php/friends_runme.php +index f0ef5df58..2e5d3b1fd 100644 +--- a/Examples/test-suite/php/friends_runme.php ++++ b/Examples/test-suite/php/friends_runme.php +@@ -3,7 +3,7 @@ + require "tests.php"; + + check::functions(array('globalscope','mix','get_val2','get_val3','bas','baz','bar','get_val1','set')); +-check::classes(array('friends','Foo','A','B','D_i','D_d')); ++check::classes(array('friends','Foo','A','B','D_i','D_d','CModelParameterCompartment','CModelParameterSpecies')); + // No new vars + check::globals(array()); + +diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y +index e5a79f128..edf38c360 100644 +--- a/Source/CParse/parser.y ++++ b/Source/CParse/parser.y +@@ -4732,7 +4732,10 @@ cpp_member : cpp_member_no_dox + */ + + cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { +- if (inclass || extendmode) { ++ /* Cannot be a constructor declaration/definition if parsed as a friend destructor/constructor ++ or a badly declared friend function without return type */ ++ int isfriend = Strstr($1, "friend") != NULL; ++ if (!isfriend && (inclass || extendmode)) { + String *name = SwigType_templateprefix($2); /* A constructor can optionally be declared with template parameters before C++20, strip these off */ + SwigType *decl = NewStringEmpty(); + $$ = new_node("constructor"); +-- +2.43.0 + diff --git a/swig-Friends-testcase-fix.patch b/swig-Friends-testcase-fix.patch new file mode 100644 index 0000000..7862c55 --- /dev/null +++ b/swig-Friends-testcase-fix.patch @@ -0,0 +1,30 @@ +From 2d39d558734cd49b960410c8894b76aa59af60cc Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Tue, 16 Jan 2024 08:24:46 +0000 +Subject: [PATCH] Friends testcase fix + +--- + Examples/test-suite/friends.i | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Examples/test-suite/friends.i b/Examples/test-suite/friends.i +index e37a8c11f..0efffd1cb 100644 +--- a/Examples/test-suite/friends.i ++++ b/Examples/test-suite/friends.i +@@ -166,11 +166,11 @@ + %} + + %{ +-CModelParameterCompartment::~CModelParameterCompartment() { ++CModelParameterCompartment::CModelParameterCompartment() { + species = new CModelParameterSpecies(); + species->private_val = 1; + } +-CModelParameterCompartment::CModelParameterCompartment() { ++CModelParameterCompartment::~CModelParameterCompartment() { + species->private_val = 0; + delete species; + } +-- +2.43.0 + diff --git a/swig-PHP-Fix-director_classes-testcase-failures-on-x86.patch b/swig-PHP-Fix-director_classes-testcase-failures-on-x86.patch deleted file mode 100644 index 5a8ced4..0000000 --- a/swig-PHP-Fix-director_classes-testcase-failures-on-x86.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 5f8b9135cc2de52369a509792db578156368932f Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Sun, 19 Nov 2023 21:26:28 +1300 -Subject: [PATCH] Fix director_classes testcase failures on x86 - -Adjust the floating point constants to be 1.125 and 2.25 (which -can be exactly represented in base-2 floating point) instead of -1.1 and 2.2 (which can't). This avoids problems on platforms where -floating point calculations suffer from excess precision, the most -commonly used of which is x86 when using 387 FP instructions. ---- - .../test-suite/csharp/director_classes_runme.cs | 16 ++++++++-------- - Examples/test-suite/d/director_classes_runme.2.d | 16 ++++++++-------- - Examples/test-suite/director_classes.i | 8 ++++---- - .../test-suite/java/director_classes_runme.java | 16 ++++++++-------- - .../test-suite/php/director_classes_runme.php | 2 +- - 5 files changed, 29 insertions(+), 29 deletions(-) - -diff --git a/Examples/test-suite/csharp/director_classes_runme.cs b/Examples/test-suite/csharp/director_classes_runme.cs -index cea4949c6..25bb35968 100644 ---- a/Examples/test-suite/csharp/director_classes_runme.cs -+++ b/Examples/test-suite/csharp/director_classes_runme.cs -@@ -21,8 +21,8 @@ Base - FullyOverloaded(int 10) - Base - FullyOverloaded(bool 1) - Base - SemiOverloaded(int -678) - Base - SemiOverloaded(bool 1) --Base - DefaultParms(10, 2.2) --Base - DefaultParms(10, 1.1) -+Base - DefaultParms(10, 2.25) -+Base - DefaultParms(10, 1.125) - -------------------------------- - Derived - Val(444.555) - Derived - Ref(444.555) -@@ -32,8 +32,8 @@ Derived - FullyOverloaded(int 10) - Derived - FullyOverloaded(bool 1) - Derived - SemiOverloaded(int -678) - Base - SemiOverloaded(bool 1) --Derived - DefaultParms(10, 2.2) --Derived - DefaultParms(10, 1.1) -+Derived - DefaultParms(10, 2.25) -+Derived - DefaultParms(10, 1.125) - -------------------------------- - CSharpDerived - Val(444.555) - CSharpDerived - Ref(444.555) -@@ -43,8 +43,8 @@ CSharpDerived - FullyOverloaded(int 10) - CSharpDerived - FullyOverloaded(bool True) - CSharpDerived - SemiOverloaded(-678) - Base - SemiOverloaded(bool 1) --CSharpDerived - DefaultParms(10, 2.2) --CSharpDerived - DefaultParms(10, 1.1) -+CSharpDerived - DefaultParms(10, 2.25) -+CSharpDerived - DefaultParms(10, 1.125) - ------------ Finish ------------ - */ - -@@ -113,7 +113,7 @@ public class runme - if (myCaller.SemiOverloadedCall(true) != "Base" + "::SemiOverloaded(bool)") throw new Exception("failed"); - - // Default parameters methods test -- if (NAMESPACE + myCaller.DefaultParmsCall(10, 2.2) != myBase.GetType() + "::DefaultParms(int, double)") throw new Exception("failed"); -+ if (NAMESPACE + myCaller.DefaultParmsCall(10, 2.25) != myBase.GetType() + "::DefaultParms(int, double)") throw new Exception("failed"); - if (myBase.GetType() == typeof(CSharpDerived)) { // special handling for C# derived classes, there is no way to do this any other way - if (NAMESPACE + myCaller.DefaultParmsCall(10) != myBase.GetType() + "::DefaultParms(int, double)") throw new Exception("failed"); - } else { -@@ -182,7 +182,7 @@ public class CSharpDerived : Base - public override String DefaultParms(int x) - { - if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - DefaultParms({0})", x); -- return DefaultParms(x, 1.1/*use C++ default here*/); -+ return DefaultParms(x, 1.125/*use C++ default here*/); - } - } - -diff --git a/Examples/test-suite/d/director_classes_runme.2.d b/Examples/test-suite/d/director_classes_runme.2.d -index b16fa5461..5e9588b31 100644 ---- a/Examples/test-suite/d/director_classes_runme.2.d -+++ b/Examples/test-suite/d/director_classes_runme.2.d -@@ -23,8 +23,8 @@ - * Base - FullyOverloaded(bool 1) - * Base - SemiOverloaded(int -678) - * Base - SemiOverloaded(bool 1) -- * Base - DefaultParms(10, 2.2) -- * Base - DefaultParms(10, 1.1) -+ * Base - DefaultParms(10, 2.25) -+ * Base - DefaultParms(10, 1.125) - * -------------------------------- - * Derived - Val(444.555) - * Derived - Ref(444.555) -@@ -34,8 +34,8 @@ - * Derived - FullyOverloaded(bool 1) - * Derived - SemiOverloaded(int -678) - * Base - SemiOverloaded(bool 1) -- * Derived - DefaultParms(10, 2.2) -- * Derived - DefaultParms(10, 1.1) -+ * Derived - DefaultParms(10, 2.25) -+ * Derived - DefaultParms(10, 1.125) - * -------------------------------- - * DDerived - Val(444.555) - * DDerived - Ref(444.555) -@@ -45,8 +45,8 @@ - * DDerived - FullyOverloaded(bool true) - * DDerived - SemiOverloaded(-678) - * Base - SemiOverloaded(bool 1) -- * DDerived - DefaultParms(10, 2.2) -- * DDerived - DefaultParms(10, 1.1) -+ * DDerived - DefaultParms(10, 2.25) -+ * DDerived - DefaultParms(10, 1.125) - * ------------ Finish ------------ - */ - module director_classes_runme; -@@ -111,7 +111,7 @@ void makeCalls(Caller myCaller, Base myBase) { - enforce(myCaller.SemiOverloadedCall(true) == "Base" ~ "::SemiOverloaded(bool)", "[7] failed"); - - // Default parameters methods test -- enforce(myCaller.DefaultParmsCall(10, 2.2) == myBaseType ~ "::DefaultParms(int, double)", "[8] failed"); -+ enforce(myCaller.DefaultParmsCall(10, 2.25) == myBaseType ~ "::DefaultParms(int, double)", "[8] failed"); - if (myBase.classinfo == DDerived.classinfo) { // special handling for D derived classes, there is no other way to do this - enforce(myCaller.DefaultParmsCall(10) == myBaseType ~ "::DefaultParms(int, double)", "[9] failed"); - } else { -@@ -173,6 +173,6 @@ public class DDerived : Base { - // only here to ensure consistent behavior for calls from C++ and D code. - public override string DefaultParms(int x) { - if (PrintDebug) writefln("DDerived - DefaultParms(%s)", x); -- return DefaultParms(x, 1.1/*use C++ default here*/); -+ return DefaultParms(x, 1.125/*use C++ default here*/); - } - } -diff --git a/Examples/test-suite/director_classes.i b/Examples/test-suite/director_classes.i -index 52342bfc8..f8c4e68e2 100644 ---- a/Examples/test-suite/director_classes.i -+++ b/Examples/test-suite/director_classes.i -@@ -56,10 +56,10 @@ public: - virtual std::string SemiOverloaded(int x) { if (PrintDebug) std::cout << "Base - SemiOverloaded(int " << x << ")" << std::endl; return "Base::SemiOverloaded(int)"; } - virtual std::string SemiOverloaded(bool x) { if (PrintDebug) std::cout << "Base - SemiOverloaded(bool " << x << ")" << std::endl; return "Base::SemiOverloaded(bool)"; } - -- virtual std::string DefaultParms(int x, double y = 1.1) { -+ virtual std::string DefaultParms(int x, double y = 1.125) { - if (PrintDebug) std::cout << "Base - DefaultParms(" << x << ", " << y << ")" << std::endl; - std::string ret("Base::DefaultParms(int"); -- if (y!=1.1) -+ if (y!=1.125) - ret = ret + std::string(", double"); - ret = ret + std::string(")"); - return ret; -@@ -82,10 +82,10 @@ public: - virtual std::string SemiOverloaded(int x) { if (PrintDebug) std::cout << "Derived - SemiOverloaded(int " << x << ")" << std::endl; return "Derived::SemiOverloaded(int)"; } - // No SemiOverloaded(bool x) - -- virtual std::string DefaultParms(int x, double y = 1.1) { -+ virtual std::string DefaultParms(int x, double y = 1.125) { - if (PrintDebug) std::cout << "Derived - DefaultParms(" << x << ", " << y << ")" << std::endl; - std::string ret("Derived::DefaultParms(int"); -- if (y!=1.1) -+ if (y!=1.125) - ret = ret + std::string(", double"); - ret = ret + std::string(")"); - return ret; -diff --git a/Examples/test-suite/java/director_classes_runme.java b/Examples/test-suite/java/director_classes_runme.java -index 9ee6302de..292cded7f 100644 ---- a/Examples/test-suite/java/director_classes_runme.java -+++ b/Examples/test-suite/java/director_classes_runme.java -@@ -21,8 +21,8 @@ Base - FullyOverloaded(int 10) - Base - FullyOverloaded(bool 1) - Base - SemiOverloaded(int -678) - Base - SemiOverloaded(bool 1) --Base - DefaultParms(10, 2.2) --Base - DefaultParms(10, 1.1) -+Base - DefaultParms(10, 2.25) -+Base - DefaultParms(10, 1.125) - -------------------------------- - Derived - Val(444.555) - Derived - Ref(444.555) -@@ -32,8 +32,8 @@ Derived - FullyOverloaded(int 10) - Derived - FullyOverloaded(bool 1) - Derived - SemiOverloaded(int -678) - Base - SemiOverloaded(bool 1) --Derived - DefaultParms(10, 2.2) --Derived - DefaultParms(10, 1.1) -+Derived - DefaultParms(10, 2.25) -+Derived - DefaultParms(10, 1.125) - -------------------------------- - JavaDerived - Val(444.555) - JavaDerived - Ref(444.555) -@@ -43,8 +43,8 @@ JavaDerived - FullyOverloaded(int 10) - JavaDerived - FullyOverloaded(bool True) - JavaDerived - SemiOverloaded(-678) - Base - SemiOverloaded(bool 1) --JavaDerived - DefaultParms(10, 2.2) --JavaDerived - DefaultParms(10, 1.1) -+JavaDerived - DefaultParms(10, 2.25) -+JavaDerived - DefaultParms(10, 1.125) - ------------ Finish ------------ - */ - -@@ -128,7 +128,7 @@ public class director_classes_runme { - if (!myCaller.SemiOverloadedCall(true).equals("Base" + "::SemiOverloaded(bool)")) throw new RuntimeException("failed"); - - // Default parameters methods test -- if (!(myCaller.DefaultParmsCall(10, 2.2)).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed"); -+ if (!(myCaller.DefaultParmsCall(10, 2.25)).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed"); - if (myBase instanceof JavaDerived) { // special handling for Java derived classes, there is no way to do this any other way - if (!myCaller.DefaultParmsCall(10).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed"); - } else { -@@ -210,7 +210,7 @@ class JavaDerived extends Base - public String DefaultParms(int x) - { - if (director_classes.getPrintDebug()) System.out.println("JavaDerived - DefaultParms(" + x + ")"); -- return DefaultParms(x, 1.1/*use C++ default here*/); -+ return DefaultParms(x, 1.125/*use C++ default here*/); - } - } - -diff --git a/Examples/test-suite/php/director_classes_runme.php b/Examples/test-suite/php/director_classes_runme.php -index 170e10f26..c25d85d17 100644 ---- a/Examples/test-suite/php/director_classes_runme.php -+++ b/Examples/test-suite/php/director_classes_runme.php -@@ -31,7 +31,7 @@ if (PHP_MAJOR_VERSION < 8) { - $rv = preg_replace('/Base/', 'PHPDerived', $rv); - return $rv; - } -- function DefaultParms($x, $y = 1.1) { -+ function DefaultParms($x, $y = 1.125) { - $rv = parent::DefaultParms($x, $y); - $rv = preg_replace('/Base/', 'PHPDerived', $rv); - return $rv; --- -2.43.0 - diff --git a/swig-PHP-Fix-testcase-director_finalizer-with-PHP-8.3.patch b/swig-PHP-Fix-testcase-director_finalizer-with-PHP-8.3.patch deleted file mode 100644 index de9fc33..0000000 --- a/swig-PHP-Fix-testcase-director_finalizer-with-PHP-8.3.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 4a85d0479392f5e1d5ec8623b66d7b52b8209043 Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Wed, 11 Oct 2023 09:16:06 +1300 -Subject: [PATCH] [PHP] Fix testcase director_finalizer with PHP 8.3 - -Fixes #2685 ---- - Examples/test-suite/php/director_finalizer_runme.php | 2 +- - configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Examples/test-suite/php/director_finalizer_runme.php b/Examples/test-suite/php/director_finalizer_runme.php -index f3a0c2c40..689f445d2 100644 ---- a/Examples/test-suite/php/director_finalizer_runme.php -+++ b/Examples/test-suite/php/director_finalizer_runme.php -@@ -17,7 +17,7 @@ class MyFoo extends Foo { - if ($this->thisown) { - $this->orStatus(2); - } -- if (method_exists(get_parent_class(), "__destruct")) { -+ if (method_exists(parent::class, "__destruct")) { - parent::__destruct(); - } - } -diff --git a/configure.ac b/configure.ac -index b9c1a2888..c06002872 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1835,7 +1835,7 @@ if test x"${PHPBIN}" = xno; then - PHP= - else - if test "x$PHPBIN" = xyes; then -- AC_CHECK_PROGS(PHP, [php8.1 php8.0 php7.4 php7.3 php7.2 php7.1 php7.0 php]) -+ AC_CHECK_PROGS(PHP, [php8.3 php8.2 php8.1 php8.0 php7.4 php7.3 php7.2 php7.1 php7.0 php]) - else - PHP=$PHPBIN - fi --- -2.41.0 - diff --git a/swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch b/swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch new file mode 100644 index 0000000..8b286ab --- /dev/null +++ b/swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch @@ -0,0 +1,39 @@ +From 95140fa417a4350e2a0ff51c6933667199949442 Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Mon, 8 Jan 2024 19:31:49 +0000 +Subject: [PATCH] Python Regression fix - add in missing SwigPyIterator_T + fragment + +Closes #2744 +--- + CHANGES.current | 3 +++ + Lib/python/std_map.i | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +#diff --git a/CHANGES.current b/CHANGES.current +#index b88b2f563..c925cdda5 100644 +#--- a/CHANGES.current +#+++ b/CHANGES.current +#@@ -7,3 +7,6 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ +# Version 4.2.1 (in progress) +# =========================== +# +#+2024-01-06: wsfulton +#+ [Python] #2744 Regression fix - add in missing SwigPyIterator_T fragment for +#+ SwigPyIteratorClosed_T when using %import on an instantiated std::map. +diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i +index 3f8f3b06b..954e7eb2d 100644 +--- a/Lib/python/std_map.i ++++ b/Lib/python/std_map.i +@@ -2,7 +2,7 @@ + Maps + */ + +-%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits") ++%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits",fragment="SwigPyIterator_T") + { + namespace swig { + template +-- +2.43.0 + diff --git a/swig-Ruby-Adjust-external-runtime-fix.patch b/swig-Ruby-Adjust-external-runtime-fix.patch new file mode 100644 index 0000000..0e7fc67 --- /dev/null +++ b/swig-Ruby-Adjust-external-runtime-fix.patch @@ -0,0 +1,108 @@ +From 84a2c45d66f0334f8fe67077311383af11a2d5c8 Mon Sep 17 00:00:00 2001 +From: Olly Betts +Date: Fri, 12 Jan 2024 16:15:31 +1300 +Subject: [PATCH] Adjust -external-runtime fix + +The original fix broke C#, D and Java which don't seem to include +swigrun.swg, so split out the SWIG_snprintf macros into a new file +and explicitly include it for the external runtime. + +See #2751. +--- + Lib/swig.swg | 2 ++ + Lib/swigcompat.swg | 23 +++++++++++++++++++++++ + Lib/swigrun.swg | 17 ----------------- + Source/Modules/main.cxx | 9 +++++++++ + 4 files changed, 34 insertions(+), 17 deletions(-) + create mode 100644 Lib/swigcompat.swg + +diff --git a/Lib/swig.swg b/Lib/swig.swg +index faa75baa9..db7e08cf6 100644 +--- a/Lib/swig.swg ++++ b/Lib/swig.swg +@@ -710,3 +710,5 @@ template T SwigValueInit() { + #endif + %} + #endif ++ ++%insert("runtime") "swigcompat.swg" +diff --git a/Lib/swigcompat.swg b/Lib/swigcompat.swg +new file mode 100644 +index 000000000..7d29b7539 +--- /dev/null ++++ b/Lib/swigcompat.swg +@@ -0,0 +1,23 @@ ++/* ----------------------------------------------------------------------------- ++ * swigcompat.swg ++ * ++ * Macros to provide support compatibility with older C and C++ standards. ++ * ----------------------------------------------------------------------------- */ ++ ++/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF ++ * if you're missing it. ++ */ ++#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ ++ (defined __cplusplus && __cplusplus >= 201103L) || \ ++ defined SWIG_HAVE_SNPRINTF) && \ ++ !defined SWIG_NO_SNPRINTF ++# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) ++# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) ++#else ++/* Fallback versions ignore the buffer size, but most of our uses either have a ++ * fixed maximum possible size or dynamically allocate a buffer that's large ++ * enough. ++ */ ++# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) ++# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) ++#endif +diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg +index 80e41bb50..824185c02 100644 +--- a/Lib/swigrun.swg ++++ b/Lib/swigrun.swg +@@ -181,23 +181,6 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { + # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) + #endif + +-/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF +- * if you're missing it. +- */ +-#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ +- (defined __cplusplus && __cplusplus >= 201103L) || \ +- defined SWIG_HAVE_SNPRINTF) && \ +- !defined SWIG_NO_SNPRINTF +-# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) +-# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) +-#else +-/* Fallback versions ignore the buffer size, but most of our uses either have a +- * fixed maximum possible size or dynamically allocate a buffer that's large +- * enough. +- */ +-# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) +-# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) +-#endif + + #include + +diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx +index 8a44921ad..76b4f9d28 100644 +--- a/Source/Modules/main.cxx ++++ b/Source/Modules/main.cxx +@@ -379,6 +379,15 @@ static void SWIG_dump_runtime() { + Swig_banner(runtime); + Printf(runtime, "\n"); + ++ s = Swig_include_sys("swigcompat.swg"); ++ if (!s) { ++ Printf(stderr, "*** Unable to open 'swigcompat.swg'\n"); ++ Delete(runtime); ++ Exit(EXIT_FAILURE); ++ } ++ Printf(runtime, "%s", s); ++ Delete(s); ++ + s = Swig_include_sys("swiglabels.swg"); + if (!s) { + Printf(stderr, "*** Unable to open 'swiglabels.swg'\n"); +-- +2.43.0 + diff --git a/swig-Ruby-Tcl-Fix-external-runtime-output.patch b/swig-Ruby-Tcl-Fix-external-runtime-output.patch new file mode 100644 index 0000000..7edaa44 --- /dev/null +++ b/swig-Ruby-Tcl-Fix-external-runtime-output.patch @@ -0,0 +1,90 @@ +From db50dc8154c5c63593e80c5cc5f96d6303dd0214 Mon Sep 17 00:00:00 2001 +From: Olly Betts +Date: Fri, 12 Jan 2024 14:08:35 +1300 +Subject: [PATCH] [Ruby,Tcl] Fix -external-runtime output + +Fix -external-runtime output to define SWIG_snprintf (bug introduced in +4.2.0). + +Fixes #2751 +--- + CHANGES.current | 4 ++++ + Lib/swig.swg | 21 --------------------- + Lib/swigrun.swg | 17 +++++++++++++++++ + 3 files changed, 21 insertions(+), 21 deletions(-) + +#diff --git a/CHANGES.current b/CHANGES.current +#index fefa0f942..8d68a9687 100644 +#--- a/CHANGES.current +#+++ b/CHANGES.current +#@@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ +# Version 4.2.1 (in progress) +# =========================== +# +#+2024-01-12: olly +#+ [Ruby,Tcl] #2751 Fix -external-runtime output to define +#+ SWIG_snprintf (bug introduced in 4.2.0). +#+ +# 2024-01-12: olly +# Improve preprocessor warning for use of an undefined function-like +# macro. SWIG now warns: +diff --git a/Lib/swig.swg b/Lib/swig.swg +index ce5163685..faa75baa9 100644 +--- a/Lib/swig.swg ++++ b/Lib/swig.swg +@@ -710,24 +710,3 @@ template T SwigValueInit() { + #endif + %} + #endif +- +-%insert("runtime") %{ +-/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF +- * if you're missing it. +- */ +-#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ +- (defined __cplusplus && __cplusplus >= 201103L) || \ +- defined SWIG_HAVE_SNPRINTF) && \ +- !defined SWIG_NO_SNPRINTF +-# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) +-# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) +-#else +-/* Fallback versions ignore the buffer size, but most of our uses either have a +- * fixed maximum possible size or dynamically allocate a buffer that's large +- * enough. +- */ +-# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) +-# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) +-#endif +- +-%} +diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg +index 824185c02..80e41bb50 100644 +--- a/Lib/swigrun.swg ++++ b/Lib/swigrun.swg +@@ -181,6 +181,23 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { + # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) + #endif + ++/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF ++ * if you're missing it. ++ */ ++#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ ++ (defined __cplusplus && __cplusplus >= 201103L) || \ ++ defined SWIG_HAVE_SNPRINTF) && \ ++ !defined SWIG_NO_SNPRINTF ++# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) ++# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) ++#else ++/* Fallback versions ignore the buffer size, but most of our uses either have a ++ * fixed maximum possible size or dynamically allocate a buffer that's large ++ * enough. ++ */ ++# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) ++# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) ++#endif + + #include + +-- +2.43.0 + diff --git a/swig-configure-c99.patch b/swig-configure-c99.patch deleted file mode 100644 index b1d42c9..0000000 --- a/swig-configure-c99.patch +++ /dev/null @@ -1,52 +0,0 @@ -Add missing #include directives to obtain additional function -prototypes. This avoids altering the result of this test with C99 -compilers which do not support implicit function declarations. - -Submitted upstream: - -diff --git a/CCache/configure b/CCache/configure -index 829db3db32ca442a..66f60da79446541e 100755 ---- a/CCache/configure -+++ b/CCache/configure -@@ -4135,6 +4135,9 @@ else $as_nop - - #include - #include -+#include -+#include -+#include - void foo(const char *format, ...) { - va_list ap; - int len; -@@ -4149,7 +4152,7 @@ void foo(const char *format, ...) { - - exit(0); - } --main() { foo("hello"); } -+int main(void) { foo("hello"); } - - _ACEOF - if ac_fn_c_try_run "$LINENO" -diff --git a/CCache/configure.ac b/CCache/configure.ac -index 2db3553ce796ec21..9afd49e8370d4cac 100644 ---- a/CCache/configure.ac -+++ b/CCache/configure.ac -@@ -63,6 +63,9 @@ AC_CACHE_CHECK([for C99 vsnprintf],ccache_cv_HAVE_C99_VSNPRINTF,[ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - #include -+#include -+#include -+#include - void foo(const char *format, ...) { - va_list ap; - int len; -@@ -77,7 +80,7 @@ void foo(const char *format, ...) { - - exit(0); - } --main() { foo("hello"); } -+int main(void) { foo("hello"); } - ]])],[ccache_cv_HAVE_C99_VSNPRINTF=yes],[ccache_cv_HAVE_C99_VSNPRINTF=no],[ccache_cv_HAVE_C99_VSNPRINTF=cross])]) - if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then - AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) diff --git a/swig-octave-8.1.patch b/swig-octave-8.1.patch deleted file mode 100644 index 8563775..0000000 --- a/swig-octave-8.1.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 8d211ca6732cd0745b196b63ceeedc6cd4f5225c Mon Sep 17 00:00:00 2001 -From: Andrea L -Date: Tue, 14 Mar 2023 22:08:30 +0100 -Subject: [PATCH 1/3] Update octruntime.swg to work with Octave v8.1.0 - ---- - Lib/octave/octruntime.swg | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg -index e76151f146b..3a41ba02576 100644 ---- a/Lib/octave/octruntime.swg -+++ b/Lib/octave/octruntime.swg -@@ -318,8 +318,10 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { - SWIG_InitializeModule(0); - SWIG_PropagateClientData(); - --#if SWIG_OCTAVE_PREREQ(6,0,0) -+if SWIG_OCTAVE_PREREQ(8,0,0) - octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); -+ octave_function *me = tree_eval.current_function(); -+#elif SWIG_OCTAVE_PREREQ(6,0,0) octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); - octave::call_stack& stack = tree_eval.get_call_stack(); - octave_function *me = stack.current_function(); - #elif SWIG_OCTAVE_PREREQ(4,4,0) - -From e8fa1a5018b7ec2c52f98d2161331f3f17489c83 Mon Sep 17 00:00:00 2001 -From: Andrea L -Date: Tue, 14 Mar 2023 22:13:21 +0100 -Subject: [PATCH 2/3] Update octrun.swg to work with Octave v8.1.0 - ---- - Lib/octave/octrun.swg | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg -index 2973318c44c..27389d57731 100644 ---- a/Lib/octave/octrun.swg -+++ b/Lib/octave/octrun.swg -@@ -1630,8 +1630,12 @@ SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) { - octave::interpreter *interp = octave::interpreter::the_interpreter (); - interp->assign(name, interp->global_varval(name)); - octave::tree_evaluator& tree_eval = interp->get_evaluator(); -+#if SWIG_OCTAVE_PREREQ(8,0,0) -+ std::shared_ptr stackFrame = tree_eval.get_current_stack_frame(); -+#else - octave::call_stack& callStack = tree_eval.get_call_stack(); -- std::shared_ptr stackFrame = callStack.get_current_stack_frame(); -+ std::shared_ptr stackFrame = tree_eval.get_current_stack_frame(); -+#endif - octave::symbol_record sym=symscope.lookup_symbol(name); - stackFrame->mark_global(sym); - #else - -From ae072d6585bc95ca16cdc0e19f4e227a2ba0a2eb Mon Sep 17 00:00:00 2001 -From: Andrea L -Date: Tue, 14 Mar 2023 22:38:21 +0100 -Subject: [PATCH 3/3] Update octruntime.swg - ---- - Lib/octave/octruntime.swg | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg -index 3a41ba02576..94e2ca4fb9b 100644 ---- a/Lib/octave/octruntime.swg -+++ b/Lib/octave/octruntime.swg -@@ -318,10 +318,11 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { - SWIG_InitializeModule(0); - SWIG_PropagateClientData(); - --if SWIG_OCTAVE_PREREQ(8,0,0) -+#if SWIG_OCTAVE_PREREQ(8,0,0) - octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); - octave_function *me = tree_eval.current_function(); --#elif SWIG_OCTAVE_PREREQ(6,0,0) octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); -+#elif SWIG_OCTAVE_PREREQ(6,0,0) -+ octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator(); - octave::call_stack& stack = tree_eval.get_call_stack(); - octave_function *me = stack.current_function(); - #elif SWIG_OCTAVE_PREREQ(4,4,0) diff --git a/swig-python-3.12.patch b/swig-python-3.12.patch deleted file mode 100644 index 6958adc..0000000 --- a/swig-python-3.12.patch +++ /dev/null @@ -1,22 +0,0 @@ -Immortal objects now have a fixed refcount, which makes this test fail: - -checking python testcase langobj (with run test) -Traceback (most recent call last): - File "/builddir/build/BUILD/swig-4.1.1/Examples/test-suite/python/./langobj_runme.py", line 13, in - raise RuntimeError -RuntimeError -make[1]: *** [Makefile:123: langobj.cpptest] Error 1 - -See https://peps.python.org/pep-0683/ for more information. - ---- swig-4.1.1/Examples/test-suite/python/langobj_runme.py.orig 2022-11-30 00:35:05.000000000 -0700 -+++ swig-4.1.1/Examples/test-suite/python/langobj_runme.py 2023-07-12 15:48:18.745852293 -0600 -@@ -2,7 +2,7 @@ import sys - from langobj import * - - --x = "hello" -+x = (1,2) - rx = sys.getrefcount(x) - v = identity(x) - rv = sys.getrefcount(v) diff --git a/swig.spec b/swig.spec index a60db55..c464780 100644 --- a/swig.spec +++ b/swig.spec @@ -57,8 +57,8 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig -Version: 4.1.1 -Release: 15%{?dist} +Version: 4.2.0 +Release: 1%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -69,19 +69,20 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif -Patch0: swig-configure-c99.patch -# Octave 8.1 support -# https://patch-diff.githubusercontent.com/raw/swig/swig/pull/2512.patch -Patch1: swig-octave-8.1.patch # OCaml 5.0 support # https://github.com/swig/swig/pull/2649 -Patch2: swig-ocaml-5.0.patch -# Fix a test that is broken with python 3.12 -Patch3: swig-python-3.12.patch -# Fix a test that is broken with PHP 8.3 -Patch4: swig-PHP-Fix-testcase-director_finalizer-with-PHP-8.3.patch -# Fix director_classes testcase failures on x86 -Patch5: swig-PHP-Fix-director_classes-testcase-failures-on-x86.patch +Patch0: swig-ocaml-5.0.patch +# Fix missing fragment dependency, in upstream since 4.2.1 +# https://github.com/swig/swig/pull/2744 +Patch1: swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch +# Fix -external-runtime output, in upstream since 4.2.1 +# https://github.com/swig/swig/pull/2751 +Patch2: swig-Ruby-Tcl-Fix-external-runtime-output.patch +Patch3: swig-Ruby-Adjust-external-runtime-fix.patch +# Fix seg fault handling friend constructor/destructor declarations +# https://github.com/swig/swig/issues/2749 +Patch4: swig-Fix-seg-fault-handling-friend-constructor-destructor.patch +Patch5: swig-Friends-testcase-fix.patch BuildRequires: coreutils BuildRequires: findutils @@ -365,6 +366,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Tue Jan 23 2024 Jitka Plesnikova - 4.2.0-1 +- 4.2.0 bump + * Mon Dec 18 2023 Richard W.M. Jones - 4.1.1-15 - OCaml 5.1.1 + s390x code gen fix for Fedora 40