Skip to content

Make libc code lint clean #60984

@sivachandra

Description

@sivachandra

After https://reviews.llvm.org/D144705, it is possible to run linting on the libc source code again. Because of the long time since we last did any formal lint checking, the source tree has regressed in a number of places with respect to code style. Also, the new LIBC_INLINE tag is missing in a number of places. This issue is about making the libc source lint clean so that we can start running linting on a CI builder.

Addressing this bug has to be a team effort as a large part of the source tree is affected. The best way to start doing the cleanup is this:

  1. Build Clang and Clang-Tidy from head and install it into a special directory, say ~/libc-lint-tools/. You will have to install the following targets: install-clang, install-clang-tidy, install-core-resource-headers, install-clang-resource-headers, install-builtins.
  2. Configure libc with:
    cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="libc" -DCMAKE_BUILD_TYPE=Debug -DLLVM_LIBC_FULL_BUILD=ON
    -DCMAKE_CXX_COMPILER=~/libc-lint-tools/bin/clang++ -DCMAKE_C_COMPILER=~/libc-lint-tools/bin/clang
    -DLLVM_LIBC_CLANG_TIDY=~/libc-lint-tools/bin/clang-tidy 
  3. Build any lint target, for example, libc.src.string.strlen.__lint__ or just execute the libc-lint target. They should you a large number of lint problems.
  4. Send patches to problems identified in step 3.

Metadata

Metadata

Labels

code-cleanuplibcmetaissueIssue to collect references to a group of similar or related issues.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions