| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc] Templatize strtointeger implementation. (#165884) * Removes the copy-pasta implementation of wcstointeger, and migrate the wcsto* family of functions to use a template version of strtointeger. * Fixes the out-of-bound read in the original implementation(s) when the entire input string consists of whitespaces (then the sign check can access OOB memory) The code is currently slightly peppered with "if constexpr" statements to distinguish between char and wchar_t. We can probably simplify it in subsequent changes by: * using overrides, so that internal::isalnum() is overriden for both char and wchar_t (since C++ luckily allows us to reuse names). * this wouldn't help for direct comparison with literals - for this as a somewhat ugly workaround like is_char_literal(c, '0', L'0') | 8 个月前 | |
[libc] implement inet_addr (#167708) This patch adds the posix function inet_addr. Since most of the parsing logic is delegated to inet_aton, I have only included some basic smoke tests for testing purposes. | 8 个月前 | |
[libc] Mass replace enclosing namespace (#67032) This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079 | 2 年前 | |
[libc] Remove LlvmLibcStackChkFail.Smash test (#125919) This test was problematic, and also unnecessary. It's not really a test of the libc functionality or ABI. That's already covered by the LlvmLibcStackChkFail.Death test. The Smash test was in fact just testing that the compiler produces the call in the expected situation. That's a compiler test, not a libc test. It's not really feasible to make a test like this both reliable and safe. Since it's not something libc needs to test, it's not worth trying. | 1 年前 | |
[libc] Fix implicit conversion warnings in tests. (#131362) | 1 年前 | |
[libc] Migrate ctype_utils to use char instead of int where applicable. (#166225) Functions like isalpha / tolower can operate on chars internally. This allows us to get rid of unnecessary casts and open a way to creating wchar_t overloads with the same names (e.g. for isalpha), that would simplify templated code for conversion functions (see 315dfe5865962d8a3d60e21d1fffce5214fe54ef). Add the int->char converstion to public entrypoints implementation instead. We also need to introduce bounds check on the input argument values - these functions' behavior is unspecified if the argument is neither EOF nor fits in "unsigned char" range, but the tests we've had verified that they always return false for small negative values. To preserve this behavior, cover it explicitly. | 8 个月前 | |
[libc] Migrate dirent/fcntl/sched/signal tests to ErrnoCheckingTest. (#158700) Remove direct libc_errno.h inclusion and manipulation of libc_errno in various unit tests, instead relying on ErrnoCheckingTest machinery. This is the final mechanical change of migrating libc unit tests to ErrnoCheckingTest - after it, all the unit tests relying on ASSERT_ERRNO_* macro will be using ErrnoCheckingTest.h | 10 个月前 | |
[libc] Move ASSERT_ERRNO_* macro to ErrnoCheckingTest.h (#158727) Move these macro away from Test.h, since the generic Test.h (and associated test framework library) doesn't #include or depend on any errno-handling logic. Conversely, all tests that directly ASSERT various errno values are now migrated to ErrnoCheckingTest framework, which clears it our / validates it after every use case. | 10 个月前 | |
Reapply "[libc] Return errno from OFD failure paths in fcntl." (#166658) (#166846) The previous implementation in #166252 (rolled back in #166658) caused buildbot failures due to a bug in an added test. The modified UseAfterClose did not pass a struct flock value to fcntl: https://github.com/llvm/llvm-project/blob/2d5170594147b42a37698760d6e0194eec4f1390/libc/test/src/fcntl/fcntl_test.cpp#L175 Which ASAN caught and errored in the fcntl implementation when the unspecified argument was accessed: https://github.com/llvm/llvm-project/blob/c12cb2892c808af459eaa270b8738a2b375ecc9b/libc/src/__support/OSUtil/linux/fcntl.cpp#L59 | 8 个月前 | |
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993 | 1 年前 | |
[libc] Mass replace enclosing namespace (#67032) This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079 | 2 年前 | |
| 1 年前 | ||
[libc][math] Add float-only implementation for atanf. (#167004) Algorithm: 1) atan(x) = sign(x) * atan(|x|) 2) If |x| > 1 + 1/32, atan(|x|) = pi/2 - atan(1/|x|) 3) For 1/16 < |x| < 1 + 1/32, we find k such that: | |x| - k/16 | <= 1/32. Let y = |x| - k/16, then using the angle summation formula, we have: atan(|x|) = atan(k/16) + atan( (|x| - k/16) / (1 + |x| * k/16) ) = atan(k/16) + atan( y / (1 + (y + k/16) * k/16 ) = atan(k/16) + atan( y / ((1 + k^2/256) + y * k/16) ) 4) Let u = y / (1 + k^2/256), then we can rewritten the above as: atan(|x|) = atan(k/16) + atan( u / (1 + u * k/16) ) ~ atan(k/16) + (u - k/16 * u^2 + (k^2/256 - 1/3) * u^3 + + (k/16 - (k/16)^3) * u^4) + O(u^5) With all the computations are done in single precision (float), the total of approximation errors and rounding errors is bounded by 4 ULPs. | 8 个月前 | |
[libc] Add macros definitions for <nl_types.h> (#164474) This PR adds required macro definitions to <nl_types.h> header, so that they're available to the code including it. The header itself was added in 12abe8aed6dc724546cf93c94d7ff6abe864f28b, together with stub definitions of the three required functions. | 9 个月前 | |
[libc] Clean up errno header usage in some more tests. (#157974) Either remove spurious libc_errno.h which are no longer needed, or migrate some tests to ErrnoCheckingTest to remove manual errno manipulation. | 10 个月前 | |
[libc] remove errno.h includes (#110934) | 1 年前 | |
[libc] Migrate dirent/fcntl/sched/signal tests to ErrnoCheckingTest. (#158700) Remove direct libc_errno.h inclusion and manipulation of libc_errno in various unit tests, instead relying on ErrnoCheckingTest machinery. This is the final mechanical change of migrating libc unit tests to ErrnoCheckingTest - after it, all the unit tests relying on ASSERT_ERRNO_* macro will be using ErrnoCheckingTest.h | 10 个月前 | |
[libc] lsearch_test.cpp: put helpers in anonymous namespace. (#137964) | 1 年前 | |
[libc] Use anonymous namespace for test helper code (#157203) Tests can be at top-level or inside an anonymous namespace, doesn't matter. But putting their helper code inside anonymous namespaces both makes the code compatible with compiling using -Wmissing-declarations and might let the compiler optimize the test good a bit better. | 10 个月前 | |
| 9 个月前 | ||
[libc] Clean up errno header usage in some more tests. (#157974) Either remove spurious libc_errno.h which are no longer needed, or migrate some tests to ErrnoCheckingTest to remove manual errno manipulation. | 10 个月前 | |
| 1 年前 | ||
[libc] add missing headers in stdfix (#162078) Fixes https://github.com/llvm/llvm-project/issues/129361 @michaelrj-google @PiJoules --------- Signed-off-by: Shreeyash Pandey <shreeyash335@gmail.com> Co-authored-by: Michael Jones <michaelrj@google.com> | 9 个月前 | |
[libc] Fix -Wshorten-64-to-32 in fileop_test. (#168451) Explicitly cast 0 to size_t type to match fread() return type. This follows the pattern used elsewhere in this file, and fixes -Wshorten-64-to-32 warnings when building the test. | 8 个月前 | |
[libc] Move mbtowc, mbstowcs and inverse functions to stdlib.h (#168455) These functions should be declared in stdlib.h, not wchar.h, as confusing as it is. Move them to the proper header file and matching directories in src/ and test/ trees. This was discovered while testing libc++ build against llvm-libc, which re-declares functions like mbtowc in std-namespace in <cstdlib> header, and then uses those functions in its locale implementation. | 8 个月前 | |
[libc] add an SVE implementation of strlen (#167259) This PR creates an SVE-based implementation for strlen by translating from the AOR code in tree. Microbenchmark shows improvements against NEON when N>=64. Although both implementations fall behind glibc by a large margin, this may be a good start point to explore SVE implementations. Together with the PR: 1. Added two more tests of strlen with special nul symbols. 2. Added strlen's fuzzer and fix a typo in previous heap fuzzer. === strlen(16 bytes) === libc: 1.56115 ns/call, 9.54499 GiB/s neon: 1.59393 ns/call, 9.34867 GiB/s sve: 1.66097 ns/call, 8.97134 GiB/s === strlen(64 bytes) === libc: 2.06967 ns/call, 28.7991 GiB/s neon: 2.59914 ns/call, 22.9325 GiB/s sve: 2.58628 ns/call, 23.0465 GiB/s === strlen(256 bytes) === libc: 3.74165 ns/call, 63.7202 GiB/s neon: 8.98243 ns/call, 26.5428 GiB/s sve: 7.36426 ns/call, 32.3751 GiB/s === strlen(1024 bytes) === libc: 10.5327 ns/call, 90.5438 GiB/s neon: 34.363 ns/call, 27.7529 GiB/s sve: 26.9329 ns/call, 35.4092 GiB/s === strlen(4096 bytes) === libc: 37.7304 ns/call, 101.104 GiB/s neon: 145.911 ns/call, 26.144 GiB/s sve: 103.208 ns/call, 36.9612 GiB/s === strlen(1048576 bytes) === libc: 9623.4 ns/call, 101.478 GiB/s neon: 36138.2 ns/call, 27.023 GiB/s sve: 26605.6 ns/call, 36.7051 GiB/s | 8 个月前 | |
[libc] Add -Wextra for libc tests (#153321) RE apply https://github.com/llvm/llvm-project/pull/133643/commits#top | 10 个月前 | |
[libc] Implement pkey_alloc/free/get/set/mprotect for x86_64 linux (#162362) This patch provides definitions for pkey_* functions for linux x86_64. pkey_alloc, pkey_free, and pkey_mprotect are simple syscall wrappers. pkey_set and pkey_get modify architecture-specific registers. The logic for these live in architecture specific directories: * libc/src/sys/mman/linux/x86_64/pkey_common.h has a real implementation * libc/src/sys/mman/linux/generic/pkey_common.h contains stubs that just return ENOSYS. | 8 个月前 | |
[libc] Clean up errno header usage in some more tests. (#157974) Either remove spurious libc_errno.h which are no longer needed, or migrate some tests to ErrnoCheckingTest to remove manual errno manipulation. | 10 个月前 | |
[libc][POSIX] Add clock_settime() function for Linux (#161729) Closes #161461 - This is my first time contributing to libc's POSIX, so for reference I used clock_gettime implementation for Linux. For convenience, here is the description of clock_settime function [behavior](https://www.man7.org/linux/man-pages/man3/clock_settime.3.html) | 8 个月前 | |
| 8 个月前 | ||
[libc] Move mbtowc, mbstowcs and inverse functions to stdlib.h (#168455) These functions should be declared in stdlib.h, not wchar.h, as confusing as it is. Move them to the proper header file and matching directories in src/ and test/ trees. This was discovered while testing libc++ build against llvm-libc, which re-declares functions like mbtowc in std-namespace in <cstdlib> header, and then uses those functions in its locale implementation. | 8 个月前 | |
[libc] fix iswalpha signiture and test (#152343) The iswalpha function is only working for characters in the ascii range right now, which isn't ideal. Also it was returning a bool when the function is supposed to return an int. | 11 个月前 | |
[libc] Stub out message catalog functions from <nl_types.h> (#164360) Create a POSIX <nl_types.h> header with catopen, catclose, and catgets function declarations. Provide the stub/placeholder implementations which always return error. This is consistent with the way locales are currently (un-)implemented in llvm-libc. Notably, providing <nl_types.h> fixes the last remaining issue with building libc++ against llvm-libc (on certain configuration of x86_64 Linux) after disabling threads and wide-characters in libc++. | 9 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 9 个月前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 9 个月前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 11 个月前 | ||
| 9 个月前 |