avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subject: Re: [avr-gcc-list] Getting inline to work


From: Bob Weber
Subject: Subject: Re: [avr-gcc-list] Getting inline to work
Date: 23 May 2003 14:31:20 -0700

> address@hidden wrote:
> > Hello all
> >
> > I'm having a difficult time trying to get inline to

work.
> >
> > I have:
> >
> > // prototypes
> > static inline void foo(void);
> > static void bar(void);
> >
> > static inline void foo(void)
> > {
> >     //...
> > }
> >
> > static void bar(void)
> > {
> >     //...
> >     foo();
> >     //...
> >     foo();
> >     //...
> >     foo();
> >     //...
> > }
> >
> > I use -std=gnu99 -Os as well as -Winline and I don't

get
> > any warnings / errors and the listing shows that bar is
> > *calling* foo; i.e. foo isn't getting inlined.
>
> Try -finline-limit=<your favourite number>, or -O2. With -

Os, avr-gcc
> has a *very low* limit on the size of functions it will
inline.
>
> David Gay
>
address@hidden
>

Tried -02. Tried -finline-limit=10000.
Still no luck. So I used a macro to force inlining.

Thanks for the info anyway.

Eric
I've had the same problem with inlines, even with optimization at -O3. It's just a suggestion to the compiler, or so I've read, and sometimes the compiler won't/cannot inline the function.

By using macros, it's not a suggestion any more, and it works. I'll stick with that approach.

Bob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]