Skip to content

Commit 788be0d

Browse files
authored
[flang] fix build on *BSD after 4762c65 (#86204)
The HUGE definition collides with the HUGE macro from math.h. Unlike the fix in 3149c93 (#84478) (largely reverted in f95710c), add another #undef HUGE since there is no practical way to make FreeBSD's headers not define HUGE and still define XSI interfaces such as isascii or strnlen. Update comments above `#undef HUGE` instances to reflect the fact that all major BSD versions (I checked DragonFly, FreeBSD, NetBSD, and OpenBSD) leak the HUGE macro from math.h to various degrees. Fixes #86038
1 parent 4a04fca commit 788be0d

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

flang/include/flang/Evaluate/integer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <string>
2828
#include <type_traits>
2929

30-
// Some environments, viz. glibc 2.17, allow the macro HUGE
30+
// Some environments, viz. glibc 2.17 and *BSD, allow the macro HUGE
3131
// to leak out of <math.h>.
3232
#undef HUGE
3333

flang/include/flang/Evaluate/real.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <limits>
1919
#include <string>
2020

21-
// Some environments, viz. glibc 2.17, allow the macro HUGE
21+
// Some environments, viz. glibc 2.17 and *BSD, allow the macro HUGE
2222
// to leak out of <math.h>.
2323
#undef HUGE
2424

flang/lib/Decimal/decimal-to-binary.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include <cstring>
1717
#include <utility>
1818

19+
// Some environments, viz. glibc 2.17 and *BSD, allow the macro HUGE
20+
// to leak out of <math.h>.
21+
#undef HUGE
22+
1923
namespace Fortran::decimal {
2024

2125
template <int PREC, int LOG10RADIX>

flang/lib/Evaluate/fold-implementation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <type_traits>
4040
#include <variant>
4141

42-
// Some environments, viz. glibc 2.17, allow the macro HUGE
42+
// Some environments, viz. glibc 2.17 and *BSD, allow the macro HUGE
4343
// to leak out of <math.h>.
4444
#undef HUGE
4545

0 commit comments

Comments
 (0)