]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/crimson: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 03:38:07 +0000 (11:38 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 01:33:14 +0000 (09:33 +0800)
* 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 <kchai@redhat.com>
src/test/crimson/gtest_seastar.cc
src/test/crimson/test_async_echo.cc
src/test/crimson/test_config.cc
src/test/crimson/test_messenger.cc
src/test/crimson/test_monc.cc
src/test/crimson/test_socket.cc

index 4411213af9013a5e1b9c21fc36404fbc6b31191b..2fd5e39fab8f819dc4a7c3ee0e212f3a7e90b8d2 100644 (file)
@@ -22,7 +22,7 @@ int main(int argc, char **argv)
 
   seastar_test_suite_t::seastar_env.run([] {
     return crimson::common::sharded_conf().start(
-      EntityName{}, string_view{"ceph"}
+      EntityName{}, std::string_view{"ceph"}
     ).then([] {
       return crimson::common::sharded_perf_coll().start();
     });
index 4f2d43d9d296c51962159247f9077839601cc3e5..62ad8daed0475432c1c654807681335ee5a0e6a1 100644 (file)
@@ -33,7 +33,7 @@ struct Server {
     msgr->set_require_authorizer(false);
   }
   DummyAuthClientServer dummy_auth;
-  unique_ptr<Messenger> msgr;
+  std::unique_ptr<Messenger> msgr;
   struct ServerDispatcher : Dispatcher {
     std::mutex mutex;
     std::condition_variable on_reply;
@@ -79,7 +79,7 @@ struct Server {
 };
 
 struct Client {
-  unique_ptr<Messenger> msgr;
+  std::unique_ptr<Messenger> msgr;
   Client(CephContext *cct)
     : dummy_auth(cct), dispatcher(cct)
   {
@@ -126,6 +126,7 @@ struct Client {
       return true;
     }
     bool ping(Messenger* msgr, const entity_inst_t& peer) {
+      using namespace std::chrono_literals;
       auto conn = msgr->connect_to(peer.name.type(),
                                    entity_addrvec_t{peer.addr});
       replied = false;
index 608aa26942ca539f802575419951f508341dac8c..7541c0931254a9e410097790a524b78b0c93ab0d 100644 (file)
@@ -7,6 +7,7 @@
 #include "common/config_obs.h"
 #include "crimson/common/config_proxy.h"
 
+using namespace std::literals;
 using Config = crimson::common::ConfigProxy;
 const std::string test_uint_option = "osd_max_pgls";
 const uint64_t INVALID_VALUE = (uint64_t)(-1);
@@ -47,7 +48,7 @@ seastar::sharded<ConfigObs> sharded_cobs;
 
 static seastar::future<> test_config()
 {
-  return crimson::common::sharded_conf().start(EntityName{}, string_view{"ceph"}).then([] {
+  return crimson::common::sharded_conf().start(EntityName{}, "ceph"sv).then([] {
     std::vector<const char*> args;
     std::string cluster;
     std::string conf_file_list;
index 57388394596513074ee3c0d9fa0927161877a8b3..bd549d4d6161339940316c9ccd6baf9e2f610d62 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "test_cmds.h"
 
+using namespace std::chrono_literals;
 namespace bpo = boost::program_options;
 using crimson::common::local_conf;
 
index f590ce73a148afe50dcf0da6f556e135584fb2a6..6331f4d61a25e7eb9a857dfd9c4931bfa172080a 100644 (file)
@@ -22,9 +22,11 @@ DummyAuthHandler dummy_handler;
 
 }
 
+using namespace std::literals;
+
 static seastar::future<> test_monc()
 {
-  return crimson::common::sharded_conf().start(EntityName{}, string_view{"ceph"}).then([] {
+  return crimson::common::sharded_conf().start(EntityName{}, "ceph"sv).then([] {
     std::vector<const char*> args;
     std::string cluster;
     std::string conf_file_list;
index bfdeeea2a787fd4c9c547aad425cff02b88ff246..49d6aef7d64d26ca7cbc0d68e7b12014a784c026 100644 (file)
@@ -15,6 +15,8 @@
 
 namespace {
 
+using namespace std::chrono_literals;
+
 using seastar::engine;
 using seastar::future;
 using crimson::net::error;