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

make clang-tidy recognize .H as a header #2795

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

zingale
Copy link
Member

@zingale zingale commented Mar 21, 2024

PR summary

PR motivation

PR checklist

  • test suite needs to be run on this PR
  • this PR will change answers in the test suite to more than roundoff level
  • all newly-added functions have docstrings as per the coding conventions
  • the CHANGES file has been updated, if appropriate
  • if appropriate, this change is described in the docs

@yut23
Copy link
Collaborator

yut23 commented Mar 26, 2024

This gives an error for me with clang-tidy 15.0.7:

/home/eric/dev/Castro/.clang-tidy:50:1: error: unknown key 'HeaderFileExtensions'
HeaderFileExtensions: ['', "H", 'h', 'hh', 'hpp', 'hxx']
^~~~~~~~~~~~~~~~~~~~
Error parsing /home/eric/dev/Castro/.clang-tidy: Invalid argument

It looks like the global option was only added in LLVM 17. Manually setting the check-specific options appears to work fine (found with https://releases.llvm.org/16.0.0/tools/clang/tools/extra/docs/search.html?q=HeaderFileExtensions):

CheckOptions:
  bugprone-suspicious-include.HeaderFileExtensions: ';H;h;hh;hpp;hxx'
  google-build-namespaces.HeaderFileExtensions: ',H,h,hh,hpp,hxx'
  google-global-names-in-headers.HeaderFileExtensions: ',H,h,hh,hpp,hxx'
  llvm-header-guard.HeaderFileExtensions: ',H,h,hh,hpp,hxx'
  misc-definitions-in-headers.HeaderFileExtensions: ',H,h,hh,hpp,hxx'
  misc-unused-using-decls.HeaderFileExtensions: ',H,h,hh,hpp,hxx'  # since LLVM 16
  misc-use-anonymous-namespace.HeaderFileExtensions: ';H;h;hh;hpp;hxx'  # since LLVM 16

@zingale
Copy link
Member Author

zingale commented Mar 26, 2024

indeed. It only works with clang-tidy >= 17

see: AMReX-Codes/amrex#3832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants