[libc][NFC] Add explicit casts to ctype functionsReviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D106902
[libc][nfc] move ctype_utils and FPUtils to __supportSome ctype functions are called from other libc functions (e.g. isspaceis used in atoi). By moving ctype_utils.h to __support it becomes easier
[libc][nfc] move ctype_utils and FPUtils to __supportSome ctype functions are called from other libc functions (e.g. isspaceis used in atoi). By moving ctype_utils.h to __support it becomes easierto include just the implementations of these functions. For thesereasons the implementation for isspace was moved intoctype_utils as well.FPUtils was moved to simplify the build order, and to clarify whichfiles are a part of the actual libc.Many files were modified to accomodate these changes, mostly changingthe #include paths.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D107600
show more ...
[libc][NFC] Add noreturn and constexpr qualifiers where appropriateThese functions make it clear to the compiler and user what the intendedbehavior is so llvm can make them go as fast as possible.
[libc][NFC] Add noreturn and constexpr qualifiers where appropriateThese functions make it clear to the compiler and user what the intendedbehavior is so llvm can make them go as fast as possible.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D106807
[libc] Use #undef isascii in specific headerStandard C allows all standard headers to declare macros for alltheir functions. So after possibly including any standard headerlike <ctype.h>, it's p
[libc] Use #undef isascii in specific headerStandard C allows all standard headers to declare macros for alltheir functions. So after possibly including any standard headerlike <ctype.h>, it's perfectly normal for any and all of thefunctions it declares to be defined as macros. Standard C requiresexplicit `#undef` before using that identifier in a way that is notcompatible with function-like macro definitions.The C standard's rules for this are extended to POSIX as well forthe interfaces it defines, and it's the expected norm fornonstandard extensions declared by standard C library headers too.So far the only place this has come up for llvm-libc's code is withthe isascii function in Fuchsia's libc. But other cases can arisefor any standard (or common extension) function names that sourcecode in llvm-libc is using in nonstandard ways, i.e. as C++identifiers.The only correct and robust way to handle the possible inclusion ofstandard C library headers when building llvm-libc source code is touse `#undef` explicitly for each identifier before using it. Theeasy and obvious place to do that is in the per-function header.This requires that all code, such as test code, that might includeany standard C library headers, e.g. via utils/UnitTest/Test.h, makesure to include those *first* before the per-function header.This change does that for isascii and its test. But it should bedone uniformly for all the code and documented as a consistentconvention so new implementation files are sure to get this right.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D94642
[libc][NFC] change isblank and iscntrl from implicit castingisblank and iscntrl were casting an int to a char implicitly and thiswas throwing errors under Fuchsia. I've added a static cast to reso
[libc][NFC] change isblank and iscntrl from implicit castingisblank and iscntrl were casting an int to a char implicitly and thiswas throwing errors under Fuchsia. I've added a static cast to resolvethis issue.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D94634
[libc] add isascii and toascii implementationsadding both at once since these are trivial functions.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D94558
[libc] Switch to use a macro which does not insert a section for every libc function.Summary:The new macro also inserts the C alias for the C++ implementationswithout needing an objcopy based pos
[libc] Switch to use a macro which does not insert a section for every libc function.Summary:The new macro also inserts the C alias for the C++ implementationswithout needing an objcopy based post processing step. The CMakerules have been updated to reflect this. More CMake cleanup can betaken up in future rounds and appropriate TODOs have been added for them.Reviewers: mcgrathr, sivachandraSubscribers:
[libc] Add tolower, toupper implementation.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D85326
[libc] Add isspace, isprint, isxdigit implementations.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D85270
[libc] Add implementations for isblank, iscntrl, isgraph, ispunct.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D85059
[libc] Add islower and isupper implementation.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D84960
[libc] Implements isdigit and isalnum. Adds a utility header to inlinefunctions to avoid overhead of function calls.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D84893
[libc] Add scaffolding for ctype and implementation of isalphaReviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D84575