Accepting request 1229398 from devel:tools:building
OBS-URL: https://build.opensuse.org/request/show/1229398 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/swig?expand=0&rev=84
This commit is contained in:
commit
e6fed37b2b
55
swig-4.3.0-Fix-precedence-of-casts.patch
Normal file
55
swig-4.3.0-Fix-precedence-of-casts.patch
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
From 4e315cdd7c9072fd33ac1df3d208a0990b8231c3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olly Betts <olly@survex.com>
|
||||||
|
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
|
||||||
|
|
||||||
|
Index: swig-4.3.0/Examples/test-suite/cpp11_auto_variable.i
|
||||||
|
===================================================================
|
||||||
|
--- swig-4.3.0.orig/Examples/test-suite/cpp11_auto_variable.i
|
||||||
|
+++ swig-4.3.0/Examples/test-suite/cpp11_auto_variable.i
|
||||||
|
@@ -62,3 +62,11 @@ static auto wstring_lit_len2 = sizeof("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;
|
||||||
|
+%}
|
||||||
|
Index: swig-4.3.0/Source/CParse/parser.y
|
||||||
|
===================================================================
|
||||||
|
--- swig-4.3.0.orig/Source/CParse/parser.y
|
||||||
|
+++ swig-4.3.0/Source/CParse/parser.y
|
||||||
|
@@ -1793,7 +1793,6 @@ static String *add_qualifier_to_declarat
|
||||||
|
%token <str> DOXYGENSTRING
|
||||||
|
%token <str> DOXYGENPOSTSTRING
|
||||||
|
|
||||||
|
-%precedence CAST
|
||||||
|
%left QUESTIONMARK
|
||||||
|
%left LOR
|
||||||
|
%left LAND
|
||||||
|
@@ -1809,7 +1808,7 @@ static String *add_qualifier_to_declarat
|
||||||
|
%left LSHIFT RSHIFT
|
||||||
|
%left PLUS MINUS
|
||||||
|
%left STAR SLASH MODULO
|
||||||
|
-%precedence UMINUS NOT LNOT
|
||||||
|
+%precedence UMINUS NOT LNOT CAST
|
||||||
|
%token DCOLON
|
||||||
|
|
||||||
|
%type <node> program interface declaration swig_directive ;
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Dec 8 18:15:12 UTC 2024 - Andreas Stieger <andreas.stieger@gmx.de>
|
||||||
|
|
||||||
|
- Add patch from upstream to fix regression affecting hamlib
|
||||||
|
swig-4.3.0-Fix-precedence-of-casts.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Oct 21 11:49:43 UTC 2024 - Klaus Kämpf <kkaempf@suse.de>
|
Mon Oct 21 11:49:43 UTC 2024 - Klaus Kämpf <kkaempf@suse.de>
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# spec file for package swig
|
# spec file for package swig
|
||||||
#
|
#
|
||||||
# Copyright (c) 2024 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
|
# Copyright (c) 2024 Andreas Stieger <Andreas.Stieger@gmx.de>
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -38,6 +39,7 @@ Group: Development/Languages/C and C++
|
|||||||
URL: https://www.swig.org/
|
URL: https://www.swig.org/
|
||||||
Source: https://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
Source: https://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||||
Source1: %{name}.rpmlintrc
|
Source1: %{name}.rpmlintrc
|
||||||
|
Patch0: swig-4.3.0-Fix-precedence-of-casts.patch
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: pcre2-devel
|
BuildRequires: pcre2-devel
|
||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
@ -70,6 +72,9 @@ BuildRequires: ocaml-camlp4-devel
|
|||||||
BuildRequires: ocaml-findlib
|
BuildRequires: ocaml-findlib
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# for swig-4.3.0-Fix-precedence-of-casts.patch
|
||||||
|
BuildRequires: bison
|
||||||
|
|
||||||
%description
|
%description
|
||||||
SWIG is a compiler that attempts to make it easy to integrate C, C++,
|
SWIG is a compiler that attempts to make it easy to integrate C, C++,
|
||||||
or Objective-C code with scripting languages including Perl, Tcl, and
|
or Objective-C code with scripting languages including Perl, Tcl, and
|
||||||
|
Loading…
Reference in New Issue
Block a user