Skip to content

Commit b12a3ad

Browse files
authored
Merge pull request numpy#24182 from charris/backport-24060
BLD: use ``-ftrapping-math`` with Clang on macOS
2 parents ef46300 + 621390f commit b12a3ad

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)