Skip to content

Commit 3f4d8ed

Browse files
author
Staale Smedseng
committed
Bug #49829 Many "hides virtual function" warnings with
SunStudio SunStudio compilers of late warn about methods that might hide methods in base classes due to the use of overloading combined with overriding. SunStudio also warns about variables defined in local socpe or method arguments that have the same name as a member attribute of the class. This patch renames methods that might hide base class methods, to make it easier both for humans and compilers to see what is actually called. It also renames variables in local scope.
1 parent 0e94511 commit 3f4d8ed

16 files changed

Lines changed: 128 additions & 127 deletions

sql/field.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -2944,16 +2944,16 @@ Field_new_decimal::unpack(uchar* to,
29442944
a decimal and write that to the raw data buffer.
29452945
*/
29462946
decimal_digit_t dec_buf[DECIMAL_MAX_PRECISION];
2947-
decimal_t dec;
2948-
dec.len= from_precision;
2949-
dec.buf= dec_buf;
2947+
decimal_t dec_val;
2948+
dec_val.len= from_precision;
2949+
dec_val.buf= dec_buf;
29502950
/*
29512951
Note: bin2decimal does not change the length of the field. So it is
29522952
just the first step the resizing operation. The second step does the
29532953
resizing using the precision and decimals from the slave.
29542954
*/
2955-
bin2decimal((uchar *)from, &dec, from_precision, from_decimal);
2956-
decimal2bin(&dec, to, precision, decimals());
2955+
bin2decimal((uchar *)from, &dec_val, from_precision, from_decimal);
2956+
decimal2bin(&dec_val, to, precision, decimals());
29572957
}
29582958
else
29592959
memcpy(to, from, len); // Sizes are the same, just copy the data.
@@ -6334,7 +6334,7 @@ check_string_copy_error(Field_str *field,
63346334
63356335
SYNOPSIS
63366336
Field_longstr::report_if_important_data()
6337-
ptr - Truncated rest of string
6337+
pstr - Truncated rest of string
63386338
end - End of truncated string
63396339
count_spaces - Treat traling spaces as important data
63406340
@@ -6350,12 +6350,12 @@ check_string_copy_error(Field_str *field,
63506350
*/
63516351

63526352
int
6353-
Field_longstr::report_if_important_data(const char *ptr, const char *end,
6353+
Field_longstr::report_if_important_data(const char *pstr, const char *end,
63546354
bool count_spaces)
63556355
{
6356-
if ((ptr < end) && table->in_use->count_cuted_fields)
6356+
if ((pstr < end) && table->in_use->count_cuted_fields)
63576357
{
6358-
if (test_if_important_data(field_charset, ptr, end))
6358+
if (test_if_important_data(field_charset, pstr, end))
63596359
{
63606360
if (table->in_use->abort_on_warning)
63616361
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
@@ -7008,9 +7008,8 @@ const uint Field_varstring::MAX_SIZE= UINT_MAX16;
70087008
*/
70097009
int Field_varstring::do_save_field_metadata(uchar *metadata_ptr)
70107010
{
7011-
char *ptr= (char *)metadata_ptr;
70127011
DBUG_ASSERT(field_length <= 65535);
7013-
int2store(ptr, field_length);
7012+
int2store((char*)metadata_ptr, field_length);
70147013
return 2;
70157014
}
70167015

sql/item.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -3028,6 +3028,7 @@ class Item_cache_int: public Item_cache
30283028
Item_cache_int(enum_field_types field_type_arg):
30293029
Item_cache(field_type_arg), value(0) {}
30303030

3031+
virtual void store(Item *item){ Item_cache::store(item); }
30313032
void store(Item *item, longlong val_arg);
30323033
double val_real();
30333034
longlong val_int();

sql/item_cmpfunc.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2006 MySQL AB
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -1022,12 +1022,12 @@ bool Arg_comparator::try_year_cmp_func(Item_result type)
10221022
@return cache item or original value.
10231023
*/
10241024

1025-
Item** Arg_comparator::cache_converted_constant(THD *thd, Item **value,
1025+
Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
10261026
Item **cache_item,
10271027
Item_result type)
10281028
{
10291029
/* Don't need cache if doing context analysis only. */
1030-
if (!thd->is_context_analysis_only() &&
1030+
if (!thd_arg->is_context_analysis_only() &&
10311031
(*value)->const_item() && type != (*value)->result_type())
10321032
{
10331033
Item_cache *cache= Item_cache::get_cache(*value, type);
@@ -1368,12 +1368,12 @@ int Arg_comparator::compare_real()
13681368

13691369
int Arg_comparator::compare_decimal()
13701370
{
1371-
my_decimal value1;
1372-
my_decimal *val1= (*a)->val_decimal(&value1);
1371+
my_decimal decimal1;
1372+
my_decimal *val1= (*a)->val_decimal(&decimal1);
13731373
if (!(*a)->null_value)
13741374
{
1375-
my_decimal value2;
1376-
my_decimal *val2= (*b)->val_decimal(&value2);
1375+
my_decimal decimal2;
1376+
my_decimal *val2= (*b)->val_decimal(&decimal2);
13771377
if (!(*b)->null_value)
13781378
{
13791379
if (set_null)
@@ -1397,9 +1397,9 @@ int Arg_comparator::compare_e_real()
13971397

13981398
int Arg_comparator::compare_e_decimal()
13991399
{
1400-
my_decimal value1, value2;
1401-
my_decimal *val1= (*a)->val_decimal(&value1);
1402-
my_decimal *val2= (*b)->val_decimal(&value2);
1400+
my_decimal decimal1, decimal2;
1401+
my_decimal *val1= (*a)->val_decimal(&decimal1);
1402+
my_decimal *val2= (*b)->val_decimal(&decimal2);
14031403
if ((*a)->null_value || (*b)->null_value)
14041404
return test((*a)->null_value && (*b)->null_value);
14051405
return test(my_decimal_cmp(val1, val2) == 0);
@@ -5402,11 +5402,11 @@ void Item_equal::merge(Item_equal *item)
54025402
members follow in a wrong order they are swapped. This is performed
54035403
again and again until we get all members in a right order.
54045404
5405-
@param cmp function to compare field item
5405+
@param compare function to compare field item
54065406
@param arg context extra parameter for the cmp function
54075407
*/
54085408

5409-
void Item_equal::sort(Item_field_cmpfunc cmp, void *arg)
5409+
void Item_equal::sort(Item_field_cmpfunc compare, void *arg)
54105410
{
54115411
bool swap;
54125412
List_iterator<Item_field> it(fields);
@@ -5420,7 +5420,7 @@ void Item_equal::sort(Item_field_cmpfunc cmp, void *arg)
54205420
while ((item2= it++))
54215421
{
54225422
Item_field **ref2= it.ref();
5423-
if (cmp(item1, item2, arg) < 0)
5423+
if (compare(item1, item2, arg) < 0)
54245424
{
54255425
Item_field *item= *ref1;
54265426
*ref1= *ref2;

sql/item_cmpfunc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2003 MySQL AB
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -1616,7 +1616,7 @@ class Item_equal: public Item_bool_func
16161616
longlong val_int();
16171617
const char *func_name() const { return "multiple equal"; }
16181618
optimize_type select_optimize() const { return OPTIMIZE_EQUAL; }
1619-
void sort(Item_field_cmpfunc cmp, void *arg);
1619+
void sort(Item_field_cmpfunc compare, void *arg);
16201620
friend class Item_equal_iterator;
16211621
void fix_length_and_dec();
16221622
bool fix_fields(THD *thd, Item **ref);

sql/item_create.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2003 MySQL AB
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@
4242
class Create_native_func : public Create_func
4343
{
4444
public:
45-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
45+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
4646

4747
/**
4848
Builder method, with no arguments.
@@ -69,7 +69,7 @@ class Create_native_func : public Create_func
6969
class Create_func_arg0 : public Create_func
7070
{
7171
public:
72-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
72+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
7373

7474
/**
7575
Builder method, with no arguments.
@@ -93,7 +93,7 @@ class Create_func_arg0 : public Create_func
9393
class Create_func_arg1 : public Create_func
9494
{
9595
public:
96-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
96+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
9797

9898
/**
9999
Builder method, with one argument.
@@ -118,7 +118,7 @@ class Create_func_arg1 : public Create_func
118118
class Create_func_arg2 : public Create_func
119119
{
120120
public:
121-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
121+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
122122

123123
/**
124124
Builder method, with two arguments.
@@ -144,7 +144,7 @@ class Create_func_arg2 : public Create_func
144144
class Create_func_arg3 : public Create_func
145145
{
146146
public:
147-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
147+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
148148

149149
/**
150150
Builder method, with three arguments.
@@ -194,7 +194,7 @@ class Create_sp_func : public Create_qfunc
194194
class Create_func_no_geom : public Create_func
195195
{
196196
public:
197-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
197+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
198198

199199
/** Singleton. */
200200
static Create_func_no_geom s_singleton;
@@ -2315,7 +2315,7 @@ static bool has_named_parameters(List<Item> *params)
23152315
Create_func_no_geom Create_func_no_geom::s_singleton;
23162316

23172317
Item*
2318-
Create_func_no_geom::create(THD * /* unused */,
2318+
Create_func_no_geom::create_func(THD * /* unused */,
23192319
LEX_STRING /* unused */,
23202320
List<Item> * /* unused */)
23212321
{
@@ -2328,7 +2328,7 @@ Create_func_no_geom::create(THD * /* unused */,
23282328

23292329

23302330
Item*
2331-
Create_qfunc::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2331+
Create_qfunc::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
23322332
{
23332333
LEX_STRING db;
23342334

@@ -2361,7 +2361,7 @@ Create_qfunc::create(THD *thd, LEX_STRING name, List<Item> *item_list)
23612361
Create_udf_func Create_udf_func::s_singleton;
23622362

23632363
Item*
2364-
Create_udf_func::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2364+
Create_udf_func::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
23652365
{
23662366
udf_func *udf= find_udf(name.str, name.length);
23672367
DBUG_ASSERT(udf);
@@ -2512,7 +2512,7 @@ Create_sp_func::create(THD *thd, LEX_STRING db, LEX_STRING name,
25122512

25132513

25142514
Item*
2515-
Create_native_func::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2515+
Create_native_func::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
25162516
{
25172517
if (has_named_parameters(item_list))
25182518
{
@@ -2525,7 +2525,7 @@ Create_native_func::create(THD *thd, LEX_STRING name, List<Item> *item_list)
25252525

25262526

25272527
Item*
2528-
Create_func_arg0::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2528+
Create_func_arg0::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
25292529
{
25302530
int arg_count= 0;
25312531

@@ -2543,7 +2543,7 @@ Create_func_arg0::create(THD *thd, LEX_STRING name, List<Item> *item_list)
25432543

25442544

25452545
Item*
2546-
Create_func_arg1::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2546+
Create_func_arg1::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
25472547
{
25482548
int arg_count= 0;
25492549

@@ -2569,7 +2569,7 @@ Create_func_arg1::create(THD *thd, LEX_STRING name, List<Item> *item_list)
25692569

25702570

25712571
Item*
2572-
Create_func_arg2::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2572+
Create_func_arg2::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
25732573
{
25742574
int arg_count= 0;
25752575

@@ -2597,7 +2597,7 @@ Create_func_arg2::create(THD *thd, LEX_STRING name, List<Item> *item_list)
25972597

25982598

25992599
Item*
2600-
Create_func_arg3::create(THD *thd, LEX_STRING name, List<Item> *item_list)
2600+
Create_func_arg3::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
26012601
{
26022602
int arg_count= 0;
26032603

sql/item_create.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2006 MySQL AB
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ class Create_func
5353
@param item_list The list of arguments to the function, can be NULL
5454
@return An item representing the parsed function call, or NULL
5555
*/
56-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
56+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
5757

5858
protected:
5959
/** Constructor */
@@ -80,7 +80,7 @@ class Create_qfunc : public Create_func
8080
@param item_list The list of arguments to the function, can be NULL
8181
@return An item representing the parsed function call
8282
*/
83-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
83+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
8484

8585
/**
8686
The builder create method, for qualified functions.
@@ -127,7 +127,7 @@ extern Create_qfunc * find_qualified_function_builder(THD *thd);
127127
class Create_udf_func : public Create_func
128128
{
129129
public:
130-
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
130+
virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
131131

132132
/**
133133
The builder create method, for User Defined Functions.

sql/item_sum.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2003 MySQL AB
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -647,7 +647,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
647647
default:
648648
DBUG_ASSERT(0);
649649
};
650-
setup(args[0], NULL);
650+
setup_hybrid(args[0], NULL);
651651
/* MIN/MAX can return NULL for empty set indepedent of the used column */
652652
maybe_null= 1;
653653
unsigned_flag=item->unsigned_flag;
@@ -681,7 +681,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
681681
of the original MIN/MAX object and it is saved in this object's cache.
682682
*/
683683

684-
void Item_sum_hybrid::setup(Item *item, Item *value_arg)
684+
void Item_sum_hybrid::setup_hybrid(Item *item, Item *value_arg)
685685
{
686686
value= Item_cache::get_cache(item);
687687
value->setup(item);
@@ -1651,7 +1651,7 @@ void Item_sum_hybrid::no_rows_in_result()
16511651
Item *Item_sum_min::copy_or_same(THD* thd)
16521652
{
16531653
Item_sum_min *item= new (thd->mem_root) Item_sum_min(thd, this);
1654-
item->setup(args[0], value);
1654+
item->setup_hybrid(args[0], value);
16551655
return item;
16561656
}
16571657

@@ -1674,7 +1674,7 @@ bool Item_sum_min::add()
16741674
Item *Item_sum_max::copy_or_same(THD* thd)
16751675
{
16761676
Item_sum_max *item= new (thd->mem_root) Item_sum_max(thd, this);
1677-
item->setup(args[0], value);
1677+
item->setup_hybrid(args[0], value);
16781678
return item;
16791679
}
16801680

sql/item_sum.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2000-2006 MySQL AB
1+
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -353,7 +353,7 @@ class Item_sum :public Item_result_field
353353
*/
354354
void no_rows_in_result() { clear(); }
355355

356-
virtual bool setup(THD *thd) {return 0;}
356+
virtual bool setup(THD* thd) {return 0;}
357357
virtual void make_unique() {}
358358
Item *get_tmp_table_item(THD *thd);
359359
virtual Field *create_tmp_field(bool group, TABLE *table,
@@ -843,7 +843,7 @@ class Item_sum_hybrid :public Item_sum
843843
was_values(item->was_values)
844844
{ }
845845
bool fix_fields(THD *, Item **);
846-
void setup(Item *item, Item *value_arg);
846+
void setup_hybrid(Item *item, Item *value_arg);
847847
void clear();
848848
double val_real();
849849
longlong val_int();

0 commit comments

Comments
 (0)