From 3cf71e8c7d7a1ed83db5ea6e5a110346807b307b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 Oct 2019 15:51:52 -0400 Subject: cmLocalGenerator: Drop unused initializer in AddUnityBuild Fix a warning from clang-scanbuild: warning: Value stored to 'chunk' during its initialization is never read for (size_t itemsLeft = filtered_sources.size(), chunk = batchSize, ^~~~~ ~~~~~~~~~ Simply remove the initializer. --- Source/cmLocalGenerator.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a2eb1b9..8879040 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2453,8 +2453,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) batchSize = filtered_sources.size(); } - for (size_t itemsLeft = filtered_sources.size(), chunk = batchSize, - batch = 0; + for (size_t itemsLeft = filtered_sources.size(), chunk, batch = 0; itemsLeft > 0; itemsLeft -= chunk, ++batch) { chunk = std::min(itemsLeft, batchSize); -- cgit v0.12 From fe5ba71bd0dba82d8a3093217ec1fcec1dd00ac6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 29 Oct 2019 11:20:47 -0400 Subject: Tests: Suppress clang scan-build warning in UTF8 test Clang scan-build 7 reports: ``` Tests/CMakeLib/testUTF8.cxx:12:3: warning: 4th function call argument is an uninitialized value printf("[0x%02X,0x%02X,0x%02X,0x%02X]", static_cast(d[0]), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Manual tracing of all call sites shows that all values are initialized. --- Tests/CMakeLib/testUTF8.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx index 986f595..1bf88cf 100644 --- a/Tests/CMakeLib/testUTF8.cxx +++ b/Tests/CMakeLib/testUTF8.cxx @@ -9,9 +9,11 @@ typedef char test_utf8_char[5]; static void test_utf8_char_print(test_utf8_char const c) { unsigned char const* d = reinterpret_cast(c); +#ifndef __clang_analyzer__ // somehow thinks arguments are not initialized printf("[0x%02X,0x%02X,0x%02X,0x%02X]", static_cast(d[0]), static_cast(d[1]), static_cast(d[2]), static_cast(d[3])); +#endif } static void byte_array_print(char const* s) -- cgit v0.12