Skip to content

Commit

Permalink
BLD: use -ftrapping-math with Clang on macOS
Browse files Browse the repository at this point in the history
The distutils build also uses this flag, and it avoids some problems
with `floor_divide` and similar functions (xref numpygh-19479).
  • Loading branch information
rgommers committed Jun 27, 2023
1 parent c058561 commit 4d26f3d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions meson.build
Original file line number Diff line number Diff 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 comments on commit 4d26f3d

Please sign in to comment.