Skip to content

[libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_FLOAT64 #73948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

gchatelet
Copy link
Contributor

No description provided.

@gchatelet gchatelet requested a review from lntue November 30, 2023 15:01
@llvmbot llvmbot added the libc label Nov 30, 2023
@llvmbot
Copy link
Member

llvmbot commented Nov 30, 2023

@llvm/pr-subscribers-libc

Author: Guillaume Chatelet (gchatelet)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/73948.diff

10 Files Affected:

  • (modified) libc/src/__support/FPUtil/generic/sqrt.h (+1-1)
  • (modified) libc/src/__support/FPUtil/x86_64/sqrt.h (+1-1)
  • (modified) libc/src/__support/float_to_string.h (+2-2)
  • (modified) libc/src/__support/macros/properties/float.h (+1-2)
  • (modified) libc/src/__support/str_to_float.h (+2-2)
  • (modified) libc/test/src/__support/FPUtil/fpbits_test.cpp (+1-1)
  • (modified) libc/test/src/__support/str_to_float_test.cpp (+1-1)
  • (modified) libc/test/src/stdio/sprintf_test.cpp (+22-22)
  • (modified) libc/test/src/stdio/sscanf_test.cpp (+1-1)
  • (modified) libc/test/src/stdlib/strtold_test.cpp (+2-2)
diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h
index 63e8329b066074a..08ae6e4cd4d9b92 100644
--- a/libc/src/__support/FPUtil/generic/sqrt.h
+++ b/libc/src/__support/FPUtil/generic/sqrt.h
@@ -43,7 +43,7 @@ LIBC_INLINE void normalize(int &exponent,
   mantissa <<= shift;
 }
 
-#ifdef LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
 template <>
 LIBC_INLINE void normalize<long double>(int &exponent, uint64_t &mantissa) {
   normalize<double>(exponent, mantissa);
diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h
index 7edba5528d6a91e..31cb73c38fbe416 100644
--- a/libc/src/__support/FPUtil/x86_64/sqrt.h
+++ b/libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -33,7 +33,7 @@ template <> LIBC_INLINE double sqrt<double>(double x) {
   return result;
 }
 
-#ifdef LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
 template <> LIBC_INLINE long double sqrt<long double>(long double x) {
   long double result;
   __asm__ __volatile__("sqrtsd %x1, %x0" : "=x"(result) : "x"(x));
diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index eb06cd9c08af287..fee7474aed293b2 100644
--- a/libc/src/__support/float_to_string.h
+++ b/libc/src/__support/float_to_string.h
@@ -602,7 +602,7 @@ class FloatToString {
   }
 };
 
-#ifndef LONG_DOUBLE_IS_DOUBLE
+#ifndef LIBC_LONG_DOUBLE_IS_DOUBLE
 // --------------------------- LONG DOUBLE FUNCTIONS ---------------------------
 
 template <>
@@ -754,7 +754,7 @@ FloatToString<long double>::get_negative_block(int block_index) {
   }
 }
 
-#endif // LONG_DOUBLE_IS_DOUBLE
+#endif // LIBC_LONG_DOUBLE_IS_DOUBLE
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/__support/macros/properties/float.h b/libc/src/__support/macros/properties/float.h
index 7e00ddc8f0cd327..1d025575934a870 100644
--- a/libc/src/__support/macros/properties/float.h
+++ b/libc/src/__support/macros/properties/float.h
@@ -19,8 +19,7 @@
 
 // 'long double' properties.
 #if (LDBL_MANT_DIG == DBL_MANT_DIG)
-// TODO: Replace with LIBC_LONG_DOUBLE_IS_DOUBLE
-#define LONG_DOUBLE_IS_DOUBLE
+#define LIBC_LONG_DOUBLE_IS_DOUBLE
 #endif
 #if (LDBL_MANT_DIG == 64)
 // TODO: Replace with LIBC_LONG_DOUBLE_IS_X86_BIN80
diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index 81ab36dbf9471fb..02f9903b83e2fe6 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -221,7 +221,7 @@ eisel_lemire(ExpandedFloat<T> init_num,
   return output;
 }
 
-#if !defined(LONG_DOUBLE_IS_DOUBLE)
+#if !defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
 template <>
 LIBC_INLINE cpp::optional<ExpandedFloat<long double>>
 eisel_lemire<long double>(ExpandedFloat<long double> init_num,
@@ -516,7 +516,7 @@ template <> class ClingerConsts<double> {
   static constexpr double MAX_EXACT_INT = 9007199254740991.0;
 };
 
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
 template <> class ClingerConsts<long double> {
 public:
   static constexpr long double POWERS_OF_TEN_ARRAY[] = {
diff --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp
index 027db8807ab226a..f0fb7436e7c7015 100644
--- a/libc/test/src/__support/FPUtil/fpbits_test.cpp
+++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp
@@ -213,7 +213,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
 }
 #else
 TEST(LlvmLibcFPBitsTest, LongDoubleType) {
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   return; // The tests for the "double" type cover for this case.
 #else
   using LongDoubleBits = FPBits<long double>;
diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp
index ae729418ebe3639..b5d0b29c253d5d1 100644
--- a/libc/test/src/__support/str_to_float_test.cpp
+++ b/libc/test/src/__support/str_to_float_test.cpp
@@ -279,7 +279,7 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) {
   EXPECT_EQ(double_result.error, 0);
 }
 
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
 TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat64AsLongDouble) {
   eisel_lemire_test<long double>(123, 0, 0x1EC00000000000, 1029);
 }
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index e41579a20656b72..17ad19afbfb1ec1 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -644,7 +644,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
   written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
 #if defined(SPECIAL_X86_LONG_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
 #else // 128 bit long double
   ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -653,7 +653,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
   written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
 #if defined(SPECIAL_X86_LONG_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "inf");
 #else // 128 bit long double
   ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -662,7 +662,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
   written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
 #if defined(SPECIAL_X86_LONG_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0x0p+0");
 #else // 128 bit long double
   ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -768,7 +768,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
   written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
 #if defined(SPECIAL_X86_LONG_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
 #else // 128 bit long double
   ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -777,7 +777,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) {
   written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L);
 #if defined(SPECIAL_X86_LONG_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
-#elif defined(LONG_DOUBLE_IS_DOUBLE)
+#elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   ASSERT_STREQ_LEN(written, buff, "inf");
 #else // 128 bit long double
   ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -1024,14 +1024,14 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
 
 // Some float128 systems (specifically the ones used for aarch64 buildbots)
 // don't respect signs for long double NaNs.
-#if defined(SPECIAL_X86_LONG_DOUBLE) || defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(SPECIAL_X86_LONG_DOUBLE) || defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   written = LIBC_NAMESPACE::sprintf(buff, "%LF", -ld_nan);
   ASSERT_STREQ_LEN(written, buff, "-NAN");
 #endif
 
   // Length Modifier Tests.
 
-  // TODO(michaelrj): Add tests for LONG_DOUBLE_IS_DOUBLE and 128 bit long
+  // TODO(michaelrj): Add tests for LIBC_LONG_DOUBLE_IS_DOUBLE and 128 bit long
   // double systems.
   // TODO(michaelrj): Fix the tests to only depend on the digits the long double
   // is accurate for.
@@ -1333,7 +1333,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -1342,7 +1342,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "inf");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -1351,7 +1351,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x0p+0");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -1550,7 +1550,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -1559,7 +1559,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
   0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "inf");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -1977,7 +1977,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -1986,7 +1986,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "inf");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -1995,7 +1995,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x0p+0");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -2173,7 +2173,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -2182,7 +2182,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
   0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "inf");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
