[PATCH] D47177: [CMake] Silence unused variable warning in compiler check

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 19:46:36 PDT 2018


phosek created this revision.
phosek added reviewers: vitalybuka, beanz.
Herald added subscribers: Sanitizers, llvm-commits, mgorny.

This is breaking the compiler check on bots.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D47177

Files:
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake


Index: compiler-rt/cmake/Modules/CompilerRTUtils.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -131,11 +131,11 @@
   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})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47177.147938.patch
Type: text/x-patch
Size: 1092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/de7cf90a/attachment.bin>


More information about the llvm-commits mailing list