-
Notifications
You must be signed in to change notification settings - Fork 535
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
integrating clang-tidy into openal-soft with cmake #1005
base: master
Are you sure you want to change the base?
integrating clang-tidy into openal-soft with cmake #1005
Conversation
this changes introduces the integration of Clang-Tidy into the OpenAL-Soft project using CMake. Clang-Tidy is a static code analysis tool that helps identify and fix potential issues in C++ code. The changes in this comment will analyze and apply clang-tidy fixes to the following directories and files: * `al` * `alc` * `common` * `core` * `utils/openal-info.c` (if enabled) * CMake 3.5 or higher [see. CMAKE_EXPORT_COMPILE_COMMANDS](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html). compatible for current project cmake version. * Clang-Tidy (only required if analysis is executed) 1. Configure OpenAL-Soft with CMake using the desired features and add the `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` flag to the CMake command line. ex. `cmake -G "MinGW Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release ..` 2. Run Clang-Tidy using the target `clang-tidy-check`. ex. `make clang-tidy-check` 1. The fixes applied by clang-tidy are not guaranteed to be correct. Therefore, it is important to re-compile and test the project after running this target. 2. More checks over clang-tidy can be implemented, but this may prevent the project from compiling. A more comprehensive clang-tidy configuration with lint comments to ignore specific cases can be developed in the future.
For pffft, sure. It's already heavily modified, so more changes to fix other issues isn't a problem (so long as it doesn't adversely affect performance).
Currently this is what I have enabled with Qt Creator:
This has a few "false" reports from |
hi @kcat, i added the checks you shared. i tested the changes on ubuntu and Windows. there seems to be no problem, but of course i think a review is necessary. commit was a big :) . |
this changes introduces the integration of Clang-Tidy into the OpenAL-Soft project using CMake.
Clang-Tidy is a static code analysis tool that helps identify and fix potential issues in C++ code.
The changes in this pull request will analyze and apply clang-tidy fixes to the following directories and files:
al
alc
common
core
utils/openal-info.c
(if enabled)requirements
usage
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
flag to the CMake command line. And you can also set the appropriate clang-tidy program according to the platform, check out the note below.e.g.
cmake -G "MinGW Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release ..
clang-tidy-check
.e.g.
make clang-tidy-check
Note: LLVM toolset is usually installed as
<tool_name>-<version>
. Theclang-tidy
executable file may not be directly on your platform with the clang-tidy name/path. In this case, you can report clang-tidy available on the platform to cmake.The default executable is
clang-tidy
.For Linux based OSs:
export
.E.g.
export CLANG_TIDY_EXECUTABLE=clang-tidy-18
E.g.
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCLANG_TIDY_EXECUTABLE=clang-tidy-18 ..
For Windows OS:
SET
.E.g.
SET CLANG_TIDY_EXECUTABLE=clang-tidy-18
importants
some questions we need to answer
I can make changes based on these two questions.
For the second question i took the basic checks and tested some of them to see if they were compatible with the project. Activating some of them (ex. using explicit in single-argument constructors) requires a lot of time because it requires too many changes. I eliminated these.