8000 BLD: use ``-ftrapping-math`` with Clang on macOS in Meson build by rgommers · Pull Request #24060 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BLD: use -ftrapping-math with Clang on macOS in Meson build #24060

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 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
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
BLD: use -ftrapping-math with Clang on macOS
The distutils build also uses this flag, and it avoids some problems
with `floor_divide` and similar functions (xref gh-19479).

For older macOS arm64 Clang versions, the flag does get accepted, but then
gets overridden because it's not actually supported - which yields these
warnings:
```
warning: overriding currently unsupported use of floating point exceptions on this target [-Wunsupported-floating-point-opt]
```
Since they're a little annoying to suppress and will go away when updating to
the latest XCode version, we'll ignore these warnings.
  • Loading branch information
rgommers committed Jun 27, 2023
commit 928cd7478dfe7f4d8702df307a62e6fd85aeda43
9 changes: 9 additions & 0 deletions meson.build
6B8A
Original file line number Diff line numberDiff line change
Expand Up @@ -52,6 +52,15 @@ endif
add_project_arguments(
cc.get_supported_arguments( '-fno-strict-aliasing'), language : 'c'
)
#
# Clang defaults to a non-strict floating error point model, but we need strict
# behavior. `-ftrapping-math` is equivalent to `-ffp-exception-behavior=strict`.
# Note that this is only supported on macOS arm64 as of XCode 14.3
if cc.get_id() == 'clang'
add_project_arguments(
cc.get_supported_arguments('-ftrapping-math'), language: ['c', 'cpp'],
)
endif

# Generate version number. Note that this will not (yet) update the version
# number seen by pip or reflected in wheel filenames. See
Expand Down
0