mgorny created this revision.
mgorny added reviewers: labath, zturner, teemperor.
mgorny added a project: LLDB.
Herald added subscribers: jdoerfert, abidh.

Silence zero-length format warnings in UtilityTests reported by GCC.
Zero-length format strings are permitted by the standards, and are used
purposedly in the tests.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D58680

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/unittests/Utility/CMakeLists.txt


Index: lldb/unittests/Utility/CMakeLists.txt
===================================================================
--- lldb/unittests/Utility/CMakeLists.txt
+++ lldb/unittests/Utility/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(CXX_SUPPORTS_NO_FORMAT_ZERO_LENGTH)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-zero-length")
+endif()
+
 add_lldb_unittest(UtilityTests
   AnsiTerminalTest.cpp
   ArgsTest.cpp
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -278,6 +278,9 @@
 check_cxx_compiler_flag("-Wno-nested-anon-types"
                         CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
 
+check_cxx_compiler_flag("-Wno-format-zero-length"
+                        CXX_SUPPORTS_NO_FORMAT_ZERO_LENGTH)
+
 # Disable MSVC warnings
 if( MSVC )
   add_definitions(


Index: lldb/unittests/Utility/CMakeLists.txt
===================================================================
--- lldb/unittests/Utility/CMakeLists.txt
+++ lldb/unittests/Utility/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(CXX_SUPPORTS_NO_FORMAT_ZERO_LENGTH)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-zero-length")
+endif()
+
 add_lldb_unittest(UtilityTests
   AnsiTerminalTest.cpp
   ArgsTest.cpp
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -278,6 +278,9 @@
 check_cxx_compiler_flag("-Wno-nested-anon-types"
                         CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
 
+check_cxx_compiler_flag("-Wno-format-zero-length"
+                        CXX_SUPPORTS_NO_FORMAT_ZERO_LENGTH)
+
 # Disable MSVC warnings
 if( MSVC )
   add_definitions(
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to