summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-22 13:58:44 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-22 20:51:15 (GMT)
commite24c403816e38d4acf6cf998427d07ac5831a63a (patch)
treecaf3a3b18b129693c300fee6e5b45619dfb1cee0
parent48297cf770664e59283b3bf3a35a2ceab7b55f1f (diff)
downloadCMake-e24c403816e38d4acf6cf998427d07ac5831a63a.zip
CMake-e24c403816e38d4acf6cf998427d07ac5831a63a.tar.gz
CMake-e24c403816e38d4acf6cf998427d07ac5831a63a.tar.bz2
liblzma: Suppress clang-analyzer warnings
-rw-r--r--Utilities/cmliblzma/liblzma/common/index.c3
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_encoder.c4
2 files changed, 7 insertions, 0 deletions
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;