8000 MAINT: default to C11 rather than C99, fix most build warnings with Clang 14 by rgommers · Pull Request #25072 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: default to C11 rather than C99, fix most build warnings with Clang 14 #25072

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

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BLD: use C11 rather than C99 as the C standard version we target
In effect we were already using C11 for a long time, because that's
where `complex.h` and complex types became optional rather than
mandatory. Also, there were several places where we used typedef
redefinitions, which is a C11 feature, as indicated by build warnings
like these:

```
In file included from ../numpy/_core/src/multiarray/common.h:6:
../numpy/_core/include/numpy/ndarraytypes.h:308:31: warning: redefinition of typedef 'NpyAuxData' is a C11 feature [-Wtypedef-redefinition]
typedef struct NpyAuxData_tag NpyAuxData;
                              ^
../numpy/_core/src/umath/loops.h.src:37:31: note: previous definition is here
typedef struct NpyAuxData_tag NpyAuxData;
                              ^

In file included from ../numpy/_core/src/multiarray/array_method.h:14:
../numpy/_core/include/numpy/_dtype_api.h:108:3: warning: redefinition of typedef 'PyArrayMethod_Context' is a C11 feature [-Wtypedef-redefinition]
} PyArrayMethod_Context;
  ^
../numpy/_core/src/umath/loops.h.src:36:42: note: previous definition is here
typedef struct PyArrayMethod_Context_tag PyArrayMethod_Context;

```
  • Loading branch information
rgommers committed Dec 13, 2023
commit a9ae89c38e58589a65954835df28ba65179d1e68
2 changes: 1 addition & 1 deletion doc/source/dev/development_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Recommended development setup
Since NumPy contains parts written in C and Cython that need to be
compiled before use, make sure you have the necessary compilers and Python
development headers installed - see :ref:`building-from-source`. Building
NumPy 8000 as of version ``1.17`` requires a C99 compliant compiler.
NumPy as of version ``2.0`` requires C11 and C++17 compliant compilers.

Having compiled code also means that importing NumPy from the development
sources needs some additional steps, which are explained below. For the rest
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(
default_options: [
'buildtype=debugoptimized',
'b_ndebug=if-release',
'c_std=c99',
'c_std=c11',
'cpp_std=c++17',
'pkgconfig.relocatable=true',
],
Expand Down
0