Skip to content

Commit 3bbd4be

Browse files
committed
Bug#22254109: FIX NEW C++11 COMPILATION WARNINGS IN RUNTIME CODE
Fix new C++11 deprecation warnings in runtime code by replacing std::auto_ptr with std::unique_ptr.
1 parent db1bde7 commit 3bbd4be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+162
-161
lines changed

sql/dd/cache/dictionary_client.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class Dictionary_client
525525
template <typename Iterator_type>
526526
bool fetch_schema_components(
527527
const Schema *schema,
528-
std::auto_ptr<Iterator_type> *iter) const;
528+
std::unique_ptr<Iterator_type> *iter) const;
529529

530530

531531
/**
@@ -544,7 +544,7 @@ class Dictionary_client
544544

545545
template <typename Iterator_type>
546546
bool fetch_catalog_components(
547-
std::auto_ptr<Iterator_type> *iter) const;
547+
std::unique_ptr<Iterator_type> *iter) const;
548548

549549

550550
/**
@@ -560,7 +560,7 @@ class Dictionary_client
560560

561561
template <typename Iterator_type>
562562
bool fetch_global_components(
563-
std::auto_ptr<Iterator_type> *iter) const;
563+
std::unique_ptr<Iterator_type> *iter) const;
564564

565565

566566
/**

sql/dd/dd_schema.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "dd/types/object_type.h" // dd::Object_type
2828
#include "dd/types/schema.h" // dd::Schema
2929

30-
#include <memory> // auto_ptr
30+
#include <memory> // unique_ptr
3131

3232
namespace dd {
3333

@@ -57,7 +57,7 @@ bool create_schema(THD *thd, const char *schema_name,
5757
return false;
5858

5959
// Create dd::Schema object.
60-
std::auto_ptr<dd::Schema> sch_obj(dd::create_object<dd::Schema>());
60+
std::unique_ptr<dd::Schema> sch_obj(dd::create_object<dd::Schema>());
6161

6262
// Set schema name and collation id.
6363
sch_obj->set_name(schema_name);

sql/dd/dd_table.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// TODO: Avoid exposing dd/impl headers in public files.
4848
#include "dd/impl/utils.h" // dd::escape
4949

50-
#include <memory> // auto_ptr
50+
#include <memory> // unique_ptr
5151

5252

5353
// Explicit instanciation of some template functions
@@ -568,7 +568,7 @@ fill_dd_index_elements_from_key_parts(const dd::Table *tab_obj,
568568
const dd::Column *key_col_obj;
569569

570570
{
571-
std::auto_ptr<dd::Column_const_iterator> it(tab_obj->user_columns());
571+
std::unique_ptr<dd::Column_const_iterator> it(tab_obj->user_columns());
572572
int i= 0;
573573

574574
while ((key_col_obj= it->next()) != NULL && i < key_part->fieldnr)
@@ -1185,7 +1185,7 @@ static bool fill_dd_partition_from_create_info(THD *thd,
11851185
If table is subpartitioned for each subpartition, index pair
11861186
we need to create Partition_index object.
11871187
*/
1188-
std::auto_ptr<dd::Index_iterator> idx_it(tab_obj->indexes());
1188+
std::unique_ptr<dd::Index_iterator> idx_it(tab_obj->indexes());
11891189
dd::Index *idx;
11901190

