Skip to content

Commit dd8e539

Browse files
committed
Bug#24296291: FIX -WUNUSED-PARAMETER WARNINGS
Patch #2: Fix unused parameter warnings when building archive SE.
1 parent a7bdd35 commit dd8e539

24 files changed

+394
-326
lines changed

include/sql_string.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ class String
191191
m_is_alloced(false)
192192
{ }
193193
static void *operator new(size_t size, MEM_ROOT *mem_root,
194-
const std::nothrow_t &arg= std::nothrow) throw ()
194+
const std::nothrow_t &arg MY_ATTRIBUTE((unused))
195+
= std::nothrow) throw ()
195196
{ return alloc_root(mem_root, size); }
196197
static void operator delete(void *ptr_arg, size_t size)
197198
{
@@ -201,7 +202,7 @@ class String
201202
}
202203

203204
static void operator delete(void *, MEM_ROOT *,
204-
const std::nothrow_t &arg) throw ()
205+
const std::nothrow_t &) throw ()
205206
{ /* never called */ }
206207

207208
~String() { mem_free(); }

sql/field.h

+56-39
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ class Field: public Proto_field, public Sql_alloc
962962
Useful only for variable length datatypes where it's overloaded.
963963
By default assume the length is constant.
964964
*/
965-
virtual uint32 data_length(uint row_offset= 0) { return pack_length(); }
965+
virtual uint32 data_length(uint row_offset MY_ATTRIBUTE((unused))= 0)
966+
{ return pack_length(); }
966967
virtual uint32 sort_length() const { return pack_length(); }
967968

968969
/**
@@ -1018,7 +1019,7 @@ class Field: public Proto_field, public Sql_alloc
10181019
Since this interface relies on the caller to truncate the value according to this
10191020
Field's scale, it will work with all constructs that we currently allow.
10201021
*/
1021-
virtual void store_timestamp(const timeval *tm) { DBUG_ASSERT(false); }
1022+
virtual void store_timestamp(const timeval*) { DBUG_ASSERT(false); }
10221023

10231024
virtual void set_default()
10241025
{
@@ -1072,18 +1073,20 @@ class Field: public Proto_field, public Sql_alloc
10721073
return type();
10731074
}
10741075
inline int cmp(const uchar *str) { return cmp(ptr,str); }
1075-
virtual int cmp_max(const uchar *a, const uchar *b, uint max_len)
1076-
{ return cmp(a, b); }
1076+
virtual int cmp_max(const uchar *a, const uchar *b,
1077+
uint max_len MY_ATTRIBUTE((unused)))
1078+
{ return cmp(a, b); }
10771079
virtual int cmp(const uchar *,const uchar *)=0;
1078-
virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L)
1080+
virtual int cmp_binary(const uchar *a,const uchar *b,
1081+
uint32 max_length MY_ATTRIBUTE((unused))=~0L)
10791082
{ return memcmp(a,b,pack_length()); }
10801083
virtual int cmp_offset(uint row_offset)
10811084
{ return cmp(ptr,ptr+row_offset); }
10821085
virtual int cmp_binary_offset(uint row_offset)
10831086
{ return cmp_binary(ptr, ptr+row_offset); };
10841087
virtual int key_cmp(const uchar *a,const uchar *b)
10851088
{ return cmp(a, b); }
1086-
virtual int key_cmp(const uchar *str, uint length)
1089+
virtual int key_cmp(const uchar *str, uint length MY_ATTRIBUTE((unused)))
10871090
{ return cmp(ptr,str); }
10881091
virtual uint decimals() const { return 0; }
10891092
virtual bool is_text_key_type() const { return false; }
@@ -1307,10 +1310,10 @@ class Field: public Proto_field, public Sql_alloc
13071310
m_null_ptr= ADD_TO_PTR(m_null_ptr, ptr_diff, uchar*);
13081311
}
13091312

1310-
virtual void get_image(uchar *buff, size_t length, const CHARSET_INFO *cs)
1313+
virtual void get_image(uchar *buff, size_t length, const CHARSET_INFO*)
13111314
{ memcpy(buff, ptr, length); }
13121315

1313-
virtual void set_image(const uchar *buff, size_t length, const CHARSET_INFO *cs)
1316+
virtual void set_image(const uchar *buff, size_t length, const CHARSET_INFO*)
13141317
{ memcpy(ptr, buff, length); }
13151318

13161319

@@ -1340,7 +1343,8 @@ class Field: public Proto_field, public Sql_alloc
13401343
Number of copied bytes (excluding padded zero bytes -- see above).
13411344
*/
13421345

1343-
virtual size_t get_key_image(uchar *buff, size_t length, imagetype type)
1346+
virtual size_t get_key_image(uchar *buff, size_t length,
1347+
imagetype type MY_ATTRIBUTE((unused)))
13441348
{
13451349
get_image(buff, length, &my_charset_bin);
13461350
return length;
@@ -1435,7 +1439,7 @@ class Field: public Proto_field, public Sql_alloc
14351439
virtual enum Derivation derivation(void) const
14361440
{ return DERIVATION_IMPLICIT; }
14371441
virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; }
1438-
virtual void set_derivation(enum Derivation derivation_arg) { }
1442+
virtual void set_derivation(enum Derivation) { }
14391443

