g++-3.3 -Winline warns about functions that cannot/should not be inlined
>Submitter-Id: net
>Originator: Thomas Richter
>Organization:
>Confidential: no
>Synopsis: g++-3.3 -Winline broken
>Severity: serious
>Priority: medium
>Category: c++
>Class: sw-bug
>Release: 3.3 20030509 (Debian prerelease)
>Environment:
System: Linux skywise 2.4.20 #7 Thu May 15 19:53:29 CEST 2003 i686 unknown
Architecture: i686
<machine, os, target, libraries (multiple lines)>
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux
>Description:
g++-3.3 -Winline generates warnings for functions it cannot inline
that it shouldn't even try to inline because they are neither declared
as "inline", nor defined in the class body.
>How-To-Repeat:
Save the following as "main.cpp"
/* snip */
#include "foo.hpp"
int main(int,char)
{
return foo();
}
/* snip */
Save the following as "foo.hpp"
/* snip */
int foo(void);
/* snip */
Save the following as "foo.cpp"
/* snip */
int foo(void)
{
return 0;
}
/* snip */
Then compile with
$ g++-3.3 -O3 -Winline main.cpp new.cpp
Result is a useless warning that int foo(void) could not be inlined.
(Correct, but supposed not to be inline-able).
>Fix:
Avoid "-Winline"
Reply to: