[llvm] d0c8d58 - Fix CMake configuration error when run with -Werror/-Wall

Alex Denisov via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 10 12:26:44 PDT 2020


Author: Alex Denisov
Date: 2020-10-10T21:22:40+02:00
New Revision: d0c8d58527b07d8609961ea1f084d69ce0fcd3a8

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

LOG: Fix CMake configuration error when run with -Werror/-Wall

The following code doesn't compile

  uint64_t i = x.load(std::memory_order_relaxed);
  return 0;

when CMAKE_C_FLAGS set to -Werror -Wall, thus incorrectly
breaking the CMake configuration step:

  -- Looking for __atomic_load_8 in atomic
  -- Looking for __atomic_load_8 in atomic - not found
  CMake Error at cmake/modules/CheckAtomic.cmake:79 (message):
    Host compiler appears to require libatomic for 64-bit operations, but
    cannot find it.
  Call Stack (most recent call first):
    cmake/config-ix.cmake:360 (include)
    CMakeLists.txt:671 (include)

Added: 
    

Modified: 
    llvm/cmake/modules/CheckAtomic.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
index d0b75f3bcc9c..04eed1448482 100644
--- a/llvm/cmake/modules/CheckAtomic.cmake
+++ b/llvm/cmake/modules/CheckAtomic.cmake
@@ -32,6 +32,7 @@ function(check_working_cxx_atomics64 varname)
 std::atomic<uint64_t> x (0);
 int main() {
   uint64_t i = x.load(std::memory_order_relaxed);
+  (void)i;
   return 0;
 }
 " ${varname})


        


More information about the llvm-commits mailing list