@@ -2616,7 +2616,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4");
@@ -2625,7 +2625,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "inf");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321");
@@ -2634,7 +2634,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x0p+0");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.0d152311513c28ce202627c06ec2p-3322");
@@ -2822,7 +2822,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L);
   #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0xc.dp-7");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x1.ap-4");
@@ -2831,7 +2831,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
     written = LIBC_NAMESPACE::sprintf(buff, "%.1La",
   0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384");
-  #elif defined(LONG_DOUBLE_IS_DOUBLE)
+  #elif defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
     ASSERT_STREQ_LEN(written, buff, "inf");
   #else // 128 bit long double
     ASSERT_STREQ_LEN(written, buff, "0x2.0p+16383");
diff --git a/libc/test/src/stdio/sscanf_test.cpp b/libc/test/src/stdio/sscanf_test.cpp
index ec53c08bd9d41bf..064a1a511881d8b 100644
--- a/libc/test/src/stdio/sscanf_test.cpp
+++ b/libc/test/src/stdio/sscanf_test.cpp
@@ -322,7 +322,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) {
   EXPECT_EQ(ret_val, 1);
 // 1e600 may be larger than the maximum long double (if long double is double).
 // In that case both of these should be evaluated as inf.
-#ifdef LONG_DOUBLE_IS_DOUBLE
+#ifdef LIBC_LONG_DOUBLE_IS_DOUBLE
   EXPECT_FP_EQ(ld_result, d_inf);
 #else
   EXPECT_FP_EQ(ld_result, 1.0e600L);
diff --git a/libc/test/src/stdlib/strtold_test.cpp b/libc/test/src/stdlib/strtold_test.cpp
index 680a93188c76d1d..42834398573f429 100644
--- a/libc/test/src/stdlib/strtold_test.cpp
+++ b/libc/test/src/stdlib/strtold_test.cpp
@@ -16,7 +16,7 @@
 #include <limits.h>
 #include <stddef.h>
 
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
 #define SELECT_CONST(val, _, __) val
 #elif defined(SPECIAL_X86_LONG_DOUBLE)
 #define SELECT_CONST(_, val, __) val
@@ -26,7 +26,7 @@
 
 class LlvmLibcStrToLDTest : public LIBC_NAMESPACE::testing::Test {
 public:
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if defined(LIBC_LONG_DOUBLE_IS_DOUBLE)
   void run_test(const char *inputString, const ptrdiff_t expectedStrLen,
                 const uint64_t expectedRawData, const int expectedErrno = 0)
 #else

@gchatelet
Copy link
Contributor Author

Not a super interesting PR but I intend to make sure libc properties are formatted consistently. Let me know if you have a better name to suggest.

Copy link
Contributor

@lntue lntue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it, technically in this case, long double and double are still 2 different types to the compilers, so LIBC_LONG_DOUBLE_IS_FLOAT64 should fit better. WDYT?

@jhuber6
Copy link
Contributor

jhuber6 commented Nov 30, 2023

Now that I think about it, technically in this case, long double and double are still 2 different types to the compilers, so LIBC_LONG_DOUBLE_IS_FLOAT64 should fit better. WDYT?

I agree, since they are distinct types as far as the compiler is concerned, see https://godbolt.org/z/szYf3jYPP for the GPU case.

@gchatelet
Copy link
Contributor Author

Agreed

@gchatelet gchatelet changed the title [libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_DOUBLE [libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_FLOAT64 Dec 1, 2023
@gchatelet gchatelet merged commit 808b7d2 into llvm:main Dec 1, 2023
@gchatelet gchatelet deleted the rename_float_properties branch December 1, 2023 12:55
gchatelet added a commit that referenced this pull request Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants