rocksdb icon indicating copy to clipboard operation
rocksdb copied to clipboard

Fix an uninitialized variable warning for g++ 11.2.0

Open bremac opened this issue 3 years ago • 0 comments

This commit fixes an uninitialized variable warning under g++ 11.2.0 in third-party/gtest/:

rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc: In function ‘bool testing::internal::StackGrowsDown()’:
rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc:8681:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 8681 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc:8671:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 8671 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
rocksdb/third-party/gtest-1.8.1/fused-src/gtest/gtest-all.cc:8679:7: note: ‘dummy’ declared here
 8679 |   int dummy;
      |       ^~~~~

This warning breaks the build under cmake, since it sets -Werror by default.

bremac avatar Sep 05 '22 22:09 bremac