[libcxx-commits] [PATCH] D108071: [libcxx] Improve testing in #ifdef.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 16 10:39:00 PDT 2021


Mordante added inline comments.


================
Comment at: libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp:95
 
-#if defined(__PPC__) && __LONG_DOUBLE_128__ && !__LONG_DOUBLE_IEEE128__
+#if defined(__PPC__) && defined(__LONG_DOUBLE_128__) && !defined(__LONG_DOUBLE_IEEE128__)
 //	For 128 bit long double implemented as 2 doubles on PowerPC,
----------------
Quuxplusone wrote:
> Who sets the `__LONG_DOUBLE_128__` macro — some vendor's compiler?
> Are you sure this doesn't need to be
> ```
> #if defined(__PPC__) && (defined(__LONG_DOUBLE_128__) && __LONG_DOUBLE_128__) && !(defined(__LONG_DOUBLE_IEEE128__) && __LONG_DOUBLE_IEEE128__)
> ```
> to deal with the (hypothetical but I-don't-know-if-impossible) case of either `__LONG_DOUBLE_128__` or `__LONG_DOUBLE_IEEE128__` being defined as `0`?
Due to the bug report is for the release I strongly suspect the compiler in question is Clang.

Based on Clang's implementation I think the current approach is correct.
clang/lib/Basic/Targets/PPC.cpp:297
```
  if (LongDoubleWidth == 128) {
    Builder.defineMacro("__LONG_DOUBLE_128__");
    Builder.defineMacro("__LONGDOUBLE128");
    if (Opts.PPCIEEELongDouble)
      Builder.defineMacro("__LONG_DOUBLE_IEEE128__");
    else
      Builder.defineMacro("__LONG_DOUBLE_IBM128__");
  }
```
I still would like @Conanap to validate this fixes that build error on PPC.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108071



More information about the libcxx-commits mailing list