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

Johnny Chen johnny.chen at apple.com
Thu Aug 11 13:43:02 PDT 2011


Thanks, Matt.

URL: http://llvm.org/viewvc/llvm-project?rev=137343&view=rev
Log:
Patch by Matt Johnson to build on his Linux machine with recent versions of libstdc++ and glibc!

On Aug 11, 2011, at 1:22 PM, Matt Johnson wrote:

> 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.
> 
> Best,
> Matt
> <cstring.diff>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20110811/ee05f689/attachment.html>


More information about the lldb-commits mailing list