summaryrefslogtreecommitdiff
path: root/libc/src/assert
AgeCommit message (Collapse)Author
2024-10-27[libc] Add `__builtin_expect` tag on assert conditions; NFC (#99498)goldsteinn
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-02-28[libc] remove header guard for assert.h (#83334)Nick Desaulniers
It's meant to be included multiple times! Maybe use a NOLINT rule to suppress clang-tidy's llvm-header-guard lint warning.
2024-02-28[libc] fix clang-tidy llvm-header-guard warnings (#82679)Nick Desaulniers
Towards the goal of getting `ninja libc-lint` back to green, fix the numerous instances of: warning: header guard does not follow preferred style [llvm-header-guard] This is because many of our header guards start with `__LLVM` rather than `LLVM`. To filter just these warnings: $ ninja -k2000 libc-lint 2>&1 | grep llvm-header-guard To automatically apply fixits: $ find libc/src libc/include libc/test -name \*.h | \ xargs -n1 -I {} clang-tidy {} -p build/compile_commands.json \ -checks='-*,llvm-header-guard' --fix --quiet Some manual cleanup is still necessary as headers that were missing header guards outright will have them inserted before the license block (we prefer them after).
2023-10-10[libc] Fix missing warp sync for the NVPTX assertJoseph Huber
Summary: The implementation of `assert` has an if statement so that only the first thread in the warp prints the assertion. On modern NVPTX architecture, this can be printed out of order with the abort call. This would lead to only a portion of the message being printed and then exiting the program. By adding a mandatory warp sync we force the full string to be printed before we continue to the abort.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
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
2023-09-21[libc][clang-tidy] Add llvm-header-guard to get consistant naming and ↵Guillaume Chatelet
prevent file copy/paste issues. (#66477)
2023-09-12[libc][NFC] Factor GPU exiting into a common function (#66093)Joseph Huber
Summary: We currently call the GPU routine to terminate the current thread in three separate locations .This should be wrapped into a helper function to simplify the implementation.
2023-08-31[libc] Support 'assert.h' on the GPUJoseph Huber
This patch adds the necessary support to provide `assert` functionality through the GPU `libc` implementation. This implementation creates a special-case GPU implementation rather than relying on the common version. This is because the GPU has special considerings for printing. The assertion is printed out in chunks with `write_to_stderr`, however when combined with the GPU execution model this causes 32+ threads to all execute in-lock step. Meaning that we'll get a horribly fragmented message. Furthermore, potentially thousands of threads could hit the assertion at once and try to print even if we had it all in one `printf`. This is solved by having a one-time lock that each thread group / wave / warp will attempt to claim. We only let one thread group pass through while the others simply stop executing. Finally only the first thread in that group will do the printing until we finally abort execution. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D159296
2023-04-10[libc][obvious] fix new assert typoMichael Jones
2023-04-07[libc][obvious] fix phrasing in assert commentMichael Jones
2023-02-21[libc] Introduce a libc internal assertion macro named LIBC_ASSERT.Siva Chandra Reddy
Few existing call-sites have been modified to use LIBC_ASSERT. Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D144161
2023-01-30[libc] Remove warning about unused variableGuillaume Chatelet
Differential Revision: https://reviews.llvm.org/D142376
2022-11-16[libc] Fix assert.h and ctype.h not being builtJoseph Huber
The `assert.h` and `ctype.h` headers are never built despite their entrypoints being present in the generated library. This patch adds a dependency on these headers so that they will be built properly. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D138142
2022-02-08[libc][NFC] Remove all Linux specific code to respective linux/ directoriesAlex Brachet
These were all the non OS agnostic implementations I could find in general directories. Currently none of these functions are actually enabled, but for when they do it makes sense that they be in linux/ specific directories. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D119164
2021-12-22[libc] Move the x86_64 syscall functions to OSUtil.Siva Chandra Reddy
Reviewed By: michaelrj, lntue Differential Revision: https://reviews.llvm.org/D116177
2021-12-07[libc] apply new lint rulesMichael Jones
This patch applies the lint rules described in the previous patch. There was also a significant amount of effort put into manually fixing things, since all of the templated functions, or structs defined in /spec, were not updated and had to be handled manually. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D114302
2021-01-08[libc] Switch to use a macro which does not insert a section for every libc ↵Michael Jones
function. Summary: The new macro also inserts the C alias for the C++ implementations without needing an objcopy based post processing step. The CMake rules have been updated to reflect this. More CMake cleanup can be taken up in future rounds and appropriate TODOs have been added for them. Reviewers: mcgrathr, sivachandra Subscribers:
2020-11-03[LIBC][NFC] Rename errno and assert files to match other files with functionsMichael Jones
Rename the files containing the `__errno_location` function to `__errno_location.h/cpp` to match the other files and move the `llvmlibc_errno` macro to its own file. Split assert.h into `__assert_fail.h` (contains the function prototype) and assert.h (contains the assert macro). Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D90653
2020-04-10[libc] Add fully-qualified target names.Siva Chandra Reddy
Only targets setup by the special LLVM libc rules now have fully qualified names. The naming style is similar to fully qualified names in Python. Reviewers: abrachet, PaulkaToast, phosek Differential Revision: https://reviews.llvm.org/D77340
2020-04-08[libc][NFC] Make all top of file comments consistent.Paula Toth
Summary: Made all header files consistent based of this documentation: https://llvm.org/docs/CodingStandards.html#file-headers. And did the same for all source files top of file comments. Reviewers: sivachandra, abrachet Reviewed By: sivachandra, abrachet Subscribers: MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D77533
2020-03-11[libc] Add initial assert definitionAlex Brachet
Summary: This patch adds a temporary `__assert_fail` and `assert` definition to make it available to internal llvm libc code. `__assert_fail` writes to fd 2 directly instead of `stderr`, using SYS_write. I have not put it in its own linux directory because this is temporary and it should be using stdio's api in the future. It does not currently print out the line number (although we could do that by stringifying `__LINE__` if reviewers wish). Reviewers: sivachandra, gchatelet, PaulkaToast Reviewed By: sivachandra Subscribers: mgorny, MaskRay, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D75420