diff options
author | Hood Chatham <roberthoodchatham@gmail.com> | 2022-03-05 16:00:54 -0800 |
---|---|---|
committer | Hood Chatham <roberthoodchatham@gmail.com> | 2022-03-07 12:17:37 -0800 |
commit | 3e4d87b1ba76b245dcbf45bb26b1f7118861f286 (patch) | |
tree | 2abb65c7cb317f25565f8a1390fb7f01c2c6de32 /numpy/array_api/_searching_functions.py | |
parent | 64cfb046e86692daa1119ba1b1de2ab50d00afde (diff) | |
download | numpy-3e4d87b1ba76b245dcbf45bb26b1f7118861f286.tar.gz |
MAINT, BLD Fix math feature detection for wasm
The web assembly linker is strict about function types, it is unwilling
to link a function defined with signature say `double f(double, double)`
to an invocation with signature `void f(void)`. This causes trouble in
`numpy/core/setup.py` in the functions `check_math_capabilities` and
`check_mathlib`.
This patch fixes the problem by giving config.try_link the correct
function signatures for these functions. In particular I added a separate
header file with all the math declarations. It would be be possible to
just include 'math.h' but we also need to parse the declarations to figure
out how to call the functions. If f has arguments type1, type2, type3, we
want to call it like f((type1)0, (type2)0, (type3)0). Anyways it is easier
to parse the arguments out of our feature_detection_math.h than to worry
about the possibility that someone will have a differently formatted system
math.h. We do a test where we include both math.h and feature_detection_math.h
to ensure consistency between the signatures.
I also separated out the fcntl functions, backtrace and madvise, and strtold_l.
This is because they require separate headers. strtold_l requires testing both
with the locale.h header and with the xlocale.h header (this seems to vary even
among different linuxes). All of the functions I moved out of OPTIONAL_STDFUNCS
are absent on windows and some are absent on OSX so separating them out of the
OPTIONAL_STDFUNCS should mildly improve the speed of feature detection on mac
and windows (since they have all the functions remaining in OPTIONAL_STDFUNCS).
Diffstat (limited to 'numpy/array_api/_searching_functions.py')
0 files changed, 0 insertions, 0 deletions