Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure C99 compliance in headers, as 'I' is reserved #2027

Merged
merged 2 commits into from
Jun 20, 2024

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.

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
13 checks passed
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
atweiden added a commit to atweiden/voidpkgs 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