[libc-commits] [PATCH] D149745: [libc] Split out FPExceptMatcher from the FP utils

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 3 06:39:55 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: sivachandra, lntue, michaelrj.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.

The FPEceptMatcher.cpp file uses system utilities and includes C++
libraries. This patch pulls it out of the main `FPTestHelpers` target so
we can exclude it from hermetic only tests.

Depends on D149705 <https://reviews.llvm.org/D149705>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149745

Files:
  libc/test/UnitTest/CMakeLists.txt
  libc/test/src/CMakeLists.txt


Index: libc/test/src/CMakeLists.txt
===================================================================
--- libc/test/src/CMakeLists.txt
+++ libc/test/src/CMakeLists.txt
@@ -24,7 +24,11 @@
     set(test_type UNIT_TEST_ONLY)
     list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper libc_math_test_utils -lmpfr -lgmp)
   endif()
-  list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
+  if(MATH_UNITTEST_HERMETIC_TEST_ONLY)
+    list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
+  else()
+    list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers LibcFPExceptionHelpers)
+  endif()
 
   add_libc_unittest(
     ${name}
Index: libc/test/UnitTest/CMakeLists.txt
===================================================================
--- libc/test/UnitTest/CMakeLists.txt
+++ libc/test/UnitTest/CMakeLists.txt
@@ -71,8 +71,6 @@
 
 add_library(
   LibcFPTestHelpers
-  FPExceptMatcher.cpp
-  FPExceptMatcher.h
   FPMatcher.h
   RoundingModeUtils.cpp
   RoundingModeUtils.h
@@ -85,6 +83,17 @@
   libc.src.__support.FPUtil.fenv_impl
   libc.test.UnitTest.string_utils
 )
+add_library(
+  LibcFPExceptionHelpers
+  FPExceptMatcher.cpp
+  FPExceptMatcher.h
+)
+add_dependencies(
+  LibcFPExceptionHelpers
+  LibcUnitTest
+  libc.src.__support.FPUtil.fp_bits
+  libc.src.__support.FPUtil.fenv_impl
+)
 
 add_library(
   LibcMemoryHelpers
@@ -123,7 +132,8 @@
   libc.test.UnitTest.string_utils
 )
 
-foreach(lib LibcFPTestHelpers LibcMemoryHelpers LibcPrintfHelpers LibcScanfHelpers)
+foreach(lib LibcFPTestHelpers LibcFPExceptionHelpers LibcMemoryHelpers 
+            LibcPrintfHelpers LibcScanfHelpers)
   target_include_directories(${lib} PUBLIC ${LIBC_SOURCE_DIR})
   target_compile_options(${lib} PRIVATE -fno-exceptions -fno-rtti)
   target_link_libraries(${lib} LibcUnitTest)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149745.519055.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230503/4ce0736f/attachment.bin>


More information about the libc-commits mailing list