[PATCH] D23030: [CMake] Don't trust compiler error code, also check for errors

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 13:26:04 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL277377: [CMake] Don't trust compiler error code, also check for errors (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D23030?vs=66367&id=66369#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23030

Files:
  compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake

Index: compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake
===================================================================
--- compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake
+++ compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake
@@ -1,3 +1,4 @@
+include(CMakeCheckCompilerFlagCommonPatterns)
 
 # This function takes an OS and a list of architectures and identifies the
 # subset of the architectures list that the installed toolchain can target.
@@ -37,7 +38,18 @@
     OUTPUT_VARIABLE TEST_OUTPUT
     ERROR_VARIABLE TEST_ERROR
   )
-  if(result EQUAL 0)
+
+  CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS)
+  foreach(var ${_CheckCCompilerFlag_COMMON_PATTERNS})
+    if("${var}" STREQUAL "FAIL_REGEX")
+      continue()
+    endif()
+    if("${var}" MATCHES "${_CheckCCompilerFlag_COMMON_PATTERNS}")
+      set(ERRORS_FOUND True)
+    endif()
+  endforeach()
+
+  if(result EQUAL 0 AND NOT ERRORS_FOUND)
     set(${output} True PARENT_SCOPE)
   else()
     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23030.66369.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160801/0a992120/attachment.bin>


More information about the llvm-commits mailing list