[Bug c++/64875] -Winline does not report C++ methods

2017-08-22 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64875

Eric Gallager  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-08-22
 CC||egallager at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |daniel.gutson at intel 
dot com
 Ever confirmed|0   |1

--- Comment #3 from Eric Gallager  ---
(In reply to Daniel Gutson from comment #0)
> The following code misses the warning:
> 
> #include 
> 
> struct PP
> {
>   inline void m();
> };
> 
> int main()
> {
>   PP pp;
>   pp.m();
> }
> 
> inline void PP::m()
> {
>   std::cout << "hola" << std::endl;
> }
> 
> Invoke:
>   g++ -Wall -Wextra -pedantic -ggdb3 -std=c++11 -Winline winline.cpp
> No warnings emitted.
> 
> However:
> 
> objdump -dC ./a.out |grep "PP"
>   40086c: e8 59 00 00 00  callq  4008ca 
> 004008ca :
> 
> If no one is available, assign this to me (though I'm not sure when I will
> have time to address this).

OK.

(In reply to Daniel Gutson from comment #2)
> inline is as useful in c++ as in C regardless of ODR or any other reason but
> its original purpose: performance. I want to know when my hint is not honored
> which is the exact intent of this warning.

If you use an optimization flag the 'inline' is honored:

$ /usr/local/bin/g++ -Wall -Wextra -pedantic -ggdb3 -std=c++11 -Winline -o
64975_O0.exe 64975.cc
$ objdump -dC ./64975_O0.exe | grep "PP"
1e88:   e8 b3 11 00 00  call   3040 <_ZN2PP1mEv$stub>
1f0e :
3040 <_ZN2PP1mEv$stub>:
$ /usr/local/bin/g++ -Wall -Wextra -pedantic -ggdb3 -std=c++11 -Winline -O1 -o
64975_O1.exe 64975.cc
$ objdump -dC ./64975_O1.exe | grep "PP"

So maybe mention optimizing in the warning if you add one.

[Bug c++/64875] -Winline does not report C++ methods

2015-01-30 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64875

--- Comment #1 from Jonathan Wakely redi at gcc dot gnu.org ---
I don't think this warning is very relevant to C++.

In C++ 'inline' is more useful for telling the compiler that the function may
be defined in mutiple translation units, and that is typically more important
than whether it is actually inlined or not.


[Bug c++/64875] -Winline does not report C++ methods

2015-01-30 Thread daniel.gutson at tallertechnologies dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64875

--- Comment #2 from Daniel Gutson daniel.gutson at tallertechnologies dot com 
---
inline is as useful in c++ as in C regardless of ODR or any other reason but
its original purpose: performance.I want to know when my hint is not honored
which is the exact intent of this warning.