[compiler-rt] [builtins] Avoid using long double in FreeBSD standalone environment (PR #76175)

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 05:45:41 PST 2023


================
@@ -156,7 +156,9 @@ typedef struct {
 // still makes it 80 bits. Clang will match whatever compiler it is trying to
 // be compatible with. On 32-bit x86 Android, long double is 64 bits, while on
 // x86_64 Android, long double is 128 bits.
-#if (defined(__i386__) || defined(__x86_64__)) &&                              \
+#if !CRT_HAS_FLOATING_POINT
----------------
DimitryAndric wrote:

I'm sorry, but you both seem to suggest different things. :)

So @arichardson seems to suggest extending the `#if CRT_HAS_FLOATING_POINT ` block from line 132 (just after the `#if defined(__FreeBSD__) && defined(_STANDALONE)` line) to the next-to-last `#endif` (just before `#endif // INT_TYPES_H`). I.e., remove the `#endif` on line 142 (just after the `float_bits` and `double_bits` unions), and also remove `#if CRT_HAS_FLOATING_POINT` on line 223 (just before the `#if __STDC_VERSION__ >= 199901L` line. Effectively, this makes everything from line 132 onward disappear when floating point isn't supported.

@compnerd seems to to suggest only moving only the block that defines `HAS_80BIT_LONG_DOUBLE` (lines 154 through 166) to just after line 129. I.e. in the `#else` case of the `#if defined(__FreeBSD__) && defined(_STANDALONE)` block.

Have I got that right? I think @arichardson's suggestion is somewhat more clear, and I would also like to add comments in the `#endif` directives to indicated what block they belong to. I.e. `#endif // CRT_HAS_FLOATING_POINT` etc.

https://github.com/llvm/llvm-project/pull/76175


More information about the llvm-commits mailing list