Skip to content

Conversation

@dimpase
Copy link
Contributor

@dimpase dimpase commented Jun 19, 2024

Including complex.h before flint headers leads to errors with modern compilers
Note that the following code

#include <complex.h> /* save as t.c */
#include <flint/mpoly.h>

fails to compile with a suffciently new compiler, e.g. clang 16 or gcc 14.

$ gcc -c t.c
In file included from t.c:1:
/usr/include/flint/mpoly.h:1319:43: error: expected ‘)’ before ‘__extension__’
 1319 | void mpoly_gcd_info_init(mpoly_gcd_info_t I, slong nvars);
      |                                           ^
In file included from /usr/include/flint/fmpz_types.h:15,
                 from /usr/include/flint/fmpz_mod_types.h:15,
                 from /usr/include/flint/mpoly_types.h:15,
                 from /usr/include/flint/mpoly.h:23,
                 from t.c:2:
/usr/include/flint/mpoly.h:1319:46: error: expected ‘;’, ‘,’ or ‘)’ before ‘mp_limb_signed_t’
 1319 | void mpoly_gcd_info_init(mpoly_gcd_info_t I, slong nvars);
...

So the fix is to rename I to Iv in function declarations.

dimpase added 2 commits June 19, 2024 22:16
Note that the following code
---- cut here: save as t.c
---- cut here

fails to compile with a suffciently new compiler, e.g. clang 16 or gcc 14.

$ gcc -c t.c
In file included from t.c:1:
/usr/include/flint/mpoly.h:1319:43: error: expected ‘)’ before ‘__extension__’
 1319 | void mpoly_gcd_info_init(mpoly_gcd_info_t I, slong nvars);
      |                                           ^
In file included from /usr/include/flint/fmpz_types.h:15,
                 from /usr/include/flint/fmpz_mod_types.h:15,
                 from /usr/include/flint/mpoly_types.h:15,
                 from /usr/include/flint/mpoly.h:23,
                 from t.c:2:
/usr/include/flint/mpoly.h:1319:46: error: expected ‘;’, ‘,’ or ‘)’ before ‘mp_limb_signed_t’
 1319 | void mpoly_gcd_info_init(mpoly_gcd_info_t I, slong nvars);

...
@dimpase
Copy link
Contributor Author

dimpase commented Jun 19, 2024

in particular this issue prevents building Sage (sagelib) with numpy 2.0 (which includes complex.h)

@dimpase dimpase mentioned this pull request Jun 19, 2024
1 task
@albinahlback
Copy link
Collaborator

Looks good to me, thanks!

@albinahlback albinahlback merged commit b579cdd into flintlib:main Jun 20, 2024
@dimpase dimpase mentioned this pull request Jun 21, 2024
2 tasks
tornaria added a commit to tornaria/void-packages that referenced this pull request Aug 20, 2024
ahesford pushed a commit to void-linux/void-packages that referenced this pull request Aug 23, 2024
jason1987d pushed a commit to jason1987d/void-packages that referenced this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants