[PATCH] D115468: CMake: Suppress warnings from llvm-libtool

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 13:56:05 PST 2021


dexonsmith created this revision.
dexonsmith added a reviewer: alexander-shaposhnikov.
Herald added a subscriber: mgorny.
dexonsmith requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added a subscriber: Sanitizers.

cdcb60a820571f7384920fb534ce23e7568bfc03 <https://reviews.llvm.org/rGcdcb60a820571f7384920fb534ce23e7568bfc03> added warnings for objects with
no symbols and the `-no_warning_for_no_symbols` flag. That commit landed
in LLVM 13.0.0. Update CMake configuration to use the flag.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115468

Files:
  compiler-rt/cmake/Modules/UseLibtool.cmake
  llvm/cmake/modules/UseLibtool.cmake


Index: llvm/cmake/modules/UseLibtool.cmake
===================================================================
--- llvm/cmake/modules/UseLibtool.cmake
+++ llvm/cmake/modules/UseLibtool.cmake
@@ -28,6 +28,12 @@
     if(NOT LIBTOOL_VERSION VERSION_LESS "862")
       set(LIBTOOL_NO_WARNING_FLAG "-no_warning_for_no_symbols")
     endif()
+  elseif("${LIBTOOL_V_OUTPUT}" MATCHES "LLVM version ([0-9.]+).*")
+    string(REGEX REPLACE ".*LLVM version ([0-9.]+).*" "\\1" LIBTOOL_VERSION
+      ${LIBTOOL_V_OUTPUT})
+    if(NOT LIBTOOL_VERSION VERSION_LESS "13")
+      set(LIBTOOL_NO_WARNING_FLAG "-no_warning_for_no_symbols")
+    endif()
   endif()
 
   foreach(lang ${languages})
Index: compiler-rt/cmake/Modules/UseLibtool.cmake
===================================================================
--- compiler-rt/cmake/Modules/UseLibtool.cmake
+++ compiler-rt/cmake/Modules/UseLibtool.cmake
@@ -28,6 +28,12 @@
     if(NOT LIBTOOL_VERSION VERSION_LESS "862")
       set(LIBTOOL_NO_WARNING_FLAG "-no_warning_for_no_symbols")
     endif()
+  elseif("${LIBTOOL_V_OUTPUT}" MATCHES "LLVM version ([0-9.]+).*")
+    string(REGEX REPLACE ".*LLVM version ([0-9.]+).*" "\\1" LIBTOOL_VERSION
+      ${LIBTOOL_V_OUTPUT})
+    if(NOT LIBTOOL_VERSION VERSION_LESS "13")
+      set(LIBTOOL_NO_WARNING_FLAG "-no_warning_for_no_symbols")
+    endif()
   endif()
 
   foreach(lang ${languages})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115468.393280.patch
Type: text/x-patch
Size: 1375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211209/61dce6df/attachment.bin>


More information about the llvm-commits mailing list