[libcxx-commits] [PATCH] D111671: [libcxx] [test] Generalize the conditions for testing bitcasts between long double, double and int128

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 13 10:28:31 PDT 2021


Quuxplusone accepted this revision.
Quuxplusone added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp:233
+#endif
+#if !defined(_LIBCPP_HAS_NO_INT128)
+#if defined(__SIZEOF_LONG_DOUBLE__) && defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__
----------------
Mordante wrote:
> In `__config` there's this definition
> ```
> #ifndef __SIZEOF_INT128__
> #define _LIBCPP_HAS_NO_INT128
> #endif
> ```
> So this test can be removed.
LGTM mod this comment as well. Also, I don't think you should be "silently hiding" if `__SIZEOF_DOUBLE__` is not defined. In the unlikely event that it's not defined, I think we //want// to be told about it via `-Wundefined-macro-is-zero` or whatever that warning's name is.

So when this is addressed, you'll just have
```
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
        test_roundtrip_through<double, false>(i);
#endif
#if defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__
        test_roundtrip_through<__int128_t, false>(i);
        test_roundtrip_through<__uint128_t, false>(i);
#endif
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111671/new/

https://reviews.llvm.org/D111671



More information about the libcxx-commits mailing list