From 69876619ddb359346a81209b6331e7a29e14c2e6 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sat, 2 Apr 2022 10:43:45 +0100 Subject: [PATCH] clang-tidy-14: suppress some further warnings using asserts (removed remaining NOLINT) --- backend/large.c | 2 ++ backend/qr.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/large.c b/backend/large.c index 127dca12..c2db31fe 100644 --- a/backend/large.c +++ b/backend/large.c @@ -45,6 +45,7 @@ * https://github.com/fahickman/r128/blob/master/r128.h * "R128 is released into the public domain. See LICENSE for details." LICENSE is The Unlicense. */ +#include #include #ifdef _MSC_VER #include @@ -197,6 +198,7 @@ INTERNAL uint64_t large_div_u64(large_int *t, uint64_t v) { /* Compute qhat1 estimate */ + assert(vn1 != 0); /* Suppress clang-tidy-14 clang-analyzer-core.DivideZero */ qhat1 = tnhi / vn1; /* Divide first digit of v into first 2 digits of t */ rhat = tnhi % vn1; diff --git a/backend/qr.c b/backend/qr.c index f9058721..383d2851 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -765,6 +765,8 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[] ecc_cw = rmqr_total_codewords[version - RMQR_VERSION] - data_cw; } + /* Suppress some clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult/uninitialized.Assign warnings */ + assert(blocks > 0); short_data_block_length = data_cw / blocks; qty_long_blocks = data_cw % blocks; qty_short_blocks = blocks - qty_long_blocks; @@ -840,7 +842,6 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[] } for (j = 0; j < data_cw; j++) { - // NOLINTNEXTLINE suppress clang-tidy warning: interleaved_data[data_cw] fully set fullstream[j] = interleaved_data[j]; } for (j = 0; j < ecc_cw; j++) {