clang-tidy-14: suppress some further warnings using asserts (removed remaining NOLINT)

This commit is contained in:
gitlost 2022-04-02 10:43:45 +01:00
parent 8950f10c00
commit 69876619dd
2 changed files with 4 additions and 1 deletions

View File

@ -45,6 +45,7 @@
* https://github.com/fahickman/r128/blob/master/r128.h * https://github.com/fahickman/r128/blob/master/r128.h
* "R128 is released into the public domain. See LICENSE for details." LICENSE is The Unlicense. * "R128 is released into the public domain. See LICENSE for details." LICENSE is The Unlicense.
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <malloc.h> #include <malloc.h>
@ -197,6 +198,7 @@ INTERNAL uint64_t large_div_u64(large_int *t, uint64_t v) {
/* Compute qhat1 estimate */ /* 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 */ qhat1 = tnhi / vn1; /* Divide first digit of v into first 2 digits of t */
rhat = tnhi % vn1; rhat = tnhi % vn1;

View File

@ -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; 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; short_data_block_length = data_cw / blocks;
qty_long_blocks = data_cw % blocks; qty_long_blocks = data_cw % blocks;
qty_short_blocks = blocks - qty_long_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++) { for (j = 0; j < data_cw; j++) {
// NOLINTNEXTLINE suppress clang-tidy warning: interleaved_data[data_cw] fully set
fullstream[j] = interleaved_data[j]; fullstream[j] = interleaved_data[j];
} }
for (j = 0; j < ecc_cw; j++) { for (j = 0; j < ecc_cw; j++) {