On Fri, Mar 20, 2020 at 11:07 PM Gregory Nutt <spudan...@gmail.com> wrote: > > > > In C, if placing a function in a header, "static inline" is needed to avoid > > a "multiple definitions" problem, but means that if the compiler decides > > *not* to inline the function, and if the function is used from multiple C > > modules, then some code bloat results because you could end up with > > multiple copies of the object code in your executable. But I consider this > > to be a negligible problem because you should not make functions inline > > unless they're really short and simple anyway. > > I was recently working with a platform that has only a C89 compiler. > There was incredible code bloat and I found that code had bloated by 80% > due to static inline functions. I fixed these (not very elegantly) and > the the size was a little more managable but still to large (I expect > there are others) > > See commit 3b53cd1e578de1e6bddfae605452a77323e5a70b > > I think we should get all static inline functions at least out of common > header files. >
If we want to support the compiler which don't support inline, it's better that: 1.Remove CONFIG_HAVE_INLINE from include/nuttx/compiler.h 2.Convert inline fucntion to macro to normal function It isn't hard to fix because grep just can find inline about 100 times.