Merge branch 'clang-tidy' into 'master'

add .clang-tidy file

See merge request wlroots/wlroots!5288
This commit is contained in:
Simon Zeni 2026-03-21 19:11:18 -04:00
commit ff531ca397
6 changed files with 79 additions and 4 deletions

View file

@ -20,6 +20,7 @@ packages:
- xwayland-dev
- libseat-dev
- hwdata-dev
- clang-extra-tools
# for docs
- go
- zip
@ -58,3 +59,6 @@ tasks:
-o public \
"$include_dir/wlr/"
zip -r ~/public.zip public/
- clang-tidy: |
cd wlroots
ninja -C build clang-tidy

73
.clang-tidy Normal file
View file

@ -0,0 +1,73 @@
# First block is the enabled checks
# Second block is the disabled checks
# Third block is the checks to fix
Checks: |
bugprone-*,
cert-*,
clang-analyzer-*,
clang-diagnostic-*,
concurrency-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-bugprone-assignment-in-if-condition,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-macro-parentheses,
-bugprone-multi-level-implicit-pointer-conversion,
-bugprone-narrowing-conversions,
-bugprone-reserved-identifier,
-bugprone-sizeof-expression,
-bugprone-suspicious-memory-comparison,
-bugprone-suspicious-realloc-usage,
-bugprone-suspicious-string-compare,
-bugprone-switch-missing-default-case,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cert-err33-c,
-cert-err34-c,
-cert-exp42-c,
-cert-flp37-c,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.uninitialized.Assign,
-clang-analyzer-optin.core.EnumCastOutOfRange,
-clang-analyzer-optin.portability.UnixAPI,
-clang-analyzer-optin.taint.GenericTaint,
-clang-analyzer-optin.taint.TaintedAlloc,
-clang-analyzer-security.ArrayBound,
-clang-analyzer-unix.Malloc,
-clang-analyzer-valist.Uninitialized,
-concurrency-mt-unsafe,
-misc-include-cleaner,
-misc-no-recursion,
-misc-unused-parameters,
-modernize-macro-to-enum,
-modernize-use-nullptr,
-performance-no-int-to-ptr,
-performance-type-promotion-in-math-fn,
-readability-avoid-nested-conditional-operator,
-readability-braces-around-statements,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-inconsistent-declaration-parameter-name,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-math-missing-parentheses,
-readability-non-const-parameter,
-readability-simplify-boolean-expr,
-readability-suspicious-call-argument,
-readability-uppercase-literal-suffix,
-readability-use-concise-preprocessor-directives,
WarningsAsErrors: '*'
HeaderFilterRegex: '^include/.*'
FormatStyle: file

View file

@ -35,4 +35,5 @@ endforeach
wlr_files += configure_file(
output: 'config.h',
configuration: internal_config,
macro_name: 'CONFIG_H',
)

View file

@ -180,8 +180,7 @@ static void color_repr_handle_set_chroma_location(struct wl_client *client,
}
uint32_t version = wl_resource_get_version(resource);
if (!wp_color_representation_surface_v1_chroma_location_is_valid(
version, chroma_location)) {
if (!wp_color_representation_surface_v1_chroma_location_is_valid(chroma_location, version)) {
wl_resource_post_error(resource, WP_COLOR_REPRESENTATION_SURFACE_V1_ERROR_CHROMA_LOCATION,
"Chroma location is not a valid enum value");
return;

View file

@ -4,7 +4,6 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include <sys/socket.h>
#include <sys/types.h>

View file

@ -2,7 +2,6 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>