lldb build warnings

How do folks handle warnings when building debug lldb?

I’m building on Linux with Clang 3.2 and had to add these options to get the number down to a reasonable count:

-Wno-sign-compare -Wno-four-char-constants -Wno-extended-offsetof -Wno-unused-function

Still seeing several others though (down below). Having all these warnings can make it difficult to track down new ones though.
-Mike

mikesart@mikesart-rad:~/data/src/llvm/build$ lldb_build
ninja: Entering directory `/home/mikesart/data/src/llvm/build’
[88/2270] cd /home/mikesart/data/src/llvm/build/tools/clang/lib/Basic && /usr/local/bin/cmak…ang/lib/Basic/SVNVersion.inc -P /home/mikesart/data/src/llvm/llvm/cmake/modules/GetSVN.cmak
– Found Subversion: /usr/bin/svn (found version “1.7.9”)
[140/2270] Building lldb python wrapper
SWIG needs to be re-run.
[633/2270] Building CXX object lib/Target/PowerPC/InstPrinter/CMakeFiles/LLVMPowerPCAsmPrinter.dir/PPCInstPrinter.cpp.o
/home/mikesart/data/src/llvm/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp:92:13: warning: enumeration value ‘PRED_BAD’ not handled in switch [-Wswitch]
switch ((PPC::Predicate)Code) {
^
1 warning generated.
[722/2270] Building CXX object lib/Target/PowerPC/MCTargetDesc/CMakeFiles/LLVMPowerPCDesc.dir/PPCPredicates.cpp.o
/home/mikesart/data/src/llvm/llvm/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.cpp:20:11: warning: enumeration value ‘PRED_BAD’ not handled in switch [-Wswitch]
switch (Opcode) {
^
/home/mikesart/data/src/llvm/llvm/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.cpp:34:11: warning: enumeration value ‘PRED_BAD’ not handled in switch [-Wswitch]
switch (Opcode) {
^
2 warnings generated.
[1936/2270] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/DataExtractor.cpp.o
/home/mikesart/data/src/llvm/llvm/tools/lldb/source/Core/DataExtractor.cpp:1328:22: warning: hexadecimal floating constants are a C99 feature [-Wc99-extensions]
return u.f * 0x1.0p125f;
^
/home/mikesart/data/src/llvm/llvm/tools/lldb/source/Core/DataExtractor.cpp:1333:18: warning: hexadecimal floating constants are a C99 feature [-Wc99-extensions]
return u.f * 0x1.0p-112f;
^
2 warnings generated.
[2264/2270] Building CXX object tools/lldb/source/CMakeFiles/liblldb.dir/__/scripts/LLDBWrapPython.cpp.o

tools/lldb/scripts/LLDBWrapPython.cpp:2380:23: warning: explicitly assigning a variable of type ‘int’ to itself [-Wself-assign]
res = SWIG_AddCast(res);

tools/lldb/scripts/LLDBWrapPython.cpp:2383:23: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
tools/lldb/scripts/LLDBWrapPython.cpp:2905:9: warning: variable 'res' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~
tools/lldb/scripts/LLDBWrapPython.cpp:2929:10: note: uninitialized use occurs here
return res;
^~~
tools/lldb/scripts/LLDBWrapPython.cpp:2905:5: note: remove the 'if' if its condition is always false
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~
tools/lldb/scripts/LLDBWrapPython.cpp:2886:10: note: initialize the variable 'res' to silence this warning
int res;
^
= 0
tools/lldb/scripts/LLDBWrapPython.cpp:54935:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
4 warnings generated.

Ø -Wno-sign-compare -Wno-four-char-constants -Wno-extended-offsetof -Wno-unused-function

Do you need to disable these warnings when building with clang 3.4? The short list of remaining warnings that you quoted is more consistent with the clang 3.4 buildbot runs. Example:

http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang/builds/4094/steps/compile/logs/warnings%20%286%29

FYI, Matt has done a great job of fixing a lot of warnings to date. Example:

http://llvm.org/viewvc/llvm-project?rev=183140&view=rev

  • Ashok

Our intention was to suppress (false positives) by adding the "–Wno" switches to the definition lists in the top–level CMakeLists.txt (see around line 114) but clearly have not been vigilant enough about suppressing warnings or fixing them as they crop up :frowning:

Personally, I look forward to the day we turn on –Werror (if not –Wall) but that may not be in the near future.

Cheers,
Dan

Do you need to disable these warnings when building with clang 3.4? The short list of remaining warnings that you quoted is more consistent with the clang 3.4 buildbot runs. Example:
http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang/builds/4094/steps/compile/logs/warnings%20%286%29

Building with clang 3.4 produces the same warnings as 3.2 - which is good because some of these seem quite legit. :slight_smile: When I do a full clean build, I get ~100 warnings.

Is the buildbot only building modules that were recently changed? Is that why it doesn’t see these warnings usually? I’m also building Debug…

In any case, I’ll go through and fix these when I run across them. Just hate to get into that battle if others are busy adding more, but it seems like the eventual goal would be to narrow these down, so it’s good.

Thanks much.
-Mike