This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Inline limitation?


Nathan Myers wrote:
> 
> Marco Manfai Yu wrote:
> 
> >     It seems that egcs 1.0.3a does not inline a function unless
> > it is defined before use.
> 
> This is conventional.  The compiler is permitted to inline it (or
> any function, inline or otherwise) or not.
> 
> Perhaps there should be an optional warning that an inline function
> is not available for inlining at the point where it is called.
Yes. Actually I had (erroneously) thought -Winline did this, but not so.
The documentation for -Winline implies that it should,

	Warn if a function can not be inlined, and either it was
	declared as inline,or else the @samp{-finline-functions}
	option was given.

We implemented such a feature on a commercial compiler I was involved
with. To be any use the warning has to be in two parts. First at the
call site indicating where the declaration was as well, and secondly at
the definition site indicating where the first call site was too.

(We did eventually add a 'monster inline' option which delayed code
generation until all inline definitions had been seen -- but that of
course uses a lot of memory.)

nathan

-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]