[flang-commits] [flang] [flang] Fix Darwin build after 4762c6557d15 (PR #84478)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Fri Mar 8 05:19:24 PST 2024
https://github.com/luporl created https://github.com/llvm/llvm-project/pull/84478
Select POSIX 2008 standard to avoid including Darwin extensions.
Otherwise, Darwin's math.h header defines HUGE, which conflicts
with Flang's HUGE function.
This is a temporary build fix. More permanent solutions would be to
rename Flang's HUGE or to define _POSIX_C_SOURCE for Flang as a
whole.
This started happening after 4762c6557d15 (#82443), that added the
"utility" include, which seems to include "math.h".
>From b024690e21ee44847b50be04065ff3e0fb63f68e Mon Sep 17 00:00:00 2001
From: Leandro Lupori <leandro.lupori at linaro.org>
Date: Fri, 8 Mar 2024 09:55:49 -0300
Subject: [PATCH] [flang] Fix Darwin build after 4762c6557d15
Select POSIX 2008 standard to avoid including Darwin extensions.
Otherwise, Darwin's math.h header defines HUGE, which conflicts
with Flang's HUGE function.
This is a temporary build fix. More permanent solutions would be to
rename Flang's HUGE or to define _POSIX_C_SOURCE for Flang as a
whole.
This started happening after 4762c6557d15 (#82443), that added the
"utility" include, which seems to include "math.h".
---
flang/lib/Decimal/decimal-to-binary.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/flang/lib/Decimal/decimal-to-binary.cpp b/flang/lib/Decimal/decimal-to-binary.cpp
index c5cdb72e355f62..7b37215f597927 100644
--- a/flang/lib/Decimal/decimal-to-binary.cpp
+++ b/flang/lib/Decimal/decimal-to-binary.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#define _POSIX_C_SOURCE 200809
+
#include "big-radix-floating-point.h"
#include "flang/Common/bit-population-count.h"
#include "flang/Common/leading-zero-bit-count.h"
More information about the flang-commits
mailing list