public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Feature request: smarter warning about inlining of vararg functions
@ 1998-08-17  5:04 C. van Reeuwijk
  0 siblings, 0 replies; only message in thread
From: C. van Reeuwijk @ 1998-08-17  5:04 UTC (permalink / raw)
  To: egcs-bugs

The following program:
=-=-=-=-=
// File: va.cc

class X {
    int v;

public:
    X() { v = 0; }
    virtual void foo( int x, ... ){ v = x; }
};

int main()
{
    X x;

    x.foo( 3 );
}
=-=-=-=-=

Causes the following warning:

=-=-=-=
> g++ -v
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.54/specs
gcc version egcs-2.91.54 19980816 (gcc2 ss-980609 experimental)
> g++ -O -Winline -c va.cc -o va.o
va.cc: In method `void X::foo(int ...)':
va.cc:8: warning: varargs function cannot be inline
va.cc: In function `int main()':
va.cc:8: warning: can't inline call to `void X::foo(int ...)'
va.cc:15: warning: called from here
=-=-=-=

If either '-O' or '-Winline' is omitted, or if '-O' is replaced with
'-finline-functions', there are no warnings.

Strictly speaking, this is correct behavior, since -O makes functions
defined within a class inline by default, and apparently the compiler
cannot inline foo().  Nevertheless, it would be nice if the combination
of flags '-O -Winline' could be used without complaints about these
functions.

-- 
Kees van Reeuwijk, Delft University of Technology
http://pds.twi.tudelft.nl/~reeuwijk


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-08-17  5:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-17  5:04 Feature request: smarter warning about inlining of vararg functions C. van Reeuwijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).