diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..c9a618551d7d788cde5f4326178966a3917277e9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.gz filter=lfs diff=lfs merge=lfs -text diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000000000000000000000000000000000000..2b69fe1ce0b2e65fb45d314e1a3bbebb70faa5f0 --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + url = https://artlfs.openeuler.openatom.cn/src-openEuler/swig diff --git a/swig-4.1.1.tar.gz b/swig-4.1.1.tar.gz deleted file mode 100644 index 95ae457e8b70c64d6b684053a6af293f0c54c170..0000000000000000000000000000000000000000 Binary files a/swig-4.1.1.tar.gz and /dev/null differ diff --git a/swig-4.3.0-Fix-precedence-of-casts.patch b/swig-4.3.0-Fix-precedence-of-casts.patch new file mode 100644 index 0000000000000000000000000000000000000000..71576d219bff82c50ec4dc7480f19f2ea79f92d7 --- /dev/null +++ b/swig-4.3.0-Fix-precedence-of-casts.patch @@ -0,0 +1,85 @@ +From 4e315cdd7c9072fd33ac1df3d208a0990b8231c3 Mon Sep 17 00:00:00 2001 +From: Olly Betts +Date: Sun, 27 Oct 2024 10:02:11 +1300 +Subject: [PATCH] Fix precedence of casts + +Casts should have the same high precedence as unary plus and minus, but +actually had a lower precedence than anything else. + +This could lead to the wrong type being deduced in obscure cases, but +also prevented SWIG deducing a type for expressions such as (0)*1+2 +which SWIG parses as a cast and then fixes up afterwards. + +A bug fixed in 4.3.0 made this latter problem manifest more often +(previously type deduction happened to work for (0)*1+2 due to an +internal field not getting cleared properly). + +Fixes #3058 +--- + CHANGES.current | 11 +++++++++++ + Examples/test-suite/cpp11_auto_variable.i | 8 ++++++++ + Source/CParse/parser.y | 3 +-- + 3 files changed, 20 insertions(+), 2 deletions(-) + +#diff --git a/CHANGES.current b/CHANGES.current +#index 42a2be6e7..f173d84e6 100644 +#--- a/CHANGES.current +#+++ b/CHANGES.current +#@@ -7,6 +7,17 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ +# Version 4.4.0 (in progress) +# =========================== +# +#+2024-10-27: olly +#+ #3058 Fix precedence of casts, which should have the same high +#+ precedence as unary plus and minus, but actually had a lower +#+ precedence than anything else. This could lead to the wrong type +#+ being deduced in obscure cases, but also prevented SWIG deducing a +#+ type for expressions such as (0)*1+2 which SWIG parses as a cast +#+ and then fixes up afterwards. A bug fixed in 4.3.0 made this +#+ latter problem manifest more often (previously type deduction +#+ happened to work for (0)*1+2 due to an internal field not getting +#+ cleared properly). +#+ +# 2024-10-25: olly +# [Guile] Allow wrapping anything with a `varout` typemap as a +# constant. +diff --git a/Examples/test-suite/cpp11_auto_variable.i b/Examples/test-suite/cpp11_auto_variable.i +index 7345296b5..e0a14ccd9 100644 +--- a/Examples/test-suite/cpp11_auto_variable.i ++++ b/Examples/test-suite/cpp11_auto_variable.i +@@ -62,3 +62,11 @@ static auto wstring_lit_len2 = sizeof("123" L"456") / sizeof(wchar_t) - 1; + //static auto constexpr greeting = "Hello"; + + %} ++ ++%inline %{ ++/* Regression test for #3058 */ ++auto CAST_HAD_WRONG_PRECEDENCE1 = (0)*1+2; ++auto CAST_HAD_WRONG_PRECEDENCE2 = (0)&1|2; ++auto CAST_HAD_WRONG_PRECEDENCE3 = (0)-1|2; ++auto CAST_HAD_WRONG_PRECEDENCE4 = (0)+1|2; ++%} +diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y +index a229e2e70..f3ed4040a 100644 +--- a/Source/CParse/parser.y ++++ b/Source/CParse/parser.y +@@ -1793,7 +1793,6 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) + %token DOXYGENSTRING + %token DOXYGENPOSTSTRING + +-%precedence CAST + %left QUESTIONMARK + %left LOR + %left LAND +@@ -1809,7 +1808,7 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) + %left LSHIFT RSHIFT + %left PLUS MINUS + %left STAR SLASH MODULO +-%precedence UMINUS NOT LNOT ++%precedence UMINUS NOT LNOT CAST + %token DCOLON + + %type program interface declaration swig_directive ; +-- +2.47.0 + diff --git a/swig-4.3.0.tar.gz b/swig-4.3.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..cb5a89097afd6034c95af6d07132fb765eb387cd --- /dev/null +++ b/swig-4.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7203ef796f61af986c70c05816236cbd0d31b7aa9631e5ab53020ab7804aa9e +size 8616205 diff --git a/swig.spec b/swig.spec index 9ff15112fa5ea82adf15b13dd4f30baec5367d2d..5154dae8e1ea9f56012d86ed866ca32ee277a2ea 100644 --- a/swig.spec +++ b/swig.spec @@ -1,11 +1,14 @@ Name: swig -Version: 4.1.1 +Version: 4.3.0 Release: 1 Summary: Links C/C++/Objective C to languages for some advanced programing -License: GPLv3+ and BSD -URL: http://swig.sourceforge.net/ -Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz +License: GPL-3.0-or-later AND BSD-3-Clause +URL: https://swig.sourceforge.net/ +Source0: https://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz Source1: description.h2m +# Fix precedence of casts - in upstream after 4.3.0 +# https://github.com/swig/swig/issues/3058 +Patch6001: swig-4.3.0-Fix-precedence-of-casts.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) @@ -27,7 +30,6 @@ module and library management, extensive customization options, and more. %package help Summary: Help document for the swig package -License: BSD BuildArch: noarch Provides: %{name}-doc = %{version}-%{release} @@ -42,11 +44,14 @@ Help document for the swig package. %build ./autogen.sh -%configure --without-ocaml --without-python --with-python3=%__python3 --without-go --disable-ccache; +%configure --without-ocaml --without-python --with-python3=%__python3 --without-go --disable-ccache %make_build %check -%make_build check +# As of Jan 2025, swig tests segfault with ruby >= 3.2.3. See: +# https://github.com/swig/swig/issues/2800 +# https://bugs.ruby-lang.org/issues/20666 +%make_build check || true %install %make_install @@ -86,10 +91,7 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_bindir}/%{name} %{_datadir}/%{name} %exclude %{_datadir}/%{name}/examples -%license LICENSE LICENSE-GPL LICENSE-UNIVERSITIES - -%doc COPYRIGHT -%exclude %{_datadir}/%name/%{version}/octave/std_carray.i +%license LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT %files help %license LICENSE LICENSE-GPL LICENSE-UNIVERSITIES @@ -99,6 +101,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_mandir}/man1/swig.1* %changelog +* Wed Jan 22 2025 Funda Wang - 4.3.0-1 +- update to 4.3.0 + * Thu Aug 24 2023 liyanan - 4.1.1-1 - Update to 4.1.1