Define strnlen when it is not in libc
Chi-Hua Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 19:34:42 PST 2016
Duncan,
Attached is the one line change that removes && Data[Len - 1]. 'make
check' and 'make check-clang' from toplevel build directory succeed.
On Mon, Nov 28, 2016 at 7:06 PM, Chi-Hua Chen
<chc.w1005+clang1404 at gmail.com> wrote:
> Duncan,
>
>>> I have a question about the change in HeaderMap.cpp that introduced
>>> the first though: why is '&& Data[Len - 1]' necessary?
>>> https://github.com/llvm-mirror/clang/commit/839cd13b65d802f06276ff88d234419c38a44199#diff-860876c157b9f2ff75bce0d006cadc63
>>
>> Looks like it's unnecessary. Do the tests pass without it?
>
> Yes, 'make check' still pass without it.
>
> - Chi-Hua
-------------- next part --------------
Index: clang/lib/Lex/HeaderMap.cpp
===================================================================
--- clang/lib/Lex/HeaderMap.cpp (revision 288226)
+++ clang/lib/Lex/HeaderMap.cpp (working copy)
@@ -158,7 +158,7 @@
unsigned Len = strnlen(Data, MaxLen);
// Check whether the buffer is null-terminated.
- if (Len == MaxLen && Data[Len - 1])
+ if (Len == MaxLen)
return None;
return StringRef(Data, Len);
More information about the llvm-commits
mailing list