[Lldb-commits] [PATCH] D47411: Mute some compiler warnings in the generated python wrapper code.

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat May 26 07:58:42 PDT 2018


teemperor created this revision.
teemperor added a reviewer: zturner.
Herald added a subscriber: mgorny.

With SWIG 3.0.12 I get the following compiler warnings when compiling LLDB:

  tools/lldb/scripts/LLDBWrapPython.cpp:23699:52: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
      result = (int)(arg1)->SetErrorStringWithFormat((char const *)arg2);
                                                     ^             ~~~~
  tools/lldb/scripts/LLDBWrapPython.cpp:23699:52: note: treat the string as an argument to avoid this
      result = (int)(arg1)->SetErrorStringWithFormat((char const *)arg2);
                                                     ^
                                                     "%s", 
  tools/lldb/scripts/LLDBWrapPython.cpp:52418:21: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
        for (i = 0; i < arg3; i++) {
                    ~ ^ ~~~~
  tools/lldb/scripts/LLDBWrapPython.cpp:52510:21: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
        for (i = 0; i < arg3; i++) {
                    ~ ^ ~~~~
  tools/lldb/scripts/LLDBWrapPython.cpp:52611:21: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
        for (i = 0; i < arg3; i++) {
                    ~ ^ ~~~~

As the code is anyway generated we probably should disable those two warnings for the source file.


https://reviews.llvm.org/D47411

Files:
  source/API/CMakeLists.txt


Index: source/API/CMakeLists.txt
===================================================================
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -108,6 +108,12 @@
     set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
   endif()
 endif()
+
+if (NOT MSVC)
+  # The generated code triggers some compiler warnings that we can ignore.
+  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sign-compare -Wno-format-security")
+endif()
+
 set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
 if (CLANG_CL)
   set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47411.148720.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180526/5fdbf333/attachment.bin>


More information about the lldb-commits mailing list