From e88cac0d1f1c97b93fda31fd83e8f526c67cc2a7 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:38:57 +0700 Subject: [PATCH] Workaround to allow flint to be compiled with numpy 2 --- src/sage/libs/flint/flint_wrap.h | 5 +++++ src/sage_setup/autogen/flint/templates/flint_wrap.h.template | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/sage/libs/flint/flint_wrap.h b/src/sage/libs/flint/flint_wrap.h index 1302973779e..2cd39eb1441 100644 --- a/src/sage/libs/flint/flint_wrap.h +++ b/src/sage/libs/flint/flint_wrap.h @@ -26,6 +26,10 @@ #pragma push_macro("ulong") #undef ulong +/* Reserved in C99, needed for FLINT without https://github.com/flintlib/flint/pull/2027 */ +#pragma push_macro("I") +#define I Iv + #include /* If flint was already previously included via another header (e.g. @@ -169,6 +173,7 @@ #undef mp_bitcnt_t #pragma pop_macro("ulong") +#pragma pop_macro("I") /* CPU_SIZE_1 and SIZE_RED_FAILURE_THRESH are defined as macros in flint/fmpz_lll.h * and as variables in fplll/defs.h, which breaks build if linbox is compiled with fplll */ diff --git a/src/sage_setup/autogen/flint/templates/flint_wrap.h.template b/src/sage_setup/autogen/flint/templates/flint_wrap.h.template index 97323ede6ce..ec58aa2f602 100644 --- a/src/sage_setup/autogen/flint/templates/flint_wrap.h.template +++ b/src/sage_setup/autogen/flint/templates/flint_wrap.h.template @@ -26,6 +26,10 @@ #pragma push_macro("ulong") #undef ulong +/* Reserved in C99, needed for FLINT without https://github.com/flintlib/flint/pull/2027 */ +#pragma push_macro("I") +#define I Iv + #include /* If flint was already previously included via another header (e.g. @@ -43,6 +47,7 @@ #undef mp_bitcnt_t #pragma pop_macro("ulong") +#pragma pop_macro("I") /* CPU_SIZE_1 and SIZE_RED_FAILURE_THRESH are defined as macros in flint/fmpz_lll.h * and as variables in fplll/defs.h, which breaks build if linbox is compiled with fplll */