From: Kefu Chai Date: Wed, 11 Aug 2021 03:50:47 +0000 (+0800) Subject: test/objectstore: build without "using namespace std" X-Git-Tag: v17.1.0~1121^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7646874dbb40dc63044728121c548edbbe72efb;p=ceph-ci.git test/objectstore: build without "using namespace std" * add "std::" prefix in headers * add "using" declarations in .cc files. so we don't rely on "using namespace std" in one or more included headers. Signed-off-by: Kefu Chai --- diff --git a/src/test/objectstore/Allocator_test.cc b/src/test/objectstore/Allocator_test.cc index 29bbd73946f..40fbed12bd3 100644 --- a/src/test/objectstore/Allocator_test.cc +++ b/src/test/objectstore/Allocator_test.cc @@ -14,6 +14,8 @@ #include "include/Context.h" #include "os/bluestore/Allocator.h" +using namespace std; + typedef boost::mt11213b gen_type; class AllocTest : public ::testing::TestWithParam { diff --git a/src/test/objectstore/chain_xattr.cc b/src/test/objectstore/chain_xattr.cc index 27c6bbb2f6d..c7bf09e7e92 100644 --- a/src/test/objectstore/chain_xattr.cc +++ b/src/test/objectstore/chain_xattr.cc @@ -32,6 +32,8 @@ #define LARGE_BLOCK_LEN CHAIN_XATTR_MAX_BLOCK_LEN + 1024 #define FILENAME "chain_xattr" +using namespace std; + TEST(chain_xattr, get_and_set) { const char* file = FILENAME; ::unlink(file); diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 883ad0121be..16133241fd7 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -43,6 +43,7 @@ #include "include/unordered_map.h" #include "store_test_fixture.h" +using namespace std; using namespace std::placeholders; typedef boost::mt11213b gen_type; diff --git a/src/test/objectstore/store_test_fixture.cc b/src/test/objectstore/store_test_fixture.cc index 2b26207d4e5..130c2c78bb9 100644 --- a/src/test/objectstore/store_test_fixture.cc +++ b/src/test/objectstore/store_test_fixture.cc @@ -13,6 +13,8 @@ #endif #include "store_test_fixture.h" +using namespace std; + static void rm_r(const string& path) { string cmd = string("rm -r ") + path; diff --git a/src/test/objectstore/test_bdev.cc b/src/test/objectstore/test_bdev.cc index b24368f0a05..e5e591a38c4 100755 --- a/src/test/objectstore/test_bdev.cc +++ b/src/test/objectstore/test_bdev.cc @@ -14,6 +14,8 @@ #include "blk/BlockDevice.h" +using namespace std; + class TempBdev { public: TempBdev(uint64_t size) diff --git a/src/test/objectstore/test_bluefs.cc b/src/test/objectstore/test_bluefs.cc index 551d143223d..1de92744868 100644 --- a/src/test/objectstore/test_bluefs.cc +++ b/src/test/objectstore/test_bluefs.cc @@ -19,6 +19,8 @@ #include "os/bluestore/BlueFS.h" +using namespace std; + std::unique_ptr gen_buffer(uint64_t size) { std::unique_ptr buffer = std::make_unique(size); diff --git a/src/test/objectstore/test_bluestore_types.cc b/src/test/objectstore/test_bluestore_types.cc index a830915952a..e3b14f9c272 100644 --- a/src/test/objectstore/test_bluestore_types.cc +++ b/src/test/objectstore/test_bluestore_types.cc @@ -17,6 +17,8 @@ #define _STR(x) #x #define STRINGIFY(x) _STR(x) +using namespace std; + TEST(bluestore, sizeof) { #define P(t) cout << STRINGIFY(t) << "\t" << sizeof(t) << std::endl P(BlueStore::Onode); diff --git a/src/test/objectstore/test_memstore_clone.cc b/src/test/objectstore/test_memstore_clone.cc index 85d4132949e..2a0ea093f86 100644 --- a/src/test/objectstore/test_memstore_clone.cc +++ b/src/test/objectstore/test_memstore_clone.cc @@ -22,6 +22,8 @@ #define dout_context g_ceph_context +using namespace std; + namespace { const coll_t cid; diff --git a/src/test/objectstore/test_transaction.cc b/src/test/objectstore/test_transaction.cc index 6d7c9fe0f98..381b9df7d64 100644 --- a/src/test/objectstore/test_transaction.cc +++ b/src/test/objectstore/test_transaction.cc @@ -18,6 +18,8 @@ #include "include/utime.h" #include +using namespace std; + TEST(Transaction, MoveConstruct) { auto a = ObjectStore::Transaction{}; diff --git a/src/test/os/TestLFNIndex.cc b/src/test/os/TestLFNIndex.cc index d74de739d1e..053af6db22a 100644 --- a/src/test/os/TestLFNIndex.cc +++ b/src/test/os/TestLFNIndex.cc @@ -27,6 +27,8 @@ #include "global/global_init.h" #include +using namespace std; + class TestWrapLFNIndex : public LFNIndex { public: TestWrapLFNIndex(CephContext* cct,