This is an archive of the discontinued LLVM Phabricator instance.

Mute some compiler warnings in the generated python wrapper code.
AbandonedPublic

Authored by teemperor on May 26 2018, 7:58 AM.

Details

Reviewers
zturner
Summary

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.

Diff Detail

Event Timeline

teemperor created this revision.May 26 2018, 7:58 AM
teemperor abandoned this revision.Jun 12 2018, 2:10 PM

It seems people are also in favor of completely disabling the warnings, so that patch will replace this one.