[Lldb-commits] [PATCH] Begin cleanup to silence G++ warnings

Matt Johnson johnso87 at crhc.illinois.edu
Fri Jul 15 13:26:52 PDT 2011


Hi all,
This is the beginning of a cleanup effort to reduce the (vast) number of 
(mostly benign) warnings when compiling LLDB HEAD under G++ 4.5.2 on 
Ubuntu 11.04. Getting these warnings out of the way makes it much easier 
to spot more important warnings, if nothing else. The fixes here can be 
categorized as follows:

* Use of a signed type as a for loop induction variable, when the loop 
bound is an unsigned type
* Assigning NULL (a pointer constant) to non-pointer types (e.g., 
uint32_t, addr_t)
* Declaring class members in one order, and including them in 
constructor initializer lists in a different order

There are many more of the above warnings that I haven't gotten to yet, 
as well as things like the following:
* Python docstrings in e.g. SBTarget.h use a nonstandard gcc 
preprocessor extension that allows multi-line string literals.
- This causes *tons* of warnings (one per line of the literal, per 
inclusion of the relevant header). e.g.:

/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:23:1: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:48:1: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:91:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:164:5: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:180:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:216:5: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:224:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:245:5: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:253:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:277:5: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:286:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:310:5: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:334:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:361:5: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:370:27: 
warning: missing terminating " character
/media/d2/llvm/tools/lldb/source/Target/../../include/lldb/API/SBTarget.h:386:5: 
warning: missing terminating " character

- These literals should be formed like:

#ifdef SWIG
%feature("docstring",
"Represents the target program running under the debugger.\n"
"\n"
"SBTarget supports module and breakpoint iterations. For example,\n"
...

- instead of:

%feature("docstring",
"Represents the target program running under the debugger.

SBTarget supports module and breakpoint iterations. For example,
...


* Use of (deprecated) <ext/hash_map> instead of <unordered_map>
* Not handling some enum values in a switch statement. e.g., 
"ClangASTType.cpp:283:12: warning: enumeration value ‘UnaryTransform’ 
not handled in switch"
* Defining static helper functions that are never used. e.g., 
"RegisterContextLinux_x86_64.cpp:408:17: warning: ‘unsigned int 
GetRegSize(unsigned int)’ defined but not used"

Comments welcome.
Best,
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cleanup.diff
Type: text/x-diff
Size: 20274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20110715/bab889a4/attachment.diff>


More information about the lldb-commits mailing list