Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] method for NOLINT whole file #83339

Closed
nickdesaulniers opened this issue Feb 28, 2024 · 2 comments
Closed

[clang-tidy] method for NOLINT whole file #83339

nickdesaulniers opened this issue Feb 28, 2024 · 2 comments
Labels
clang-tidy enhancement Improving things as opposed to bug fixing, e.g. new or missing feature question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@nickdesaulniers
Copy link
Member

https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics mentions that:

The NOLINT comment instructs clang-tidy to ignore warnings on the same line (it doesn’t apply to a function, a block of code or any other language construct; it applies to the line of code it is on).

For implementing assert.h in llvm-libc, you literally do not want a header guard. To suppress llvm-header-guard, we need to add NOLINT(llvm-header-guard) as the very first line to this header, BEFORE the license comment, which is also against the style guide.

It would be nice if we had another method for silence this clang-tidy diagnostic somehow within this file.

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 28, 2024

@llvm/issue-subscribers-clang-tidy

Author: Nick Desaulniers (nickdesaulniers)

https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics mentions that:

> The NOLINT comment instructs clang-tidy to ignore warnings on the same line (it doesn’t apply to a function, a block of code or any other language construct; it applies to the line of code it is on).

For implementing assert.h in llvm-libc, you literally do not want a header guard. To suppress llvm-header-guard, we need to add NOLINT(llvm-header-guard) as the very first line to this header, BEFORE the license comment, which is also against the style guide.

It would be nice if we had another method for silence this clang-tidy diagnostic somehow within this file.

@EugeneZelenko EugeneZelenko added the enhancement Improving things as opposed to bug fixing, e.g. new or missing feature label Feb 28, 2024
@nickdesaulniers
Copy link
Member Author

@cjdb point out that NOLINTBEGIN and NOLINTEND can be used for entire file nolints

https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics

@EugeneZelenko EugeneZelenko added the question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-tidy enhancement Improving things as opposed to bug fixing, e.g. new or missing feature question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

3 participants