From e24c403816e38d4acf6cf998427d07ac5831a63a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 22 May 2023 09:58:44 -0400 Subject: liblzma: Suppress clang-analyzer warnings --- Utilities/cmliblzma/liblzma/common/index.c | 3 +++ Utilities/cmliblzma/liblzma/common/index_encoder.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Utilities/cmliblzma/liblzma/common/index.c b/Utilities/cmliblzma/liblzma/common/index.c index a41e8f3..4c463ec 100644 --- a/Utilities/cmliblzma/liblzma/common/index.c +++ b/Utilities/cmliblzma/liblzma/common/index.c @@ -263,6 +263,9 @@ index_tree_append(index_tree *tree, index_tree_node *node) up = ctz32(tree->count) + 2; do { node = node->parent; + #ifdef __clang_analyzer__ + assert(node); + #endif } while (--up > 0); // Rotate left using node as the rotation root. diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.c b/Utilities/cmliblzma/liblzma/common/index_encoder.c index ac97d0c..5e822cb 100644 --- a/Utilities/cmliblzma/liblzma/common/index_encoder.c +++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c @@ -237,12 +237,15 @@ lzma_index_buffer_encode(const lzma_index *i, // Do the actual encoding. This should never fail, but store // the original *out_pos just in case. +#ifndef __clang_analyzer__ // Hide unreachable code from clang-analyzer. const size_t out_start = *out_pos; +#endif lzma_ret ret = index_encode(&coder, NULL, NULL, NULL, 0, out, out_pos, out_size, LZMA_RUN); if (ret == LZMA_STREAM_END) { ret = LZMA_OK; +#ifndef __clang_analyzer__ // Hide unreachable code from clang-analyzer. } else { // We should never get here, but just in case, restore the // output position and set the error accordingly if something @@ -250,6 +253,7 @@ lzma_index_buffer_encode(const lzma_index *i, assert(0); *out_pos = out_start; ret = LZMA_PROG_ERROR; +#endif } return ret; -- cgit v0.12