List:Commits« Previous MessageNext Message »
From:Staale Smedseng Date:March 9 2010 6:34pm
Subject:bzr commit into mysql-5.1-bugteam branch (staale.smedseng:3375) Bug#49829
View as plain text  
#At file:///export/home/tmp/ss156133/z/49829-51/ based on revid:joro@stripped

 3375 Staale Smedseng	2010-03-09
      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.
      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.
     @ sql/field.cc
        Local scope variable or method argument same as class 
        attribute.
     @ sql/item_cmpfunc.cc
        Local scope variable or method argument same as class 
        attribute.
     @ sql/item_create.cc
        Renaming base class create() to create_func().
     @ sql/item_create.h
        Renaming base class create() to create_func().
     @ sql/protocol.cc
        Local scope variable or method argument same as class 
        attribute.
     @ sql/sql_profile.cc
        Local scope variable or method argument same as class 
        attribute.
     @ sql/sql_select.cc
        Local scope variable or method argument same as class 
        attribute.
     @ sql/sql_yacc.yy
        Renaming base class create() to create_func().
     @ storage/federated/ha_federated.cc
        Local scope variable or method argument same as class 
        attribute.
     @ storage/myisammrg/ha_myisammrg.cc
        Local scope variable or method argument same as class 
        attribute.

    modified:
      sql/field.cc
      sql/item.h
      sql/item_cmpfunc.cc
      sql/item_create.cc
      sql/item_create.h
      sql/item_sum.h
      sql/protocol.cc
      sql/sql_profile.cc
      sql/sql_select.cc
      sql/sql_yacc.yy
      storage/example/ha_example.h
      storage/federated/ha_federated.cc
      storage/myisammrg/ha_myisammrg.cc
=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-02-10 14:56:47 +0000
+++ b/sql/field.cc	2010-03-09 18:34:44 +0000
@@ -2944,16 +2944,16 @@ Field_new_decimal::unpack(uchar* to,
       a decimal and write that to the raw data buffer.
     */
     decimal_digit_t dec_buf[DECIMAL_MAX_PRECISION];
-    decimal_t dec;
-    dec.len= from_precision;
-    dec.buf= dec_buf;
+    decimal_t decimal;
+    decimal.len= from_precision;
+    decimal.buf= dec_buf;
     /*
       Note: bin2decimal does not change the length of the field. So it is
       just the first step the resizing operation. The second step does the
       resizing using the precision and decimals from the slave.
     */
-    bin2decimal((uchar *)from, &dec, from_precision, from_decimal);
-    decimal2bin(&dec, to, precision, decimals());
+    bin2decimal((uchar *)from, &decimal, from_precision, from_decimal);
+    decimal2bin(&decimal, to, precision, decimals());
   }
   else
     memcpy(to, from, len); // Sizes are the same, just copy the data.