14401444
/**
14411445
Produce warning or note about data saved into field.
@@ -1553,7 +1557,8 @@ class Field: public Proto_field, public Sql_alloc
15531557
}
15541558

15551559
/* Validate the value stored in a field */
1556-
virtual type_conversion_status validate_stored_val(THD *thd)
1560+
virtual type_conversion_status
1561+
validate_stored_val(THD *thd MY_ATTRIBUTE((unused)))
15571562
{ return TYPE_OK; }
15581563

15591564
/* Hash value */
@@ -1620,12 +1625,14 @@ class Field: public Proto_field, public Sql_alloc
16201625
16211626
@returns 0 no bytes written.
16221627
*/
1623-
virtual int do_save_field_metadata(uchar *metadata_ptr)
1628+
virtual int
1629+
do_save_field_metadata(uchar *metadata_ptr MY_ATTRIBUTE((unused)))
16241630
{ return 0; }
16251631

16261632
protected:
16271633
static void handle_int16(uchar *to, const uchar *from,
1628-
bool low_byte_first_from, bool low_byte_first_to)
1634+
bool low_byte_first_from MY_ATTRIBUTE((unused)),
1635+
bool low_byte_first_to MY_ATTRIBUTE((unused)))
16291636
{
16301637
int16 val;
16311638
#ifdef WORDS_BIGENDIAN
@@ -1644,7 +1651,8 @@ class Field: public Proto_field, public Sql_alloc
16441651
}
16451652

16461653
static void handle_int24(uchar *to, const uchar *from,
1647-
bool low_byte_first_from, bool low_byte_first_to)
1654+
bool low_byte_first_from MY_ATTRIBUTE((unused)),
1655+
bool low_byte_first_to MY_ATTRIBUTE((unused)))
16481656
{
16491657
int32 val;
16501658
#ifdef WORDS_BIGENDIAN
@@ -1670,7 +1678,8 @@ class Field: public Proto_field, public Sql_alloc
16701678
Helper function to pack()/unpack() int32 values
16711679
*/
16721680
static void handle_int32(uchar *to, const uchar *from,
1673-
bool low_byte_first_from, bool low_byte_first_to)
1681+
bool low_byte_first_from MY_ATTRIBUTE((unused)),
1682+
bool low_byte_first_to MY_ATTRIBUTE((unused)))
16741683
{
16751684
int32 val;
16761685
#ifdef WORDS_BIGENDIAN
@@ -1692,7 +1701,8 @@ class Field: public Proto_field, public Sql_alloc
16921701
Helper function to pack()/unpack() int64 values
16931702
*/
16941703
static void handle_int64(uchar* to, const uchar *from,
1695-
bool low_byte_first_from, bool low_byte_first_to)
1704+
bool low_byte_first_from MY_ATTRIBUTE((unused)),
1705+
bool low_byte_first_to MY_ATTRIBUTE((unused)))
16961706
{
16971707
int64 val;
16981708
#ifdef WORDS_BIGENDIAN
@@ -1789,12 +1799,8 @@ class Field_num :public Field {
17891799
bool get_time(MYSQL_TIME *ltime);
17901800
uint is_equal(const Create_field *new_field);
17911801
uint row_pack_length() const { return pack_length(); }
1792-
uint32 pack_length_from_metadata(uint field_metadata) {
1793-
uint32 length= pack_length();
1794-
DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
1795-
field_metadata, length));
1796-
return length;
1797-
}
1802+
uint32 pack_length_from_metadata(uint field_metadata MY_ATTRIBUTE((unused)))
1803+
{ return pack_length(); }
17981804
type_conversion_status check_int(const CHARSET_INFO *cs,
17991805
const char *str, size_t length,
18001806
const char *int_end, int error);
@@ -2054,14 +2060,16 @@ class Field_tiny :public Field_num {
20542060
return new Field_tiny(*this);
20552061
}
20562062
virtual uchar *pack(uchar* to, const uchar *from,
2057-
uint max_length, bool low_byte_first)
2063+
uint max_length MY_ATTRIBUTE((unused)),
2064+
bool low_byte_first MY_ATTRIBUTE((unused)))
20582065
{
20592066
*to= *from;
20602067
return to + 1;
20612068
}
20622069

20632070
virtual const uchar *unpack(uchar* to, const uchar *from,
2064-
uint param_data, bool low_byte_first)
2071+
uint param_data MY_ATTRIBUTE((unused)),
2072+
bool low_byte_first MY_ATTRIBUTE((unused)))
20652073
{
20662074
*to= *from;
20672075
return from + 1;
@@ -2116,13 +2124,15 @@ class Field_short :public Field_num {
21162124
return new Field_short(*this);
21172125
}
21182126
virtual uchar *pack(uchar* to, const uchar *from,
2119-
uint max_length, bool low_byte_first)
2127+
uint max_length MY_ATTRIBUTE((unused)),
2128+
bool low_byte_first)
21202129
{
21212130
return pack_int16(to, from, low_byte_first);
21222131
}
21232132

