Re: Minimum optimizations required to use inline functions

Peter Bigot <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <CAPOJ94PDdvdP-yKevMr-3skO9Rr2kkwT2tBJxy8jWjtc5Jezyg@mail.gmail.com>
On Sat, Apr 12, 2014 at 8:43 PM, Wayne Uroda <[email protected]> wrote:
> Hi,
>
> I make extensive use of inline functions in my code, as below:
>
>     extern inline void setClockLine(Bool value)
>     { ... }
>
> Sometimes I put these definitions in .c files, sometimes in .h files (I'm
> not sure if that makes a difference, apart from scope).

It does.  See (for example): http://m68hc11.serveftp.org/inline-1.php

This explains your linker error, assuming you don't have a
non-extern/non-inline definition in a .c file.

I generally use "static inline" definitions placed in headers.  Since
-Os can affect whether a function is actually inlined, there's also
attribute __always_inline__ that can be added to encourage the
compiler more strongly (might even be an error if it can't be
inlined).

I haven't tried -Og to see if it does anything.

Peter

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.