From b4326b5273f677f28d5709e0f2ff86cf2d502bb3 Mon Sep 17 00:00:00 2001 From: Jay Zhuang Date: Mon, 18 Oct 2021 12:21:25 -0700 Subject: [PATCH] Fix gcc-11 compile error (#9043) Summary: gcc11 added new static check. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9043 Test Plan: Added CI for gcc11 build Reviewed By: zhichao-cao Differential Revision: D31716005 Pulled By: jay-zhuang fbshipit-source-id: 9f53be6f2f9e58e39b83359f6bbf66f945d57429 --- .circleci/config.yml | 11 +++++++++++ table/table_test.cc | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b39532496..8fb0bc93b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -379,6 +379,16 @@ jobs: - run: CC=gcc-10 CXX=g++-10 V=1 SKIP_LINK=1 ROCKSDB_CXX_STANDARD=c++20 make -j16 all | .circleci/cat_ignore_eagain # Linking broken because libgflags compiled with newer ABI - post-steps + build-linux-gcc-11-no_test_run: + machine: + image: ubuntu-2004:202010-01 + resource_class: xlarge + steps: + - pre-steps + - run: sudo apt-get update -y && sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get install gcc-11 g++-11 libgflags-dev + - run: CC=gcc-11 CXX=g++-11 V=1 SKIP_LINK=1 make -j16 all | .circleci/cat_ignore_eagain # Linking broken because libgflags compiled with newer ABI + - post-steps + # This job is only to make sure the microbench tests are able to run, the benchmark result is not meaningful as the CI host is changing. build-linux-microbench: machine: @@ -779,6 +789,7 @@ workflows: - build-linux-gcc-8-no_test_run - build-linux-gcc-9-no_test_run - build-linux-gcc-10-cxx20-no_test_run + - build-linux-gcc-11-no_test_run - build-linux-arm-cmake-no_test_run build-macos: jobs: diff --git a/table/table_test.cc b/table/table_test.cc index a5017acd9..cd33c7d49 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -1365,7 +1365,7 @@ TEST_F(TablePropertyTest, PrefixScanTest) { {"num.555.3", "3"}, }; // prefixes that exist - for (const std::string& prefix : {"num.111", "num.333", "num.555"}) { + for (const std::string prefix : {"num.111", "num.333", "num.555"}) { int num = 0; for (auto pos = props.lower_bound(prefix); pos != props.end() && @@ -1380,7 +1380,7 @@ TEST_F(TablePropertyTest, PrefixScanTest) { } // prefixes that don't exist - for (const std::string& prefix : + for (const std::string prefix : {"num.000", "num.222", "num.444", "num.666"}) { auto pos = props.lower_bound(prefix); ASSERT_TRUE(pos == props.end() ||