sci-mathematics/pari: fix build with gcc-15

Closes: https://bugs.gentoo.org/947939
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
This commit is contained in:
Michael Orlitzky
2025-01-12 21:15:12 -05:00
parent c37a56d823
commit bbc1cc4fdc
2 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
From 4cce8c7b9107053ffd1bb0d6510797dafd632151 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Sun, 12 Jan 2025 21:02:40 -0500
Subject: [PATCH] src/graph/plotfltk.c: swap PARI and FLTK includes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
PARI defines a swap() macro that conflicts with the swap() function
declared in some C++ headers used by FLTK. This can lead to build
failures like
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/alloc_traits.h
:1005:46:error: macro swap requires 2 arguments, but only 1 given
1005 | __c.get_allocator()).swap(__c);
| ^
when using the forthcoming g++-15 to build PARI. Basically this fails
because the macro is defined before the C++ headers are included. If
we swap the includes, then the macro clobbers the function, but that's
okay because PARI only expects the macro to be in scope.
---
src/graph/plotfltk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/graph/plotfltk.c b/src/graph/plotfltk.c
index f81515d..e95275e 100644
--- a/src/graph/plotfltk.c
+++ b/src/graph/plotfltk.c
@@ -18,16 +18,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
//
// Based on plotQt by Nils-Peter Skoruppa (www.countnumber.de)
/////////////////////////////////////////////////////////////////////////////
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+#include <FL/fl_draw.H>
+
extern "C" {
#include "pari.h"
#include "paripriv.h"
#include "rect.h"
}
-#include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include <FL/fl_draw.H>
-
class Plotter: public Fl_Window {
public:
--
2.47.1

View File

@@ -33,6 +33,8 @@ DEPEND="
X? ( x11-libs/libX11:0= )"
RDEPEND="${DEPEND}"
PATCHES=( "${FILESDIR}/${P}-gcc15-swap-conflict.patch" )
src_prepare() {
default