mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Silence clang static analyzer warnings
This commit is contained in:
parent
0f0873cf2b
commit
5f724b047b
9 changed files with 13 additions and 9 deletions
|
|
@ -229,6 +229,7 @@ clean-local:
|
|||
rm -f lcov.info
|
||||
rm -f gmon.out
|
||||
rm -f makeslackware.sh makeslackdist.sh pkg/snapraid.SlackBuild pkg/snapraid.info makedeb.sh pkg/control makerpm.sh pkg/snapraid.spec
|
||||
rm -fr *.plist
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f $(LIST_MAN)
|
||||
|
|
|
|||
|
|
@ -329,7 +329,9 @@ static int repair(struct snapraid_state* state, int rehash, block_off_t pos, uns
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (hash_is_invalid(block->hash)) {
|
||||
if (block == BLOCK_NULL) {
|
||||
hash = "none";
|
||||
} else if (hash_is_invalid(block->hash)) {
|
||||
hash = "lost";
|
||||
} else if (hash_is_zero(block->hash)) {
|
||||
hash = "zero";
|
||||
|
|
|
|||
|
|
@ -188,8 +188,6 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
|
|||
/* start all the worker threads */
|
||||
io_start(&io, blockstart, blockmax, 0);
|
||||
|
||||
blockcur = blockstart;
|
||||
|
||||
int alert = state_progress_begin(state, blockstart, blockmax, countmax);
|
||||
if (alert > 0)
|
||||
goto end;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ int handle_open(struct snapraid_handle* handle, struct snapraid_file* file, int
|
|||
out_missing = log_error;
|
||||
|
||||
/* if already opened, nothing to do */
|
||||
if (handle->file == file && handle->file != 0 && handle->f != -1) {
|
||||
if (handle->file != 0 && handle->file == file && handle->f != -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ static int clean_dir(const char* dir)
|
|||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (dd == 0 && errno == 0) {
|
||||
if (dd == 0) {
|
||||
break; /* finished */
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ static void read_dir(tommy_hashdyn* poolset, const char* base_dir, const char* s
|
|||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (dd == 0 && errno == 0) {
|
||||
if (dd == 0) {
|
||||
break; /* finished */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2007,7 +2007,10 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
|||
int all_missing = 0;
|
||||
int all_rewritten = 0;
|
||||
done = 0;
|
||||
|
||||
for (i = state->disklist, j = scanlist; i != 0; i = i->next, j = j->next) {
|
||||
assert(j != 0); /* silence the clang static analyzer (both lists have the same number of elements) */
|
||||
|
||||
struct snapraid_disk* disk = i->data;
|
||||
struct snapraid_scan* scan = j->data;
|
||||
|
||||
|
|
|
|||
|
|
@ -2026,6 +2026,8 @@ int fssnapshot_mount(const char* path, struct fssnapshot_struct* fss)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
assert(fss != 0); /* silence the clang static analyzer (it's never called with a NULL fss) */
|
||||
|
||||
if (sfs.f_type == BTRFS_SUPER_MAGIC) {
|
||||
/* btrfs reserved inode 256 for subvolume roots */
|
||||
return fssnapshot_inode(path, BTRFS_SUPER_MAGIC, 256, fss);
|
||||
|
|
|
|||
|
|
@ -676,8 +676,6 @@ int util_selftest(void)
|
|||
if (util_rotl32(0x80000000U, 1) != 0x00000001U) return -1;
|
||||
if (util_rotl32(0x00000001U, 31) != 0x80000000U) return -1;
|
||||
if (util_rotl32(0x12345678U, 4) != 0x23456781U) return -1;
|
||||
if (util_rotl32(0x12345678U, 0) != 0x12345678U) return -1;
|
||||
if (util_rotl32(0x12345678U, 32) != 0x12345678U) return -1; /* r % 32 == 0 */
|
||||
|
||||
/* rotate right 32-bit */
|
||||
if (util_rotr32(0x00000001U, 1) != 0x80000000U) return -1;
|
||||
|
|
@ -689,7 +687,6 @@ int util_selftest(void)
|
|||
if (util_rotl64(1ULL, 1) != 2ULL) return -1;
|
||||
if (util_rotl64(1ULL << 63, 1) != 1ULL) return -1;
|
||||
if (util_rotl64(0x123456789ABCDEF0ULL, 8) != 0x3456789ABCDEF012ULL) return -1;
|
||||
if (util_rotl64(0x123456789ABCDEF0ULL, 0) != 0x123456789ABCDEF0ULL) return -1;
|
||||
|
||||
/* rotate right 64-bit */
|
||||
if (util_rotr64(1ULL, 1) != (1ULL << 63)) return -1;
|
||||
|
|
|
|||
1
configure.analyzer
Executable file
1
configure.analyzer
Executable file
|
|
@ -0,0 +1 @@
|
|||
./configure CC=/usr/libexec/ccc-analyzer
|
||||
Loading…
Add table
Add a link
Reference in a new issue