11911191
while ((idx= idx_it->next()) != NULL)
@@ -1200,7 +1200,7 @@ static bool fill_dd_partition_from_create_info(THD *thd,
12001200
If table is not subpartitioned then Partition_index object is
12011201
required for each partition, index pair.
12021202
*/
1203-
std::auto_ptr<dd::Index_iterator> idx_it(tab_obj->indexes());
1203+
std::unique_ptr<dd::Index_iterator> idx_it(tab_obj->indexes());
12041204
dd::Index *idx;
12051205

12061206
while ((idx= idx_it->next()) != NULL)
@@ -1418,12 +1418,12 @@ static bool create_dd_system_table(THD *thd,
14181418
const dd::Object_table &dd_table)
14191419
{
14201420
// For DD tables: create system schema using special DD operation.
1421-
std::auto_ptr<dd::Schema> sch_obj(dd::create_dd_schema());
1421+
std::unique_ptr<dd::Schema> sch_obj(dd::create_dd_schema());
14221422

14231423
//
14241424
// Create dd::Table object
14251425
//
1426-
std::auto_ptr<dd::Table> tab_obj(sch_obj->create_table());
1426+
std::unique_ptr<dd::Table> tab_obj(sch_obj->create_table());
14271427

14281428
if (fill_dd_table_from_create_info(thd, tab_obj.get(), table_name,
14291429
create_info, create_fields,
@@ -1490,7 +1490,7 @@ static bool create_dd_user_table(THD *thd,
14901490
}
14911491

14921492
// Create dd::Table object.
1493-
std::auto_ptr<dd::Table> tab_obj(
1493+
std::unique_ptr<dd::Table> tab_obj(
14941494
const_cast<dd::Schema *>(sch_obj)->create_table());
14951495

14961496
if (fill_dd_table_from_create_info(thd, tab_obj.get(), table_name,
@@ -1570,7 +1570,7 @@ dd::Table *create_tmp_table(THD *thd,
15701570
}
15711571

15721572
// Create dd::Table object.
1573-
std::auto_ptr<dd::Table> tab_obj(
1573+
std::unique_ptr<dd::Table> tab_obj(
15741574
const_cast<dd::Schema *>(sch_obj)->create_table());
15751575

15761576
if (fill_dd_table_from_create_info(thd, tab_obj.get(), table_name,

sql/dd/dd_tablespace.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fill_table_and_parts_tablespace_names(THD *thd,
7373
if (table_obj->partition_type() != dd::Table::PT_NONE)
7474
{
7575
// Iterate through tablespace names used by partition.
76-
std::auto_ptr<dd::Partition_const_iterator>
76+
std::unique_ptr<dd::Partition_const_iterator>
7777
part_it(table_obj->partitions());
7878
const dd::Partition *part_obj;
7979
std::string ts_name;
@@ -182,7 +182,7 @@ bool create_tablespace(THD *thd, st_alter_tablespace *ts_info,
182182
}
183183

184184
// Create new tablespace.
185-
std::auto_ptr<dd::Tablespace> tablespace(dd::create_object<dd::Tablespace>());
185+
std::unique_ptr<dd::Tablespace> tablespace(dd::create_object<dd::Tablespace>());
186186

187187
// Set tablespace name
188188
tablespace->set_name(ts_info->tablespace_name);

sql/dd/dd_view.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ bool create_view(THD *thd,
202202
}
203203

204204
// Create dd::View object.
205-
std::auto_ptr<dd::View> view_obj;
205+
std::unique_ptr<dd::View> view_obj;
206206
if (dd::get_dictionary()->is_system_view_name(schema_name, view_name))
207207
{
208208
view_obj.reset(const_cast<dd::Schema *>(sch_obj)->create_system_view());

sql/dd/impl/bootstrapper.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static bool create_schema(THD *thd)
6363
static bool create_tables(THD *thd)
6464
{
6565
// Iterate over DD tables, create tables.
66-
std::auto_ptr<Iterator<const Object_table> > it(
66+
std::unique_ptr<Iterator<const Object_table> > it(
6767
Object_table_registry::instance()->types());
6868

6969
for (const Object_table *t= it->next(); t != NULL; t= it->next())
@@ -96,7 +96,7 @@ static bool end_transaction(THD *thd, bool error)
9696
// Store the temporarily saved meta data into the DD tables.
9797
static bool store_meta_data(THD *thd)
9898
{
99-
std::auto_ptr<Iterator<const Object_table> > it(
99+
std::unique_ptr<Iterator<const Object_table> > it(
100100
Object_table_registry::instance()->types());
101101

102102
for (const Object_table *t= it->next(); t != NULL; t= it->next())
@@ -110,7 +110,7 @@ static bool store_meta_data(THD *thd)
110110
static bool populate_tables(THD *thd)
111111
{
112112
// Iterate over DD tables, populate tables
113-
std::auto_ptr<Iterator<const Object_table> > it(
113+
std::unique_ptr<Iterator<const Object_table> > it(
114114
Object_table_registry::instance()->types());
115115

116116
bool error= false;
@@ -142,7 +142,7 @@ static bool populate_tables(THD *thd)
142142
static bool add_cyclic_foreign_keys(THD *thd)
143143
{
144144
// Iterate over DD tables, add foreign keys
145-
std::auto_ptr<Iterator<const Object_table> > it(
145+
std::unique_ptr<Iterator<const Object_table> > it(
146146
Object_table_registry::instance()->types());
147147

148148
for (const Object_table *t= it->next(); t != NULL; t= it->next())
@@ -157,7 +157,7 @@ static bool add_cyclic_foreign_keys(THD *thd)
157157
// in the cache, to keep the objects from being evicted.
158158
static bool make_objects_sticky(THD *thd)
159159
{
160-
std::auto_ptr<Iterator<const Object_table> > it(
160+
std::unique_ptr<Iterator<const Object_table> > it(
161161
Object_table_registry::instance()->types());
162162

163163
for (const Object_table *t= it->next(); t != NULL; t= it->next())

sql/dd/impl/cache/dictionary_client.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ size_t Dictionary_client::release(Object_registry *registry)
448448
// Clone the object before releasing it. The object is needed for checking
449449
// the meta data lock afterwards.
450450
#ifndef DBUG_OFF
451-
std::auto_ptr<const T> object_clone(element->object()->clone());
451+
std::unique_ptr<const T> object_clone(element->object()->clone());
452452
#endif
453453

454454
// Release the element from the shared cache.
@@ -979,7 +979,7 @@ bool Dictionary_client::fetch_schema_component_names(
979979
DBUG_ASSERT(names);
980980

981981
// Create the key based on the schema id.
982-
std::auto_ptr<Object_key> object_key(
982+
std::unique_ptr<Object_key> object_key(
983983
dd::tables::Tables::create_key_by_schema_id(schema->id()));
984984

985985
// Retrieve a set of the schema components, and add the component names
@@ -996,7 +996,7 @@ bool Dictionary_client::fetch_schema_component_names(
996996
return true;
997997
}
998998

999-
std::auto_ptr<Raw_record_set> rs;
999+
std::unique_ptr<Raw_record_set> rs;
10001000
if (table->open_record_set(object_key.get(), rs))
10011001
{
10021002
DBUG_ASSERT(m_thd->is_error() || m_thd->killed);
@@ -1024,14 +1024,14 @@ bool Dictionary_client::fetch_schema_component_names(
10241024
template <typename Iterator_type>
10251025
bool Dictionary_client::fetch_schema_components(
10261026
const Schema *schema,
1027-
std::auto_ptr<Iterator_type> *iter) const
1027+
std::unique_ptr<Iterator_type> *iter) const
10281028
{
1029-
std::auto_ptr<Dictionary_object_collection<
1029+
std::unique_ptr<Dictionary_object_collection<
10301030
typename Iterator_type::Object_type> > c(
10311031
new (std::nothrow) Dictionary_object_collection<
10321032
typename Iterator_type::Object_type>(m_thd));
10331033
{
1034-
std::auto_ptr<Object_key> k(
1034+
std::unique_ptr<Object_key> k(
10351035
Iterator_type::Object_type::cache_partition_table_type::
10361036
create_key_by_schema_id(schema->id()));
10371037

@@ -1052,14 +1052,14 @@ bool Dictionary_client::fetch_schema_components(
10521052
/* purecov: begin deadcode */
10531053
template <typename Iterator_type>
10541054
bool Dictionary_client::fetch_catalog_components(
1055-
std::auto_ptr<Iterator_type> *iter) const
1055+
std::unique_ptr<Iterator_type> *iter) const
10561056
{
1057-
std::auto_ptr<Dictionary_object_collection
1057+
std::unique_ptr<Dictionary_object_collection
10581058
<typename Iterator_type::Object_type> > c(
10591059
new (std::nothrow) Dictionary_object_collection
10601060
<typename Iterator_type::Object_type>(m_thd));
10611061
{
1062-
std::auto_ptr<Object_key> k(
1062+
std::unique_ptr<Object_key> k(
10631063
Iterator_type::Object_type::cache_partition_table_type::
10641064
create_key_by_catalog_id(1));
10651065
if (c->fetch(k.get()))
@@ -1080,9 +1080,9 @@ bool Dictionary_client::fetch_catalog_components(
10801080
/* purecov: begin deadcode */
10811081
template <typename Iterator_type>
10821082
bool Dictionary_client::fetch_global_components(
1083-
std::auto_ptr<Iterator_type> *iter) const
1083+
std::unique_ptr<Iterator_type> *iter) const
10841084
{
1085-
std::auto_ptr<Dictionary_object_collection
1085+
std::unique_ptr<Dictionary_object_collection
10861086
<typename Iterator_type::Object_type> > c(
10871087
new (std::nothrow) Dictionary_object_collection
10881088
<typename Iterator_type::Object_type>(m_thd));
@@ -1289,21 +1289,21 @@ void Dictionary_client::dump() const
12891289
// Explicitly instantiate the types for the various usages.
12901290
template bool Dictionary_client::fetch_schema_components(
12911291
const Schema*,
1292-
std::auto_ptr<Abstract_table_const_iterator>*) const;
1292+
std::unique_ptr<Abstract_table_const_iterator>*) const;
12931293

12941294
template bool Dictionary_client::fetch_schema_components(
12951295
const Schema*,
1296-
std::auto_ptr<Table_const_iterator>*) const;
1296+
std::unique_ptr<Table_const_iterator>*) const;
12971297

12981298
template bool Dictionary_client::fetch_schema_components(
12991299
const Schema*,
1300-
std::auto_ptr<View_const_iterator>*) const;
1300+
std::unique_ptr<View_const_iterator>*) const;
13011301

13021302
template bool Dictionary_client::fetch_catalog_components(
1303-
std::auto_ptr<Schema_const_iterator>*) const;
1303+
std::unique_ptr<Schema_const_iterator>*) const;
13041304

13051305
template bool Dictionary_client::fetch_global_components(
1306-
std::auto_ptr<Tablespace_const_iterator>*) const;
1306+
std::unique_ptr<Tablespace_const_iterator>*) const;
13071307

13081308
template bool Dictionary_client::acquire_uncached(Object_id,
13091309
const Abstract_table**);

sql/dd/impl/cache/storage_adapter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ bool Storage_adapter::get(THD *thd, const K &key, const T **object)
6767
Raw_table *t= trx.otx.get_table(table.name());
6868

6969
// Find record by the object-id.
70-
std::auto_ptr<Raw_record> r;
70+
std::unique_ptr<Raw_record> r;
7171
if (t->find_record(key, r))
7272
{
7373
DBUG_ASSERT(thd->is_error() || thd->killed);

sql/dd/impl/collection_impl.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "dd/impl/raw/raw_record_set.h" // dd::Raw_record_set
2121
#include "dd/impl/raw/raw_table.h" // dd::Raw_table
2222

23-
#include <memory> // std::auto_ptr
23+
#include <memory> // std::unique_ptr
2424

2525
namespace dd {
2626

@@ -126,9 +126,9 @@ bool Base_collection::restore_items(
126126

127127
DBUG_ASSERT(is_empty());
128128

129-
std::auto_ptr<Object_key> key_holder(key);
129+
std::unique_ptr<Object_key> key_holder(key);
130130

131-
std::auto_ptr<Raw_record_set> rs;
131+
std::unique_ptr<Raw_record_set> rs;
132132
if (table->open_record_set(key, rs))
133133
DBUG_RETURN(true);
134134

@@ -228,7 +228,7 @@ bool Base_collection::drop_items(Open_dictionary_tables_ctx *otx,
228228
DBUG_ENTER("Base_collection::drop_items");
229229

230230
// Make sure key gets deleted
231-
std::auto_ptr<Object_key> key_holder(key);
231+
std::unique_ptr<Object_key> key_holder(key);
232232

233233
if (is_empty())
234234
DBUG_RETURN(false);
@@ -243,7 +243,7 @@ bool Base_collection::drop_items(Open_dictionary_tables_ctx *otx,
243243
DBUG_RETURN(true);
244244
}
245245

246-
std::auto_ptr<Raw_record_set> rs;
246+
std::unique_ptr<Raw_record_set> rs;
247247
if (table->open_record_set(key, rs))
248248
DBUG_RETURN(true);
249249

sql/dd/impl/dictionary_impl.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bool Dictionary_impl::init(bool install)
4848
if (Dictionary_impl::s_instance)
4949
return false; /* purecov: inspected */
5050

51-
std::auto_ptr<Dictionary_impl> d(new Dictionary_impl());
51+
std::unique_ptr<Dictionary_impl> d(new Dictionary_impl());
5252

5353
Dictionary_impl::s_instance= d.release();
5454

@@ -106,7 +106,7 @@ const Object_table *Dictionary_impl::get_dd_table(
106106
if (!is_dd_schema_name(schema_name))
107107
return NULL;
108108

109-
std::auto_ptr<Iterator<const Object_table> > it(
109+
std::unique_ptr<Iterator<const Object_table> > it(
110110
Object_table_registry::instance()->types());
111111

112112
for (const Object_table *t= it->next(); t != NULL; t= it->next())
@@ -124,7 +124,7 @@ bool Dictionary_impl::is_system_view_name(const std::string &schema_name,
124124
if (schema_name.compare("information_schema") != 0)
125125
return false;
126126

127-
std::auto_ptr<Iterator<const char> > it(
127+
std::unique_ptr<Iterator<const char> > it(
128128
System_view_name_registry::instance()->names());
129129

130130
while (true)

sql/dd/impl/dictionary_object_collection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ bool Dictionary_object_collection<Object_type>::fetch(
7575
// the record set is deleted before the transaction is committed (a
7676
// dependency in the Raw_record_set destructor.
7777
{
78-
std::auto_ptr<Raw_record_set> rs;
78+
std::unique_ptr<Raw_record_set> rs;
7979
if (table->open_record_set(object_key, rs))
8080
{
8181
DBUG_ASSERT(m_thd->is_error() || m_thd->killed);

sql/dd/impl/properties_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class Properties_impl : public Properties
269269
static const std::string EMPTY_STR;
270270

271271
private:
272-
std::auto_ptr<Properties::Map> m_map;
272+
std::unique_ptr<Properties::Map> m_map;
273273
};
274274

275275
///////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)