Skip to content

Commit

Permalink
Avoid -Wunused-function on macOS for some Float16 intrinsics (Jul…
Browse files Browse the repository at this point in the history
…iaLang#43174)

We're defining `half_to_float` and `float_to_half` unconditionally but
only ever calling them on non-Mac platforms, so Clang produces unused
function warnings during the build on macOS. To fix this, we can just
move the platform check to encompass the definitions in addition to the
uses.
  • Loading branch information
ararslan authored Nov 20, 2021
1 parent c2e9311 commit 06d5308
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime_intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
const unsigned int host_char_bit = 8;

// float16 intrinsics
// TODO: use LLVM's compiler-rt
// TODO: use LLVM's compiler-rt on all platforms (Xcode already links compiler-rt)

#if !defined(_OS_DARWIN_)

static inline float half_to_float(uint16_t ival) JL_NOTSAFEPOINT
{
Expand Down Expand Up @@ -186,8 +188,6 @@ static inline uint16_t float_to_half(float param) JL_NOTSAFEPOINT
return h;
}

#if !defined(_OS_DARWIN_) // xcode already links compiler-rt

JL_DLLEXPORT float __gnu_h2f_ieee(uint16_t param)
{
return half_to_float(param);
Expand Down

0 comments on commit 06d5308

Please sign in to comment.