[libc-commits] [libc] c00f8f1 - [libc] Split out FPExceptMatcher from the FP utils

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed May 3 09:38:01 PDT 2023


Author: Joseph Huber
Date: 2023-05-03T11:37:49-05:00
New Revision: c00f8f1314479d6f764f89cfa4efe2f23a640adf

URL: https://github.com/llvm/llvm-project/commit/c00f8f1314479d6f764f89cfa4efe2f23a640adf
DIFF: https://github.com/llvm/llvm-project/commit/c00f8f1314479d6f764f89cfa4efe2f23a640adf.diff

LOG: [libc] Split out FPExceptMatcher from the FP utils

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

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149745

Added: 
    

Modified: 
    libc/test/UnitTest/CMakeLists.txt
    libc/test/src/fenv/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index cc8140713106e..f74577bacabc9 100644
--- a/libc/test/UnitTest/CMakeLists.txt
+++ b/libc/test/UnitTest/CMakeLists.txt
@@ -71,8 +71,6 @@ add_header_library(
 
 add_library(
   LibcFPTestHelpers
-  FPExceptMatcher.cpp
-  FPExceptMatcher.h
   FPMatcher.h
   RoundingModeUtils.cpp
   RoundingModeUtils.h
@@ -85,6 +83,17 @@ add_dependencies(
   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 @@ add_dependencies(
   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)

diff  --git a/libc/test/src/fenv/CMakeLists.txt b/libc/test/src/fenv/CMakeLists.txt
index 325ec5b1d2635..11179cc88c380 100644
--- a/libc/test/src/fenv/CMakeLists.txt
+++ b/libc/test/src/fenv/CMakeLists.txt
@@ -104,6 +104,8 @@ if (NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows")
       libc.src.fenv.feraiseexcept
       libc.src.fenv.fetestexcept
       libc.src.__support.FPUtil.fenv_impl
+    LINK_LIBRARIES
+      LibcFPExceptionHelpers
   )
 
   add_fp_unittest(
@@ -116,5 +118,7 @@ if (NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows")
       libc.include.fenv
       libc.src.fenv.feholdexcept
       libc.src.__support.FPUtil.fenv_impl
+    LINK_LIBRARIES
+      LibcFPExceptionHelpers
   )
 endif()


        


More information about the libc-commits mailing list