[Lldb-commits] [PATCH] Include cstring in TimeValue.cpp, fix Linux/libstdc++ build

Matt Johnson johnso87 at crhc.illinois.edu
Thu Aug 11 13:22:24 PDT 2011

Hi all,
     strpbrk() is used in TimeValue.cpp, but the header file it lives 
in, cstring/string.h, is not #included explicitly.  The other headers 
included in the file must transitively #include cstring on the 
developers' machines, but the build breaks on Linux with recent versions 
of libstdc++ and glibc.  The attached patch fixes the build on my machine.

     As a side note, the C++ convention for including libc headers is to 
use the version with 'c' prepended and no '.h', unless that version 
happens to be broken in your C++ library.  The main difference is that 
the 'c' versions put all functions in the std namespace, rather than the 
global namespace.  This convention is followed in other LLVM projects as 
far as I can tell, but LLDB mixes both conventions (for example, grep 
for 'cassert' and 'assert.h').  I didn't prepare a patch for this 
because I wasn't sure if this was intentional or if the 'c' header 
versions caused problems on the developers' machines, but if not, 
standardizing on the 'c' versions will reduce global namespace pollution.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cstring.diff
Type: text/x-diff
Size: 389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20110811/26b11fe4/attachment.diff>

More information about the lldb-commits mailing list