Bug #49829 Many "hides virtual function" warnings with SunStudio
Submitted: 19 Dec 2009 18:01 Modified: 18 Jun 2010 1:17
Reporter: Vladislav Vaintroub Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1, mysql-next-mr, 6.0-codebase-bugfixing OS:Solaris
Assigned to: Staale Smedseng CPU Architecture:Any

[19 Dec 2009 18:01] Vladislav Vaintroub
Description:
There is a sheer number of warnings "a hides the virtual function b" when compiling with SunStudio compiler since recently. The warnings are typically originated from item.h and item_<something>.h

The meaning of the warning is explained in 
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9

How to repeat:
Compile mysql-next-mr with SunStudio

Suggested fix:
?
[21 Dec 2009 9:35] Sveta Smirnova
Thank you for the report.

Verified as described.

One of examples:

"../../sql/item.h", line 2401: Warning: Item_ref::basic_const_item hides the virtual function Item::basic_const_item() const.
"../../sql/item.h", line 3124: Warning: Item_cache_int::store hides the virtual function Item_cache::store(Item*).
"../../sql/item.h", line 3282: Warning: Item_cache_datetime::store hides the virtual function Item_cache::store(Item*).
3 Warning(s) detected.
"../../sql/item.h", line 2401: Warning: Item_ref::basic_const_item hides the virtual function Item::basic_const_item() const.
"../../sql/item_sum.h", line 1008: Warning: Item_sum_hybrid::setup hides the virtual function Item_sum::setup(THD*).
"../../sql/item_strfunc.h", line 385: Warning: Item_func_encode::transform hides the virtual function Item_func::transform(Item*(Item::*)(unsigned char*), unsigned char*).
"../../sql/item.h", line 3124: Warning: Item_cache_int::store hides the virtual function Item_cache::store(Item*).
"../../sql/item.h", line 3282: Warning: Item_cache_datetime::store hides the virtual function Item_cache::store(Item*).
5 Warning(s) detected.
[22 Dec 2009 18:25] Konstantin Osipov
The pasted warnings are in the optimizer code.
[9 Mar 2010 18:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102772

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.
[10 Mar 2010 16:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102914

3388 Staale Smedseng	2010-03-10
      Bug #49829 Many "hides virtual function" warnings with
      SunStudio
      
      [Same as first patch, but with one added fix for a case 
      of local scope variable hiding member attribute. Also
      rewrote the "using" clauses to avoid any compiler 
      compatibility problems.]
     @ 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.
[14 Mar 2010 16:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103162

3399 Staale Smedseng	2010-03-14
      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.
     @ 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.
[26 Mar 2010 8:23] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100326080914-2pz8ns984e0spu03) (version source revid:alexey.kopytov@sun.com-20100320202342-3oapaq7r0t6qhexq) (merge vers: 5.5.3-m2) (pib:16)
[26 Mar 2010 8:27] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100326081116-m3v4l34yhr43mtsv) (version source revid:alik@sun.com-20100325072612-4sds00ix8ajo1e84) (pib:16)
[26 Mar 2010 8:31] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100326081944-qja07qklw1p2w7jb) (version source revid:alik@sun.com-20100325073410-4t4i9gu2u1pge7xb) (merge vers: 6.0.14-alpha) (pib:16)
[27 Mar 2010 16:22] Paul DuBois
Cosmetic changes, no user-visible impact. No changelog entry needed.
[6 Apr 2010 7:57] Bugs System
Pushed into 5.1.46 (revid:sergey.glukhov@sun.com-20100405111026-7kz1p8qlzglqgfmu) (version source revid:staale.smedseng@sun.com-20100314160145-9hrpex246gbrtb3a) (merge vers: 5.1.46) (pib:16)
[6 Apr 2010 14:18] Paul DuBois
No changelog entry needed.
[31 May 2010 11:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/109604

3078 Tor Didriksen	2010-05-31
      Bug #49829 Many "hides virtual function" warnings with SunStudio
      
      Backport from mysql-pe (of those parts which have not been upmerged from 5.1)
     @ sql/field.cc
        Local scope variable or method argument same as class attribute.
     @ sql/item.cc
        Rename auto variable to avoid name clash.
     @ sql/item.h
        Item_ref::basic_const_item had wrong signature (missing const)
        and was thus never called.
     @ sql/partition_info.cc
        Rename, to avoid name clashes.
     @ sql/sql_load.cc
        Rename, to avoid name clashes.
[31 May 2010 11:02] Tor Didriksen
Backport missing parts from mysql-pe, and push into trunk-bugfixing.
[15 Jun 2010 8:10] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100615080459-smuswd9ooeywcxuc) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (merge vers: 5.1.47) (pib:16)
[15 Jun 2010 8:25] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615080558-cw01bzdqr1bdmmec) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (pib:16)
[17 Jun 2010 5:23] MC Brown
No changelog entry needed.
[17 Jun 2010 11:54] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:32] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609211156-tsac5qhw951miwtt) (merge vers: 5.1.46-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:20] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)