[PATCH] D146834: [support] Temporarily disable Inf/NaN testing in PrintNumber

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 11:21:19 PDT 2023


paulkirth updated this revision to Diff 508171.
paulkirth added a comment.

Remove most commented out code. Specifically leaving the `PrintNumber` ones, since they are clear about what should be re-enabled.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146834/new/

https://reviews.llvm.org/D146834

Files:
  llvm/unittests/Support/ScopedPrinterTest.cpp


Index: llvm/unittests/Support/ScopedPrinterTest.cpp
===================================================================
--- llvm/unittests/Support/ScopedPrinterTest.cpp
+++ llvm/unittests/Support/ScopedPrinterTest.cpp
@@ -567,17 +567,20 @@
 
     W.printNumber("float-max", MaxFloat);
     W.printNumber("float-min", MinFloat);
-    W.printNumber("float-inf", InfFloat);
-    W.printNumber("float-nan", NaNFloat);
     W.printNumber("float-42.0", 42.0f);
     W.printNumber("float-42.5625", 42.5625f);
 
     W.printNumber("double-max", MaxDouble);
     W.printNumber("double-min", MinDouble);
-    W.printNumber("double-inf", InfDouble);
-    W.printNumber("double-nan", NaNDouble);
     W.printNumber("double-42.0", 42.0);
     W.printNumber("double-42.5625", 42.5625);
+
+    // FIXME: temporarily disable checking the for Inf and NaN until we have a
+    // cross platform solution can handle this case
+    // W.printNumber("float-inf", InfFloat);
+    // W.printNumber("float-nan", NaNFloat);
+    // W.printNumber("double-inf", InfDouble);
+    // W.printNumber("double-nan", NaNDouble);
   };
 
   // Make sure when we check floating point representation we avoid
@@ -598,30 +601,8 @@
   format("%5.1f", MaxDouble).snprint(Buf, sizeof(Buf));
   std::string MaxDoubleStr(Buf);
 
-  format("%5.1f", InfFloat).snprint(Buf, sizeof(Buf));
-  std::string InfFloatStr(Buf);
-
-  format("%5.1f", InfDouble).snprint(Buf, sizeof(Buf));
-  std::string InfDoubleStr(Buf);
-
-  format("%5.1f", NaNFloat).snprint(Buf, sizeof(Buf));
-  std::string NaNFloatStr(Buf);
-
-  format("%5.1f", NaNDouble).snprint(Buf, sizeof(Buf));
-  std::string NaNDoubleStr(Buf);
-
-  format("%.*g", InfFloat).snprint(Buf, sizeof(Buf));
-  std::string JsonInfFloatStr(Buf);
-
-  format("%.*g", InfDouble).snprint(Buf, sizeof(Buf));
-  std::string JsonInfDoubleStr(Buf);
-
-  format("%.*g", NaNFloat).snprint(Buf, sizeof(Buf));
-  std::string JsonNaNFloatStr(Buf);
-
-  format("%.*g", NaNDouble).snprint(Buf, sizeof(Buf));
-  std::string JsonNaNDoubleStr(Buf);
-
+  // FIXME: temporarily disable checking the for Inf and NaN until we have a
+  // cross platform solution can handle this case
 
   std::string ExpectedOut = Twine(
                                 R"(uint64_t-max: 18446744073709551615
@@ -644,15 +625,11 @@
 label: value (0)
 float-max: )" + MaxFloatStr + R"(
 float-min:   0.0
-float-inf: )" + InfFloatStr + R"(
-float-nan: )" + NaNFloatStr + R"(
 float-42.0:  42.0
 float-42.5625:  42.6
 double-max: )" + MaxDoubleStr +
                                 R"(
 double-min:   0.0
-double-inf: )" + InfDoubleStr + R"(
-double-nan: )" + NaNDoubleStr + R"(
 double-42.0:  42.0
 double-42.5625:  42.6
 )")
@@ -682,17 +659,14 @@
   },
   "float-max": 3.4028234663852886e+38,
   "float-min": 1.1754943508222875e-38,
-  "float-inf": )" + JsonInfFloatStr + R"(,
-  "float-nan": )" + JsonNaNFloatStr + R"(,
   "float-42.0": 42,
   "float-42.5625": 42.5625,
   "double-max": 1.7976931348623157e+308,
   "double-min": 2.2250738585072014e-308,
-  "double-inf": )" + JsonInfDoubleStr + R"(,
-  "double-nan": )" + JsonNaNDoubleStr + R"(,
   "double-42.0": 42,
   "double-42.5625": 42.5625
-})").str();
+})")
+                                    .str();
   verifyAll(ExpectedOut, JSONExpectedOut, PrintFunc);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146834.508171.patch
Type: text/x-patch
Size: 3284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230324/090ca343/attachment.bin>


More information about the llvm-commits mailing list