[flang-commits] [flang] [flang] Fixed build issues after f20ea05. (PR #84377)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Thu Mar 7 12:39:32 PST 2024
https://github.com/vzakhari created https://github.com/llvm/llvm-project/pull/84377
Older versions of clang do not have __builtin_complex, but they
may define `__GNUC__`.
>From 22032ea5feea63291e481c10a4241b95960e38d5 Mon Sep 17 00:00:00 2001
From: Slava Zakharin <szakharin at nvidia.com>
Date: Thu, 7 Mar 2024 12:31:51 -0800
Subject: [PATCH] [flang] Fixed build issues after f20ea05.
Older versions of clang do not have __builtin_complex, but they
may define `__GNUC__`.
---
flang/runtime/complex-reduction.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/flang/runtime/complex-reduction.c b/flang/runtime/complex-reduction.c
index 72c31ce08b875a..574536badcf6bf 100644
--- a/flang/runtime/complex-reduction.c
+++ b/flang/runtime/complex-reduction.c
@@ -75,6 +75,7 @@ static long_double_Complex_t CMPLXL(long double r, long double i) {
#endif
#endif
+/* clang-format off */
#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
#ifndef CMPLXF128
/*
@@ -82,7 +83,8 @@ static long_double_Complex_t CMPLXL(long double r, long double i) {
* supports __builtin_complex. For Clang, require >=12.0.
* Otherwise, rely on the memory layout compatibility.
*/
-#if (defined(__clang_major__) && (__clang_major__ >= 12)) || defined(__GNUC__)
+#if (defined(__clang_major__) && (__clang_major__ >= 12)) ||
+ (defined(__GNUC__) && !defined(__clang__))
#define CMPLXF128 __builtin_complex
#else
static CFloat128ComplexType CMPLXF128(CFloat128Type r, CFloat128Type i) {
@@ -154,3 +156,4 @@ ADAPT_REDUCTION(DotProductComplex10, long_double_Complex_t,
ADAPT_REDUCTION(DotProductComplex16, CFloat128ComplexType, CppComplexFloat128,
CMPLXF128, DOT_PRODUCT_ARGS, DOT_PRODUCT_ARG_NAMES)
#endif
+ /* clang-format on */
More information about the flang-commits
mailing list