@@ -6334,7 +6334,7 @@ check_string_copy_error(Field_str *field
 
   SYNOPSIS
     Field_longstr::report_if_important_data()
-    ptr                      - Truncated rest of string
+    src                      - Truncated rest of string
     end                      - End of truncated string
     count_spaces             - Treat traling spaces as important data
 
@@ -6350,12 +6350,12 @@ check_string_copy_error(Field_str *field
 */
 
 int
-Field_longstr::report_if_important_data(const char *ptr, const char *end,
+Field_longstr::report_if_important_data(const char *src, const char *end,
                                         bool count_spaces)
 {
-  if ((ptr < end) && table->in_use->count_cuted_fields)
+  if ((src < end) && table->in_use->count_cuted_fields)
   {
-    if (test_if_important_data(field_charset, ptr, end))
+    if (test_if_important_data(field_charset, src, end))
     {
       if (table->in_use->abort_on_warning)
         set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
@@ -7008,9 +7008,8 @@ const uint Field_varstring::MAX_SIZE= UI
 */
 int Field_varstring::do_save_field_metadata(uchar *metadata_ptr)
 {
-  char *ptr= (char *)metadata_ptr;
   DBUG_ASSERT(field_length <= 65535);
-  int2store(ptr, field_length);
+  int2store((char*)metadata_ptr, field_length);
   return 2;
 }
 

=== modified file 'sql/item.h'
--- a/sql/item.h	2010-02-06 19:54:30 +0000
+++ b/sql/item.h	2010-03-09 18:34:44 +0000
@@ -3015,6 +3015,7 @@ public:
   Item_cache_int(enum_field_types field_type_arg):
     Item_cache(field_type_arg), value(0) {}
 
+  using Item_cache::store;
   void store(Item *item, longlong val_arg);
   double val_real();
   longlong val_int();

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2010-02-26 13:16:46 +0000
+++ b/sql/item_cmpfunc.cc	2010-03-09 18:34:44 +0000
@@ -1022,12 +1022,12 @@ bool Arg_comparator::try_year_cmp_func(I
   @return cache item or original value.
 */
 
-Item** Arg_comparator::cache_converted_constant(THD *thd, Item **value,
+Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
                                                 Item **cache_item,
                                                 Item_result type)
 {
   /* Don't need cache if doing context analysis only. */
-  if (!thd->is_context_analysis_only() &&
+  if (!thd_arg->is_context_analysis_only() &&
       (*value)->const_item() && type != (*value)->result_type())
   {
     Item_cache *cache= Item_cache::get_cache(*value, type);
@@ -1368,12 +1368,12 @@ int Arg_comparator::compare_real()
 
 int Arg_comparator::compare_decimal()
 {
-  my_decimal value1;
-  my_decimal *val1= (*a)->val_decimal(&value1);
+  my_decimal decimal1;
+  my_decimal *val1= (*a)->val_decimal(&decimal1);
   if (!(*a)->null_value)
   {
-    my_decimal value2;
-    my_decimal *val2= (*b)->val_decimal(&value2);
+    my_decimal decimal2;
+    my_decimal *val2= (*b)->val_decimal(&decimal2);
     if (!(*b)->null_value)
     {
       if (set_null)
@@ -1397,9 +1397,9 @@ int Arg_comparator::compare_e_real()
 
 int Arg_comparator::compare_e_decimal()
 {
-  my_decimal value1, value2;
-  my_decimal *val1= (*a)->val_decimal(&value1);
-  my_decimal *val2= (*b)->val_decimal(&value2);
+  my_decimal decimal1, decimal2;
+  my_decimal *val1= (*a)->val_decimal(&decimal1);
+  my_decimal *val2= (*b)->val_decimal(&decimal2);
   if ((*a)->null_value || (*b)->null_value)
     return test((*a)->null_value && (*b)->null_value);
   return test(my_decimal_cmp(val1, val2) == 0);
@@ -5402,11 +5402,11 @@ void Item_equal::merge(Item_equal *item)
   members follow in a wrong order they are swapped. This is performed
   again and again until we get all members in a right order.
 
-  @param cmp          function to compare field item
+  @param compare      function to compare field item
   @param arg          context extra parameter for the cmp function
 */
 
-void Item_equal::sort(Item_field_cmpfunc cmp, void *arg)
+void Item_equal::sort(Item_field_cmpfunc compare, void *arg)
 {
   bool swap;
   List_iterator<Item_field> it(fields);
@@ -5420,7 +5420,7 @@ void Item_equal::sort(Item_field_cmpfunc
     while ((item2= it++))
     {
       Item_field **ref2= it.ref();
-      if (cmp(item1, item2, arg) < 0)
+      if (compare(item1, item2, arg) < 0)
       {
         Item_field *item= *ref1;
         *ref1= *ref2;

=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc	2010-01-13 09:00:03 +0000
+++ b/sql/item_create.cc	2010-03-09 18:34:44 +0000
@@ -42,7 +42,7 @@
 class Create_native_func : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     Builder method, with no arguments.
@@ -69,7 +69,7 @@ protected:
 class Create_func_arg0 : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     Builder method, with no arguments.
@@ -93,7 +93,7 @@ protected:
 class Create_func_arg1 : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     Builder method, with one argument.
@@ -118,7 +118,7 @@ protected:
 class Create_func_arg2 : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     Builder method, with two arguments.
@@ -144,7 +144,7 @@ protected:
 class Create_func_arg3 : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     Builder method, with three arguments.
@@ -194,7 +194,7 @@ protected:
 class Create_func_no_geom : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /** Singleton. */
   static Create_func_no_geom s_singleton;
@@ -2315,7 +2315,7 @@ static bool has_named_parameters(List<It
 Create_func_no_geom Create_func_no_geom::s_singleton;
 
 Item*
-Create_func_no_geom::create(THD * /* unused */,
+Create_func_no_geom::create_func(THD * /* unused */,
                             LEX_STRING /* unused */,
                             List<Item> * /* unused */)
 {
@@ -2328,7 +2328,7 @@ Create_func_no_geom::create(THD * /* unu
 
 
 Item*
-Create_qfunc::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_qfunc::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   LEX_STRING db;
 
@@ -2361,7 +2361,7 @@ Create_qfunc::create(THD *thd, LEX_STRIN
 Create_udf_func Create_udf_func::s_singleton;
 
 Item*
-Create_udf_func::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_udf_func::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   udf_func *udf= find_udf(name.str, name.length);
   DBUG_ASSERT(udf);
@@ -2512,7 +2512,7 @@ Create_sp_func::create(THD *thd, LEX_STR
 
 
 Item*
-Create_native_func::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_native_func::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   if (has_named_parameters(item_list))
   {
@@ -2525,7 +2525,7 @@ Create_native_func::create(THD *thd, LEX
 
 
 Item*
-Create_func_arg0::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_func_arg0::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   int arg_count= 0;
 
@@ -2543,7 +2543,7 @@ Create_func_arg0::create(THD *thd, LEX_S
 
 
 Item*
-Create_func_arg1::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_func_arg1::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   int arg_count= 0;
 
@@ -2569,7 +2569,7 @@ Create_func_arg1::create(THD *thd, LEX_S
 
 
 Item*
-Create_func_arg2::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_func_arg2::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   int arg_count= 0;
 
@@ -2597,7 +2597,7 @@ Create_func_arg2::create(THD *thd, LEX_S
 
 
 Item*
-Create_func_arg3::create(THD *thd, LEX_STRING name, List<Item> *item_list)
+Create_func_arg3::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
 {
   int arg_count= 0;
 

=== modified file 'sql/item_create.h'
--- a/sql/item_create.h	2007-08-15 13:43:08 +0000
+++ b/sql/item_create.h	2010-03-09 18:34:44 +0000
@@ -53,7 +53,7 @@ public:
     @param item_list The list of arguments to the function, can be NULL
     @return An item representing the parsed function call, or NULL
   */
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
 
 protected:
   /** Constructor */
@@ -80,7 +80,7 @@ public:
     @param item_list The list of arguments to the function, can be NULL
     @return An item representing the parsed function call
   */
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     The builder create method, for qualified functions.
@@ -127,7 +127,7 @@ extern Create_qfunc * find_qualified_fun
 class Create_udf_func : public Create_func
 {
 public:
-  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
+  virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
 
   /**
     The builder create method, for User Defined Functions.

=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h	2009-11-17 14:06:46 +0000
+++ b/sql/item_sum.h	2010-03-09 18:34:44 +0000
@@ -843,6 +843,7 @@ protected:
     was_values(item->was_values)
   { }
   bool fix_fields(THD *, Item **);
+  using Item_sum::setup; 
   void setup(Item *item, Item *value_arg);
   void clear();
   double val_real();

=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc	2009-10-13 18:21:42 +0000
+++ b/sql/protocol.cc	2010-03-09 18:34:44 +0000
@@ -525,9 +525,9 @@ void Protocol::init(THD *thd_arg)
   for the error.
 */
 
-void Protocol::end_partial_result_set(THD *thd)
+void Protocol::end_partial_result_set(THD *thd_arg)
 {
-  net_send_eof(thd, thd->server_status, 0 /* no warnings, we're inside SP */);
+  net_send_eof(thd_arg, thd_arg->server_status, 0 /* no warnings, we're inside SP */);
 }
 
 

=== modified file 'sql/sql_profile.cc'
--- a/sql/sql_profile.cc	2009-07-16 12:43:17 +0000
+++ b/sql/sql_profile.cc	2010-03-09 18:34:44 +0000
@@ -485,7 +485,7 @@ void PROFILING::set_query_source(char *q
   There are two ways to get to this function:  Selecting from the information
   schema, and a SHOW command.
 */
-int PROFILING::fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond)
+int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond)
 {
   DBUG_ENTER("PROFILING::fill_statistics_info");
   TABLE *table= tables->table;
@@ -520,7 +520,7 @@ int PROFILING::fill_statistics_info(THD 
       /* Skip the first.  We count spans of fence, not fence-posts. */
       if (previous == NULL) continue;
 
-      if (thd->lex->sql_command == SQLCOM_SHOW_PROFILE)
+      if (thd_arg->lex->sql_command == SQLCOM_SHOW_PROFILE)
       {
         /*
           We got here via a SHOW command.  That means that we stored
@@ -533,14 +533,14 @@ int PROFILING::fill_statistics_info(THD 
           struct where and having conditions at the SQL layer, then this
           condition should be ripped out.
         */
-        if (thd->lex->profile_query_id == 0) /* 0 == show final query */
+        if (thd_arg->lex->profile_query_id == 0) /* 0 == show final query */
         {
           if (query != last)
             continue;
         }
         else
         {
-          if (thd->lex->profile_query_id != query->profiling_query_id)
+          if (thd_arg->lex->profile_query_id != query->profiling_query_id)
             continue;
         }
       }
@@ -661,7 +661,7 @@ int PROFILING::fill_statistics_info(THD 
         table->field[17]->set_notnull();
       }
 
-      if (schema_table_store_record(thd, table))
+      if (schema_table_store_record(thd_arg, table))
         DBUG_RETURN(1);
 
     }

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-03-05 19:45:55 +0000
+++ b/sql/sql_select.cc	2010-03-09 18:34:44 +0000
@@ -5845,7 +5845,7 @@ store_val_in_field(Field *field, Item *i
   @retval TRUE        error occurred
 */
 bool
-JOIN::make_simple_join(JOIN *parent, TABLE *tmp_table)
+JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
 {
   DBUG_ENTER("JOIN::make_simple_join");
 
@@ -5858,7 +5858,7 @@ JOIN::make_simple_join(JOIN *parent, TAB
     DBUG_RETURN(TRUE);                        /* purecov: inspected */
 
   join_tab= parent->join_tab_reexec;
-  table= &parent->table_reexec[0]; parent->table_reexec[0]= tmp_table;
+  table= &parent->table_reexec[0]; parent->table_reexec[0]= temp_table;
   tables= 1;
   const_tables= 0;
   const_table_map= 0;
@@ -5878,7 +5878,7 @@ JOIN::make_simple_join(JOIN *parent, TAB
   do_send_rows= row_limit ? 1 : 0;
 
   join_tab->cache.buff=0;			/* No caching */
-  join_tab->table=tmp_table;
+  join_tab->table=temp_table;
   join_tab->select=0;
   join_tab->select_cond=0;
   join_tab->quick=0;
@@ -5895,8 +5895,8 @@ JOIN::make_simple_join(JOIN *parent, TAB
   join_tab->join= this;
   join_tab->ref.key_parts= 0;
   bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
-  tmp_table->status=0;
-  tmp_table->null_row=0;
+  temp_table->status=0;
+  temp_table->null_row=0;
   DBUG_RETURN(FALSE);
 }
 

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2010-02-26 13:16:46 +0000
+++ b/sql/sql_yacc.yy	2010-03-09 18:34:44 +0000
@@ -8013,7 +8013,7 @@ function_call_generic:
             builder= find_native_function_builder(thd, $1);
             if (builder)
             {
-              item= builder->create(thd, $1, $4);
+              item= builder->create_func(thd, $1, $4);
             }
             else
             {
@@ -8035,7 +8035,7 @@ function_call_generic:
               {
                 builder= find_qualified_function_builder(thd);
                 DBUG_ASSERT(builder);
-                item= builder->create(thd, $1, $4);
+                item= builder->create_func(thd, $1, $4);
               }
             }
 

=== modified file 'storage/example/ha_example.h'
--- a/storage/example/ha_example.h	2007-08-13 13:11:25 +0000
+++ b/storage/example/ha_example.h	2010-03-09 18:34:44 +0000
@@ -156,6 +156,7 @@ public:
     This method will never be called if you do not implement indexes.
   */
   virtual double read_time(ha_rows rows) { return (double) rows /  20.0+1; }
+  using handler::read_time;
 
   /*
     Everything below are methods that we implement in ha_example.cc.

=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc	2010-03-05 10:51:37 +0000
+++ b/storage/federated/ha_federated.cc	2010-03-09 18:34:44 +0000
@@ -1253,7 +1253,7 @@ bool ha_federated::create_where_from_key
                                          const key_range *start_key,
                                          const key_range *end_key,
                                          bool from_records_in_range,
-                                         bool eq_range)
+                                         bool eq_range_arg)
 {
   bool both_not_null=
     (start_key != NULL && end_key != NULL) ? TRUE : FALSE;
@@ -1360,7 +1360,7 @@ bool ha_federated::create_where_from_key
         }
         break;
       case HA_READ_AFTER_KEY:
-        if (eq_range)
+        if (eq_range_arg)
         {
           if (tmp.append("1=1"))                // Dummy
             goto err;
@@ -3208,14 +3208,14 @@ bool ha_federated::get_error_message(int
   @details    Call @c mysql_store_result() to save a result set then
               append it to the stored results array.
 
-  @param[in]  mysql  MySLQ connection structure.
+  @param[in]  mysql_arg  MySLQ connection structure.
 
   @return     Stored result set (MYSQL_RES object).
 */
 
-MYSQL_RES *ha_federated::store_result(MYSQL *mysql)
+MYSQL_RES *ha_federated::store_result(MYSQL *mysql_arg)
 {
-  MYSQL_RES *result= mysql_store_result(mysql);
+  MYSQL_RES *result= mysql_store_result(mysql_arg);
   DBUG_ENTER("ha_federated::store_result");
   if (result)
   {

=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc	2010-02-02 13:17:58 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc	2010-03-09 18:34:44 +0000
@@ -393,24 +393,24 @@ static MI_INFO *myisammrg_attach_childre
   @detail This function initializes the MERGE storage engine structures
     and adds a child list of TABLE_LIST to the parent TABLE.
 
-  @param[in]    name            MERGE table path name
-  @param[in]    mode            read/write mode, unused
-  @param[in]    test_if_locked  open flags
+  @param[in]    name                MERGE table path name
+  @param[in]    mode                read/write mode, unused
+  @param[in]    test_if_locked_arg  open flags
 
   @return       status
-    @retval     0               OK
-    @retval     -1              Error, my_errno gives reason
+    @retval     0                   OK
+    @retval     -1                  Error, my_errno gives reason
 */
 
 int ha_myisammrg::open(const char *name, int mode __attribute__((unused)),
-                       uint test_if_locked)
+                       uint test_if_locked_arg)
 {
   DBUG_ENTER("ha_myisammrg::open");
   DBUG_PRINT("myrg", ("name: '%s'  table: 0x%lx", name, (long) table));
-  DBUG_PRINT("myrg", ("test_if_locked: %u", test_if_locked));
+  DBUG_PRINT("myrg", ("test_if_locked_arg: %u", test_if_locked_arg));
 
   /* Save for later use. */
-  this->test_if_locked= test_if_locked;
+  test_if_locked= test_if_locked_arg;
 
   /* retrieve children table list. */
   my_errno= 0;


Attachment: [text/bzr-bundle] bzr/staale.smedseng@sun.com-20100309183444-10i17ywc6j04kpgn.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (staale.smedseng:3375) Bug#49829Staale Smedseng9 Mar