summaryrefslogtreecommitdiff
path: root/libc/docs/dev/code_style.rst
AgeCommit message (Collapse)Author
2025-06-23[libc] Fix broken links in libc (#145199)Shubh Pachchigar
This PR fixes broken links in all files describing libc usage modes. Please let me know if there are any other places that need updating. --------- Co-authored-by: shubhp@perlmutter <shubhp@perlmutter.com>
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-05-14[libc] Fix typos in documentation (#139852)Kazu Hirata
2024-07-03[libc] Add LIBC_NAMESPACE_DECL macro (#97109)PiJoules
This defines to LIBC_NAMESPACE with `__attribute__((visibility("hidden")))` so all the symbols under it have hidden visibility. This new macro should be used when declaring a new namespace that will have internal functions/globals and LIBC_NAMESPACE should be used as a means of accessing functions/globals declared within LIBC_NAMESPACE_DECL.
2024-04-22[libc][docs] codify Policy on Assembler Sources (#88185)Nick Desaulniers
It would be helpful in future code reviews to document a policy with regards to where and when Assembler sources are appropriate. That way when reviewers point out infractions, they can point to this written policy, which may help contributors understand that it's not solely the personal preferences of individual reviewers but instead rather a previously agreed upon rule by maintainers. Link: https://github.com/llvm/llvm-project/pull/87837 Link: https://github.com/llvm/llvm-project/pull/88157 Link: https://discourse.llvm.org/t/hand-written-in-assembly-in-libc-setjmp-longjmp/73249/12
2024-04-11[libc] Codify header inclusion policy (#87017)Nick Desaulniers
When supporting "overlay" vs "fullbuild" modes, "what ABI are you using?" becomes a fundamental question to have concrete answers for. Overlay mode MUST match the ABI of the system being overlayed onto; fullbuild more flexible (the only system ABI relevant is the OS kernel). When implementing llvm-libc we generally prefer the include-what-you use style of avoiding transitive dependencies (since that makes refactoring headers more painful, and slows down build times). So what header do you include for any given type or function declaration? For any given userspace program, the answer is straightforward. But for llvm-libc which is trying to support multiple ABIs (at least one per configuration), the answer is perhaps less clear. This proposal seeks to add one layer of indirection relative to what's being done today. It then converts users of sigset_t and struct epoll_event and the epoll implemenations over to this convention as an example.
2024-03-27[libc] Remove obsolete LIBC_HAS_BUILTIN macro (#86554)Marc Auberer
Fixes #86546 and removes the macro `LIBC_HAS_BUILTIN`. This was necessary to support older compilers that did not support `__has_builtin`. All of the compilers we support already have this builtin. See: https://libc.llvm.org/compiler_support.html All uses now use `__has_builtin` directly cc @nickdesaulniers
2024-02-29[libc][NFC] Rename `LIBC_COMPILER_HAS_FLOAT128` to `LIBC_TYPES_HAS_FLOAT128` ↵Guillaume Chatelet
(#83395) Umbrella bug #83182
2024-02-29[libc][NFC] rename `float.h` macro file to `types.h` (#83190)Guillaume Chatelet
2024-01-08Reapply "[libc] build with -Werror (#73966)" (#74506)Nick Desaulniers
This reverts commit 6886a52d6dbefff77f33de12ff85d654e2557f81. Most of the errors observed in postsubmit have been addressed. We can fix-forward the remaining ones. Link: https://lab.llvm.org/buildbot/#/changes/117129
2023-12-04Revert "[libc] build with -Werror (#73966)"Nick Desaulniers
This reverts commit 606653091d1a66d1a83a1bfdea2883cc8d46687e. Post submit buildbots are now red. We can use these explicit errors to better clean up existing warnings, then reland this. Link: #73966
2023-12-04[libc] build with -Werror (#73966)Nick Desaulniers
A recent commit introduced warnings observable when building unit tests. If the unit tests don't fail when warnings are introduced into the build, then we might fail to notice them in the stream of output from check-libc. Link: https://github.com/llvm/llvm-project/pull/72763/files#r1410932348
2023-11-24[libc][NFC] Move float macro into its own header / add target os detection ↵Guillaume Chatelet
(#73311) Floating point properties are a combination of target OS, target architecture and compiler support. - Adding target OS detection, - Moving floating point type detection to its own file. This is in preparation of adding support for `_Float16` which requires testing compiler **version** and target architecture.
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-02Fix typos in documentationKazu Hirata
2023-08-08[libc][doc] Update macros documentationGuillaume Chatelet
Update documentaiton now that macros are laid out in a more structured way. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D143911
2023-06-26[libc][Obvious] Fix docs warning.Tue Ly
2023-06-16[libc] Add LIBC_INLINE_VAR for inline variablesAlex Brachet
These are the only variables I could find that use LIBC_INLINE. Note, these are namespace scoped constexpr so local linkage is implied. inline is useful here to silence clang's unused-const-variable variable. For Fuchsia, the distinction between LIBC_INLINE and LIBC_INLINE_VAR is helpful because we define LIBC_INLINE as `[[gnu::always_inline]] inline` when building with gcc. This isn't meaningful on variables. Alternatively, we could make these variables simply constexpr and also add `[[maybe_unused]]` Reviewed By: sivachandra, mcgrathr Differential Revision: https://reviews.llvm.org/D152951
2023-04-24[libc] Fix typos in documentationKazu Hirata
2023-03-15[libc][docs] Add a section about allocations and deallocations to the style doc.Siva Chandra Reddy
Fixes #59277 - The main part of that bug has already been addressed. This commit just adds documentation. Reviewed By: jeffbailey Differential Revision: https://reviews.llvm.org/D146115
2023-03-07[libc] Add a note about using assertions in the libc runtime code.Siva Chandra Reddy
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D145466
2023-03-03[libc] Make errno an entrypoint.Siva Chandra Reddy
The entrypoint has been added to the various entrypoint lists. The libc code style doc has been updated with information on how errno should be set from the libc runtime code. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D145179
2023-03-02[libc][NFC] Move all developer docs into a sub-directory docs/dev.Siva Chandra Reddy