Skip to content

Commit

Permalink
sagemathgh-39291: Workaround to allow flint to be compiled with numpy 2
Browse files Browse the repository at this point in the history
    
As discussed in sagemath#39241 .

Based on mkoeppe@6247975f786c85c35124a66a
0d32df00260461c5 , but also change the template file.

Note that for tests to pass, sagemath#39242
is also needed.
    
URL: sagemath#39291
Reported by: user202729
Reviewer(s): Tobias Diez
  • Loading branch information
Release Manager committed Jan 8, 2025
2 parents 471effb + e88cac0 commit e9c6f8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sage/libs/flint/flint_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flint/flint.h>

/* If flint was already previously included via another header (e.g.
Expand Down Expand Up @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions src/sage_setup/autogen/flint/templates/flint_wrap.h.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flint/flint.h>

/* If flint was already previously included via another header (e.g.
Expand All @@ -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 */
Expand Down

0 comments on commit e9c6f8d

Please sign in to comment.