This patch adds a skeleton as a preparatory step for the next patch which
adds the actual implementations of the condition variable functions.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D108947
The Fuchsia build compiles the libc and test code with lots
of warnings enabled, including all the integer conversion warnings.
There was some sloppy type usage here that triggered some of those.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D108800
This allows others parts of the libc to use the mutex types without
actually pulling in public function implementations.
Along the way, few cleanups have been done, like using a uniform type to
refer the linux futex word.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D108749
Add inttypes.h to llvm libc. As its first functions strtoimax and
strtoumax are included.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108736
I think this is the last windows type conversion fix, the rest of the
build seems to be okay.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108659
Fix the errors caused by having some numbers too large for a 32 bit
number in the tests for windows. Also fix the base causing some type
confusion.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108653
There were some copy paste errors as well as some oddities around how
windows handles the difference between long and long long types. This
change fixes those.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108591
Adds atoi, atol, atoll, strtol, strtoll, strtoul, and strtoull to the
list of entrypoints for Windows and aarch64 linux, as well as moving
them out of the LLVM_LIBC_FULL_BUILD condition for x86_64 linux.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108477
These functions will be used in a future patch to implement
trigonometric functions. Unit tests have been added but to the
libc-long-running-tests suite. The unit tests long running because we
compare against MPFR computations performed at 1280 bits of precision.
Some cleanups or elimination of repeated patterns can be done as follow
up changes.
Differential Revision: https://reviews.llvm.org/D104817
This suite is helpful is adding long running tests which take a long
time to finish that they can be run on the public builders. They
will probably be run on special builders in future.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D104816
adds a custom command for libc-scudo-integration-test that makes it run
when it is built.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108409
This is based on the work done to add strtoll and the other strto
functions. The atoi functions also were added to stdc and
entrypoints.txt.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D108330
Updates the internal string conversion function so that it
uses the new Limits.h added in a previous commit for max and min values,
and has a templated type. This makes implementing the other strto*
functions very simple.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D107999
Since the precondition for loop is `size >= T::kSize` we always expect
at least one run of the loop. This patch transforms the for-loop into a
do/while-loop which saves at least one test.
We also add a second template parameter to allow the Tail operation to
differ from the loop operation.
Add an implementation of numeric_limits for use in str_conv_utils.
It currently only supports the basic integer types, with more types
coming as needed.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D107987
This change adds the stroll function, but most of the implementation is
in the new file str_conv_utils.h since many of the other integer
conversion functions are implemented through what are effectively calls
to strtoll.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D107792
Some ctype functions are called from other libc functions (e.g. isspace
is used in atoi). By moving ctype_utils.h to __support it becomes easier
to include just the implementations of these functions. For these
reasons the implementation for isspace was moved into
ctype_utils as well.
FPUtils was moved to simplify the build order, and to clarify which
files are a part of the actual libc.
Many files were modified to accomodate these changes, mostly changing
the #include paths.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D107600
This change adds tests to make sure that SCUDO is being properly
included with llvm libc. This change also adds the toggles to properly
use SCUDO, as GWP-ASan is enabled by default and must be included for
SCUDO to function.
Reviewed By: sivachandra, hctim
Differential Revision: https://reviews.llvm.org/D106919
The next step is to be able to benchmark several implementations at once and compare which one performs best on a particular machine.
Differential Revision: https://reviews.llvm.org/D107265
TestHelpers.h pulls few pieces from LLVM libc's unittest framework
which aren't available on platforms like Fuchsia which use their own
unittest framework. So, by moving FPExceptMatcher to a different file
we can exclude LLVM libc specific pieces in a cleaner way.
In a later pass, it might make more sense to rename TestHelpers.h also
to FPMatcher.h. That way, we can make macros like EXPECT_FP_EQ to be
equivalent to EXPECT_EQ on platforms like Fuchsia.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D107129
In mixed mode builds, we should not be including errno as part of
LLVM libc - errno from another library (or the system library) should be
used. But, other entrypoints which use errno list LLVM libc's errno as a
dep ta satisfy the full build mode. So, we add a dummy errno
implementation with empty files to make both mixed mode and full build
mode happy.
These functions make it clear to the compiler and user what the intended
behavior is so llvm can make them go as fast as possible.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106807
Add strncmp as a function to strings.h. Also adds unit tests, and adds
strncmp as an entrypoint for all current platforms.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106901
While working and testing my refactoring of multiple string functions in libc, I came across a bug that needs to be addressed in a patch on its own: src is checked for nullptr and assigned to *saveptr if it is nullptr. However, saveptr is initially nullptr when it comes to reentry. This could cause a problem if both saveptr and src are null; we need to do the check first and return nullptr if both are nullptr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106885
All fenv functions are also enabled for windows. Since two tests,
enabled_exceptions_test and feholdexcept_test are still failing on
windows, they have been disabled.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D106808