From a252cbf0283475ea40251d9abc9feec1722620f9 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 23 Aug 2022 05:18:17 +0100 Subject: [PATCH] clang-tidy: disable some noisy warnings Also fix some of the warnings Signed-off-by: Yuxuan Shui --- .clang-tidy | 8 +++++++- src/backend/gl/gl_common.c | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 7b59c22f..e46c0873 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,7 +11,9 @@ Checks: > misc-static-assert, -clang-analyzer-*, -readability-isolate-declaration, - -readability-magic-numbers + -readability-magic-numbers, + -readability-identifier-length, + -bugprone-easily-swappable-parameters AnalyzeTemporaryDtors: false FormatStyle: file CheckOptions: @@ -19,3 +21,7 @@ CheckOptions: value: 4;8;16;24;32;1;2;3;4096;65536; - key: readability-magic-numbers.IgnoredFloatingPointValues value: 255.0;1.0; + - key: readability-function-cognitive-complexity.IgnoreMacros + value: true + - key: readability-function-cognitive-complexity.DescribeBasicIncrements + value: true diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index ed757f23..d1272b7b 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -622,8 +622,8 @@ bool gl_kernel_blur(backend_t *base, double opacity, void *ctx, const rect_t *ex glBindTexture(GL_TEXTURE_2D, src_texture); glUseProgram(p->prog); - glUniform2f(p->uniform_pixel_norm, 1.0f / (GLfloat)tex_width, - 1.0f / (GLfloat)tex_height); + glUniform2f(p->uniform_pixel_norm, 1.0F / (GLfloat)tex_width, + 1.0F / (GLfloat)tex_height); // The number of indices in the selected vertex array GLsizei nelems; @@ -644,7 +644,7 @@ bool gl_kernel_blur(backend_t *base, double opacity, void *ctx, const rect_t *ex return false; } - glUniform1f(p->uniform_opacity, 1.0); + glUniform1f(p->uniform_opacity, 1.0F); } else { // last pass, draw directly into the back buffer, with origin // regions @@ -715,8 +715,8 @@ bool gl_dual_kawase_blur(backend_t *base, double opacity, void *ctx, const rect_ glUniform1f(down_pass->scale_loc, (GLfloat)scale_factor); - glUniform2f(down_pass->uniform_pixel_norm, 1.0f / (GLfloat)tex_width, - 1.0f / (GLfloat)tex_height); + glUniform2f(down_pass->uniform_pixel_norm, 1.0F / (GLfloat)tex_width, + 1.0F / (GLfloat)tex_height); glDrawElements(GL_TRIANGLES, nelems, GL_UNSIGNED_INT, NULL); } @@ -764,8 +764,8 @@ bool gl_dual_kawase_blur(backend_t *base, double opacity, void *ctx, const rect_ } glUniform1f(up_pass->scale_loc, (GLfloat)scale_factor); - glUniform2f(up_pass->uniform_pixel_norm, 1.0f / (GLfloat)tex_width, - 1.0f / (GLfloat)tex_height); + glUniform2f(up_pass->uniform_pixel_norm, 1.0F / (GLfloat)tex_width, + 1.0F / (GLfloat)tex_height); glDrawElements(GL_TRIANGLES, nelems, GL_UNSIGNED_INT, NULL); } @@ -1511,8 +1511,8 @@ void *gl_create_blur_context(backend_t *base, enum blur_method method, void *arg // Note: OpenGL matrices are column major GLint viewport_dimensions[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewport_dimensions); - GLfloat projection_matrix[4][4] = {{2.0f / (GLfloat)viewport_dimensions[0], 0, 0, 0}, - {0, 2.0f / (GLfloat)viewport_dimensions[1], 0, 0}, + GLfloat projection_matrix[4][4] = {{2.0F / (GLfloat)viewport_dimensions[0], 0, 0, 0}, + {0, 2.0F / (GLfloat)viewport_dimensions[1], 0, 0}, {0, 0, 0, 0}, {-1, -1, 0, 1}}; @@ -1715,7 +1715,7 @@ bool gl_init(struct gl_data *gd, session_t *ps) { glViewport(0, 0, viewport_dimensions[0], viewport_dimensions[1]); // Clear screen - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClearColor(0.0F, 0.0F, 0.0F, 1.0F); glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glGenFramebuffers(1, &gd->back_fbo);