Skip to content

Commit 227dc6e

Browse files
committed
Bug#24296291: FIX -WUNUSED-PARAMETER WARNINGS
Patch #14: Fix -Wunused-parameter warnings in new DD.
1 parent c42b90e commit 227dc6e

31 files changed

+98
-122
lines changed

sql-common/client_authentication.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
mysql_mutex_t g_public_key_mutex;
4646
#endif
4747

48-
int sha256_password_init(char *a, size_t b, int c, va_list d)
48+
int sha256_password_init(char *, size_t, int, va_list)
4949
{
5050
#if !defined(HAVE_YASSL)
5151
mysql_mutex_init(0,&g_public_key_mutex, MY_MUTEX_INIT_SLOW);

sql/dd/dd_table.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ dd::String_type get_sql_type_by_create_field(TABLE *table,
263263
used by the I_S queries only.
264264
For others, default value can be obtained from the columns.default_values.
265265
266-
@param[in] thd Thread handle.
267266
@param[in] buf Default value buffer.
268267
@param[in] table Table object.
269268
@param[in] field Field information.
@@ -276,8 +275,7 @@ dd::String_type get_sql_type_by_create_field(TABLE *table,
276275
column is nullptr.
277276
*/
278277

279-
static void prepare_default_value_string(THD *thd,
280-
uchar *buf,
278+
static void prepare_default_value_string(uchar *buf,
281279
TABLE *table,
282280
const Create_field &field,
283281
dd::Column *col_obj,
@@ -758,7 +756,7 @@ fill_dd_columns_from_create_fields(THD *thd,
758756
prepared in prepare_default_value() is used.
759757
*/
760758
String def_val;
761-
prepare_default_value_string(thd, buf, &table, *field, col_obj, &def_val);
759+
prepare_default_value_string(buf, &table, *field, col_obj, &def_val);
762760
if (def_val.ptr() != nullptr)
763761
col_obj->set_default_value_utf8(dd::String_type(def_val.ptr(),
764762
def_val.length()));

sql/dd/dd_trigger.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ get_dd_action_timing(const ::Trigger *new_trigger)
117117
/**
118118
Fill in a dd::Trigger object based on a Trigger object supplied by sql-layer.
119119
120-
@param [in] thd thread handle
121120
@param [in] new_trigger Trigger object supplied by sql-layer
122121
@param [out] dd_trig_obj dd::Trigger object to fill in
123122
@@ -126,7 +125,7 @@ get_dd_action_timing(const ::Trigger *new_trigger)
126125
@retval false Success
127126
*/
128127

129-
static bool fill_in_dd_trigger_object(THD *thd, const ::Trigger *new_trigger,
128+
static bool fill_in_dd_trigger_object(const ::Trigger *new_trigger,
130129
Trigger *dd_trig_obj)
131130
{
132131
dd_trig_obj->set_name(String_type(new_trigger->get_trigger_name().str,
@@ -258,7 +257,7 @@ bool create_trigger(THD *thd, const ::Trigger *new_trigger,
258257
// by the dd::cache::Dictionary_client::add_trigger.
259258
DBUG_RETURN(true);
260259

261-
if (fill_in_dd_trigger_object(thd, new_trigger, dd_trig_obj))
260+
if (fill_in_dd_trigger_object(new_trigger, dd_trig_obj))
262261
DBUG_RETURN(true);
263262

264263
/*

sql/dd/dd_upgrade.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3495,7 +3495,7 @@ bool find_files_with_metadata(THD *thd, const char *dbname,
34953495
Scans datadir for databases and lists all the database names.
34963496
*/
34973497

3498-
bool find_schema_from_datadir(THD *thd, std::vector<String_type> *db_name)
3498+
bool find_schema_from_datadir(std::vector<String_type> *db_name)
34993499
{
35003500
MY_DIR *a;
35013501
uint i;

sql/dd/dd_upgrade.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ bool find_files_with_metadata(THD *thd, const char *dbname,
6565
Find all the directories inside data directory. Every directory will be
6666
treated as a schema. These directories are in filename-encoded form.
6767
68-
@param[in] thd Thread handle.
6968
@param[out] db_name An std::vector containing all database name.
7069
7170
@retval false ON SUCCESS
7271
@retval true ON FAILURE
7372
*/
74-
bool find_schema_from_datadir(THD *thd, std::vector<String_type> *db_name);
73+
bool find_schema_from_datadir(std::vector<String_type> *db_name);
7574

7675
/**
7776
Create entry in mysql.schemata for all the folders found in data directory.

sql/dd/impl/bootstrapper.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ bool store_single_schema_table_meta_data(THD *thd,
261261
false on success
262262
true when fails to store the metadata.
263263
*/
264-
bool store_schema_table_meta_data(THD *thd, plugin_ref plugin, void *unused)
264+
bool store_schema_table_meta_data(THD *thd, plugin_ref plugin, void*)
265265
{
266266
// Fetch schema ID of IS schema.
267267
const dd::Schema *IS_schema_obj= nullptr;
@@ -863,7 +863,7 @@ bool sync_meta_data(THD *thd)
863863

864864
// Get the synced DD schema object id. Needed for the DD table name keys.
865865
Object_id dd_schema_id= cache::Storage_adapter::instance()->
866-
core_get_id<Schema>(thd, schema_key);
866+
core_get_id<Schema>(schema_key);
867867

868868
// Sync the DD tables.
869869
for (System_tables::Const_iterator it= System_tables::instance()->begin();
@@ -1038,7 +1038,7 @@ bool verify_core_objects_present(THD *thd)
10381038
Schema::name_key_type schema_key;
10391039
Schema::update_name_key(&schema_key, MYSQL_SCHEMA_NAME.str);
10401040
Object_id dd_schema_id= cache::Storage_adapter::instance()->
1041-
core_get_id<Schema>(thd, schema_key);
1041+
core_get_id<Schema>(schema_key);
10421042

10431043
DBUG_ASSERT(dd_schema_id != INVALID_OBJECT_ID);
10441044
if (dd_schema_id == INVALID_OBJECT_ID)
@@ -1067,7 +1067,7 @@ bool verify_core_objects_present(THD *thd)
10671067
Table::update_name_key(&table_key, dd_schema_id,
10681068
(*it)->entity()->name());
10691069
Object_id dd_table_id= cache::Storage_adapter::instance()->
1070-
core_get_id<Table>(thd, table_key);
1070+
core_get_id<Table>(table_key);
10711071

10721072
DBUG_ASSERT(dd_table_id != INVALID_OBJECT_ID);
10731073
if (dd_table_id == INVALID_OBJECT_ID)
@@ -1085,7 +1085,7 @@ bool verify_core_objects_present(THD *thd)
10851085
Tablespace::name_key_type tspace_key;
10861086
Tablespace::update_name_key(&tspace_key, MYSQL_TABLESPACE_NAME.str);
10871087
Object_id dd_tspace_id= cache::Storage_adapter::instance()->
1088-
core_get_id<Tablespace>(thd, tspace_key);
1088+
core_get_id<Tablespace>(tspace_key);
10891089
#endif
10901090

10911091
/*
@@ -1493,7 +1493,7 @@ bool upgrade_fill_dd_and_finalize(THD *thd)
14931493
std::vector<dd::String_type> db_name;
14941494
std::vector<dd::String_type>::iterator it;
14951495

1496-
if (find_schema_from_datadir(thd, &db_name))
1496+
if (find_schema_from_datadir(&db_name))
14971497
{
14981498
delete_dictionary_and_cleanup(thd);
14991499
return true;

sql/dd/impl/cache/dictionary_client.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class MDL_checker
394394

395395
public:
396396
// Releasing arbitrary dictionary objects is not checked.
397-
static bool is_release_locked(THD *thd, const dd::Dictionary_object *object)
397+
static bool is_release_locked(THD*, const dd::Dictionary_object*)
398398
{ return true; }
399399

400400
// Reading a table object should be governed by MDL_SHARED.
@@ -506,7 +506,7 @@ class MDL_checker
506506

507507
// Check if the component is hidden.
508508
template <typename T>
509-
bool is_component_hidden(dd::Raw_record *r)
509+
bool is_component_hidden(dd::Raw_record*)
510510
{ return false; }
511511

512512
template <>

sql/dd/impl/cache/storage_adapter.cc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ size_t Storage_adapter::core_size()
8383

8484
// Get a dictionary object id from core storage.
8585
template <typename T>
86-
Object_id Storage_adapter::core_get_id(THD *thd,
87-
const typename T::name_key_type &key)
86+
Object_id Storage_adapter::core_get_id(const typename T::name_key_type &key)
8887
{
8988
Cache_element<typename T::cache_partition_type> *element= nullptr;
9089
Mutex_lock lock(&m_lock);
@@ -100,7 +99,7 @@ Object_id Storage_adapter::core_get_id(THD *thd,
10099

101100
// Get a dictionary object from core storage.
102101
template <typename K, typename T>
103-
void Storage_adapter::core_get(THD *thd, const K &key, const T **object)
102+
void Storage_adapter::core_get(const K &key, const T **object)
104103
{
105104
DBUG_ASSERT(object);
106105
*object= nullptr;
@@ -126,7 +125,7 @@ bool Storage_adapter::get(THD *thd,
126125
DBUG_ASSERT(object);
127126
*object= nullptr;
128127

129-
instance()->core_get(thd, key, object);
128+
instance()->core_get(key, object);
130129
if (*object || s_use_fake_storage)
131130
return false;
132131

@@ -419,23 +418,20 @@ template bool Storage_adapter::core_sync(THD *,
419418
const Schema*);
420419

421420
template Object_id Storage_adapter::core_get_id<Table>(
422-
THD *,
423421
const Table::name_key_type &);
424422
template Object_id Storage_adapter::core_get_id<Schema>(
425-
THD *,
426423
const Schema::name_key_type &);
427424
template Object_id Storage_adapter::core_get_id<Tablespace>(
428-
THD *,
429425
const Tablespace::name_key_type &);
430426

431427
template
432-
void Storage_adapter::core_get(THD*,
428+
void Storage_adapter::core_get(
433429
dd::Item_name_key const&, const dd::Schema**);
434430
template
435-
void Storage_adapter::core_get<dd::Item_name_key, dd::Abstract_table>(THD*,
431+
void Storage_adapter::core_get<dd::Item_name_key, dd::Abstract_table>(
436432
dd::Item_name_key const&, const dd::Abstract_table**);
437433
template
438-
void Storage_adapter::core_get<dd::Global_name_key, dd::Tablespace>(THD*,
434+
void Storage_adapter::core_get<dd::Global_name_key, dd::Tablespace>(
439435
dd::Global_name_key const&, const dd::Tablespace**);
440436

441437
template Object_id Storage_adapter::next_oid<Abstract_table>();
@@ -572,12 +568,12 @@ template bool Storage_adapter::store(THD *, Tablespace*);
572568
*/
573569

574570
template <>
575-
void Storage_adapter::core_get(THD*, const Table_stat::name_key_type&,
571+
void Storage_adapter::core_get(const Table_stat::name_key_type&,
576572
const Table_stat**)
577573
{ }
578574

579575
template <>
580-
void Storage_adapter::core_get(THD*, const Index_stat::name_key_type&,
576+
void Storage_adapter::core_get(const Index_stat::name_key_type&,
581577
const Index_stat**)
582578
{ }
583579

sql/dd/impl/cache/storage_adapter.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ friend class dd_cache_unittest::CacheStorageTest;
9696
9797
@tparam K Key type.
9898
@tparam T Dictionary object type.
99-
@param thd Thread context.
10099
@param key Key for which to get the object.
101100
@param [out] object Object retrieved, possibly nullptr if not present.
102101
*/
103102

104103
template <typename K, typename T>
105-
void core_get(THD *thd, const K &key, const T **object);
104+
void core_get(const K &key, const T **object);
106105

107106

108107
Object_registry m_core_registry; // Object registry storing core DD objects.
@@ -142,13 +141,12 @@ friend class dd_cache_unittest::CacheStorageTest;
142141
Get a dictionary object id from core storage.
143142
144143
@tparam T Dictionary object type.
145-
@param thd Thread context.
146144
@param key Name key for which to get the object id.
147145
@return Object id, INVALID_OBJECT_ID if the object is not present.
148146
*/
149147

150148
template <typename T>
151-
Object_id core_get_id(THD *thd, const typename T::name_key_type &key);
149+
Object_id core_get_id(const typename T::name_key_type &key);
152150

153151

154152
/**

sql/dd/impl/sdi.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ namespace sdi {
153153
*/
154154

155155
template <class DDT>
156-
inline bool store(THD *thd, const DDT *ddo)
156+
inline bool store(THD *thd MY_ATTRIBUTE((unused)),
157+
const DDT *ddo MY_ATTRIBUTE((unused)))
157158
{
158159
return false;
159160
}
@@ -225,7 +226,8 @@ bool store(THD *thd, const Tablespace *ts);
225226
*/
226227

227228
template <class DDT>
228-
inline bool drop(THD *thd, const DDT*)
229+
inline bool drop(THD *thd MY_ATTRIBUTE((unused)),
230+
const DDT*)
229231
{
230232
return false;
231233
}
@@ -297,7 +299,9 @@ bool drop(THD *thd, const Tablespace *ts);
297299
*/
298300

299301
template <class DDT>
300-
inline bool drop_after_update(THD *thd, const DDT *old_ddo, const DDT *new_ddo)
302+
inline bool drop_after_update(THD *thd MY_ATTRIBUTE((unused)),
303+
const DDT *old_ddo MY_ATTRIBUTE((unused)),
304+
const DDT *new_ddo MY_ATTRIBUTE((unused)))
301305
{
302306
return false;
303307
}

sql/dd/impl/sdi_file.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ make_dir_pattern_tuple(const LEX_STRING &path, const LEX_CSTRING &schema_name)
189189
}
190190

191191

192-
bool expand_sdi_pattern(THD *thd, const Dir_pat_tuple &dpt,
192+
bool expand_sdi_pattern(const Dir_pat_tuple &dpt,
193193
dd::sdi_file::Paths_type *paths)
194194
{
195195
const char *dir_beg= dpt.dir.c_str();
@@ -293,12 +293,12 @@ String_type sdi_filename(const dd::Entity_object *eo,
293293
return String_type(path);
294294
}
295295

296-
bool store(THD *thd, const MYSQL_LEX_CSTRING &sdi, const dd::Schema *schema)
296+
bool store(THD*, const MYSQL_LEX_CSTRING &sdi, const dd::Schema *schema)
297297
{
298298
return checked_return(write_sdi_file(sdi_filename(schema, ""), sdi));
299299
}
300300

301-
bool store(THD *thd, handlerton*, const MYSQL_LEX_CSTRING &sdi, const dd::Table *table,
301+
bool store(THD*, handlerton*, const MYSQL_LEX_CSTRING &sdi, const dd::Table *table,
302302
const dd::Schema *schema)
303303
{
304304
return checked_return(write_sdi_file(sdi_filename(table,
@@ -327,20 +327,20 @@ static bool remove_sdi_file_if_exists(const String_type &fname)
327327
return checked_return(remove(fname));
328328
}
329329

330-
bool remove(THD *thd, const dd::Schema *schema)
330+
bool remove(THD*, const dd::Schema *schema)
331331
{
332332
String_type sdi_fname= sdi_filename(schema, "");
333333
return checked_return(remove_sdi_file_if_exists(sdi_fname));
334334
}
335335

336-
bool remove(THD *thd, handlerton*, const dd::Table *table,
336+
bool remove(THD*, handlerton*, const dd::Table *table,
337337
const dd::Schema *schema)
338338
{
339339
String_type sdi_fname= sdi_filename(table, schema->name());
340340
return checked_return(remove_sdi_file_if_exists(sdi_fname));
341341
}
342342

343-
bool load(THD *thd, const dd::String_type &fname,
343+
bool load(THD*, const dd::String_type &fname,
344344
dd::String_type *buf)
345345
{
346346
File sdi_fd= mysql_file_open(key_file_sdi, fname.c_str(), O_RDONLY,
@@ -379,7 +379,7 @@ bool load(THD *thd, const dd::String_type &fname,
379379
bool expand_pattern(THD *thd, const LEX_STRING &pattern, Paths_type *paths)
380380
{
381381
auto dpt= make_dir_pattern_tuple(pattern, thd->db());
382-
if (expand_sdi_pattern(thd, dpt, paths))
382+
if (expand_sdi_pattern(dpt, paths))
383383
{
384384
return true;
385385
}

sql/dd/impl/types/foreign_key_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Foreign_key_impl : public Entity_object_impl,
8686
void debug_print(String_type &outb) const;
8787

8888
public:
89-
void set_ordinal_position(uint ordinal_position)
89+
void set_ordinal_position(uint)
9090
{ }
9191

9292
virtual uint ordinal_position() const

sql/dd/impl/types/index_element_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Index_element_impl : public Weak_object_impl,
127127
virtual void set_length(uint length)
128128
{ m_length= length; }
129129

130-
virtual void set_length_null(bool is_null)
130+
virtual void set_length_null(bool)
131131
{ m_length= (uint) -1; }
132132

133133
virtual bool is_length_null() const

sql/dd/impl/types/object_table_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Object_table_impl : virtual public Object_table
7878
return Dictionary_impl::instance()->get_actual_dd_version(thd);
7979
}
8080

81-
virtual bool populate(THD *thd) const
81+
virtual bool populate(THD*) const
8282
{ return false; }
8383

8484
virtual bool hidden() const

sql/dd/impl/types/partition_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Partition_impl : public Entity_object_impl,
8484

8585
void debug_print(String_type &outb) const;
8686

87-
void set_ordinal_position(uint ordinal_position)
87+
void set_ordinal_position(uint)
8888
{ }
8989

9090
virtual uint ordinal_position() const

sql/dd/impl/types/partition_index_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Partition_index_impl : public Weak_object_impl,
7676

7777
void debug_print(String_type &outb) const;
7878

79-
void set_ordinal_position(uint ordinal_position)
79+
void set_ordinal_position(uint)
8080
{ }
8181

8282
virtual uint ordinal_position() const

sql/dd/impl/types/partition_value_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Partition_value_impl : public Weak_object_impl,
8282

8383
bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val);
8484

85-
void set_ordinal_position(uint ordinal_position)
85+
void set_ordinal_position(uint)
8686
{ }
8787

8888
virtual uint ordinal_position() const

0 commit comments

Comments
 (0)