From: Kefu Chai Date: Tue, 26 Aug 2025 05:28:56 +0000 (+0800) Subject: src: replace push_back(T{}) with emplace_back() X-Git-Tag: testing/wip-vshankar-testing-20250917.163544-debug~16^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6387fd81c6e23dbfb14edbd21185e1a753a249a;p=ceph-ci.git src: replace push_back(T{}) with emplace_back() in ed6b7124, we switched from some instances of `push_back(Type{})` patterns to `emplace_back()` to simplify the code and to avoid unnecessary overhead of copy/move constructor calls. but there were still remaining instances of them in `generate_test_instance()` member function implementations. in this change, we switched all of them to be more consistent. Signed-off-by: Kefu Chai --- diff --git a/src/auth/Auth.h b/src/auth/Auth.h index 366aeb69ce5..feb19ccbfb7 100644 --- a/src/auth/Auth.h +++ b/src/auth/Auth.h @@ -76,7 +76,7 @@ struct EntityAuth { } static std::list generate_test_instances() { std::list ls; - ls.push_back(EntityAuth{}); + ls.emplace_back(); return ls; } }; @@ -122,10 +122,10 @@ struct AuthCapsInfo { } static std::list generate_test_instances() { std::list ls; - ls.push_back(AuthCapsInfo{}); - ls.push_back(AuthCapsInfo{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().allow_all = true; - ls.push_back(AuthCapsInfo{}); + ls.emplace_back(); ls.back().caps.append("foo"); ls.back().caps.append("bar"); return ls; @@ -190,8 +190,8 @@ struct AuthTicket { } static std::list generate_test_instances() { std::list ls; - ls.push_back(AuthTicket{}); - ls.push_back(AuthTicket{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().name.set_id("client.123"); ls.back().global_id = 123; ls.back().init_timestamps(utime_t(123, 456), 7); @@ -290,8 +290,8 @@ struct ExpiringCryptoKey { } static std::list generate_test_instances() { std::list ls; - ls.push_back(ExpiringCryptoKey{}); - ls.push_back(ExpiringCryptoKey{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().key.set_secret( CEPH_CRYPTO_AES, bufferptr("1234567890123456", 16), utime_t(123, 456)); return ls; @@ -365,8 +365,8 @@ struct RotatingSecrets { } static std::list generate_test_instances() { std::list ls; - ls.push_back(RotatingSecrets{}); - ls.push_back(RotatingSecrets{}); + ls.emplace_back(); + ls.emplace_back(); ExpiringCryptoKey eck{}; ls.back().add(eck); return ls; diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index addac53e726..1dbfb15475e 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -80,8 +80,8 @@ struct KeyServerData { } static std::list generate_test_instances() { std::list ls; - ls.push_back(KeyServerData{}); - ls.push_back(KeyServerData{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().version = 1; return ls; } @@ -180,11 +180,11 @@ struct KeyServerData { } static std::list generate_test_instances() { std::list ls; - ls.push_back(Incremental{}); + ls.emplace_back(); ls.back().op = AUTH_INC_DEL; - ls.push_back(Incremental{}); + ls.emplace_back(); ls.back().op = AUTH_INC_ADD; - ls.push_back(Incremental{}); + ls.emplace_back(); ls.back().op = AUTH_INC_SET_ROTATING; return ls; } diff --git a/src/auth/cephx/CephxProtocol.h b/src/auth/cephx/CephxProtocol.h index f47eb8856dc..3e7bdb2c58f 100644 --- a/src/auth/cephx/CephxProtocol.h +++ b/src/auth/cephx/CephxProtocol.h @@ -60,7 +60,7 @@ struct CephXServerChallenge { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXServerChallenge{}); + ls.emplace_back(); ls.back().server_challenge = 1; return ls; } @@ -86,7 +86,7 @@ struct CephXRequestHeader { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXRequestHeader{}); + ls.emplace_back(); ls.back().request_type = 1; return ls; } @@ -113,7 +113,7 @@ struct CephXResponseHeader { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXResponseHeader{}); + ls.emplace_back(); ls.back().request_type = 1; ls.back().status = 0; return ls; @@ -150,7 +150,7 @@ struct CephXTicketBlob { static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXTicketBlob{}); + ls.emplace_back(); ls.back().secret_id = 123; ls.back().blob.append(std::string_view("this is a blob")); return ls; @@ -204,10 +204,10 @@ struct CephXAuthenticate { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXAuthenticate{}); + ls.emplace_back(); ls.back().client_challenge = 0; ls.back().key = 0; - ls.push_back(CephXAuthenticate{}); + ls.emplace_back(); ls.back().client_challenge = 1; ls.back().key = 2; ls.back().old_ticket.secret_id = 3; @@ -237,7 +237,7 @@ struct CephXChallengeBlob { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXChallengeBlob{}); + ls.emplace_back(); ls.back().server_challenge = 123; ls.back().client_challenge = 456; return ls; @@ -299,7 +299,7 @@ struct CephXServiceTicketRequest { static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXServiceTicketRequest{}); + ls.emplace_back(); ls.back().keys = 123; return ls; } @@ -342,9 +342,9 @@ struct CephXAuthorizeReply { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXAuthorizeReply{}); + ls.emplace_back(); ls.back().nonce_plus_one = 0; - ls.push_back(CephXAuthorizeReply{}); + ls.emplace_back(); ls.back().nonce_plus_one = 123; ls.back().connection_secret = "secret"; return ls; @@ -457,8 +457,8 @@ struct CephXServiceTicket { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXServiceTicket{}); - ls.push_back(CephXServiceTicket{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().session_key.set_secret( CEPH_CRYPTO_AES, bufferptr("1234567890123456", 16), utime_t(123, 456)); ls.back().validity = utime_t(123, 456); @@ -492,8 +492,8 @@ struct CephXServiceTicketInfo { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXServiceTicketInfo{}); - ls.push_back(CephXServiceTicketInfo{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ticket.global_id = 1234; ls.back().ticket.init_timestamps(utime_t(123, 456), utime_t(123, 456)); ls.back().session_key.set_secret( @@ -522,7 +522,7 @@ struct CephXAuthorizeChallenge : public AuthAuthorizerChallenge { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXAuthorizeChallenge{}); + ls.emplace_back(); ls.back().server_challenge = 1234; return ls; } @@ -558,8 +558,8 @@ struct CephXAuthorize { } static std::list generate_test_instances() { std::list ls; - ls.push_back(CephXAuthorize{}); - ls.push_back(CephXAuthorize{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().nonce = 1234; ls.back().have_challenge = true; ls.back().server_challenge_plus_one = 1234; diff --git a/src/cls/2pc_queue/cls_2pc_queue_ops.h b/src/cls/2pc_queue/cls_2pc_queue_ops.h index 65435c521f8..66c1ac22e8e 100644 --- a/src/cls/2pc_queue/cls_2pc_queue_ops.h +++ b/src/cls/2pc_queue/cls_2pc_queue_ops.h @@ -32,9 +32,9 @@ struct cls_2pc_queue_reserve_op { static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_queue_reserve_op{}); + ls.emplace_back(); ls.back().size = 0; - ls.push_back(cls_2pc_queue_reserve_op{}); + ls.emplace_back(); ls.back().size = 123; ls.back().entries = 456; return ls; @@ -63,7 +63,7 @@ struct cls_2pc_queue_reserve_ret { static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_queue_reserve_ret{}); + ls.emplace_back(); ls.back().id = 123; return ls; } @@ -95,7 +95,7 @@ struct cls_2pc_queue_commit_op { static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_queue_commit_op{}); + ls.emplace_back(); ls.back().id = 123; ls.back().bl_data_vec.push_back(ceph::buffer::list()); ls.back().bl_data_vec.back().append("foo"); @@ -125,7 +125,7 @@ struct cls_2pc_queue_abort_op { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_queue_abort_op{}); + ls.emplace_back(); ls.back().id = 1; return ls; } @@ -152,8 +152,8 @@ struct cls_2pc_queue_expire_op { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_queue_expire_op{}); - ls.push_back(cls_2pc_queue_expire_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().stale_time = ceph::coarse_real_time::min(); return ls; } @@ -187,8 +187,8 @@ struct cls_2pc_queue_reservations_ret { static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_queue_reservations_ret{}); - ls.push_back(cls_2pc_queue_reservations_ret{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().reservations[1] = cls_2pc_reservation(); ls.back().reservations[2] = cls_2pc_reservation(); return ls; diff --git a/src/cls/2pc_queue/cls_2pc_queue_types.h b/src/cls/2pc_queue/cls_2pc_queue_types.h index c64ce58632f..5c12f26b114 100644 --- a/src/cls/2pc_queue/cls_2pc_queue_types.h +++ b/src/cls/2pc_queue/cls_2pc_queue_types.h @@ -44,9 +44,9 @@ struct cls_2pc_reservation static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_reservation{}); + ls.emplace_back(); ls.back().size = 0; - ls.push_back(cls_2pc_reservation{}); + ls.emplace_back(); ls.back().size = 123; ls.back().timestamp = ceph::coarse_real_clock::zero(); return ls; @@ -102,8 +102,8 @@ struct cls_2pc_urgent_data static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_2pc_urgent_data{}); - ls.push_back(cls_2pc_urgent_data{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().reserved_size = 123; ls.back().last_id = 456; ls.back().reservations.emplace(789, cls_2pc_reservation(1, ceph::coarse_real_clock::zero(), 2)); diff --git a/src/cls/cas/cls_cas_internal.h b/src/cls/cas/cls_cas_internal.h index a4020566eea..f535b2c6cd8 100644 --- a/src/cls/cas/cls_cas_internal.h +++ b/src/cls/cas/cls_cas_internal.h @@ -95,7 +95,7 @@ struct chunk_refs_t { } static std::list generate_test_instances() { std::list ls; - ls.push_back(chunk_refs_t{}); + ls.emplace_back(); return ls; } }; @@ -149,8 +149,8 @@ struct chunk_refs_by_object_t : public chunk_refs_t::refs_t { } static std::list generate_test_instances() { std::list ls; - ls.push_back(chunk_refs_by_object_t{}); - ls.push_back(chunk_refs_by_object_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().by_object.insert(hobject_t(sobject_t("foo", CEPH_NOSNAP))); ls.back().by_object.insert(hobject_t(sobject_t("bar", CEPH_NOSNAP))); return ls; @@ -398,8 +398,8 @@ struct chunk_refs_count_t : public chunk_refs_t::refs_t { } static std::list generate_test_instances() { std::list o; - o.push_back(chunk_refs_count_t{}); - o.push_back(chunk_refs_count_t{}); + o.emplace_back(); + o.emplace_back(); o.back().total = 123; return o; } diff --git a/src/cls/cas/cls_cas_ops.h b/src/cls/cas/cls_cas_ops.h index fdc3ea9fc7c..916c00ede20 100644 --- a/src/cls/cas/cls_cas_ops.h +++ b/src/cls/cas/cls_cas_ops.h @@ -41,7 +41,7 @@ struct cls_cas_chunk_create_or_get_ref_op { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_cas_chunk_create_or_get_ref_op{}); + ls.emplace_back(); return ls; } }; @@ -69,7 +69,7 @@ struct cls_cas_chunk_get_ref_op { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_cas_chunk_get_ref_op{}); + ls.emplace_back(); return ls; } }; @@ -98,7 +98,7 @@ struct cls_cas_chunk_put_ref_op { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_cas_chunk_put_ref_op{}); + ls.emplace_back(); return ls; } }; diff --git a/src/cls/fifo/cls_fifo.cc b/src/cls/fifo/cls_fifo.cc index 6526f7ee51d..9d78eb8f01e 100644 --- a/src/cls/fifo/cls_fifo.cc +++ b/src/cls/fifo/cls_fifo.cc @@ -59,8 +59,8 @@ struct entry_header { } static std::list generate_test_instances() { std::list ls; - ls.push_back(entry_header{}); - ls.push_back(entry_header{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().mtime = ceph::real_clock::now(); return ls; } diff --git a/src/cls/fifo/cls_fifo_ops.h b/src/cls/fifo/cls_fifo_ops.h index 0328e4ca0f9..45a8732df75 100644 --- a/src/cls/fifo/cls_fifo_ops.h +++ b/src/cls/fifo/cls_fifo_ops.h @@ -79,8 +79,8 @@ struct create_meta } static std::list generate_test_instances() { std::list o; - o.push_back(create_meta{}); - o.push_back(create_meta{}); + o.emplace_back(); + o.emplace_back(); o.back().id = "id"; objv v1; v1.instance = "inst1"; @@ -116,8 +116,8 @@ struct get_meta } static std::list generate_test_instances() { std::list o; - o.push_back(get_meta{}); - o.push_back(get_meta{}); + o.emplace_back(); + o.emplace_back(); objv v1; v1.instance = "inst1"; v1.ver = 1; @@ -155,8 +155,8 @@ struct get_meta_reply } static std::list generate_test_instances() { std::list o; - o.push_back(get_meta_reply{}); - o.push_back(get_meta_reply{}); + o.emplace_back(); + o.emplace_back(); o.back().info = fifo::info(); o.back().part_header_size = 1024; o.back().part_entry_overhead = 1024; diff --git a/src/cls/fifo/cls_fifo_types.h b/src/cls/fifo/cls_fifo_types.h index 03f1d58cad2..d74ef5309f9 100644 --- a/src/cls/fifo/cls_fifo_types.h +++ b/src/cls/fifo/cls_fifo_types.h @@ -121,8 +121,8 @@ struct data_params { } static std::list generate_test_instances() { std::list o; - o.push_back(data_params{}); - o.push_back(data_params{}); + o.emplace_back(); + o.emplace_back(); o.back().max_part_size = 1; o.back().max_entry_size = 2; o.back().full_size_threshold = 3; @@ -443,8 +443,8 @@ struct info { } static std::list generate_test_instances() { std::list o; - o.push_back(info{}); - o.push_back(info{}); + o.emplace_back(); + o.emplace_back(); o.back().id = "myid"; o.back().version = objv(); o.back().oid_prefix = "myprefix"; diff --git a/src/cls/journal/cls_journal_types.cc b/src/cls/journal/cls_journal_types.cc index d311811165b..530110ce6cb 100644 --- a/src/cls/journal/cls_journal_types.cc +++ b/src/cls/journal/cls_journal_types.cc @@ -35,7 +35,7 @@ void ObjectPosition::dump(Formatter *f) const { std::list ObjectPosition::generate_test_instances() { std::list o; - o.push_back(ObjectPosition{}); + o.emplace_back(); o.push_back(ObjectPosition(1, 2, 3)); return o; } @@ -64,7 +64,7 @@ void ObjectSetPosition::dump(Formatter *f) const { std::list ObjectSetPosition::generate_test_instances() { std::list o; - o.push_back(ObjectSetPosition{}); + o.emplace_back(); o.push_back(ObjectSetPosition({{0, 1, 120}, {121, 2, 121}})); return o; } @@ -142,7 +142,7 @@ void Tag::dump(Formatter *f) const { std::list Tag::generate_test_instances() { std::list o; - o.push_back(Tag{}); + o.emplace_back(); bufferlist data; data.append(std::string(128, '1')); diff --git a/src/cls/lock/cls_lock_ops.cc b/src/cls/lock/cls_lock_ops.cc index 2d4e607b9e4..77f04936a4c 100644 --- a/src/cls/lock/cls_lock_ops.cc +++ b/src/cls/lock/cls_lock_ops.cc @@ -51,7 +51,7 @@ list cls_lock_lock_op::generate_test_instances() i.duration = utime_t(5, 0); i.flags = LOCK_FLAG_MAY_RENEW; o.push_back(std::move(i)); - o.push_back(cls_lock_lock_op{}); + o.emplace_back(); return o; } @@ -68,7 +68,7 @@ list cls_lock_unlock_op::generate_test_instances() i.name = "name"; i.cookie = "cookie"; o.push_back(std::move(i)); - o.push_back(cls_lock_unlock_op{}); + o.emplace_back(); return o; } @@ -87,7 +87,7 @@ list cls_lock_break_op::generate_test_instances() i.cookie = "cookie"; i.locker = entity_name_t::CLIENT(1); o.push_back(std::move(i)); - o.push_back(cls_lock_break_op{}); + o.emplace_back(); return o; } @@ -102,7 +102,7 @@ list cls_lock_get_info_op::generate_test_instances() cls_lock_get_info_op i; i.name = "name"; o.push_back(std::move(i)); - o.push_back(cls_lock_get_info_op{}); + o.emplace_back(); return o; } @@ -154,7 +154,7 @@ list cls_lock_get_info_reply::generate_test_instances() i.lockers[id2] = locker_info_t(utime_t(20, 0), addr2, "description2"); o.push_back(std::move(i)); - o.push_back(cls_lock_get_info_reply{}); + o.emplace_back(); return o; } @@ -179,7 +179,7 @@ list cls_lock_list_locks_reply::generate_test_instanc i.locks.push_back("lock3"); o.push_back(std::move(i)); - o.push_back(cls_lock_list_locks_reply{}); + o.emplace_back(); return o; } @@ -200,7 +200,7 @@ list cls_lock_assert_op::generate_test_instances() i.cookie = "cookie"; i.tag = "tag"; o.push_back(std::move(i)); - o.push_back(cls_lock_assert_op{}); + o.emplace_back(); return o; } @@ -223,7 +223,7 @@ list cls_lock_set_cookie_op::generate_test_instances() i.tag = "tag"; i.new_cookie = "new cookie"; o.push_back(std::move(i)); - o.push_back(cls_lock_set_cookie_op{}); + o.emplace_back(); return o; } diff --git a/src/cls/lock/cls_lock_types.cc b/src/cls/lock/cls_lock_types.cc index 5bf7f8602b8..65936141d4b 100644 --- a/src/cls/lock/cls_lock_types.cc +++ b/src/cls/lock/cls_lock_types.cc @@ -36,7 +36,7 @@ std::list locker_id_t::generate_test_instances() locker_id_t i; generate_lock_id(i, 1, "cookie"); o.push_back(std::move(i)); - o.push_back(locker_id_t{}); + o.emplace_back(); return o; } @@ -67,7 +67,7 @@ std::list locker_info_t::generate_test_instances() generate_test_addr(i.addr, 1, 2); i.description = "description"; o.push_back(std::move(i)); - o.push_back(locker_info_t{}); + o.emplace_back(); return o; } @@ -99,6 +99,6 @@ std::list lock_info_t::generate_test_instances() i.lock_type = ClsLockType::EXCLUSIVE; i.tag = "tag"; o.push_back(std::move(i)); - o.push_back(lock_info_t{}); + o.emplace_back(); return o; } diff --git a/src/cls/log/cls_log_ops.h b/src/cls/log/cls_log_ops.h index d0609aa0e42..00f561c9e20 100644 --- a/src/cls/log/cls_log_ops.h +++ b/src/cls/log/cls_log_ops.h @@ -45,8 +45,8 @@ struct add_op { std::list l; l.emplace_back(); l.emplace_back(); - l.back().entries.push_back(entry{}); - l.back().entries.push_back(entry{}); + l.back().entries.emplace_back(); + l.back().entries.emplace_back(); l.back().entries.back().section = "section"; l.back().entries.back().name = "name"; l.back().entries.back().timestamp = ceph::real_time{1s + 2ns}; @@ -137,8 +137,8 @@ struct list_ret { std::list ls; ls.emplace_back(); ls.emplace_back(); - ls.back().entries.push_back(entry{}); - ls.back().entries.push_back(entry{}); + ls.back().entries.emplace_back(); + ls.back().entries.emplace_back(); ls.back().entries.back().section = "section"; ls.back().entries.back().name = "name"; ls.back().entries.back().timestamp = ceph::real_time{1s + 2ns}; diff --git a/src/cls/log/cls_log_types.h b/src/cls/log/cls_log_types.h index 75f9116563c..b4d963ba82b 100644 --- a/src/cls/log/cls_log_types.h +++ b/src/cls/log/cls_log_types.h @@ -71,8 +71,8 @@ struct entry { static std::list generate_test_instances() { std::list l; - l.push_back(cls::log::entry{}); - l.push_back(cls::log::entry{}); + l.emplace_back(); + l.emplace_back(); l.back().id = "test_id"; l.back().section = "test_section"; l.back().name = "test_name"; @@ -109,8 +109,8 @@ struct header { } static std::list
generate_test_instances() { std::list
o; - o.push_back(header{}); - o.push_back(header{}); + o.emplace_back(); + o.emplace_back(); o.back().max_marker = "test_marker"; o.back().max_time = ceph::real_clock::zero(); return o; diff --git a/src/cls/queue/cls_queue_ops.h b/src/cls/queue/cls_queue_ops.h index db0e901a5c3..517dc0c2eaa 100644 --- a/src/cls/queue/cls_queue_ops.h +++ b/src/cls/queue/cls_queue_ops.h @@ -38,8 +38,8 @@ struct cls_queue_init_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_init_op{}); - o.push_back(cls_queue_init_op{}); + o.emplace_back(); + o.emplace_back(); o.back().queue_size = 1024; o.back().max_urgent_data_size = 1024; o.back().bl_urgent_data.append(std::string_view("data")); @@ -71,8 +71,8 @@ struct cls_queue_enqueue_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_enqueue_op{}); - o.push_back(cls_queue_enqueue_op{}); + o.emplace_back(); + o.emplace_back(); o.back().bl_data_vec.push_back(ceph::buffer::list()); o.back().bl_data_vec.back().append(std::string_view("data")); return o; @@ -112,8 +112,8 @@ struct cls_queue_list_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_list_op{}); - o.push_back(cls_queue_list_op{}); + o.emplace_back(); + o.emplace_back(); o.back().max = 123; o.back().start_marker = "foo"; return o; @@ -152,7 +152,7 @@ struct cls_queue_list_ret { static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_list_ret{}); + o.emplace_back(); o.back().is_truncated = true; o.back().next_marker = "foo"; o.back().entries.push_back(cls_queue_entry()); @@ -186,8 +186,8 @@ struct cls_queue_remove_op { } static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_remove_op{}); - o.push_back(cls_queue_remove_op{}); + o.emplace_back(); + o.emplace_back(); o.back().end_marker = "foo"; return o; } @@ -216,7 +216,7 @@ struct cls_queue_get_capacity_ret { } static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_get_capacity_ret{}); + o.emplace_back(); o.back().queue_capacity = 123; return o; } diff --git a/src/cls/queue/cls_queue_types.h b/src/cls/queue/cls_queue_types.h index 7d31e57ac06..138d6ca44f4 100644 --- a/src/cls/queue/cls_queue_types.h +++ b/src/cls/queue/cls_queue_types.h @@ -41,8 +41,8 @@ struct cls_queue_entry } static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_entry{}); - o.push_back(cls_queue_entry{}); + o.emplace_back(); + o.emplace_back(); o.back().data.append(std::string_view("data")); o.back().marker = "marker"; return o; @@ -99,8 +99,8 @@ struct cls_queue_marker } static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_marker{}); - o.push_back(cls_queue_marker{}); + o.emplace_back(); + o.emplace_back(); o.back().offset = 1024; o.back().gen = 0; return o; @@ -150,8 +150,8 @@ struct cls_queue_head } static std::list generate_test_instances() { std::list o; - o.push_back(cls_queue_head{}); - o.push_back(cls_queue_head{}); + o.emplace_back(); + o.emplace_back(); o.back().max_head_size = 1024; o.back().front.offset = 1024; o.back().front.gen = 0; diff --git a/src/cls/rbd/cls_rbd.h b/src/cls/rbd/cls_rbd.h index 91df6d20e10..32ac460de60 100644 --- a/src/cls/rbd/cls_rbd.h +++ b/src/cls/rbd/cls_rbd.h @@ -95,7 +95,7 @@ struct cls_rbd_parent { static std::list generate_test_instances() { std::list o; - o.push_back(cls_rbd_parent{}); + o.emplace_back(); o.push_back(cls_rbd_parent{{1, "", "image id", 234}, {}}); o.push_back(cls_rbd_parent{{1, "", "image id", 234}, {123}}); o.push_back(cls_rbd_parent{{1, "ns", "image id", 234}, {123}}); diff --git a/src/cls/rbd/cls_rbd_types.cc b/src/cls/rbd/cls_rbd_types.cc index 794dbfee104..b312b8a8573 100644 --- a/src/cls/rbd/cls_rbd_types.cc +++ b/src/cls/rbd/cls_rbd_types.cc @@ -539,7 +539,7 @@ void ParentImageSpec::dump(Formatter *f) const { std::list ParentImageSpec::generate_test_instances() { std::list o; - o.push_back(ParentImageSpec{}); + o.emplace_back(); o.push_back(ParentImageSpec{1, "", "foo", 3}); o.push_back(ParentImageSpec{1, "ns", "foo", 3}); return o; diff --git a/src/cls/refcount/cls_refcount_ops.cc b/src/cls/refcount/cls_refcount_ops.cc index 22d6ae36284..2286438b370 100644 --- a/src/cls/refcount/cls_refcount_ops.cc +++ b/src/cls/refcount/cls_refcount_ops.cc @@ -16,8 +16,8 @@ void cls_refcount_get_op::dump(ceph::Formatter *f) const list cls_refcount_get_op::generate_test_instances() { list ls; - ls.push_back(cls_refcount_get_op{}); - ls.push_back(cls_refcount_get_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().tag = "foo"; ls.back().implicit_ref = true; return ls; @@ -33,8 +33,8 @@ void cls_refcount_put_op::dump(ceph::Formatter *f) const list cls_refcount_put_op::generate_test_instances() { list ls; - ls.push_back(cls_refcount_put_op{}); - ls.push_back(cls_refcount_put_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().tag = "foo"; ls.back().implicit_ref = true; return ls; @@ -50,8 +50,8 @@ void cls_refcount_set_op::dump(ceph::Formatter *f) const list cls_refcount_set_op::generate_test_instances() { list ls; - ls.push_back(cls_refcount_set_op{}); - ls.push_back(cls_refcount_set_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().refs.push_back("foo"); ls.back().refs.push_back("bar"); return ls; @@ -66,8 +66,8 @@ void cls_refcount_read_op::dump(ceph::Formatter *f) const list cls_refcount_read_op::generate_test_instances() { list ls; - ls.push_back(cls_refcount_read_op{}); - ls.push_back(cls_refcount_read_op{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } @@ -83,8 +83,8 @@ void cls_refcount_read_ret::dump(ceph::Formatter *f) const list cls_refcount_read_ret::generate_test_instances() { list ls; - ls.push_back(cls_refcount_read_ret{}); - ls.push_back(cls_refcount_read_ret{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().refs.push_back("foo"); ls.back().refs.push_back("bar"); return ls; @@ -110,7 +110,7 @@ void obj_refcount::dump(ceph::Formatter *f) const list obj_refcount::generate_test_instances() { list ls; - ls.push_back(obj_refcount{}); + ls.emplace_back(); ls.back().refs.emplace("foo",true); ls.back().retired_refs.emplace("bar"); return ls; diff --git a/src/cls/rgw/cls_rgw_ops.cc b/src/cls/rgw/cls_rgw_ops.cc index 7a0c58454e9..5d4034ae13c 100644 --- a/src/cls/rgw/cls_rgw_ops.cc +++ b/src/cls/rgw/cls_rgw_ops.cc @@ -20,8 +20,8 @@ void rgw_cls_tag_timeout_op::dump(Formatter *f) const list rgw_cls_tag_timeout_op::generate_test_instances() { list ls; - ls.push_back(rgw_cls_tag_timeout_op{}); - ls.push_back(rgw_cls_tag_timeout_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().tag_timeout = 23323; return ls; } @@ -37,8 +37,8 @@ void cls_rgw_gc_set_entry_op::dump(Formatter *f) const list cls_rgw_gc_set_entry_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_gc_set_entry_op{}); - ls.push_back(cls_rgw_gc_set_entry_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().expiration_secs = 123; return ls; } @@ -52,8 +52,8 @@ void cls_rgw_gc_defer_entry_op::dump(Formatter *f) const list cls_rgw_gc_defer_entry_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_gc_defer_entry_op{}); - ls.push_back(cls_rgw_gc_defer_entry_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().expiration_secs = 123; ls.back().tag = "footag"; return ls; @@ -69,8 +69,8 @@ void cls_rgw_gc_list_op::dump(Formatter *f) const list cls_rgw_gc_list_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_gc_list_op{}); - ls.push_back(cls_rgw_gc_list_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().marker = "mymarker"; ls.back().max = 2312; return ls; @@ -86,8 +86,8 @@ void cls_rgw_gc_list_ret::dump(Formatter *f) const list cls_rgw_gc_list_ret::generate_test_instances() { list ls; - ls.push_back(cls_rgw_gc_list_ret{}); - ls.push_back(cls_rgw_gc_list_ret{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().entries.push_back(cls_rgw_gc_obj_info()); ls.back().truncated = true; return ls; @@ -101,8 +101,8 @@ void cls_rgw_gc_remove_op::dump(Formatter *f) const list cls_rgw_gc_remove_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_gc_remove_op{}); - ls.push_back(cls_rgw_gc_remove_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().tags.push_back("tag1"); ls.back().tags.push_back("tag2"); return ls; @@ -117,7 +117,7 @@ list cls_rgw_lc_get_entry_ret::generate_test_instances { list ls; cls_rgw_lc_entry entry("bucket1", 6000, 0); - ls.push_back(cls_rgw_lc_get_entry_ret{}); + ls.emplace_back(); ls.back().entry = entry; return ls; } @@ -131,7 +131,7 @@ list rgw_cls_obj_prepare_op::generate_test_instances() op.tag = "tag"; op.locator = "locator"; o.push_back(std::move(op)); - o.push_back(rgw_cls_obj_prepare_op{}); + o.emplace_back(); return o; } @@ -159,7 +159,7 @@ list rgw_cls_obj_complete_op::generate_test_instances() op.meta = *iter; o.push_back(std::move(op)); - o.push_back(rgw_cls_obj_complete_op{}); + o.emplace_back(); return o; } @@ -197,7 +197,7 @@ list rgw_cls_link_olh_op::generate_test_instances() o.push_back(std::move(op)); - o.push_back(rgw_cls_link_olh_op{}); + o.emplace_back(); return o; } @@ -228,7 +228,7 @@ list rgw_cls_unlink_instance_op::generate_test_insta o.push_back(std::move(op)); - o.push_back(rgw_cls_unlink_instance_op{}); + o.emplace_back(); return o; } @@ -251,7 +251,7 @@ list rgw_cls_read_olh_log_op::generate_test_instances() op.olh_tag = "olh_tag"; o.push_back(std::move(op)); - o.push_back(rgw_cls_read_olh_log_op{}); + o.emplace_back(); return o; } @@ -272,7 +272,7 @@ list rgw_cls_read_olh_log_ret::generate_test_instances r.log[1].push_back(*iter); o.push_back(std::move(r)); - o.push_back(rgw_cls_read_olh_log_ret{}); + o.emplace_back(); return o; } @@ -291,7 +291,7 @@ list rgw_cls_trim_olh_log_op::generate_test_instances() op.olh_tag = "olh_tag"; o.push_back(std::move(op)); - o.push_back(rgw_cls_trim_olh_log_op{}); + o.emplace_back(); return o; } @@ -310,7 +310,7 @@ list rgw_cls_bucket_clear_olh_op::generate_test_ins op.olh_tag = "olh_tag"; o.push_back(std::move(op)); - o.push_back(rgw_cls_bucket_clear_olh_op{}); + o.emplace_back(); return o; } @@ -328,7 +328,7 @@ list rgw_cls_list_op::generate_test_instances() op.num_entries = 100; op.filter_prefix = "filter_prefix"; o.push_back(std::move(op)); - o.push_back(rgw_cls_list_op{}); + o.emplace_back(); return o; } @@ -349,7 +349,7 @@ list rgw_cls_list_ret::generate_test_instances() o.push_back(std::move(ret)); } - o.push_back(rgw_cls_list_ret{}); + o.emplace_back(); return o; } @@ -371,7 +371,7 @@ list rgw_cls_check_index_ret::generate_test_instances() r.calculated_header = h.front(); o.push_back(std::move(r)); - o.push_back(rgw_cls_check_index_ret{}); + o.emplace_back(); return o; } @@ -396,7 +396,7 @@ list rgw_cls_bucket_update_stats_op::generate_te dec_s.total_size_rounded = 4096; dec_s.num_entries = 1; o.push_back(std::move(r)); - o.push_back(rgw_cls_bucket_update_stats_op{}); + o.emplace_back(); return o; } @@ -424,8 +424,8 @@ void cls_rgw_bi_log_list_op::dump(Formatter *f) const list cls_rgw_bi_log_list_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_bi_log_list_op{}); - ls.push_back(cls_rgw_bi_log_list_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().marker = "mark"; ls.back().max = 123; return ls; @@ -440,8 +440,8 @@ void cls_rgw_bi_log_trim_op::dump(Formatter *f) const list cls_rgw_bi_log_trim_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_bi_log_trim_op{}); - ls.push_back(cls_rgw_bi_log_trim_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().start_marker = "foo"; ls.back().end_marker = "bar"; return ls; @@ -456,8 +456,8 @@ void cls_rgw_bi_log_list_ret::dump(Formatter *f) const list cls_rgw_bi_log_list_ret::generate_test_instances() { list ls; - ls.push_back(cls_rgw_bi_log_list_ret{}); - ls.push_back(cls_rgw_bi_log_list_ret{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().entries.push_back(rgw_bi_log_entry()); ls.back().truncated = true; return ls; @@ -466,9 +466,9 @@ list cls_rgw_bi_log_list_ret::generate_test_instances() std::list cls_rgw_mp_upload_part_info_update_op::generate_test_instances() { std::list ls; - ls.push_back(cls_rgw_mp_upload_part_info_update_op{}); + ls.emplace_back(); ls.back().part_key = "part1"; - ls.push_back(cls_rgw_mp_upload_part_info_update_op{}); + ls.emplace_back(); ls.back().part_key = "part2"; return ls; } @@ -483,8 +483,8 @@ void cls_rgw_mp_upload_part_info_update_op::dump(Formatter* f) const list cls_rgw_reshard_add_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_add_op{}); - ls.push_back(cls_rgw_reshard_add_op{}); + ls.emplace_back(); + ls.emplace_back(); list l = cls_rgw_reshard_entry::generate_test_instances(); auto iter = l.begin(); ls.back().entry = *iter; @@ -499,8 +499,8 @@ void cls_rgw_reshard_add_op::dump(Formatter *f) const list cls_rgw_reshard_list_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_list_op{}); - ls.push_back(cls_rgw_reshard_list_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().max = 1000; ls.back().marker = "foo"; return ls; @@ -515,8 +515,8 @@ void cls_rgw_reshard_list_op::dump(Formatter *f) const list cls_rgw_reshard_list_ret::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_list_ret{}); - ls.push_back(cls_rgw_reshard_list_ret{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().entries.push_back(cls_rgw_reshard_entry()); ls.back().is_truncated = true; return ls; @@ -531,8 +531,8 @@ void cls_rgw_reshard_list_ret::dump(Formatter *f) const list cls_rgw_reshard_get_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_get_op{}); - ls.push_back(cls_rgw_reshard_get_op{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } @@ -544,8 +544,8 @@ void cls_rgw_reshard_get_op::dump(Formatter *f) const list cls_rgw_reshard_get_ret::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_get_ret{}); - ls.push_back(cls_rgw_reshard_get_ret{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } @@ -557,8 +557,8 @@ void cls_rgw_reshard_get_ret::dump(Formatter *f) const list cls_rgw_reshard_remove_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_remove_op{}); - ls.push_back(cls_rgw_reshard_remove_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().bucket_name = "foo"; ls.back().bucket_id = "bucket_id"; return ls; @@ -574,8 +574,8 @@ void cls_rgw_reshard_remove_op::dump(Formatter *f) const list cls_rgw_set_bucket_resharding_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_set_bucket_resharding_op{}); - ls.push_back(cls_rgw_set_bucket_resharding_op{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } @@ -587,8 +587,8 @@ void cls_rgw_set_bucket_resharding_op::dump(Formatter *f) const list cls_rgw_clear_bucket_resharding_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_clear_bucket_resharding_op{}); - ls.push_back(cls_rgw_clear_bucket_resharding_op{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } @@ -599,8 +599,8 @@ void cls_rgw_clear_bucket_resharding_op::dump(Formatter *f) const list cls_rgw_guard_bucket_resharding_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_guard_bucket_resharding_op{}); - ls.push_back(cls_rgw_guard_bucket_resharding_op{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } @@ -613,8 +613,8 @@ void cls_rgw_guard_bucket_resharding_op::dump(Formatter *f) const list cls_rgw_get_bucket_resharding_op::generate_test_instances() { list ls; - ls.push_back(cls_rgw_get_bucket_resharding_op{}); - ls.push_back(cls_rgw_get_bucket_resharding_op{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } diff --git a/src/cls/rgw/cls_rgw_ops.h b/src/cls/rgw/cls_rgw_ops.h index 5b63280eeff..be5606aee8e 100644 --- a/src/cls/rgw/cls_rgw_ops.h +++ b/src/cls/rgw/cls_rgw_ops.h @@ -536,7 +536,7 @@ struct rgw_cls_obj_remove_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_obj_remove_op{}); + o.emplace_back(); o.back().keep_attr_prefixes.push_back("keep_attr_prefixes1"); o.back().keep_attr_prefixes.push_back("keep_attr_prefixes2"); o.back().keep_attr_prefixes.push_back("keep_attr_prefixes3"); @@ -566,7 +566,7 @@ struct rgw_cls_obj_store_pg_ver_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_obj_store_pg_ver_op{}); + o.emplace_back(); o.back().attr = "attr"; return o; } @@ -600,7 +600,7 @@ struct rgw_cls_obj_check_attrs_prefix { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_obj_check_attrs_prefix{}); + o.emplace_back(); o.back().check_prefix = "prefix"; o.back().fail_if_exist = true; return o; @@ -666,7 +666,7 @@ struct rgw_cls_usage_log_add_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_usage_log_add_op{}); + o.emplace_back(); return o; } }; @@ -701,8 +701,8 @@ struct rgw_cls_bi_get_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_bi_get_op{}); - o.push_back(rgw_cls_bi_get_op{}); + o.emplace_back(); + o.emplace_back(); o.back().key.name = "key"; o.back().key.instance = "instance"; o.back().type = BIIndexType::Plain; @@ -734,7 +734,7 @@ struct rgw_cls_bi_get_ret { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_bi_get_ret{}); + o.emplace_back(); o.back().entry.idx = "entry"; return o; } @@ -764,8 +764,8 @@ struct rgw_cls_bi_put_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_bi_put_op{}); - o.push_back(rgw_cls_bi_put_op{}); + o.emplace_back(); + o.emplace_back(); o.back().entry.idx = "entry"; return o; } @@ -794,8 +794,8 @@ struct rgw_cls_bi_put_entries_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_bi_put_entries_op{}); - o.push_back(rgw_cls_bi_put_entries_op{}); + o.emplace_back(); + o.emplace_back(); o.back().entries.push_back({.idx = "entry"}); o.back().check_existing = true; return o; @@ -840,8 +840,8 @@ struct rgw_cls_bi_list_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_bi_list_op{}); - o.push_back(rgw_cls_bi_list_op{}); + o.emplace_back(); + o.emplace_back(); o.back().max = 100; o.back().name_filter = "name_filter"; o.back().marker = "marker"; @@ -878,8 +878,8 @@ struct rgw_cls_bi_list_ret { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_bi_list_ret{}); - o.push_back(rgw_cls_bi_list_ret{}); + o.emplace_back(); + o.emplace_back(); o.back().entries.push_back(rgw_cls_bi_entry()); o.back().entries.push_back(rgw_cls_bi_entry()); o.back().entries.back().idx = "entry"; @@ -933,7 +933,7 @@ struct rgw_cls_usage_log_read_op { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_usage_log_read_op{}); + o.emplace_back(); o.back().start_epoch = 1; o.back().end_epoch = 2; o.back().owner = "owner"; @@ -974,11 +974,11 @@ struct rgw_cls_usage_log_read_ret { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_cls_usage_log_read_ret{}); + o.emplace_back(); o.back().next_iter = "123"; o.back().truncated = true; o.back().usage.clear(); - o.push_back(rgw_cls_usage_log_read_ret{}); + o.emplace_back(); o.back().usage[rgw_user_bucket("user1", "bucket1")] = rgw_usage_log_entry(); o.back().usage[rgw_user_bucket("user2", "bucket2")] = rgw_usage_log_entry(); o.back().truncated = true; @@ -1400,8 +1400,8 @@ struct cls_rgw_lc_set_entry_op { static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_rgw_lc_set_entry_op{}); - ls.push_back(cls_rgw_lc_set_entry_op{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().entry.bucket = "foo"; ls.back().entry.start_time = 123; ls.back().entry.status = 456; diff --git a/src/cls/rgw/cls_rgw_types.cc b/src/cls/rgw/cls_rgw_types.cc index 8f665bc714f..b70bb8885be 100644 --- a/src/cls/rgw/cls_rgw_types.cc +++ b/src/cls/rgw/cls_rgw_types.cc @@ -64,8 +64,8 @@ void rgw_zone_set::dump(Formatter *f) const list rgw_zone_set::generate_test_instances() { list o; - o.push_back(rgw_zone_set{}); - o.push_back(rgw_zone_set{}); + o.emplace_back(); + o.emplace_back(); std::optional loc_key = "loc_key"; o.back().insert("zone1", loc_key); o.back().insert("zone2", loc_key); @@ -151,7 +151,7 @@ list rgw_bucket_pending_info::generate_test_instances() i.state = CLS_RGW_STATE_COMPLETE; i.op = CLS_RGW_OP_DEL; o.push_back(std::move(i)); - o.push_back(rgw_bucket_pending_info{}); + o.emplace_back(); return o; } @@ -189,7 +189,7 @@ list rgw_bucket_dir_entry_meta::generate_test_instanc m.owner_display_name = "display name"; m.content_type = "content/type"; o.push_back(std::move(m)); - o.push_back(rgw_bucket_dir_entry_meta{}); + o.emplace_back(); return o; } @@ -245,7 +245,7 @@ list rgw_bucket_dir_entry::generate_test_instances() o.push_back(std::move(e)); } - o.push_back(rgw_bucket_dir_entry{}); + o.emplace_back(); return o; } @@ -263,8 +263,8 @@ void rgw_bucket_entry_ver::decode_json(JSONObj *obj) { list rgw_bucket_entry_ver::generate_test_instances() { list ls; - ls.push_back(rgw_bucket_entry_ver{}); - ls.push_back(rgw_bucket_entry_ver{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().pool = 123; ls.back().epoch = 12322; return ls; @@ -463,7 +463,7 @@ list rgw_cls_bi_entry::generate_test_instances() m.idx = "idx"; encode(entry, m.data); o.push_back(std::move(m)); - o.push_back(rgw_cls_bi_entry{}); + o.emplace_back(); return o; } @@ -501,7 +501,7 @@ list rgw_bucket_olh_entry::generate_test_instances() entry.exists = true; entry.pending_removal = true; o.push_back(std::move(entry)); - o.push_back(rgw_bucket_olh_entry{}); + o.emplace_back(); return o; } @@ -522,7 +522,7 @@ list rgw_bucket_deleted_entry::generate_test_instances entry.key.name = "key.name"; entry.key.instance = "key.instance"; o.push_back(std::move(entry)); - o.push_back(rgw_bucket_deleted_entry{}); + o.emplace_back(); return o; } @@ -537,7 +537,7 @@ list rgw_bucket_olh_log_entry::generate_test_instances entry.key.instance = "key.instance"; entry.delete_marker = true; o.push_back(std::move(entry)); - o.push_back(rgw_bucket_olh_log_entry{}); + o.emplace_back(); return o; } @@ -650,8 +650,8 @@ void rgw_bi_log_entry::dump(Formatter *f) const list rgw_bi_log_entry::generate_test_instances() { list ls; - ls.push_back(rgw_bi_log_entry{}); - ls.push_back(rgw_bi_log_entry{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().id = "midf"; ls.back().object = "obj"; ls.back().timestamp = ceph::real_clock::from_ceph_timespec({ceph_le32(2), ceph_le32(3)}); @@ -671,7 +671,7 @@ list rgw_bucket_category_stats::generate_test_instanc s.num_entries = 2; s.actual_size = 1024; o.push_back(std::move(s)); - o.push_back(rgw_bucket_category_stats{}); + o.emplace_back(); return o; } @@ -699,7 +699,7 @@ list rgw_bucket_dir_header::generate_test_instances() o.push_back(std::move(h)); } - o.push_back(rgw_bucket_dir_header{}); + o.emplace_back(); return o; } @@ -742,7 +742,7 @@ list rgw_bucket_dir::generate_test_instances() o.push_back(std::move(d)); } - o.push_back(rgw_bucket_dir{}); + o.emplace_back(); return o; } @@ -769,7 +769,7 @@ list rgw_s3select_usage_data::generate_test_instances() s.bytes_processed = 1024; s.bytes_returned = 512; o.push_back(std::move(s)); - o.push_back(rgw_s3select_usage_data{}); + o.emplace_back(); return o; } @@ -788,7 +788,7 @@ list rgw_usage_data::generate_test_instances() s.ops = 2; s.successful_ops = 1; o.push_back(std::move(s)); - o.push_back(rgw_usage_data{}); + o.emplace_back(); return o; } @@ -811,7 +811,7 @@ list rgw_usage_log_info::generate_test_instances() rgw_usage_log_entry r(owner, payer, bucket); s.entries.push_back(r); o.push_back(std::move(s)); - o.push_back(rgw_usage_log_info{}); + o.emplace_back(); return o; } @@ -827,7 +827,7 @@ list rgw_user_bucket::generate_test_instances() s.user = "user"; s.bucket = "bucket"; o.push_back(std::move(s)); - o.push_back(rgw_user_bucket{}); + o.emplace_back(); return o; } @@ -889,7 +889,7 @@ list rgw_usage_log_entry::generate_test_instances() entry.usage_map["get_obj"] = usage_data; entry.s3select_usage = s3select_usage_data; o.push_back(std::move(entry)); - o.push_back(rgw_usage_log_entry{}); + o.emplace_back(); return o; } @@ -931,8 +931,8 @@ void cls_rgw_reshard_entry::dump(Formatter *f) const list cls_rgw_reshard_entry::generate_test_instances() { list ls; - ls.push_back(cls_rgw_reshard_entry{}); - ls.push_back(cls_rgw_reshard_entry{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().time = ceph::real_clock::from_ceph_timespec({ceph_le32(2), ceph_le32(3)}); ls.back().tenant = "tenant"; ls.back().bucket_name = "bucket1"""; @@ -950,8 +950,8 @@ void cls_rgw_bucket_instance_entry::dump(Formatter *f) const list cls_rgw_bucket_instance_entry::generate_test_instances() { list ls; - ls.push_back(cls_rgw_bucket_instance_entry{}); - ls.push_back(cls_rgw_bucket_instance_entry{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().reshard_status = RESHARD_STATUS::IN_PROGRESS; return ls; } @@ -971,7 +971,7 @@ list cls_rgw_lc_entry::generate_test_instances() s.start_time = 10; s.status = 1; o.push_back(std::move(s)); - o.push_back(cls_rgw_lc_entry{}); + o.emplace_back(); return o; } diff --git a/src/cls/rgw/cls_rgw_types.h b/src/cls/rgw/cls_rgw_types.h index 8dbdae7aa91..486ac5e0186 100644 --- a/src/cls/rgw/cls_rgw_types.h +++ b/src/cls/rgw/cls_rgw_types.h @@ -1179,8 +1179,8 @@ struct cls_rgw_obj { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_rgw_obj{}); - ls.push_back(cls_rgw_obj{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().pool = "mypool"; ls.back().key.name = "myoid"; ls.back().loc = "mykey"; @@ -1233,7 +1233,7 @@ struct cls_rgw_obj_chain { } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_rgw_obj_chain{}); + ls.emplace_back(); return ls; } @@ -1286,8 +1286,8 @@ struct cls_rgw_gc_obj_info } static std::list generate_test_instances() { std::list ls; - ls.push_back(cls_rgw_gc_obj_info{}); - ls.push_back(cls_rgw_gc_obj_info{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().tag = "footag"; ceph_timespec ts{ceph_le32(21), ceph_le32(32)}; ls.back().time = ceph::real_clock::from_ceph_timespec(ts); diff --git a/src/cls/rgw_gc/cls_rgw_gc_ops.h b/src/cls/rgw_gc/cls_rgw_gc_ops.h index 3c741a0e2c6..321f4f72e38 100644 --- a/src/cls/rgw_gc/cls_rgw_gc_ops.h +++ b/src/cls/rgw_gc/cls_rgw_gc_ops.h @@ -32,7 +32,7 @@ struct cls_rgw_gc_queue_init_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_rgw_gc_queue_init_op{}); + o.emplace_back(); o.back().size = 1024; o.back().num_deferred_entries = 512; return o; diff --git a/src/cls/rgw_gc/cls_rgw_gc_types.h b/src/cls/rgw_gc/cls_rgw_gc_types.h index 672563c858a..93502336a28 100644 --- a/src/cls/rgw_gc/cls_rgw_gc_types.h +++ b/src/cls/rgw_gc/cls_rgw_gc_types.h @@ -42,8 +42,8 @@ struct cls_rgw_gc_urgent_data } static std::list generate_test_instances() { std::list o; - o.push_back(cls_rgw_gc_urgent_data{}); - o.push_back(cls_rgw_gc_urgent_data{}); + o.emplace_back(); + o.emplace_back(); o.back().num_urgent_data_entries = 1024; o.back().num_head_urgent_entries = 512; o.back().num_xattr_urgent_entries = 512; diff --git a/src/cls/timeindex/cls_timeindex_ops.h b/src/cls/timeindex/cls_timeindex_ops.h index dea9859413e..0a2883ab29c 100644 --- a/src/cls/timeindex/cls_timeindex_ops.h +++ b/src/cls/timeindex/cls_timeindex_ops.h @@ -66,8 +66,8 @@ struct cls_timeindex_list_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_timeindex_list_op{}); - o.push_back(cls_timeindex_list_op{}); + o.emplace_back(); + o.emplace_back(); o.back().from_time = utime_t(1, 2); o.back().marker = "marker"; o.back().to_time = utime_t(3, 4); @@ -108,8 +108,8 @@ struct cls_timeindex_list_ret { static std::list generate_test_instances() { std::list o; - o.push_back(cls_timeindex_list_ret{}); - o.push_back(cls_timeindex_list_ret{}); + o.emplace_back(); + o.emplace_back(); o.back().entries.push_back(cls_timeindex_entry()); o.back().entries.back().key_ts = utime_t(1, 2); o.back().entries.back().key_ext = "key_ext"; diff --git a/src/cls/timeindex/cls_timeindex_types.cc b/src/cls/timeindex/cls_timeindex_types.cc index c9d0c058bac..4becaf47253 100644 --- a/src/cls/timeindex/cls_timeindex_types.cc +++ b/src/cls/timeindex/cls_timeindex_types.cc @@ -18,6 +18,6 @@ std::list cls_timeindex_entry::generate_test_instances() bl.append("bar"); i.value = bl; o.push_back(std::move(i)); - o.push_back(cls_timeindex_entry{}); + o.emplace_back(); return o; } diff --git a/src/cls/user/cls_user_ops.cc b/src/cls/user/cls_user_ops.cc index c0de485768e..12621339398 100644 --- a/src/cls/user/cls_user_ops.cc +++ b/src/cls/user/cls_user_ops.cc @@ -19,7 +19,7 @@ void cls_user_set_buckets_op::dump(Formatter *f) const list cls_user_set_buckets_op::generate_test_instances() { list ls; - ls.push_back(cls_user_set_buckets_op{}); + ls.emplace_back(); cls_user_set_buckets_op op; for (int i = 0; i < 3; i++) { cls_user_bucket_entry e; @@ -40,7 +40,7 @@ void cls_user_remove_bucket_op::dump(Formatter *f) const list cls_user_remove_bucket_op::generate_test_instances() { list ls; - ls.push_back(cls_user_remove_bucket_op{}); + ls.emplace_back(); cls_user_remove_bucket_op op; cls_user_gen_test_bucket(&op.bucket, 0); ls.push_back(std::move(op)); @@ -56,7 +56,7 @@ void cls_user_list_buckets_op::dump(Formatter *f) const list cls_user_list_buckets_op::generate_test_instances() { list ls; - ls.push_back(cls_user_list_buckets_op{}); + ls.emplace_back(); cls_user_list_buckets_op op;; op.marker = "marker"; op.max_entries = 1000; @@ -74,7 +74,7 @@ void cls_user_list_buckets_ret::dump(Formatter *f) const list cls_user_list_buckets_ret::generate_test_instances() { list ls; - ls.push_back(cls_user_list_buckets_ret{}); + ls.emplace_back(); cls_user_list_buckets_ret ret;; for (int i = 0; i < 3; i++) { cls_user_bucket_entry e; @@ -95,7 +95,7 @@ void cls_user_get_header_op::dump(Formatter *f) const list cls_user_get_header_op::generate_test_instances() { list ls; - ls.push_back(cls_user_get_header_op{}); + ls.emplace_back(); return ls; } @@ -107,7 +107,7 @@ void cls_user_get_header_ret::dump(Formatter *f) const list cls_user_get_header_ret::generate_test_instances() { list ls; - ls.push_back(cls_user_get_header_ret{}); + ls.emplace_back(); cls_user_get_header_ret ret; cls_user_gen_test_header(&ret.header); ls.push_back(std::move(ret)); @@ -122,7 +122,7 @@ void cls_user_complete_stats_sync_op::dump(Formatter *f) const list cls_user_complete_stats_sync_op::generate_test_instances() { list ls; - ls.push_back(cls_user_complete_stats_sync_op{}); + ls.emplace_back(); cls_user_complete_stats_sync_op op; op.time = utime_t(12345, 0).to_real_time(); ls.push_back(std::move(op)); @@ -140,7 +140,7 @@ void cls_user_account_resource_add_op::dump(Formatter *f) const std::list cls_user_account_resource_add_op::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource_add_op{}); + ls.emplace_back(); cls_user_account_resource_add_op op; cls_user_gen_test_resource(op.entry); ls.push_back(std::move(op)); @@ -155,7 +155,7 @@ void cls_user_account_resource_get_op::dump(Formatter *f) const std::list cls_user_account_resource_get_op::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource_get_op{}); + ls.emplace_back(); cls_user_account_resource_get_op op; op.name = "name"; ls.push_back(std::move(op)); @@ -170,7 +170,7 @@ void cls_user_account_resource_get_ret::dump(Formatter *f) const std::list cls_user_account_resource_get_ret::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource_get_ret{}); + ls.emplace_back(); cls_user_account_resource_get_ret ret; cls_user_gen_test_resource(ret.entry); ls.push_back(std::move(ret)); @@ -185,7 +185,7 @@ void cls_user_account_resource_rm_op::dump(Formatter *f) const std::list cls_user_account_resource_rm_op::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource_rm_op{}); + ls.emplace_back(); cls_user_account_resource_rm_op op; op.name = "name"; ls.push_back(std::move(op)); @@ -202,7 +202,7 @@ void cls_user_account_resource_list_op::dump(Formatter *f) const std::list cls_user_account_resource_list_op::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource_list_op{}); + ls.emplace_back(); cls_user_account_resource_list_op op; op.marker = "marker"; op.path_prefix = "path"; @@ -221,7 +221,7 @@ void cls_user_account_resource_list_ret::dump(Formatter *f) const std::list cls_user_account_resource_list_ret::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource_list_ret{}); + ls.emplace_back(); cls_user_account_resource_list_ret ret; cls_user_gen_test_resource(ret.entries.emplace_back()); ret.truncated = true; diff --git a/src/cls/user/cls_user_types.cc b/src/cls/user/cls_user_types.cc index d26a059163c..27c3abe9bb6 100644 --- a/src/cls/user/cls_user_types.cc +++ b/src/cls/user/cls_user_types.cc @@ -33,7 +33,7 @@ void cls_user_bucket::dump(Formatter *f) const list cls_user_bucket::generate_test_instances() { list ls; - ls.push_back(cls_user_bucket{}); + ls.emplace_back(); cls_user_bucket b; cls_user_gen_test_bucket(&b, 0); ls.push_back(std::move(b)); @@ -63,7 +63,7 @@ void cls_user_gen_test_bucket_entry(cls_user_bucket_entry *entry, int i) list cls_user_bucket_entry::generate_test_instances() { list ls; - ls.push_back(cls_user_bucket_entry{}); + ls.emplace_back(); cls_user_bucket_entry entry; cls_user_gen_test_bucket_entry(&entry, 0); ls.push_back(std::move(entry)); @@ -87,7 +87,7 @@ void cls_user_stats::dump(Formatter *f) const list cls_user_stats::generate_test_instances() { list ls; - ls.push_back(cls_user_stats{}); + ls.emplace_back(); cls_user_stats s; cls_user_gen_test_stats(&s); ls.push_back(std::move(s)); @@ -111,7 +111,7 @@ void cls_user_header::dump(Formatter *f) const list cls_user_header::generate_test_instances() { list ls; - ls.push_back(cls_user_header{}); + ls.emplace_back(); cls_user_header h; cls_user_gen_test_header(&h); ls.push_back(std::move(h)); @@ -127,7 +127,7 @@ void cls_user_account_header::dump(ceph::Formatter* f) const std::list cls_user_account_header::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_header{}); + ls.emplace_back(); return ls; } @@ -147,7 +147,7 @@ void cls_user_gen_test_resource(cls_user_account_resource& r) std::list cls_user_account_resource::generate_test_instances() { std::list ls; - ls.push_back(cls_user_account_resource{}); + ls.emplace_back(); cls_user_account_resource p; cls_user_gen_test_resource(p); ls.push_back(std::move(p)); diff --git a/src/cls/version/cls_version_ops.h b/src/cls/version/cls_version_ops.h index 74447753f13..2e96ebc0760 100644 --- a/src/cls/version/cls_version_ops.h +++ b/src/cls/version/cls_version_ops.h @@ -30,8 +30,8 @@ struct cls_version_set_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_version_set_op{}); - o.push_back(cls_version_set_op{}); + o.emplace_back(); + o.emplace_back(); o.back().objv.ver = 123; o.back().objv.tag = "foo"; return o; @@ -66,8 +66,8 @@ struct cls_version_inc_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_version_inc_op{}); - o.push_back(cls_version_inc_op{}); + o.emplace_back(); + o.emplace_back(); o.back().objv.ver = 123; o.back().objv.tag = "foo"; o.back().conds.push_back(obj_version_cond()); @@ -106,8 +106,8 @@ struct cls_version_check_op { static std::list generate_test_instances() { std::list o; - o.push_back(cls_version_check_op{}); - o.push_back(cls_version_check_op{}); + o.emplace_back(); + o.emplace_back(); o.back().objv.ver = 123; o.back().objv.tag = "foo"; o.back().conds.push_back(obj_version_cond()); @@ -142,8 +142,8 @@ struct cls_version_read_ret { static std::list generate_test_instances() { std::list o; - o.push_back(cls_version_read_ret{}); - o.push_back(cls_version_read_ret{}); + o.emplace_back(); + o.emplace_back(); o.back().objv.ver = 123; o.back().objv.tag = "foo"; return o; diff --git a/src/cls/version/cls_version_types.h b/src/cls/version/cls_version_types.h index faf08338862..6b6ccfb1516 100644 --- a/src/cls/version/cls_version_types.h +++ b/src/cls/version/cls_version_types.h @@ -114,8 +114,8 @@ struct obj_version_cond { static std::list generate_test_instances() { std::list o; - o.push_back(obj_version_cond{}); - o.push_back(obj_version_cond{}); + o.emplace_back(); + o.emplace_back(); o.back().ver.ver = 1; o.back().ver.tag = "foo"; o.back().cond = VER_COND_EQ; diff --git a/src/common/CompatSet.cc b/src/common/CompatSet.cc index 77145d8f2eb..e00a2975f4e 100644 --- a/src/common/CompatSet.cc +++ b/src/common/CompatSet.cc @@ -83,8 +83,8 @@ void CompatSet::dump(ceph::Formatter *f) const { std::list CompatSet::generate_test_instances() { std::list o; - o.push_back(CompatSet{}); - o.push_back(CompatSet{}); + o.emplace_back(); + o.emplace_back(); o.back().compat.insert(Feature(1, "one")); o.back().compat.insert(Feature(2, "two")); o.back().ro_compat.insert(Feature(4, "four")); diff --git a/src/common/LogEntry.cc b/src/common/LogEntry.cc index 4ebc64f7085..a76307c4106 100644 --- a/src/common/LogEntry.cc +++ b/src/common/LogEntry.cc @@ -32,7 +32,7 @@ void LogEntryKey::dump(Formatter *f) const list LogEntryKey::generate_test_instances() { list o; - o.push_back(LogEntryKey{}); + o.emplace_back(); o.push_back(LogEntryKey(entity_name_t::CLIENT(1234), utime_t(1,2), 34)); return o; } @@ -274,7 +274,7 @@ void LogEntry::dump(Formatter *f) const list LogEntry::generate_test_instances() { list o; - o.push_back(LogEntry{}); + o.emplace_back(); return o; } @@ -359,7 +359,7 @@ void LogSummary::dump(Formatter *f) const list LogSummary::generate_test_instances() { list o; - o.push_back(LogSummary{}); + o.emplace_back(); // more! return o; } diff --git a/src/common/SloppyCRCMap.cc b/src/common/SloppyCRCMap.cc index 6c60c63953d..bfa49c04df8 100644 --- a/src/common/SloppyCRCMap.cc +++ b/src/common/SloppyCRCMap.cc @@ -174,7 +174,7 @@ void SloppyCRCMap::dump(ceph::Formatter *f) const list SloppyCRCMap::generate_test_instances() { list ls; - ls.push_back(SloppyCRCMap{}); + ls.emplace_back(); ls.push_back(SloppyCRCMap(2)); bufferlist bl; bl.append("some data"); diff --git a/src/common/bit_vector.hpp b/src/common/bit_vector.hpp index 7f864a8beca..e6df71c86f4 100644 --- a/src/common/bit_vector.hpp +++ b/src/common/bit_vector.hpp @@ -619,7 +619,7 @@ template auto BitVector<_b>::generate_test_instances() -> std::list { std::list o; - o.push_back(BitVector{}); + o.emplace_back(); BitVector b; const uint64_t radix = 1 << b.BIT_COUNT; diff --git a/src/common/ceph_json.h b/src/common/ceph_json.h index 22e729bcd43..ae64ff34312 100644 --- a/src/common/ceph_json.h +++ b/src/common/ceph_json.h @@ -858,16 +858,16 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(JSONFormattable{}); - o.push_back(JSONFormattable{}); + o.emplace_back(); + o.emplace_back(); o.back().set_type(FMT_VALUE); o.back().value.str = "foo"; o.back().value.quoted = true; - o.push_back(JSONFormattable{}); + o.emplace_back(); o.back().set_type(FMT_VALUE); o.back().value.str = "foo"; o.back().value.quoted = false; - o.push_back(JSONFormattable{}); + o.emplace_back(); o.back().set_type(FMT_ARRAY); o.back().arr.push_back(JSONFormattable()); o.back().arr.back().set_type(FMT_VALUE); @@ -877,7 +877,7 @@ public: o.back().arr.back().set_type(FMT_VALUE); o.back().arr.back().value.str = "bar"; o.back().arr.back().value.quoted = true; - o.push_back(JSONFormattable{}); + o.emplace_back(); o.back().set_type(FMT_OBJ); o.back().obj["foo"] = JSONFormattable(); o.back().obj["foo"].set_type(FMT_VALUE); diff --git a/src/common/entity_name.cc b/src/common/entity_name.cc index 6d07652167c..4cfb694c4c6 100644 --- a/src/common/entity_name.cc +++ b/src/common/entity_name.cc @@ -52,11 +52,11 @@ void EntityName::dump(ceph::Formatter *f) const { std::list EntityName::generate_test_instances() { std::list ls; - ls.push_back(EntityName{}); - ls.push_back(EntityName{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().set_type(CEPH_ENTITY_TYPE_OSD); ls.back().set_id("0"); - ls.push_back(EntityName{}); + ls.emplace_back(); ls.back().set_type(CEPH_ENTITY_TYPE_MDS); ls.back().set_id("a"); return ls; diff --git a/src/common/frag.cc b/src/common/frag.cc index 071a8cd43b6..f67c5a13154 100644 --- a/src/common/frag.cc +++ b/src/common/frag.cc @@ -47,7 +47,7 @@ void frag_t::dump(ceph::Formatter *f) const { std::list frag_t::generate_test_instances() { std::list ls; - ls.push_back(frag_t{}); + ls.emplace_back(); ls.push_back(frag_t(10, 2)); ls.push_back(frag_t(11, 3)); return ls; @@ -189,8 +189,8 @@ void fragtree_t::dump(ceph::Formatter *f) const { std::list fragtree_t::generate_test_instances() { std::list ls; - ls.push_back(fragtree_t{}); - ls.push_back(fragtree_t{}); + ls.emplace_back(); + ls.emplace_back(); return ls; } diff --git a/src/common/fs_types.cc b/src/common/fs_types.cc index a0db94d27bf..fd6d07ad496 100644 --- a/src/common/fs_types.cc +++ b/src/common/fs_types.cc @@ -146,8 +146,8 @@ void file_layout_t::decode_json(JSONObj *obj){ std::list file_layout_t::generate_test_instances() { std::list o; - o.push_back(file_layout_t{}); - o.push_back(file_layout_t{}); + o.emplace_back(); + o.emplace_back(); o.back().stripe_unit = 4096; o.back().stripe_count = 16; o.back().object_size = 1048576; diff --git a/src/common/histogram.cc b/src/common/histogram.cc index fbc04cecd65..8a33b7d775d 100644 --- a/src/common/histogram.cc +++ b/src/common/histogram.cc @@ -42,8 +42,8 @@ void pow2_hist_t::decode(ceph::buffer::list::const_iterator& p) std::list pow2_hist_t::generate_test_instances() { std::list ls; - ls.push_back(pow2_hist_t{}); - ls.push_back(pow2_hist_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().h.push_back(1); ls.back().h.push_back(3); ls.back().h.push_back(0); diff --git a/src/common/hobject.cc b/src/common/hobject.cc index c6156ea768a..502818e7c09 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -197,8 +197,8 @@ void hobject_t::dump(Formatter *f) const list hobject_t::generate_test_instances() { list o; - o.push_back(hobject_t{}); - o.push_back(hobject_t{}); + o.emplace_back(); + o.emplace_back(); o.back().max = true; o.push_back(hobject_t(object_t("oname"), string(), 1, 234, -1, "")); o.push_back(hobject_t(object_t("oname2"), string("okey"), CEPH_NOSNAP, @@ -500,8 +500,8 @@ void ghobject_t::dump(Formatter *f) const list ghobject_t::generate_test_instances() { list o; - o.push_back(ghobject_t{}); - o.push_back(ghobject_t{}); + o.emplace_back(); + o.emplace_back(); o.back().hobj.max = true; o.push_back(ghobject_t(hobject_t(object_t("oname"), string(), 1, 234, -1, ""))); diff --git a/src/common/snap_types.cc b/src/common/snap_types.cc index 078a2c6716d..ad0313bde70 100644 --- a/src/common/snap_types.cc +++ b/src/common/snap_types.cc @@ -45,7 +45,7 @@ void SnapRealmInfo::dump(ceph::Formatter *f) const std::list SnapRealmInfo::generate_test_instances() { std::list o; - o.push_back(SnapRealmInfo{}); + o.emplace_back(); o.push_back(SnapRealmInfo(1, 10, 10, 0)); o.push_back(SnapRealmInfo(1, 10, 10, 0)); o.back().my_snaps.push_back(10); @@ -88,7 +88,7 @@ void SnapRealmInfoNew::dump(ceph::Formatter *f) const std::list SnapRealmInfoNew::generate_test_instances() { std::list o; - o.push_back(SnapRealmInfoNew{}); + o.emplace_back(); o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 0), utime_t(), 0)); o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 0), utime_t(), 1)); o.back().info.my_snaps.push_back(10); @@ -145,7 +145,7 @@ void SnapContext::dump(ceph::Formatter *f) const std::list SnapContext::generate_test_instances() { std::list o; - o.push_back(SnapContext{}); + o.emplace_back(); std::vector v; o.push_back(SnapContext(10, v)); v.push_back(18); diff --git a/src/include/cephfs/types.h b/src/include/cephfs/types.h index 913129625d9..61fdffa30ed 100644 --- a/src/include/cephfs/types.h +++ b/src/include/cephfs/types.h @@ -214,7 +214,7 @@ struct vinodeno_t { void dump(ceph::Formatter *f) const; static std::list generate_test_instances() { std::list ls; - ls.push_back(vinodeno_t{}); + ls.emplace_back(); ls.push_back(vinodeno_t(1, 2)); return ls; } @@ -1134,8 +1134,8 @@ template class Allocator> auto inode_t::generate_test_instances() -> std::list { std::list ls; - ls.push_back(inode_t{}); - ls.push_back(inode_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ino = 1; // i am lazy. return ls; diff --git a/src/include/filepath.cc b/src/include/filepath.cc index 243bf127d0b..3844945ea47 100644 --- a/src/include/filepath.cc +++ b/src/include/filepath.cc @@ -118,7 +118,7 @@ void filepath::dump(ceph::Formatter *f) const { std::list filepath::generate_test_instances() { std::list o; - o.push_back(filepath{}); + o.emplace_back(); o.push_back(filepath("/usr/bin", 0)); o.push_back(filepath("/usr/sbin", 1)); o.push_back(filepath("var/log", 1)); diff --git a/src/include/object.cc b/src/include/object.cc index ec7e879c484..5265cb75dc0 100644 --- a/src/include/object.cc +++ b/src/include/object.cc @@ -33,7 +33,7 @@ void object_t::dump(ceph::Formatter *f) const { std::list object_t::generate_test_instances() { std::list o; - o.push_back(object_t{}); + o.emplace_back(); o.push_back(object_t{"myobject"}); return o; } @@ -64,7 +64,7 @@ void sobject_t::dump(ceph::Formatter *f) const { std::list sobject_t::generate_test_instances() { std::list o; - o.push_back(sobject_t{}); + o.emplace_back(); o.push_back(sobject_t{object_t("myobject"), 123}); return o; } diff --git a/src/include/types.cc b/src/include/types.cc index 79a305292c3..ead9a1e8331 100644 --- a/src/include/types.cc +++ b/src/include/types.cc @@ -54,7 +54,7 @@ void client_t::dump(ceph::Formatter *f) const { std::list client_t::generate_test_instances() { std::list ls; - ls.push_back(client_t{}); + ls.emplace_back(); ls.push_back(client_t(1)); ls.push_back(client_t(123)); return ls; diff --git a/src/include/types.h b/src/include/types.h index 7ab2195100a..68e2d5f5a7f 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -610,10 +610,10 @@ struct sha_digest_t { } static std::list generate_test_instances() { std::list ls; - ls.push_back(sha_digest_t{}); - ls.push_back(sha_digest_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().v[0] = 1; - ls.push_back(sha_digest_t{}); + ls.emplace_back(); ls.back().v[0] = 2; return ls; } diff --git a/src/include/util.h b/src/include/util.h index e250ac5a34a..f7f2f7ee926 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -65,8 +65,8 @@ struct ceph_data_stats static std::list generate_test_instances() { std::list ls; - ls.push_back(ceph_data_stats{}); - ls.push_back(ceph_data_stats{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().byte_total = 1024*1024; ls.back().byte_used = 512*1024; ls.back().byte_avail = 512*1024; diff --git a/src/mds/Anchor.cc b/src/mds/Anchor.cc index b0deda5623b..eb4b420aca6 100644 --- a/src/mds/Anchor.cc +++ b/src/mds/Anchor.cc @@ -53,8 +53,8 @@ void Anchor::dump(Formatter *f) const std::list Anchor::generate_test_instances() { std::list ls; - ls.push_back(Anchor{}); - ls.push_back(Anchor{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ino = 1; ls.back().dirino = 2; ls.back().d_name = "hello"; diff --git a/src/mds/Capability.cc b/src/mds/Capability.cc index 8e435f96ab9..4e1cf6e5ba3 100644 --- a/src/mds/Capability.cc +++ b/src/mds/Capability.cc @@ -145,8 +145,8 @@ void Capability::revoke_info::dump(ceph::Formatter *f) const std::list Capability::revoke_info::generate_test_instances() { std::list ls; - ls.push_back(revoke_info{}); - ls.push_back(revoke_info{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().before = 1; ls.back().seq = 2; ls.back().last_issue = 3; diff --git a/src/mds/inode_backtrace.cc b/src/mds/inode_backtrace.cc index 59ea974900d..46299fe4af8 100644 --- a/src/mds/inode_backtrace.cc +++ b/src/mds/inode_backtrace.cc @@ -43,8 +43,8 @@ void inode_backpointer_t::dump(ceph::Formatter *f) const std::list inode_backpointer_t::generate_test_instances() { std::list ls; - ls.push_back(inode_backpointer_t{}); - ls.push_back(inode_backpointer_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().dirino = 1; ls.back().dname = "foo"; ls.back().version = 123; @@ -110,8 +110,8 @@ void inode_backtrace_t::dump(ceph::Formatter *f) const std::list inode_backtrace_t::generate_test_instances() { std::list ls; - ls.push_back(inode_backtrace_t{}); - ls.push_back(inode_backtrace_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ino = 1; ls.back().ancestors.push_back(inode_backpointer_t()); ls.back().ancestors.back().dirino = 123; diff --git a/src/mds/mdstypes.cc b/src/mds/mdstypes.cc index 21095afcc3d..a7bc03e48fc 100644 --- a/src/mds/mdstypes.cc +++ b/src/mds/mdstypes.cc @@ -87,8 +87,8 @@ void frag_info_t::decode_json(JSONObj *obj){ std::list frag_info_t::generate_test_instances() { std::list ls; - ls.push_back(frag_info_t{}); - ls.push_back(frag_info_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().version = 1; ls.back().mtime = utime_t(2, 3); ls.back().nfiles = 4; @@ -170,8 +170,8 @@ void nest_info_t::decode_json(JSONObj *obj){ std::list nest_info_t::generate_test_instances() { std::list ls; - ls.push_back(nest_info_t{}); - ls.push_back(nest_info_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().version = 1; ls.back().rbytes = 2; ls.back().rfiles = 3; @@ -216,8 +216,8 @@ void quota_info_t::decode_json(JSONObj *obj){ std::list quota_info_t::generate_test_instances() { std::list ls; - ls.push_back(quota_info_t{}); - ls.push_back(quota_info_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().max_bytes = 16; ls.back().max_files = 16; return ls; @@ -272,8 +272,8 @@ void client_writeable_range_t::byte_range_t::decode_json(JSONObj *obj){ std::list client_writeable_range_t::generate_test_instances() { std::list ls; - ls.push_back(client_writeable_range_t{}); - ls.push_back(client_writeable_range_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().range.first = 123; ls.back().range.last = 456; ls.back().follows = 12; @@ -320,8 +320,8 @@ void inline_data_t::dump(Formatter *f) const std::list inline_data_t::generate_test_instances() { std::list ls; - ls.push_back(inline_data_t{}); - ls.push_back(inline_data_t{}); + ls.emplace_back(); + ls.emplace_back(); bufferlist bl; bl.append("inline data"); ls.back().set_data(bl); @@ -404,8 +404,8 @@ void fnode_t::decode_json(JSONObj *obj){ std::list fnode_t::generate_test_instances() { std::list ls; - ls.push_back(fnode_t{}); - ls.push_back(fnode_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().version = 1; ls.back().snap_purged_thru = 2; list fls = frag_info_t::generate_test_instances(); @@ -742,8 +742,8 @@ void session_info_t::dump(Formatter *f) const std::list session_info_t::generate_test_instances() { std::listls; - ls.push_back(session_info_t{}); - ls.push_back(session_info_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().inst = entity_inst_t(entity_name_t::MDS(12), entity_addr_t()); ls.back().completed_requests.insert(make_pair(234, inodeno_t(111222))); ls.back().completed_requests.insert(make_pair(237, inodeno_t(222333))); @@ -805,11 +805,11 @@ void string_snap_t::dump(Formatter *f) const std::list string_snap_t::generate_test_instances() { std::list ls; - ls.push_back(string_snap_t{}); - ls.push_back(string_snap_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().name = "foo"; ls.back().snapid = 123; - ls.push_back(string_snap_t{}); + ls.emplace_back(); ls.back().name = "bar"; ls.back().snapid = 456; return ls; @@ -861,13 +861,13 @@ void MDSCacheObjectInfo::print(std::ostream& out) const { std::list MDSCacheObjectInfo::generate_test_instances() { std::list ls; - ls.push_back(MDSCacheObjectInfo{}); - ls.push_back(MDSCacheObjectInfo{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ino = 1; ls.back().dirfrag = dirfrag_t(2, 3); ls.back().dname = "fooname"; ls.back().snapid = CEPH_NOSNAP; - ls.push_back(MDSCacheObjectInfo{}); + ls.emplace_back(); ls.back().ino = 121; ls.back().dirfrag = dirfrag_t(222, 0); ls.back().dname = "bar foo"; @@ -906,8 +906,8 @@ void mds_table_pending_t::dump(Formatter *f) const std::list mds_table_pending_t::generate_test_instances() { std::list ls; - ls.push_back(mds_table_pending_t{}); - ls.push_back(mds_table_pending_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().reqid = 234; ls.back().mds = 2; ls.back().tid = 35434; @@ -925,7 +925,7 @@ void metareqid_t::print(std::ostream& out) const { std::list metareqid_t::generate_test_instances() { std::list ls; - ls.push_back(metareqid_t{}); + ls.emplace_back(); ls.push_back(metareqid_t(entity_name_t::CLIENT(123), 456)); return ls; } @@ -947,7 +947,7 @@ void dirfrag_t::dump(ceph::Formatter *f) const { std::list dirfrag_t::generate_test_instances() { std::list ls; - ls.push_back(dirfrag_t{}); + ls.emplace_back(); ls.push_back(dirfrag_t(1, frag_t())); ls.push_back(dirfrag_t(2, frag_t(3))); return ls; @@ -1139,7 +1139,7 @@ void cap_reconnect_t::dump(Formatter *f) const std::list cap_reconnect_t::generate_test_instances() { std::list ls; - ls.push_back(cap_reconnect_t{}); + ls.emplace_back(); ls.back().path = "/test/path"; ls.back().capinfo.cap_id = 1; return ls; @@ -1180,7 +1180,7 @@ void snaprealm_reconnect_t::dump(Formatter *f) const std::list snaprealm_reconnect_t::generate_test_instances() { std::list ls; - ls.push_back(snaprealm_reconnect_t{}); + ls.emplace_back(); ls.back().realm.ino = 0x10000000001ULL; ls.back().realm.seq = 2; ls.back().realm.parent = 1; diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 37d7150ef0b..0e983dbac76 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -206,8 +206,8 @@ template class Allocator> auto old_inode_t::generate_test_instances() -> std::list> { std::list> ls; - ls.push_back(old_inode_t{}); - ls.push_back(old_inode_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().first = 2; std::list> ils = inode_t::generate_test_instances(); ls.back().inode = ils.back(); diff --git a/src/mds/snap.cc b/src/mds/snap.cc index 559a6ea29c0..ca316d084a2 100644 --- a/src/mds/snap.cc +++ b/src/mds/snap.cc @@ -67,8 +67,8 @@ void SnapInfo::dump(Formatter *f) const std::list SnapInfo::generate_test_instances() { std::list ls; - ls.push_back(SnapInfo{}); - ls.push_back(SnapInfo{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().snapid = 1; ls.back().ino = 2; ls.back().stamp = utime_t(3, 4); @@ -126,8 +126,8 @@ void snaplink_t::dump(Formatter *f) const std::list snaplink_t::generate_test_instances() { std::list ls; - ls.push_back(snaplink_t{}); - ls.push_back(snaplink_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ino = 2; ls.back().first = 123; return ls; @@ -226,8 +226,8 @@ void sr_t::dump(Formatter *f) const std::list sr_t::generate_test_instances() { std::list ls; - ls.push_back(sr_t{}); - ls.push_back(sr_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().seq = 1; ls.back().created = 2; ls.back().last_created = 3; diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h index 19af4377bbd..e844592d277 100644 --- a/src/messages/MClientReply.h +++ b/src/messages/MClientReply.h @@ -326,8 +326,8 @@ public: } static std::list generate_test_instances() { std::list ls; - ls.push_back(openc_response_t{}); - ls.push_back(openc_response_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().created_ino = 1; ls.back().delegated_inos.insert(1, 10); return ls; diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index a1e4bd48cac..98d5be446c0 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -67,8 +67,8 @@ struct SnapPayload { } static std::list generate_test_instances() { std::list o; - o.push_back(SnapPayload{}); - o.push_back(SnapPayload{}); + o.emplace_back(); + o.emplace_back(); o.back().metadata["key1"] = "val1"; o.back().metadata["key2"] = "val2"; return o; @@ -124,8 +124,8 @@ public: static std::list generate_test_instances() { std::list ls; - ls.push_back(Release{}); - ls.push_back(Release{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().item.dname_len = 4; ls.back().dname = "test"; return ls; diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index b3b982575d3..a0d078d3408 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -224,8 +224,8 @@ struct MDSHealth static std::list generate_test_instances() { std::list ls; - ls.push_back(MDSHealth{}); - ls.push_back(MDSHealth{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().metrics.push_back(MDSHealthMetric(MDS_HEALTH_TRIM, HEALTH_WARN, "MDS is behind on trimming")); return ls; diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h index 022df4e5d0c..ffe91c57b17 100644 --- a/src/messages/MMDSCacheRejoin.h +++ b/src/messages/MMDSCacheRejoin.h @@ -72,7 +72,7 @@ public: } static std::list generate_test_instances() { std::list ls; - ls.push_back(inode_strong{}); + ls.emplace_back(); ls.push_back(inode_strong(1, 2, 3, 4, 5)); return ls; } @@ -96,7 +96,7 @@ public: } static std::list generate_test_instances() { std::list ls; - ls.push_back(dirfrag_strong{}); + ls.emplace_back(); ls.push_back(dirfrag_strong(1, 2)); return ls; } @@ -143,7 +143,7 @@ public: } static std::list generate_test_instances() { std::list ls; - ls.push_back(dn_strong{}); + ls.emplace_back(); ls.push_back(dn_strong(1, "alternate_name", 2, 3, 4, 5, 6)); return ls; } @@ -201,7 +201,7 @@ public: } static std::list generate_test_instances() { std::list ls; - ls.push_back(dn_strong_new{}); + ls.emplace_back(); ls.push_back(dn_strong_new(1, "alternate_name", 2, 3, 4, 5, 6, 7)); return ls; } diff --git a/src/messages/MMgrReport.h b/src/messages/MMgrReport.h index 9fc8c177ac5..0139fc06ee9 100644 --- a/src/messages/MMgrReport.h +++ b/src/messages/MMgrReport.h @@ -87,8 +87,8 @@ public: static std::list generate_test_instances() { std::list ls; - ls.push_back(PerfCounterType{}); - ls.push_back(PerfCounterType{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().path = "mycounter"; ls.back().description = "mycounter description"; ls.back().nick = "mycounter nick"; diff --git a/src/mgr/MDSPerfMetricTypes.h b/src/mgr/MDSPerfMetricTypes.h index e11b9f4480b..e715b5a92ac 100644 --- a/src/mgr/MDSPerfMetricTypes.h +++ b/src/mgr/MDSPerfMetricTypes.h @@ -399,8 +399,8 @@ struct MDSPerfMetricReport { } static std::list generate_test_instances() { std::list o; - o.push_back(MDSPerfMetricReport{}); - o.push_back(MDSPerfMetricReport{}); + o.emplace_back(); + o.emplace_back(); o.back().reports.emplace(MDSPerfMetricQuery(), MDSPerfMetrics()); o.back().rank_metrics_delayed.insert(1); return o; diff --git a/src/mgr/MetricTypes.h b/src/mgr/MetricTypes.h index ec317db7759..52dedcc0a0b 100644 --- a/src/mgr/MetricTypes.h +++ b/src/mgr/MetricTypes.h @@ -244,7 +244,7 @@ struct MDSConfigPayload { } static std::list generate_test_instances() { std::list ls; - ls.push_back(MDSConfigPayload{}); + ls.emplace_back(); return ls; } }; diff --git a/src/mgr/MgrCap.cc b/src/mgr/MgrCap.cc index 1d10b13ab5c..637223ee49a 100644 --- a/src/mgr/MgrCap.cc +++ b/src/mgr/MgrCap.cc @@ -387,24 +387,24 @@ void MgrCap::dump(ceph::Formatter *f) const { std::list MgrCap::generate_test_instances() { std::list ls; - ls.push_back(MgrCap{}); - ls.push_back(MgrCap{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().parse("allow *"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow rwx"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow service foo x"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow command bar x"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow service foo r, allow command bar x"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow command bar with k1=v1 x"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow command bar with k1=v1 k2=v2 x"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("allow module bar with k1=v1 k2=v2 x"); - ls.push_back(MgrCap{}); + ls.emplace_back(); ls.back().parse("profile rbd pool=rbd"); return ls; } diff --git a/src/mgr/OSDPerfMetricTypes.h b/src/mgr/OSDPerfMetricTypes.h index 6345c889177..dc7b0717c6d 100644 --- a/src/mgr/OSDPerfMetricTypes.h +++ b/src/mgr/OSDPerfMetricTypes.h @@ -426,8 +426,8 @@ struct OSDPerfMetricReport { static std::list generate_test_instances() { std::list o; - o.push_back(OSDPerfMetricReport{}); - o.push_back(OSDPerfMetricReport{}); + o.emplace_back(); + o.emplace_back(); o.back().performance_counter_descriptors.push_back( PerformanceCounterDescriptor(PerformanceCounterType::OPS)); o.back().performance_counter_descriptors.push_back( diff --git a/src/mgr/ServiceMap.cc b/src/mgr/ServiceMap.cc index 10d2cd9fc98..de9bfcafa3e 100644 --- a/src/mgr/ServiceMap.cc +++ b/src/mgr/ServiceMap.cc @@ -61,8 +61,8 @@ void ServiceMap::Daemon::dump(Formatter *f) const auto ServiceMap::Daemon::generate_test_instances() -> std::list { std::list ls; - ls.push_back(Daemon{}); - ls.push_back(Daemon{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().gid = 222; ls.back().metadata["this"] = "that"; ls.back().task_status["task1"] = "running"; @@ -199,8 +199,8 @@ void ServiceMap::Service::dump(Formatter *f) const auto ServiceMap::Service::generate_test_instances() -> std::list { std::list ls; - ls.push_back(Service{}); - ls.push_back(Service{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().daemons["one"].gid = 1; ls.back().daemons["two"].gid = 2; return ls; @@ -240,8 +240,8 @@ void ServiceMap::dump(Formatter *f) const std::list ServiceMap::generate_test_instances() { std::list ls; - ls.push_back(ServiceMap{}); - ls.push_back(ServiceMap{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().epoch = 123; ls.back().services["rgw"].daemons["one"].gid = 123; ls.back().services["rgw"].daemons["two"].gid = 344; diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h index c8860cf299b..06302936653 100644 --- a/src/mon/AuthMonitor.h +++ b/src/mon/AuthMonitor.h @@ -84,11 +84,11 @@ public: } static std::list generate_test_instances() { std::list ls; - ls.push_back(Incremental{}); - ls.push_back(Incremental{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().inc_type = GLOBAL_ID; ls.back().max_global_id = 1234; - ls.push_back(Incremental{}); + ls.emplace_back(); ls.back().inc_type = AUTH_DATA; ls.back().auth_type = 12; ls.back().auth_data.append("foo"); diff --git a/src/mon/ConnectionTracker.cc b/src/mon/ConnectionTracker.cc index a80f91f2ff5..66c92865af1 100644 --- a/src/mon/ConnectionTracker.cc +++ b/src/mon/ConnectionTracker.cc @@ -504,8 +504,8 @@ void ConnectionReport::dump(ceph::Formatter *f) const std::list ConnectionReport::generate_test_instances() { std::list o; - o.push_back(ConnectionReport{}); - o.push_back(ConnectionReport{}); + o.emplace_back(); + o.emplace_back(); o.back().rank = 1; o.back().epoch = 2; o.back().epoch_version = 3; @@ -533,8 +533,8 @@ void ConnectionTracker::dump(ceph::Formatter *f) const std::list ConnectionTracker::generate_test_instances() { std::list o; - o.push_back(ConnectionTracker{}); - o.push_back(ConnectionTracker{}); + o.emplace_back(); + o.emplace_back(); ConnectionTracker& e = o.back(); e.rank = 2; e.epoch = 3; diff --git a/src/mon/CreatingPGs.h b/src/mon/CreatingPGs.h index d21b6264bb9..61fa0be3034 100644 --- a/src/mon/CreatingPGs.h +++ b/src/mon/CreatingPGs.h @@ -85,9 +85,9 @@ struct creating_pgs_t { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_create_info{}); + o.emplace_back(); o.back().create_epoch = 10; - o.push_back(pg_create_info{}); + o.emplace_back(); o.back().create_epoch = 1; o.back().create_stamp = utime_t(2, 3); o.back().up = {1, 2, 3}; diff --git a/src/mon/MgrMap.h b/src/mon/MgrMap.h index de6dde22a78..d846e6409d0 100644 --- a/src/mon/MgrMap.h +++ b/src/mon/MgrMap.h @@ -110,8 +110,8 @@ public: static std::list generate_test_instances() { std::list ls; - ls.push_back(ModuleOption{}); - ls.push_back(ModuleOption{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().name = "name"; ls.back().type = Option::TYPE_STR; ls.back().level = Option::LEVEL_ADVANCED; @@ -180,8 +180,8 @@ public: static std::list generate_test_instances() { std::list ls; - ls.push_back(ModuleInfo{}); - ls.push_back(ModuleInfo{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().name = "name"; ls.back().can_run = true; ls.back().error_string = "error_string"; @@ -642,7 +642,7 @@ public: static std::list generate_test_instances() { std::list l; - l.push_back(MgrMap{}); + l.emplace_back(); return l; } diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc index ecec105fded..c4d60f99ac0 100644 --- a/src/mon/MonCap.cc +++ b/src/mon/MonCap.cc @@ -532,20 +532,20 @@ void MonCap::dump(Formatter *f) const list MonCap::generate_test_instances() { list ls; - ls.push_back(MonCap{}); - ls.push_back(MonCap{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().parse("allow *"); - ls.push_back(MonCap{}); + ls.emplace_back(); ls.back().parse("allow rwx"); - ls.push_back(MonCap{}); + ls.emplace_back(); ls.back().parse("allow service foo x"); - ls.push_back(MonCap{}); + ls.emplace_back(); ls.back().parse("allow command bar x"); - ls.push_back(MonCap{}); + ls.emplace_back(); ls.back().parse("allow service foo r, allow command bar x"); - ls.push_back(MonCap{}); + ls.emplace_back(); ls.back().parse("allow command bar with k1=v1 x"); - ls.push_back(MonCap{}); + ls.emplace_back(); ls.back().parse("allow command bar with k1=v1 k2=v2 x"); return ls; } diff --git a/src/mon/MonCommand.h b/src/mon/MonCommand.h index 994ef178ea0..bc87e98033a 100644 --- a/src/mon/MonCommand.h +++ b/src/mon/MonCommand.h @@ -64,8 +64,8 @@ struct MonCommand { static std::list generate_test_instances() { std::list ls; - ls.push_back(MonCommand{}); - ls.push_back(MonCommand{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().cmdstring = "foo"; ls.back().helpstring = "bar"; ls.back().module = "baz"; diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 533c3fd8d12..8b487a38f98 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -123,8 +123,8 @@ void mon_info_t::dump(ceph::Formatter *f) const list mon_info_t::generate_test_instances() { list ls; - ls.push_back(mon_info_t{}); - ls.push_back(mon_info_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().name = "noname"; ls.back().public_addrs.parse("v1:1.2.3.4:567/890"); ls.back().priority = 1; @@ -328,8 +328,8 @@ void MonMap::decode(ceph::buffer::list::const_iterator& p) list MonMap::generate_test_instances() { list o; - o.push_back(MonMap{}); - o.push_back(MonMap{}); + o.emplace_back(); + o.emplace_back(); o.back().epoch = 1; o.back().last_changed = utime_t(123, 456); o.back().created = utime_t(789, 101112); diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index 32df36ea3fc..f4c66de1812 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -121,7 +121,7 @@ class MonitorDBStore static std::list generate_test_instances() { std::list ls; - ls.push_back(Op{}); + ls.emplace_back(); // we get coverage here from the Transaction instances return ls; } @@ -209,8 +209,8 @@ class MonitorDBStore static std::list generate_test_instances() { std::list ls; - ls.push_back(Transaction{}); - ls.push_back(Transaction{}); + ls.emplace_back(); + ls.emplace_back(); ceph::buffer::list bl; bl.append("value"); ls.back().put("prefix", "key", bl); diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 3a6a7b6c1b0..68b6fb50e98 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -197,7 +197,7 @@ void PGMapDigest::dump(ceph::Formatter *f) const list PGMapDigest::generate_test_instances() { list ls; - ls.push_back(PGMapDigest{}); + ls.emplace_back(); return ls; } @@ -1118,15 +1118,15 @@ void PGMap::Incremental::dump(ceph::Formatter *f) const list PGMap::Incremental::generate_test_instances() { list o; - o.push_back(Incremental{}); - o.push_back(Incremental{}); + o.emplace_back(); + o.emplace_back(); o.back().version = 1; o.back().stamp = utime_t(123,345); - o.push_back(Incremental{}); + o.emplace_back(); o.back().version = 2; o.back().pg_stat_updates[pg_t(1,2)] = pg_stat_t(); o.back().osd_stat_updates[5] = osd_stat_t(); - o.push_back(Incremental{}); + o.emplace_back(); o.back().version = 3; o.back().osdmap_epoch = 1; o.back().pg_scan = 2; @@ -2264,7 +2264,7 @@ void PGMap::clear_delta() list PGMap::generate_test_instances() { list o; - o.push_back(PGMap{}); + o.emplace_back(); list inc = Incremental::generate_test_instances(); inc.pop_front(); while (!inc.empty()) { diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 2ce76be8553..6df83ab4739 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -84,8 +84,8 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(pg_count{}); - o.push_back(pg_count{}); + o.emplace_back(); + o.emplace_back(); o.back().acting = 1; o.back().up_not_acting = 2; o.back().primary = 3; diff --git a/src/mon/health_check.h b/src/mon/health_check.h index 28ada82dbc2..26436e2f171 100644 --- a/src/mon/health_check.h +++ b/src/mon/health_check.h @@ -60,9 +60,9 @@ struct health_check_t { static std::list generate_test_instances() { std::list ls; - ls.push_back(health_check_t{}); + ls.emplace_back(); ls.back().severity = HEALTH_WARN; - ls.push_back(health_check_t{}); + ls.emplace_back(); ls.back().severity = HEALTH_ERR; ls.back().summary = "summarization"; ls.back().detail = {"one", "two", "three"}; @@ -102,8 +102,8 @@ struct health_mute_t { static std::list generate_test_instances() { std::list ls; - ls.push_back(health_mute_t{}); - ls.push_back(health_mute_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().code = "OSD_DOWN"; ls.back().ttl = utime_t(1, 2); ls.back().sticky = true; @@ -132,8 +132,8 @@ struct health_check_map_t { static std::list generate_test_instances() { std::list ls; - ls.push_back(health_check_map_t{}); - ls.push_back(health_check_map_t{}); + ls.emplace_back(); + ls.emplace_back(); { auto& d = ls.back().add("FOO", HEALTH_WARN, "foo", 2); d.detail.push_back("a"); diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index bff2e1e298d..4640abd4d28 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -120,8 +120,8 @@ struct FeatureMap { static std::list generate_test_instances() { std::list ls; - ls.push_back(FeatureMap{}); - ls.push_back(FeatureMap{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().add(CEPH_ENTITY_TYPE_OSD, CEPH_FEATURE_UID); ls.back().add(CEPH_ENTITY_TYPE_OSD, CEPH_FEATURE_NOSRCADDR); ls.back().add(CEPH_ENTITY_TYPE_OSD, CEPH_FEATURE_PGID64); @@ -179,8 +179,8 @@ struct MonitorDBStoreStats { static std::list generate_test_instances() { std::list ls; - ls.push_back(MonitorDBStoreStats{}); - ls.push_back(MonitorDBStoreStats{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().bytes_total = 1024*1024; ls.back().bytes_sst = 512*1024; ls.back().bytes_log = 256*1024; @@ -212,8 +212,8 @@ struct DataStats { } static std::list generate_test_instances() { std::list ls; - ls.push_back(DataStats{}); - ls.push_back(DataStats{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().fs_stats.byte_total = 1024*1024; ls.back().fs_stats.byte_used = 512*1024; ls.back().fs_stats.byte_avail = 256*1024; @@ -295,8 +295,8 @@ struct ScrubResult { } static std::list generate_test_instances() { std::list ls; - ls.push_back(ScrubResult{}); - ls.push_back(ScrubResult{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().prefix_crc["foo"] = 123; ls.back().prefix_keys["bar"] = 456; return ls; @@ -508,10 +508,10 @@ public: static std::list generate_test_instances() { std::list ls; - ls.push_back(mon_feature_t{}); - ls.push_back(mon_feature_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().features = 1; - ls.push_back(mon_feature_t{}); + ls.emplace_back(); ls.back().features = 2; return ls; } @@ -739,8 +739,8 @@ struct ProgressEvent { } static std::list generate_test_instances() { std::list o; - o.push_back(ProgressEvent{}); - o.push_back(ProgressEvent{}); + o.emplace_back(); + o.emplace_back(); o.back().message = "test message"; o.back().progress = 0.5; o.back().add_to_ceph_s = true; @@ -801,11 +801,11 @@ struct PoolAvailability { static std::list generate_test_instances() { std::list o; - o.push_back(PoolAvailability{}); + o.emplace_back(); o.back().started_at = utime_t(123, 456); o.back().last_uptime = utime_t(123, 456); o.back().last_downtime = utime_t(123, 456); - o.push_back(PoolAvailability{}); + o.emplace_back(); o.back().pool_name = "foo"; o.back().started_at = utime_t(123, 456); o.back().uptime = 100; diff --git a/src/os/SequencerPosition.h b/src/os/SequencerPosition.h index 112de8aa1fb..2076395e4f3 100644 --- a/src/os/SequencerPosition.h +++ b/src/os/SequencerPosition.h @@ -43,7 +43,7 @@ struct SequencerPosition { } static std::list generate_test_instances() { std::list o; - o.push_back(SequencerPosition{}); + o.emplace_back(); o.push_back(SequencerPosition(1, 2, 3)); o.push_back(SequencerPosition(4, 5, 6)); return o; diff --git a/src/os/Transaction.cc b/src/os/Transaction.cc index 3569d001ff2..848b993fd74 100644 --- a/src/os/Transaction.cc +++ b/src/os/Transaction.cc @@ -534,7 +534,7 @@ list Transaction::generate_test_instances() { list o; - o.push_back(Transaction{}); + o.emplace_back(); Transaction t; t.nop(); diff --git a/src/os/bluestore/bluefs_types.cc b/src/os/bluestore/bluefs_types.cc index b894f1871ef..ec1c8364ffd 100644 --- a/src/os/bluestore/bluefs_types.cc +++ b/src/os/bluestore/bluefs_types.cc @@ -28,8 +28,8 @@ void bluefs_extent_t::dump(Formatter *f) const list bluefs_extent_t::generate_test_instances() { list ls; - ls.push_back(bluefs_extent_t{}); - ls.push_back(bluefs_extent_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().offset = 1; ls.back().length = 2; ls.back().bdev = 1; @@ -168,8 +168,8 @@ void bluefs_layout_t::dump(Formatter *f) const list bluefs_layout_t::generate_test_instances() { list ls; - ls.push_back(bluefs_layout_t{}); - ls.push_back(bluefs_layout_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().shared_bdev = 1; ls.back().dedicated_db = true; ls.back().dedicated_wal = true; @@ -224,8 +224,8 @@ void bluefs_super_t::dump(Formatter *f) const list bluefs_super_t::generate_test_instances() { list ls; - ls.push_back(bluefs_super_t{}); - ls.push_back(bluefs_super_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().seq = 1; ls.back().block_size = 4096; return ls; @@ -313,8 +313,8 @@ void bluefs_fnode_t::dump(Formatter *f) const list bluefs_fnode_t::generate_test_instances() { list ls; - ls.push_back(bluefs_fnode_t{}); - ls.push_back(bluefs_fnode_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().ino = 123; ls.back().size = 1048576; ls.back().mtime = utime_t(123,45); @@ -419,8 +419,8 @@ void bluefs_transaction_t::dump(Formatter *f) const list bluefs_transaction_t::generate_test_instances() { list ls; - ls.push_back(bluefs_transaction_t{}); - ls.push_back(bluefs_transaction_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().op_init(); ls.back().op_dir_create("dir"); ls.back().op_dir_create("dir2"); diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index 940e976cff3..de6feb0f705 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -72,8 +72,8 @@ void bluestore_bdev_label_t::dump(Formatter *f) const list bluestore_bdev_label_t::generate_test_instances() { list o; - o.push_back(bluestore_bdev_label_t{}); - o.push_back(bluestore_bdev_label_t{}); + o.emplace_back(); + o.emplace_back(); o.back().size = 123; o.back().btime = utime_t(4, 5); o.back().description = "fakey"; @@ -379,8 +379,8 @@ void bluestore_extent_ref_map_t::dump(Formatter *f) const list bluestore_extent_ref_map_t::generate_test_instances() { list o; - o.push_back(bluestore_extent_ref_map_t{}); - o.push_back(bluestore_extent_ref_map_t{}); + o.emplace_back(); + o.emplace_back(); o.back().get(10, 10); o.back().get(18, 22); o.back().get(20, 20); @@ -749,7 +749,7 @@ ostream& operator<<(ostream& out, const bluestore_pextent_t& o) { list bluestore_pextent_t::generate_test_instances() { list ls; - ls.push_back(bluestore_pextent_t{}); + ls.emplace_back(); ls.push_back(bluestore_pextent_t(1, 2)); return ls; } @@ -834,11 +834,11 @@ void bluestore_blob_t::dump(Formatter *f) const list bluestore_blob_t::generate_test_instances() { list ls; - ls.push_back(bluestore_blob_t{}); + ls.emplace_back(); ls.push_back(bluestore_blob_t(0)); - ls.push_back(bluestore_blob_t{}); + ls.emplace_back(); ls.back().allocated_test(bluestore_pextent_t(111, 222)); - ls.push_back(bluestore_blob_t{}); + ls.emplace_back(); ls.back().init_csum(Checksummer::CSUM_XXHASH32, 16, 65536); ls.back().csum_data = ceph::buffer::claim_malloc(4, strdup("abcd")); ls.back().add_unused(0, 3); @@ -1397,8 +1397,8 @@ void bluestore_onode_t::shard_info::dump(Formatter *f) const auto bluestore_onode_t::shard_info::generate_test_instances() -> list { list o; - o.push_back(shard_info{}); - o.push_back(shard_info{}); + o.emplace_back(); + o.emplace_back(); o.back().offset = 123; o.back().bytes = 456; return o; @@ -1501,8 +1501,8 @@ void bluestore_deferred_op_t::dump(Formatter *f) const list bluestore_deferred_op_t::generate_test_instances() { list o; - o.push_back(bluestore_deferred_op_t{}); - o.push_back(bluestore_deferred_op_t{}); + o.emplace_back(); + o.emplace_back(); o.back().op = OP_WRITE; o.back().extents.push_back(bluestore_pextent_t(1, 2)); o.back().extents.push_back(bluestore_pextent_t(100, 5)); @@ -1555,7 +1555,7 @@ void bluestore_compression_header_t::dump(Formatter *f) const list bluestore_compression_header_t::generate_test_instances() { list o; - o.push_back(bluestore_compression_header_t{}); + o.emplace_back(); o.push_back(bluestore_compression_header_t(1)); o.back().length = 1234; return o; diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 1e489c7074c..422433e28f1 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -165,7 +165,7 @@ struct bluestore_extent_ref_map_t { } static std::list generate_test_instances() { std::list o; - o.push_back(record_t{}); + o.emplace_back(); o.push_back(record_t(123, 456)); return o; } diff --git a/src/osd/HitSet.cc b/src/osd/HitSet.cc index 937d4362713..fd5b36c52c8 100644 --- a/src/osd/HitSet.cc +++ b/src/osd/HitSet.cc @@ -97,7 +97,7 @@ void HitSet::dump(Formatter *f) const list HitSet::generate_test_instances() { list o; - o.push_back(HitSet{}); + o.emplace_back(); o.push_back(HitSet(new BloomHitSet(10, .1, 1))); o.back().insert(hobject_t()); o.back().insert(hobject_t("asdf", "", CEPH_NOSNAP, 123, 1, "")); @@ -200,7 +200,7 @@ list HitSet::Params::generate_test_instances() for (auto& i : kind::Params::generate_test_instances()) \ o.push_back(Params(&i)); \ } - o.push_back(Params{}); + o.emplace_back(); o.push_back(Params(new BloomHitSet::Params)); loop_hitset_params(BloomHitSet); o.push_back(Params(new ExplicitHashHitSet::Params)); diff --git a/src/osd/HitSet.h b/src/osd/HitSet.h index fc4881e7e33..bb4fe1328cb 100644 --- a/src/osd/HitSet.h +++ b/src/osd/HitSet.h @@ -192,7 +192,7 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(Params{}); + o.emplace_back(); return o; } }; @@ -240,8 +240,8 @@ public: void dump(ceph::Formatter *f) const override; static std::list generate_test_instances() { std::list o; - o.push_back(ExplicitHashHitSet{}); - o.push_back(ExplicitHashHitSet{}); + o.emplace_back(); + o.emplace_back(); o.back().insert(hobject_t()); o.back().insert(hobject_t("asdf", "", CEPH_NOSNAP, 123, 1, "")); o.back().insert(hobject_t("qwer", "", CEPH_NOSNAP, 456, 1, "")); @@ -267,7 +267,7 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(Params{}); + o.emplace_back(); return o; } }; @@ -315,8 +315,8 @@ public: void dump(ceph::Formatter *f) const override; static std::list generate_test_instances() { std::list o; - o.push_back(ExplicitObjectHitSet{}); - o.push_back(ExplicitObjectHitSet{}); + o.emplace_back(); + o.emplace_back(); o.back().insert(hobject_t()); o.back().insert(hobject_t("asdf", "", CEPH_NOSNAP, 123, 1, "")); o.back().insert(hobject_t("qwer", "", CEPH_NOSNAP, 456, 1, "")); @@ -388,8 +388,8 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(Params{}); - o.push_back(Params{}); + o.emplace_back(); + o.emplace_back(); o.back().fpp_micro = 123456; o.back().target_size = 300; o.back().seed = 99; @@ -454,7 +454,7 @@ public: void dump(ceph::Formatter *f) const override; static std::list generate_test_instances() { std::list o; - o.push_back(BloomHitSet{}); + o.emplace_back(); o.push_back(BloomHitSet(10, .1, 1)); o.back().insert(hobject_t()); o.back().insert(hobject_t("asdf", "", CEPH_NOSNAP, 123, 1, "")); diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index fb379de40ad..8c53acb4048 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -109,8 +109,8 @@ void osd_info_t::decode(ceph::buffer::list::const_iterator& bl) list osd_info_t::generate_test_instances() { list o; - o.push_back(osd_info_t{}); - o.push_back(osd_info_t{}); + o.emplace_back(); + o.emplace_back(); o.back().last_clean_begin = 1; o.back().last_clean_end = 2; o.back().up_from = 30; @@ -193,8 +193,8 @@ void osd_xinfo_t::decode(ceph::buffer::list::const_iterator& bl) list osd_xinfo_t::generate_test_instances() { list o; - o.push_back(osd_xinfo_t{}); - o.push_back(osd_xinfo_t{}); + o.emplace_back(); + o.emplace_back(); o.back().down_stamp = utime_t(2, 3); o.back().laggy_probability = .123; o.back().laggy_interval = 123456; @@ -1394,7 +1394,7 @@ void OSDMap::Incremental::dump(Formatter *f) const auto OSDMap::Incremental::generate_test_instances() -> list { list o; - o.push_back(Incremental{}); + o.emplace_back(); return o; } diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 306d430d274..6560a53a5ed 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -348,8 +348,8 @@ struct PGTempMap { } static std::list generate_test_instances() { std::list o; - o.push_back(PGTempMap{}); - o.push_back(PGTempMap{}); + o.emplace_back(); + o.emplace_back(); o.back().set(pg_t(1, 2), { 3, 4 }); o.back().set(pg_t(2, 3), { 4, 5 }); return o; diff --git a/src/osd/SnapMapper.cc b/src/osd/SnapMapper.cc index 2f22ea9c9ee..fb59ece9eef 100644 --- a/src/osd/SnapMapper.cc +++ b/src/osd/SnapMapper.cc @@ -330,8 +330,8 @@ void SnapMapper::object_snaps::dump(ceph::Formatter *f) const auto SnapMapper::object_snaps::generate_test_instances() -> std::list { std::list o; - o.push_back(object_snaps{}); - o.push_back(object_snaps{}); + o.emplace_back(); + o.emplace_back(); o.back().oid = hobject_t(sobject_t("name", CEPH_NOSNAP)); o.back().snaps.insert(1); o.back().snaps.insert(2); diff --git a/src/osd/SnapMapper.h b/src/osd/SnapMapper.h index aa043ad3bd8..fe36bd73bfa 100644 --- a/src/osd/SnapMapper.h +++ b/src/osd/SnapMapper.h @@ -163,8 +163,8 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(Mapping{}); - o.push_back(Mapping{}); + o.emplace_back(); + o.emplace_back(); o.back().snap = 1; o.back().hoid = hobject_t(object_t("objname"), "key", 123, 456, 0, ""); return o; diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index eebfcd54595..2d72e25efba 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -242,7 +242,7 @@ void osd_reqid_t::dump(Formatter *f) const list osd_reqid_t::generate_test_instances() { list o; - o.push_back(osd_reqid_t{}); + o.emplace_back(); o.push_back(osd_reqid_t(entity_name_t::CLIENT(123), 1, 45678)); return o; } @@ -303,7 +303,7 @@ void object_locator_t::dump(Formatter *f) const list object_locator_t::generate_test_instances() { list o; - o.push_back(object_locator_t{}); + o.emplace_back(); o.push_back(object_locator_t(123)); o.push_back(object_locator_t(123, 876)); o.push_back(object_locator_t(1, "n2")); @@ -696,9 +696,9 @@ std::list osd_stat_t::generate_test_instances() { std::list o; - o.push_back(osd_stat_t{}); + o.emplace_back(); - o.push_back(osd_stat_t{}); + o.emplace_back(); list ll = store_statfs_t::generate_test_instances(); o.back().statfs = ll.back(); o.back().hb_peers.push_back(7); @@ -920,7 +920,7 @@ void pg_t::dump(Formatter *f) const list pg_t::generate_test_instances() { list o; - o.push_back(pg_t{}); + o.emplace_back(); o.push_back(pg_t(1, 2)); o.push_back(pg_t(13123, 3)); o.push_back(pg_t(131223, 4)); @@ -1341,8 +1341,8 @@ void pool_snap_info_t::decode(ceph::buffer::list::const_iterator& bl) list pool_snap_info_t::generate_test_instances() { list o; - o.push_back(pool_snap_info_t{}); - o.push_back(pool_snap_info_t{}); + o.emplace_back(); + o.emplace_back(); o.back().snapid = 1; o.back().stamp = utime_t(1, 2); o.back().name = "foo"; @@ -1562,7 +1562,7 @@ void pool_opts_t::decode(ceph::buffer::list::const_iterator& bl) std::list pool_opts_t::generate_test_instances() { std::list o; - o.push_back(pool_opts_t{}); + o.emplace_back(); return o; } @@ -3641,8 +3641,8 @@ void pg_history_t::dump(Formatter *f) const list pg_history_t::generate_test_instances() { list o; - o.push_back(pg_history_t{}); - o.push_back(pg_history_t{}); + o.emplace_back(); + o.emplace_back(); o.back().epoch_created = 1; o.back().epoch_pool_created = 1; o.back().last_epoch_started = 2; @@ -3776,8 +3776,8 @@ void pg_info_t::dump(Formatter *f) const list pg_info_t::generate_test_instances() { list o; - o.push_back(pg_info_t{}); - o.push_back(pg_info_t{}); + o.emplace_back(); + o.emplace_back(); list h = pg_history_t::generate_test_instances(); o.back().history = h.back(); o.back().pgid = spg_t(pg_t(1, 2), shard_id_t::NO_SHARD); @@ -3846,7 +3846,7 @@ list pg_notify_t::generate_test_instances() { list o; - o.push_back(pg_notify_t{}); + o.emplace_back(); o.push_back(pg_notify_t(shard_id_t(3), shard_id_t::NO_SHARD, 1, 1, pg_info_t(spg_t(pg_t(0,10), shard_id_t(-1))), PastIntervals(), PG_FEATURE_CLASSIC_ALL)); @@ -3940,8 +3940,8 @@ std::string PastIntervals::pg_interval_t::fmt_print() const auto PastIntervals::pg_interval_t::generate_test_instances() -> list { list o; - o.push_back(pg_interval_t{}); - o.push_back(pg_interval_t{}); + o.emplace_back(); + o.emplace_back(); o.back().up.push_back(1); o.back().acting.push_back(2); o.back().acting.push_back(3); @@ -5430,10 +5430,10 @@ void pg_log_t::dump(Formatter *f) const list pg_log_t::generate_test_instances() { list o; - o.push_back(pg_log_t{}); + o.emplace_back(); // this is nonsensical: - o.push_back(pg_log_t{}); + o.emplace_back(); o.back().head = eversion_t(1,2); o.back().tail = eversion_t(3,4); for (auto& p : pg_log_entry_t::generate_test_instances()) { @@ -5579,15 +5579,15 @@ void object_copy_cursor_t::dump(Formatter *f) const list object_copy_cursor_t::generate_test_instances() { list o; - o.push_back(object_copy_cursor_t{}); - o.push_back(object_copy_cursor_t{}); + o.emplace_back(); + o.emplace_back(); o.back().attr_complete = true; o.back().data_offset = 123; - o.push_back(object_copy_cursor_t{}); + o.emplace_back(); o.back().attr_complete = true; o.back().data_complete = true; o.back().omap_offset = "foo"; - o.push_back(object_copy_cursor_t{}); + o.emplace_back(); o.back().attr_complete = true; o.back().data_complete = true; o.back().omap_complete = true; @@ -5788,7 +5788,7 @@ void pg_create_t::dump(Formatter *f) const list pg_create_t::generate_test_instances() { list o; - o.push_back(pg_create_t{}); + o.emplace_back(); o.push_back(pg_create_t(1, pg_t(3, 4), 2)); return o; } @@ -5831,8 +5831,8 @@ void pg_hit_set_info_t::dump(Formatter *f) const list pg_hit_set_info_t::generate_test_instances() { list ls; - ls.push_back(pg_hit_set_info_t{}); - ls.push_back(pg_hit_set_info_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().begin = utime_t(1, 2); ls.back().end = utime_t(3, 4); return ls; @@ -5888,8 +5888,8 @@ void pg_hit_set_history_t::dump(Formatter *f) const list pg_hit_set_history_t::generate_test_instances() { list ls; - ls.push_back(pg_hit_set_history_t{}); - ls.push_back(pg_hit_set_history_t{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().current_last_update = eversion_t(1, 2); ls.back().history.push_back(pg_hit_set_info_t()); return ls; @@ -6085,10 +6085,10 @@ void SnapSet::dump(Formatter *f) const list SnapSet::generate_test_instances() { list o; - o.push_back(SnapSet{}); - o.push_back(SnapSet{}); + o.emplace_back(); + o.emplace_back(); o.back().seq = 123; - o.push_back(SnapSet{}); + o.emplace_back(); o.back().seq = 123; o.back().clones.push_back(12); o.back().clone_size[12] = 12345; @@ -6194,8 +6194,8 @@ std::string watch_info_t::fmt_print() const list watch_info_t::generate_test_instances() { list o; - o.push_back(watch_info_t{}); - o.push_back(watch_info_t{}); + o.emplace_back(); + o.emplace_back(); o.back().cookie = 123; o.back().timeout_seconds = 99; entity_addr_t ea; @@ -6248,8 +6248,8 @@ void chunk_info_t::dump(Formatter *f) const std::list chunk_info_t::generate_test_instances() { std::list o; - o.push_back(chunk_info_t{}); - o.push_back(chunk_info_t{}); + o.emplace_back(); + o.emplace_back(); o.back().length = 123; o.back().oid = hobject_t(object_t("foo"), "", 123, 456, -1, ""); o.back().flags = cflag_t::FLAG_DIRTY; @@ -6797,13 +6797,13 @@ ostream &operator<<(ostream &out, const ObjectRecoveryProgress &prog) list ObjectRecoveryProgress::generate_test_instances() { list o; - o.push_back(ObjectRecoveryProgress{}); + o.emplace_back(); o.back().first = false; o.back().data_complete = true; o.back().omap_complete = true; o.back().data_recovered_to = 100; - o.push_back(ObjectRecoveryProgress{}); + o.emplace_back(); o.back().first = true; o.back().data_complete = false; o.back().omap_complete = false; @@ -6882,7 +6882,7 @@ void ObjectRecoveryInfo::decode(ceph::buffer::list::const_iterator &bl, list ObjectRecoveryInfo::generate_test_instances() { list o; - o.push_back(ObjectRecoveryInfo{}); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("key", CEPH_NOSNAP)); o.back().version = eversion_t(0,0); o.back().size = 100; @@ -6928,10 +6928,10 @@ std::string ObjectRecoveryInfo::fmt_print() const list PushReplyOp::generate_test_instances() { list o; - o.push_back(PushReplyOp{}); - o.push_back(PushReplyOp{}); + o.emplace_back(); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("asdf", 2)); - o.push_back(PushReplyOp{}); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("asdf", CEPH_NOSNAP)); return o; } @@ -7003,11 +7003,11 @@ uint64_t PushReplyOp::cost(CephContext *cct) const list PullOp::generate_test_instances() { list o; - o.push_back(PullOp{}); - o.push_back(PullOp{}); + o.emplace_back(); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("asdf", 2)); o.back().recovery_info.version = eversion_t(3, 10); - o.push_back(PullOp{}); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("asdf", CEPH_NOSNAP)); o.back().recovery_info.version = eversion_t(0, 0); return o; @@ -7082,11 +7082,11 @@ uint64_t PullOp::cost(CephContext *cct) const list PushOp::generate_test_instances() { list o; - o.push_back(PushOp{}); - o.push_back(PushOp{}); + o.emplace_back(); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("asdf", 2)); o.back().version = eversion_t(3, 10); - o.push_back(PushOp{}); + o.emplace_back(); o.back().soid = hobject_t(sobject_t("asdf", CEPH_NOSNAP)); o.back().version = eversion_t(0, 0); return o; @@ -7259,8 +7259,8 @@ void ScrubMap::dump(Formatter *f) const list ScrubMap::generate_test_instances() { list o; - o.push_back(ScrubMap{}); - o.push_back(ScrubMap{}); + o.emplace_back(); + o.emplace_back(); o.back().valid_through = eversion_t(1, 2); o.back().incr_since = eversion_t(3, 4); list obj = object::generate_test_instances(); @@ -7363,10 +7363,10 @@ auto ScrubMap::object::generate_test_instances() -> list { list o; - o.push_back(object{}); - o.push_back(object{}); + o.emplace_back(); + o.emplace_back(); o.back().negative = true; - o.push_back(object{}); + o.emplace_back(); o.back().size = 123; { bufferlist foobl; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 09950f809f2..3421cb0232c 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -204,7 +204,7 @@ struct pg_shard_t { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_shard_t{}); + o.emplace_back(); o.push_back(pg_shard_t(1)); o.push_back(pg_shard_t(1, shard_id_t(2))); return o; @@ -619,7 +619,7 @@ struct spg_t { } static std::list generate_test_instances() { std::list o; - o.push_back(spg_t{}); + o.emplace_back(); o.push_back(spg_t(pg_t(1, 2), shard_id_t(3))); return o; } @@ -956,7 +956,7 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(eversion_t{}); + o.emplace_back(); o.push_back(eversion_t(1, 2)); return o; } @@ -1252,8 +1252,8 @@ struct pg_merge_meta_t { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_merge_meta_t{}); - o.push_back(pg_merge_meta_t{}); + o.emplace_back(); + o.emplace_back(); o.back().source_pgid = pg_t(1,2); o.back().ready_epoch = 1; o.back().last_epoch_started = 2; @@ -3341,8 +3341,8 @@ struct pg_fast_info_t { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_fast_info_t{}); - o.push_back(pg_fast_info_t{}); + o.emplace_back(); + o.emplace_back(); o.back().last_update = eversion_t(1, 2); o.back().last_complete = eversion_t(3, 4); o.back().last_user_version = version_t(5); @@ -4417,9 +4417,9 @@ struct pg_log_op_return_item_t { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_log_op_return_item_t{}); + o.emplace_back(); o.back().rval = 0; - o.push_back(pg_log_op_return_item_t{}); + o.emplace_back(); o.back().rval = 1; o.back().bl.append("asdf"); return o; @@ -4969,11 +4969,11 @@ struct pg_missing_item { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_missing_item{}); - o.push_back(pg_missing_item{}); + o.emplace_back(); + o.emplace_back(); o.back().need = eversion_t(1, 2); o.back().have = eversion_t(1, 1); - o.push_back(pg_missing_item{}); + o.emplace_back(); o.back().need = eversion_t(3, 5); o.back().have = eversion_t(3, 4); o.back().clean_regions.mark_data_region_dirty(4096, 8192); @@ -5335,14 +5335,14 @@ public: } static std::list generate_test_instances() { std::list o; - o.push_back(pg_missing_set{}); + o.emplace_back(); o.back().may_include_deletes = true; - o.push_back(pg_missing_set{}); + o.emplace_back(); o.back().add( hobject_t(object_t("foo"), "foo", 123, 456, 0, ""), eversion_t(5, 6), eversion_t(5, 1), false); o.back().may_include_deletes = true; - o.push_back(pg_missing_set{}); + o.emplace_back(); o.back().add( hobject_t(object_t("foo"), "foo", 123, 456, 0, ""), eversion_t(5, 6), eversion_t(5, 1), true); @@ -5480,18 +5480,18 @@ struct pg_nls_response_template { } static std::list generate_test_instances() { std::list> o; - o.push_back(pg_nls_response_template{}); - o.push_back(pg_nls_response_template{}); + o.emplace_back(); + o.emplace_back(); o.back().handle = hobject_t(object_t("hi"), "key", 1, 2, -1, ""); o.back().entries.push_back(librados::ListObjectImpl("", "one", "")); o.back().entries.push_back(librados::ListObjectImpl("", "two", "twokey")); o.back().entries.push_back(librados::ListObjectImpl("", "three", "")); - o.push_back(pg_nls_response_template{}); + o.emplace_back(); o.back().handle = hobject_t(object_t("hi"), "key", 3, 4, -1, ""); o.back().entries.push_back(librados::ListObjectImpl("n1", "n1one", "")); o.back().entries.push_back(librados::ListObjectImpl("n1", "n1two", "n1twokey")); o.back().entries.push_back(librados::ListObjectImpl("n1", "n1three", "")); - o.push_back(pg_nls_response_template{}); + o.emplace_back(); o.back().handle = hobject_t(object_t("hi"), "key", 5, 6, -1, ""); o.back().entries.push_back(librados::ListObjectImpl("", "one", "")); o.back().entries.push_back(librados::ListObjectImpl("", "two", "twokey")); @@ -5540,8 +5540,8 @@ struct pg_ls_response_t { } static std::list generate_test_instances() { std::list o; - o.push_back(pg_ls_response_t{}); - o.push_back(pg_ls_response_t{}); + o.emplace_back(); + o.emplace_back(); o.back().handle = hobject_t(object_t("hi"), "key", 1, 2, -1, ""); o.back().entries.push_back(std::make_pair(object_t("one"), std::string())); o.back().entries.push_back(std::make_pair(object_t("two"), std::string("twokey"))); @@ -6741,8 +6741,8 @@ struct obj_list_watch_response_t { static std::list generate_test_instances() { std::list o; entity_addr_t ea; - o.push_back(obj_list_watch_response_t{}); - o.push_back(obj_list_watch_response_t{}); + o.emplace_back(); + o.emplace_back(); std::list test_watchers = watch_item_t::generate_test_instances(); for (auto &e : test_watchers) { o.back().entries.push_back(e); @@ -6801,14 +6801,14 @@ struct clone_info { } static std::list generate_test_instances() { std::list o; - o.push_back(clone_info{}); - o.push_back(clone_info{}); + o.emplace_back(); + o.emplace_back(); o.back().cloneid = 1; o.back().snaps.push_back(1); o.back().overlap.push_back(std::pair(0,4096)); o.back().overlap.push_back(std::pair(8192,4096)); o.back().size = 16384; - o.push_back(clone_info{}); + o.emplace_back(); o.back().cloneid = CEPH_NOSNAP; o.back().size = 32768; return o; @@ -6851,8 +6851,8 @@ struct obj_list_snap_response_t { } static std::list generate_test_instances() { std::list o; - o.push_back(obj_list_snap_response_t{}); - o.push_back(obj_list_snap_response_t{}); + o.emplace_back(); + o.emplace_back(); clone_info cl; cl.cloneid = 1; cl.snaps.push_back(1); @@ -6975,7 +6975,7 @@ struct pool_pg_num_history_t { } static std::list generate_test_instances() { std::list ls; - ls.push_back(pool_pg_num_history_t{}); + ls.emplace_back(); return ls; } friend std::ostream& operator<<(std::ostream& out, const pool_pg_num_history_t& h) { diff --git a/src/rgw/driver/rados/groups.cc b/src/rgw/driver/rados/groups.cc index 1948605004c..cd5b77d01a8 100644 --- a/src/rgw/driver/rados/groups.cc +++ b/src/rgw/driver/rados/groups.cc @@ -127,7 +127,7 @@ void resource_metadata::dump(ceph::Formatter* f) const std::list resource_metadata::generate_test_instances() { std::list o; - o.push_back(resource_metadata{}); + o.emplace_back(); resource_metadata m; m.group_id = "id"; o.push_back(std::move(m)); diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index b3a868529e3..c81717ee65c 100644 --- a/src/rgw/driver/rados/rgw_bucket.cc +++ b/src/rgw/driver/rados/rgw_bucket.cc @@ -3667,7 +3667,7 @@ list RGWBucketEntryPoint::generate_test_instances() bp.creation_time = ceph::real_clock::from_ceph_timespec({ceph_le32(2), ceph_le32(3)}); o.push_back(std::move(bp)); - o.push_back(RGWBucketEntryPoint{}); + o.emplace_back(); return o; } diff --git a/src/rgw/driver/rados/rgw_data_sync.cc b/src/rgw/driver/rados/rgw_data_sync.cc index 25ff624b825..d3819290a1a 100644 --- a/src/rgw/driver/rados/rgw_data_sync.cc +++ b/src/rgw/driver/rados/rgw_data_sync.cc @@ -6676,7 +6676,7 @@ list rgw_data_sync_info::generate_test_instances() info.state = rgw_data_sync_info::StateBuildingFullSyncMaps; info.num_shards = 8; o.push_back(std::move(info)); - o.push_back(rgw_data_sync_info{}); + o.emplace_back(); return o; } @@ -6688,14 +6688,14 @@ list rgw_data_sync_marker::generate_test_instances() marker.marker = "01234"; marker.pos = 5; o.push_back(std::move(marker)); - o.push_back(rgw_data_sync_marker{}); + o.emplace_back(); return o; } list rgw_data_sync_status::generate_test_instances() { list o; - o.push_back(rgw_data_sync_status{}); + o.emplace_back(); return o; } diff --git a/src/rgw/driver/rados/rgw_datalog.cc b/src/rgw/driver/rados/rgw_datalog.cc index 3de1e530979..df2039b12d8 100644 --- a/src/rgw/driver/rados/rgw_datalog.cc +++ b/src/rgw/driver/rados/rgw_datalog.cc @@ -93,8 +93,8 @@ void rgw_data_change::decode_json(JSONObj *obj) { std::list rgw_data_change::generate_test_instances() { std::list l; - l.push_back(rgw_data_change{}); - l.push_back(rgw_data_change{}); + l.emplace_back(); + l.emplace_back(); l.back().entity_type = ENTITY_TYPE_BUCKET; l.back().key = "bucket_name"; l.back().timestamp = ceph::real_clock::zero(); diff --git a/src/rgw/driver/rados/rgw_obj_manifest.cc b/src/rgw/driver/rados/rgw_obj_manifest.cc index eb586003101..7d3756bb647 100644 --- a/src/rgw/driver/rados/rgw_obj_manifest.cc +++ b/src/rgw/driver/rados/rgw_obj_manifest.cc @@ -275,7 +275,7 @@ std::list RGWObjManifestPart::generate_test_instances() { std::list o; - o.push_back(RGWObjManifestPart{}); + o.emplace_back(); RGWObjManifestPart p; rgw_bucket b; @@ -308,7 +308,7 @@ std::list RGWObjManifest::generate_test_instances() } m.set_explicit(total_size, objs); o.push_back(std::move(m)); - o.push_back(RGWObjManifest{}); + o.emplace_back(); return o; } @@ -384,7 +384,7 @@ std::list RGWObjManifestRule::generate_test_instances() r.stripe_max_size = 512 * 1024 * 1024; r.override_prefix = "override_prefix"; o.push_back(std::move(r)); - o.push_back(RGWObjManifestRule{}); + o.emplace_back(); return o; } @@ -413,7 +413,7 @@ std::list RGWObjTier::generate_test_instances() } t.is_multipart_upload = true; o.push_back(std::move(t)); - o.push_back(RGWObjTier{}); + o.emplace_back(); return o; } diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index fbcad2dead8..5b84285093c 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -11583,7 +11583,7 @@ list objexp_hint_entry::generate_test_instances() it.bucket_id = "1234"; it.obj_key = rgw_obj_key("obj"); o.push_back(std::move(it)); - o.push_back(objexp_hint_entry{}); + o.emplace_back(); return o; } @@ -11605,7 +11605,7 @@ list RGWOLHInfo::generate_test_instances() RGWOLHInfo olh; olh.removed = false; o.push_back(olh); - o.push_back(RGWOLHInfo{}); + o.emplace_back(); return o; } diff --git a/src/rgw/driver/rados/rgw_user.h b/src/rgw/driver/rados/rgw_user.h index b22681444df..5581458d92e 100644 --- a/src/rgw/driver/rados/rgw_user.h +++ b/src/rgw/driver/rados/rgw_user.h @@ -62,8 +62,8 @@ struct RGWUID } static std::list generate_test_instances() { std::list o; - o.push_back(RGWUID{}); - o.push_back(RGWUID{}); + o.emplace_back(); + o.emplace_back(); o.back().id = "test:tester"; return o; } diff --git a/src/rgw/driver/rados/roles.cc b/src/rgw/driver/rados/roles.cc index cd5d18146b1..44730468597 100644 --- a/src/rgw/driver/rados/roles.cc +++ b/src/rgw/driver/rados/roles.cc @@ -166,7 +166,7 @@ void resource_metadata::dump(ceph::Formatter* f) const std::list resource_metadata::generate_test_instances() { std::list o; - o.push_back(resource_metadata{}); + o.emplace_back(); resource_metadata m; m.role_id = "id"; o.push_back(std::move(m)); diff --git a/src/rgw/driver/rados/users.cc b/src/rgw/driver/rados/users.cc index e08db4d3cd8..731cc5fe81d 100644 --- a/src/rgw/driver/rados/users.cc +++ b/src/rgw/driver/rados/users.cc @@ -166,7 +166,7 @@ void resource_metadata::dump(ceph::Formatter* f) const std::list resource_metadata::generate_test_instances() { std::list o; - o.push_back(resource_metadata{}); + o.emplace_back(); resource_metadata m;; m.user_id = "uid"; o.push_back(std::move(m)); diff --git a/src/rgw/rgw_acl.cc b/src/rgw/rgw_acl.cc index 0a9a8078720..c00753520fa 100644 --- a/src/rgw/rgw_acl.cc +++ b/src/rgw/rgw_acl.cc @@ -260,7 +260,7 @@ list ACLPermission::generate_test_instances() ACLPermission p; p.set_permissions(RGW_PERM_WRITE_ACP); o.push_back(std::move(p)); - o.push_back(ACLPermission{}); + o.emplace_back(); return o; } @@ -314,7 +314,7 @@ list ACLGrant::generate_test_instances() g1.set_group(ACL_GROUP_AUTHENTICATED_USERS, RGW_PERM_WRITE); o.push_back(std::move(g2)); - o.push_back(ACLGrant{}); + o.emplace_back(); return o; } @@ -322,7 +322,7 @@ list ACLGranteeType::generate_test_instances() { list o; o.push_back(ACLGranteeType(ACL_TYPE_CANON_USER)); - o.push_back(ACLGranteeType{}); + o.emplace_back(); return o; } @@ -335,7 +335,7 @@ list RGWAccessControlList::generate_test_instances() acl.add_grant(grant); } o.push_back(std::move(acl)); - o.push_back(RGWAccessControlList{}); + o.emplace_back(); return o; } @@ -346,7 +346,7 @@ list ACLOwner::generate_test_instances() owner.id = "rgw"; owner.display_name = "Mr. RGW"; o.push_back(std::move(owner)); - o.push_back(ACLOwner{}); + o.emplace_back(); return o; } @@ -364,7 +364,7 @@ list RGWAccessControlPolicy::generate_test_instances() o.push_back(std::move(p)); } - o.push_back(RGWAccessControlPolicy{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_basic_types.cc b/src/rgw/rgw_basic_types.cc index 4efe25f2ba6..f5d4450eefe 100644 --- a/src/rgw/rgw_basic_types.cc +++ b/src/rgw/rgw_basic_types.cc @@ -84,7 +84,7 @@ list rgw_bucket::generate_test_instances() rgw_bucket b; init_bucket(&b, "tenant", "name", "pool", ".index_pool", "marker", "123"); o.push_back(std::move(b)); - o.push_back(rgw_bucket{}); + o.emplace_back(); return o; } @@ -128,7 +128,7 @@ list rgw_user::generate_test_instances() rgw_user u("tenant", "user"); o.push_back(u); - o.push_back(rgw_user{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_basic_types.h b/src/rgw/rgw_basic_types.h index 19575af384f..ff8d5606cf7 100644 --- a/src/rgw/rgw_basic_types.h +++ b/src/rgw/rgw_basic_types.h @@ -83,7 +83,7 @@ struct rgw_zone_id { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_zone_id{}); + o.emplace_back(); o.push_back(rgw_zone_id("id")); return o; } diff --git a/src/rgw/rgw_cache.cc b/src/rgw/rgw_cache.cc index 71d8bada94a..0f5dea2694f 100644 --- a/src/rgw/rgw_cache.cc +++ b/src/rgw/rgw_cache.cc @@ -363,7 +363,7 @@ list ObjectMetaInfo::generate_test_instances() ObjectMetaInfo m; m.size = 1024 * 1024; o.push_back(std::move(m)); - o.push_back(ObjectMetaInfo{}); + o.emplace_back(); return o; } @@ -392,7 +392,7 @@ list ObjectCacheInfo::generate_test_instances() i.rm_xattrs["r3"] = data; i.meta.size = 512 * 1024; o.push_back(std::move(i)); - o.push_back(ObjectCacheInfo{}); + o.emplace_back(); return o; } @@ -410,7 +410,7 @@ void ObjectCacheInfo::dump(Formatter *f) const list RGWCacheNotifyInfo::generate_test_instances() { list o; - o.push_back(RGWCacheNotifyInfo{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 40895ca56b5..22c7e44c1ce 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -2072,7 +2072,7 @@ void RGWUserCaps::dump(Formatter *f) const list RGWUserCaps::generate_test_instances() { list o; - o.push_back(RGWUserCaps{}); + o.emplace_back(); RGWUserCaps caps; caps.add_cap("read"); caps.add_cap("write"); @@ -2525,7 +2525,7 @@ list RGWBucketEnt::generate_test_instances() e.size_rounded = 4096; e.count = 1; o.push_back(std::move(e)); - o.push_back(RGWBucketEnt{}); + o.emplace_back(); return o; } @@ -2546,7 +2546,7 @@ list rgw_obj::generate_test_instances() rgw_bucket b; init_bucket(&b, "tenant", "bucket", "pool", ".index_pool", "marker", "10"); o.push_back(rgw_obj(b, "object")); - o.push_back(rgw_obj{}); + o.emplace_back(); return o; } @@ -2682,7 +2682,7 @@ list RGWUserInfo::generate_test_instances() i.subusers[u.name] = u; o.push_back(std::move(i)); - o.push_back(RGWUserInfo{}); + o.emplace_back(); return o; } @@ -2975,7 +2975,7 @@ list RGWSubUser::generate_test_instances() u.name = "name"; u.perm_mask = 0xf; o.push_back(std::move(u)); - o.push_back(RGWSubUser{}); + o.emplace_back(); return o; } @@ -3031,7 +3031,7 @@ list RGWAccessKey::generate_test_instances() k.key = "key"; k.subuser = "subuser"; o.push_back(std::move(k)); - o.push_back(RGWAccessKey{}); + o.emplace_back(); return o; } @@ -3135,7 +3135,7 @@ void RGWAccountInfo::decode_json(JSONObj* obj) std::list RGWAccountInfo::generate_test_instances() { std::list o; - o.push_back(RGWAccountInfo{}); + o.emplace_back(); auto p = RGWAccountInfo{}; p.id = "account1"; p.tenant = "tenant1"; @@ -3171,7 +3171,7 @@ void RGWGroupInfo::decode_json(JSONObj* obj) std::list RGWGroupInfo::generate_test_instances() { std::list o; - o.push_back(RGWGroupInfo{}); + o.emplace_back(); auto p = RGWGroupInfo{}; p.id = "id"; p.tenant = "tenant"; diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index ec62e9c7a83..8aec72d4a99 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1602,8 +1602,8 @@ struct multipart_upload_info static std::list generate_test_instances() { std::list o; - o.push_back(multipart_upload_info{}); - o.push_back(multipart_upload_info{}); + o.emplace_back(); + o.emplace_back(); o.back().dest_placement.name = "dest_placement"; o.back().dest_placement.storage_class = "dest_storage_class"; return o; diff --git a/src/rgw/rgw_cors.cc b/src/rgw/rgw_cors.cc index 08e8eacc6fd..4aa0d30b0af 100644 --- a/src/rgw/rgw_cors.cc +++ b/src/rgw/rgw_cors.cc @@ -68,8 +68,8 @@ void RGWCORSRule::erase_origin_if_present(string& origin, bool *rule_empty) { list RGWCORSRule::generate_test_instances() { list o; - o.push_back(RGWCORSRule{}); - o.push_back(RGWCORSRule{}); + o.emplace_back(); + o.emplace_back(); o.back().id = "test"; o.back().max_age = 100; o.back().allowed_methods = RGW_CORS_GET | RGW_CORS_PUT; diff --git a/src/rgw/rgw_dencoder.cc b/src/rgw/rgw_dencoder.cc index 962ebecb812..0f7a4692132 100644 --- a/src/rgw/rgw_dencoder.cc +++ b/src/rgw/rgw_dencoder.cc @@ -28,7 +28,7 @@ list obj_version::generate_test_instances() v.tag = "tag"; o.push_back(std::move(v)); - o.push_back(obj_version{}); + o.emplace_back(); return o; } @@ -42,6 +42,6 @@ std::list RGWBucketEncryptionConfig::generate_test_in bc = RGWBucketEncryptionConfig("AES256"); o.push_back(std::move(bc)); - o.push_back(RGWBucketEncryptionConfig{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index eaae450c966..b462d4247a2 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2676,7 +2676,7 @@ RGWLC::LCWorker::~LCWorker() list RGWLifecycleConfiguration::generate_test_instances() { list o; - o.push_back(RGWLifecycleConfiguration{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 8cd0250b49e..7f770c2cd2d 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -703,7 +703,7 @@ list rgw_log_entry::generate_test_instances() e.account_id = "account_id"; e.role_id = "role_id"; o.push_back(std::move(e)); - o.push_back(rgw_log_entry{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index 83b85ef15c3..45db3ff0aac 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -99,8 +99,8 @@ void RGWMetadataLogData::decode_json(JSONObj *obj) { std::list RGWMetadataLogData::generate_test_instances() { std::list l; - l.push_back(RGWMetadataLogData{}); - l.push_back(RGWMetadataLogData{}); + l.emplace_back(); + l.emplace_back(); l.back().read_version = obj_version(); l.back().read_version.tag = "read_tag"; l.back().write_version = obj_version(); diff --git a/src/rgw/rgw_multi.cc b/src/rgw/rgw_multi.cc index 5f369d1cd0f..95454086b34 100644 --- a/src/rgw/rgw_multi.cc +++ b/src/rgw/rgw_multi.cc @@ -89,7 +89,7 @@ list RGWUploadPartInfo::generate_test_instances() i.size = 10 * 1024 * 1024; i.etag = "etag"; o.push_back(std::move(i)); - o.push_back(RGWUploadPartInfo{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_obj_types.h b/src/rgw/rgw_obj_types.h index 227c96d931e..67f00b5db26 100644 --- a/src/rgw/rgw_obj_types.h +++ b/src/rgw/rgw_obj_types.h @@ -90,8 +90,8 @@ struct rgw_obj_index_key { // cls_rgw_obj_key now aliases this type void decode_json(JSONObj *obj); static std::list generate_test_instances() { std::list ls; - ls.push_back(rgw_obj_index_key{}); - ls.push_back(rgw_obj_index_key{}); + ls.emplace_back(); + ls.emplace_back(); ls.back().name = "name"; ls.back().instance = "instance"; return ls; diff --git a/src/rgw/rgw_object_lock.cc b/src/rgw/rgw_object_lock.cc index ecb5a5fe988..6b0bd0232a3 100644 --- a/src/rgw/rgw_object_lock.cc +++ b/src/rgw/rgw_object_lock.cc @@ -51,7 +51,7 @@ void ObjectLockRule::dump(Formatter *f) const { std::list ObjectLockRule::generate_test_instances() { std::list o; - o.push_back(ObjectLockRule{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_oidc_provider.cc b/src/rgw/rgw_oidc_provider.cc index b22cc9cc4d3..4c0a21ed76d 100644 --- a/src/rgw/rgw_oidc_provider.cc +++ b/src/rgw/rgw_oidc_provider.cc @@ -38,6 +38,6 @@ std::list RGWOIDCProviderInfo::generate_test_instances() p.client_ids = {"a", "b"}; p.thumbprints = {"c", "d"}; l.push_back(std::move(p)); - l.push_back(RGWOIDCProviderInfo{}); + l.emplace_back(); return l; } diff --git a/src/rgw/rgw_placement_types.h b/src/rgw/rgw_placement_types.h index 4c78df1b66a..b4761114d09 100644 --- a/src/rgw/rgw_placement_types.h +++ b/src/rgw/rgw_placement_types.h @@ -96,7 +96,7 @@ struct rgw_placement_rule { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_placement_rule{}); + o.emplace_back(); o.push_back(rgw_placement_rule("name", "storage_class")); return o; } diff --git a/src/rgw/rgw_pool_types.h b/src/rgw/rgw_pool_types.h index 0a84f57d471..bbc9c774a14 100644 --- a/src/rgw/rgw_pool_types.h +++ b/src/rgw/rgw_pool_types.h @@ -97,7 +97,7 @@ struct rgw_pool { static std::list generate_test_instances() { std::list o; - o.push_back(rgw_pool{}); + o.emplace_back(); o.push_back(rgw_pool("pool", "ns")); return o; } diff --git a/src/rgw/rgw_quota.cc b/src/rgw/rgw_quota.cc index 4334241f113..68a9eb83d78 100644 --- a/src/rgw/rgw_quota.cc +++ b/src/rgw/rgw_quota.cc @@ -1042,8 +1042,8 @@ void RGWQuotaInfo::dump(Formatter *f) const std::list RGWQuotaInfo::generate_test_instances() { std::list o; - o.push_back(RGWQuotaInfo{}); - o.push_back(RGWQuotaInfo{}); + o.emplace_back(); + o.emplace_back(); o.back().enabled = true; o.back().check_on_raw = true; o.back().max_size = 1024; diff --git a/src/rgw/rgw_realm.cc b/src/rgw/rgw_realm.cc index 4ee4b833b29..c8a075592d6 100644 --- a/src/rgw/rgw_realm.cc +++ b/src/rgw/rgw_realm.cc @@ -86,8 +86,8 @@ int RGWRealm::find_zone(const DoutPrefixProvider *dpp, list RGWRealm::generate_test_instances() { list o; - o.push_back(RGWRealm{}); - o.push_back(RGWRealm{}); + o.emplace_back(); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_sync_policy.cc b/src/rgw/rgw_sync_policy.cc index 8c1ce02ceff..16fe5aae5e9 100644 --- a/src/rgw/rgw_sync_policy.cc +++ b/src/rgw/rgw_sync_policy.cc @@ -792,7 +792,7 @@ void rgw_sync_policy_info::dump(Formatter *f) const list rgw_sync_policy_info::generate_test_instances() { list o; - o.push_back(rgw_sync_policy_info{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_tag.cc b/src/rgw/rgw_tag.cc index 85cb3dcfd2d..5489fef9429 100644 --- a/src/rgw/rgw_tag.cc +++ b/src/rgw/rgw_tag.cc @@ -72,7 +72,7 @@ std::list RGWObjTags::generate_test_instances() r.add_tag("key1","val1"); r.add_tag("key2","val2"); o.push_back(std::move(r)); - o.push_back(RGWObjTags{}); + o.emplace_back(); return o; } diff --git a/src/rgw/rgw_zone.cc b/src/rgw/rgw_zone.cc index 951ebb89044..23323ab76c2 100644 --- a/src/rgw/rgw_zone.cc +++ b/src/rgw/rgw_zone.cc @@ -71,8 +71,8 @@ static void decode_placement_targets(map& t list RGWZone::generate_test_instances() { list o; - o.push_back(RGWZone{}); - o.push_back(RGWZone{}); + o.emplace_back(); + o.emplace_back(); return o; } @@ -511,8 +511,8 @@ void RGWZonePlacementInfo::dump(Formatter *f) const list RGWZonePlacementInfo::generate_test_instances() { list o; - o.push_back(RGWZonePlacementInfo{}); - o.push_back(RGWZonePlacementInfo{}); + o.emplace_back(); + o.emplace_back(); o.back().index_pool = rgw_pool("rgw.buckets.index"); o.back().data_extra_pool = rgw_pool("rgw.buckets.non-ec"); @@ -585,7 +585,7 @@ void RGWZoneStorageClasses::dump(Formatter *f) const list RGWZoneStorageClasses::generate_test_instances() { list o; - o.push_back(RGWZoneStorageClasses{}); + o.emplace_back(); return o; } @@ -672,8 +672,8 @@ void RGWZoneStorageClass::dump(Formatter *f) const list RGWZoneStorageClass::generate_test_instances() { list o; - o.push_back(RGWZoneStorageClass{}); - o.push_back(RGWZoneStorageClass{}); + o.emplace_back(); + o.emplace_back(); o.back().data_pool = rgw_pool("pool1"); o.back().compression_type = "zlib"; return o; diff --git a/src/rgw/rgw_zone_types.h b/src/rgw/rgw_zone_types.h index 44ece58143e..e56b8e7f406 100644 --- a/src/rgw/rgw_zone_types.h +++ b/src/rgw/rgw_zone_types.h @@ -572,7 +572,7 @@ struct RGWZoneGroupTierS3Glacier { void decode_json(JSONObj *obj); static std::list generate_test_instances() { std::list o; - o.push_back(RGWZoneGroupTierS3Glacier{}); + o.emplace_back(); o.back().glacier_restore_days = 2; o.back().glacier_restore_tier_type = GlacierRestoreTierType::Expedited; return o; @@ -671,8 +671,8 @@ struct RGWZoneGroupPlacementTier { void decode_json(JSONObj *obj); static std::list generate_test_instances() { std::list o; - o.push_back(RGWZoneGroupPlacementTier{}); - o.push_back(RGWZoneGroupPlacementTier{}); + o.emplace_back(); + o.emplace_back(); o.back().tier_type = RGWTierType::CLOUD_S3; o.back().storage_class = RGW_STORAGE_CLASS_STANDARD; o.back().allow_read_through = false; @@ -730,9 +730,9 @@ struct RGWZoneGroupPlacementTarget { void decode_json(JSONObj *obj); static std::list generate_test_instances() { std::list o; - o.push_back(RGWZoneGroupPlacementTarget{}); + o.emplace_back(); o.back().storage_classes.insert(RGW_STORAGE_CLASS_STANDARD); - o.push_back(RGWZoneGroupPlacementTarget{}); + o.emplace_back(); o.back().name = "target"; o.back().tags.insert("tag1"); o.back().tags.insert("tag2");