1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

liblzma: Silence warnings from clang -Wconditional-uninitialized.

This is similar to 2ce4f36f17.
The actual initialization of the variables is done inside
mythread_sync() macro. Clang doesn't seem to see that
the initialization code inside the macro is always executed.
This commit is contained in:
Lasse Collin 2023-01-12 03:19:59 +02:00
parent 6c886cc5b3
commit 3f13bf6b9e
2 changed files with 6 additions and 4 deletions

View file

@ -1358,9 +1358,11 @@ stream_decode_mt(void *coder_ptr, const lzma_allocator *allocator,
// values after we read these as those changes can only be // values after we read these as those changes can only be
// towards more favorable conditions (less memory in use, // towards more favorable conditions (less memory in use,
// more in cache). // more in cache).
uint64_t mem_in_use; //
uint64_t mem_cached; // These are initalized to silence warnings.
struct worker_thread *thr = NULL; // Init to silence warning. uint64_t mem_in_use = 0;
uint64_t mem_cached = 0;
struct worker_thread *thr = NULL;
mythread_sync(coder->mutex) { mythread_sync(coder->mutex) {
mem_in_use = coder->mem_in_use; mem_in_use = coder->mem_in_use;

View file

@ -645,7 +645,7 @@ stream_encode_in(lzma_stream_coder *coder, const lzma_allocator *allocator,
} }
if (block_error) { if (block_error) {
lzma_ret ret; lzma_ret ret = LZMA_OK; // Init to silence a warning.
mythread_sync(coder->mutex) { mythread_sync(coder->mutex) {
ret = coder->thread_error; ret = coder->thread_error;