[compiler-rt] r332936 - [CMake] Silence unused variable warning in compiler check

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 19:53:32 PDT 2018


Author: phosek
Date: Mon May 21 19:53:32 2018
New Revision: 332936

URL: http://llvm.org/viewvc/llvm-project?rev=332936&view=rev
Log:
[CMake] Silence unused variable warning in compiler check

This is breaking the compiler check.

Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=332936&r1=332935&r2=332936&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Mon May 21 19:53:32 2018
@@ -131,11 +131,11 @@ macro(test_target_arch arch def)
   if(SANITIZER_CXX_ABI_INTREE)
     # We're using in tree C++ ABI, only test the C compiler for now.
     set(TARGET_${arch}_FILENAME "${TARGET_${arch}_NAME}/CheckTarget.c")
-    file(WRITE "${TARGET_${arch}_FILENAME}" "#include <stdlib.h>\nint main() { void *p = malloc(1); return 0; }\n")
+    file(WRITE "${TARGET_${arch}_FILENAME}" "#include <stdlib.h>\nint main() { (void)malloc(sizeof(int)); return 0; }\n")
   else()
     # We're using the system C++ ABI, test that we can build C++ programs.
     set(TARGET_${arch}_FILENAME "${TARGET_${arch}_NAME}/CheckTarget.cpp")
-    file(WRITE "${TARGET_${arch}_FILENAME}" "#include <new>\nint main() { int *p = new int; return 0; }\n")
+    file(WRITE "${TARGET_${arch}_FILENAME}" "#include <new>\nint main() { (void) new int; return 0; }\n")
   endif()
 
   set(TARGET_${arch}_CFLAGS ${ARGN})




More information about the llvm-commits mailing list