[ 
https://issues.apache.org/jira/browse/STDCXX-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12496150#action_12496150
 ] 

sebor edited comment on STDCXX-416 at 7/29/08 9:58 AM:
--------------------------------------------------------------

Outlining the virtual dtor in a separate translation unit will not only silence 
the warnings but it will also help reduce the size of translation units where 
the class is used:

{noformat}
$ # before outlining logic_error::~logic_error():
$ make t.o && ls -l t.o && nm t.o | c++filt
gcc -c -I/amd/devco/sebor/stdcxx-trunk/include/ansi   -pthread 
-I/amd/devco/sebor/stdcxx-trunk/include 
-I/build/sebor/stdcxx-gcc-3.3.3_43.31-12d-2/include 
-I/amd/devco/sebor/stdcxx-trunk/examples/include  -pedantic -nostdinc++ -O2   
-W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long 
-Wcast-align   t.cpp
-rw-r--r--  1 sebor devel 2644 May 15 13:03 t.o
00000000 T foo(int)
         U __rw::__rw_exception::__rw_exception(char const*)
         U __rw::__rw_exception::~__rw_exception()
         U __rw::__rw_exception::what() const
00000000 W std::logic_error::~logic_error()
00000000 W std::logic_error::~logic_error()
         U typeinfo for __rw::__rw_exception
00000000 V typeinfo for std::logic_error
00000000 V typeinfo name for std::logic_error
         U vtable for __cxxabiv1::__si_class_type_info
00000000 V vtable for std::logic_error
         U operator delete(void*)
         U __cxa_allocate_exception
         U __cxa_throw
         U __gxx_personality_v0

$ # after outlining logic_error::~logic_error():
$ make t.o && ls -l t.o && nm t.o | c++filt
gcc -c -I/amd/devco/sebor/stdcxx/include/ansi   -pthread 
-I/amd/devco/sebor/stdcxx/include 
-I/build/sebor/stdcxx-gcc-3.3.3_43.31-12d/include 
-I/amd/devco/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -O2   -W 
-Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align 
  t.cpp
-rw-r--r--  1 sebor devel 1476 2007-05-15 14:52 t.o
         U __cxa_allocate_exception
         U __cxa_throw
         U __gxx_personality_v0
00000000 T foo(int)
         U __rw::__rw_exception::__rw_exception(char const*)
         U std::logic_error::~logic_error()
         U typeinfo for std::logic_error
         U vtable for std::logic_error
{noformat}

      was (Author: sebor):
    Outlining the virtual dtor in a separate translation unit will not only 
silence the warnings but it will also help reduce the size of translation units 
where the class is used:

$ # before outlining logic_error::~logic_error():
$ make t.o && ls -l t.o && nm t.o | c++filt
gcc -c -I/amd/devco/sebor/stdcxx-trunk/include/ansi   -pthread 
-I/amd/devco/sebor/stdcxx-trunk/include 
-I/build/sebor/stdcxx-gcc-3.3.3_43.31-12d-2/include 
-I/amd/devco/sebor/stdcxx-trunk/examples/include  -pedantic -nostdinc++ -O2   
-W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long 
-Wcast-align   t.cpp
-rw-r--r--  1 sebor devel 2644 May 15 13:03 t.o
00000000 T foo(int)
         U __rw::__rw_exception::__rw_exception(char const*)
         U __rw::__rw_exception::~__rw_exception()
         U __rw::__rw_exception::what() const
00000000 W std::logic_error::~logic_error()
00000000 W std::logic_error::~logic_error()
         U typeinfo for __rw::__rw_exception
00000000 V typeinfo for std::logic_error
00000000 V typeinfo name for std::logic_error
         U vtable for __cxxabiv1::__si_class_type_info
00000000 V vtable for std::logic_error
         U operator delete(void*)
         U __cxa_allocate_exception
         U __cxa_throw
         U __gxx_personality_v0

$ # after outlining logic_error::~logic_error():
$ make t.o && ls -l t.o && nm t.o | c++filt
gcc -c -I/amd/devco/sebor/stdcxx/include/ansi   -pthread 
-I/amd/devco/sebor/stdcxx/include 
-I/build/sebor/stdcxx-gcc-3.3.3_43.31-12d/include 
-I/amd/devco/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -O2   -W 
-Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align 
  t.cpp
-rw-r--r--  1 sebor devel 1476 2007-05-15 14:52 t.o
         U __cxa_allocate_exception
         U __cxa_throw
         U __gxx_personality_v0
00000000 T foo(int)
         U __rw::__rw_exception::__rw_exception(char const*)
         U std::logic_error::~logic_error()
         U typeinfo for std::logic_error
         U vtable for std::logic_error

  
> std::logic_error::~logic_error() too big to be inlined in exception.cpp
> -----------------------------------------------------------------------
>
>                 Key: STDCXX-416
>                 URL: https://issues.apache.org/jira/browse/STDCXX-416
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 19. Diagnostics
>    Affects Versions: 4.1.3
>         Environment: gcc 3.3.3 (SuSE Linux)
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>            Priority: Minor
>             Fix For: 4.2.0
>
>
> We're getting tons of warnings while optimizing the library (exception.cpp) 
> with gcc 3.3.3 for logic_error dtor being too big to be inlined (see below).
> gcc -c -I$(TOPDIR)/include/ansi   -pthread -I$(TOPDIR)/include 
> -I$(BUILDDIR)/include  -pedantic -nostdinc++ -O2  -W -Wall -Wcast-qual 
> -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align  -fPIC  
> $(TOPDIR)/src/exception.cpp
> $(TOPDIR)/include/string: In member function `virtual 
> std::out_of_range::~out_of_range()':
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:689: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/src/exception.cpp:689: warning: called from here
> $(TOPDIR)/include/string: In member function `virtual 
> std::length_error::~length_error()':
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:686: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/src/exception.cpp:686: warning: called from here
> $(TOPDIR)/include/string: In function `void __rw::__rw_throw_exception(int, 
> char*)':
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:58: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:679: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:70: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:683: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:82: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:686: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:686: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:686: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:94: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:689: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:689: warning: called from here
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : --param large-function-growth limit 
> reached while inlining the caller
> $(TOPDIR)/include/string:689: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:679:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/include/stdexcept:58: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:679:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:679: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:682:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/include/stdexcept:70: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:683:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:683: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:686:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/include/stdexcept:82: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:686:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:686: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:686:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:686: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:686:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:686: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:689:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/include/stdexcept:94: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:689:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:689: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:689:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:689: warning: called from here
> In file included from $(TOPDIR)/src/exception.cpp:689:
> $(TOPDIR)/include/stdexcept:54: warning: inlining failed in call to 
> `std::logic_error::~logic_error()' : function not considered for inlining
> $(TOPDIR)/src/exception.cpp:689: warning: called from here

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to