10000 Merge pull request #24060 from rgommers/clang-floatingpoint-flags · numpy/numpy@85385d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 85385d6

Browse files
authored
Merge pull request #24060 from rgommers/clang-floatingpoint-flags
BLD: use `-ftrapping-math` with Clang on macOS in Meson build
2 parents 18e0410 + 928cd74 commit 85385d6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

meson.build

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ endif
5252
add_project_arguments(
5353
cc.get_supported_arguments( '-fno-strict-aliasing'), language : 'c'
5454
)
55+
#
56+
# Clang defaults to a non-strict floating error point model, but we need strict
57+
# behavior. `-ftrapping-math` is equivalent to `-ffp-exception-behavior=strict`.
58+
# Note that this is only supported on macOS arm64 as of XCode 14.3
59+
if cc.get_id() == 'clang'
60+
add_project_arguments(
61+
cc.get_supported_arguments('-ftrapping-math'), language: ['c', 'cpp'],
62+
)
63+
endif
5564

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

0 commit comments

Comments
 (0)
0