21242133
virtual const uchar *unpack(uchar* to, const uchar *from,
2125-
uint param_data, bool low_byte_first)
2134+
uint param_data MY_ATTRIBUTE((unused)),
2135+
bool low_byte_first)
21262136
{
21272137
return unpack_int16(to, from, low_byte_first);
21282138
}
@@ -2460,19 +2470,24 @@ class Field_null :public Field_str {
24602470
auto_flags_arg, field_name_arg, cs)
24612471
{}
24622472
enum_field_types type() const { return MYSQL_TYPE_NULL;}
2463-
type_conversion_status store(const char *to, size_t length,
2464-
const CHARSET_INFO *cs)
2473+
type_conversion_status store(const char*, size_t,
2474+
const CHARSET_INFO*)
24652475
{
24662476
null[0]= 1;
24672477
return TYPE_OK;
24682478
}
2469-
type_conversion_status store(double nr) { null[0]=1; return TYPE_OK; }
2470-
type_conversion_status store(longlong nr, bool unsigned_val)
2479+
type_conversion_status store(double)
24712480
{
24722481
null[0]=1;
24732482
return TYPE_OK;
24742483
}
2475-
type_conversion_status store_decimal(const my_decimal *d)
2484+
type_conversion_status store(longlong,
2485+
bool unsigned_val MY_ATTRIBUTE((unused)))
2486+
{
2487+
null[0]=1;
2488+
return TYPE_OK;
2489+
}
2490+
type_conversion_status store_decimal(const my_decimal *)
24762491
{
24772492
null[0]=1;
24782493
return TYPE_OK;
@@ -2481,10 +2496,10 @@ class Field_null :public Field_str {
24812496
double val_real(void) { return 0.0;}
24822497
longlong val_int(void) { return 0;}
24832498
my_decimal *val_decimal(my_decimal *) { return 0; }
2484-
String *val_str(String *value,String *value2)
2499+
String *val_str(String*, String *value2)
24852500
{ value2->length(0); return value2;}
2486-
int cmp(const uchar *a, const uchar *b) { return 0;}
2487-
void make_sort_key(uchar *buff, size_t length) {}
2501+
int cmp(const uchar*, const uchar*) { return 0;}
2502+
void make_sort_key(uchar*, size_t) {}
24882503
uint32 pack_length() const { return 0; }
24892504
void sql_type(String &str) const;
24902505
uint32 max_display_length() { return 4; }
@@ -2623,7 +2638,7 @@ class Field_temporal :public Field {
26232638
@param thd THD
26242639
@retval sql_mode flags mixed with the field type flags.
26252640
*/
2626-
virtual my_time_flags_t date_flags(const THD *thd)
2641+
virtual my_time_flags_t date_flags(const THD *thd MY_ATTRIBUTE((unused)))
26272642
{
26282643
return 0;
26292644
}
@@ -3943,7 +3958,7 @@ class Field_geom :public Field_blob {
39433958
field_name_arg, share, blob_pack_length, &my_charset_bin)
39443959
{ geom_type= geom_type_arg; }
39453960
Field_geom(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
3946-
TABLE_SHARE *share, enum geometry_type geom_type_arg)
3961+
enum geometry_type geom_type_arg)
39473962
:Field_blob(len_arg, maybe_null_arg, field_name_arg, &my_charset_bin, false)
39483963
{ geom_type= geom_type_arg; }
39493964
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
@@ -4135,7 +4150,9 @@ class Field_enum :public Field_str {
41354150
{ return (field_metadata & 0x00ff); }
41364151
uint row_pack_length() const { return pack_length(); }
41374152
virtual bool zero_pack() const { return 0; }
4138-
bool optimize_range(uint idx, uint part) { return 0; }
4153+
bool optimize_range(uint idx MY_ATTRIBUTE((unused)),
4154+
uint part MY_ATTRIBUTE((unused)))
4155+
{ return 0; }
41394156
bool eq_def(Field *field);
41404157
bool has_charset(void) const { return TRUE; }
41414158
/* enum and set are sorted as integers */
@@ -4260,8 +4277,8 @@ class Field_bit :public Field {
42604277
{ return cmp_binary((uchar *) a, (uchar *) b); }
42614278
int key_cmp(const uchar *str, uint length);
42624279
int cmp_offset(uint row_offset);
4263-
void get_image(uchar *buff, size_t length, const CHARSET_INFO *cs)
4264-
{ get_key_image(buff, length, itRAW); }
4280+
void get_image(uchar *buff, size_t length, const CHARSET_INFO *)
4281+
{ get_key_image(buff, length, itRAW); }
42654282
void set_image(const uchar *buff, size_t length, const CHARSET_INFO *cs)
42664283
{ Field_bit::store((char *) buff, length, cs); }
42674284
size_t get_key_image(uchar *buff, size_t length, imagetype type);

0 commit comments

Comments
 (0)