[libc] Make the errno macro resolve to the thread local variable directly.With modern architectures having a thread pointer and language supportingthread locals, there is no reason to use a functi
[libc] Make the errno macro resolve to the thread local variable directly.With modern architectures having a thread pointer and language supportingthread locals, there is no reason to use a function intermediary to accessthe thread local errno value.The entrypoint corresponding to errno has been replaced with an objectlibrary as there is no formal entrypoint for errno anymore.Reviewed By: jeffbailey, michaelrjDifferential Revision: https://reviews.llvm.org/D120920
show more ...
[libc] apply new lint rulesThis patch applies the lint rules described in the previous patch. Therewas also a significant amount of effort put into manually fixing things,since all of the templat
[libc] apply new lint rulesThis patch applies the lint rules described in the previous patch. Therewas also a significant amount of effort put into manually fixing things,since all of the templated functions, or structs defined in /spec, werenot updated and had to be handled manually.Reviewed By: sivachandra, lntueDifferential Revision: https://reviews.llvm.org/D114302
[libc] Introduce asctime, asctime_r to LLVM libc[libc] Introduce asctime, asctime_r to LLVM libcasctime and asctime_r share the same common code. They call asctime_internala static inline functi
[libc] Introduce asctime, asctime_r to LLVM libc[libc] Introduce asctime, asctime_r to LLVM libcasctime and asctime_r share the same common code. They call asctime_internala static inline function.asctime uses snprintf to return the string representation in a buffer.It uses the following format (26 characters is the buffer size) as per7.27.3.1 section in http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2478.pdf.The buf parameter for asctime_r shall point to a buffer of at least 26 bytes.snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",...)Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D99686
[libc] Introduces gmtime_r to LLVM libc, based on C99/C2X/Single Unix Sp.gmtime and gmtime_r share the same common code. They call gmtime_internala static inline function. Thus added only validati
[libc] Introduces gmtime_r to LLVM libc, based on C99/C2X/Single Unix Sp.gmtime and gmtime_r share the same common code. They call gmtime_internala static inline function. Thus added only validation tests for gmtime_r.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D99046
This introduces gmtime to LLVM libc, based on C99/C2X/Single Unix Spec.This change doesn't handle TIMEZONE, tm_isdst and leap seconds.Moved shared code between mktime and gmtime into time_utils.c
This introduces gmtime to LLVM libc, based on C99/C2X/Single Unix Spec.This change doesn't handle TIMEZONE, tm_isdst and leap seconds.Moved shared code between mktime and gmtime into time_utils.cpp.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D98467
[libc] [Obvious] Fix.
Changes to mktime to handle invalid dates, overflow and underflow andcalculating the correct date and thenumber of seconds even if invalid datesare passed as arguments.Added tests for invalid dates
Changes to mktime to handle invalid dates, overflow and underflow andcalculating the correct date and thenumber of seconds even if invalid datesare passed as arguments.Added tests for invalid dates like the following Date 1970-01-01 00:00:-1 is treated as 1969-12-31 23:59:59 and seconds are returned for the modified date.Tested the code by doing ninja check-libc (and cmake).Reviewed By: sivachandra, rtennetiDifferential Revision: https://reviews.llvm.org/D96684
[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:
Initial commit of mktime.This introduces mktime to LLVM libc, based on C99/C2X/Single Unix Spec.Co-authored-by: Jeff Bailey <[email protected]>This change doesn't handle TIMEZONE, tm_isdst
Initial commit of mktime.This introduces mktime to LLVM libc, based on C99/C2X/Single Unix Spec.Co-authored-by: Jeff Bailey <[email protected]>This change doesn't handle TIMEZONE, tm_isdst and leap seconds. It returns -1 for invalid dates. I have verified the return results for all the possible dates with glibc's mktime.TODO:+ Handle leap seconds.+ Handle out of range time and date values that don't overflow or underflow.+ Implement the following suggestion Siva - As we start accumulating the seconds, we should be able to check if the next amount of seconds to be added can lead to an overflow. If it does, return the overflow value. If not keep accumulating. The benefit is that, we don't have to validate every input, and also do not need the special cases for sizeof(time_t) == 4.+ Handle timezone and update of tm_isdstReviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D91551