Re: [PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations

From: Nick Desaulniers
Date: Tue Jun 05 2018 - 13:55:56 EST


On Tue, Jun 5, 2018 at 10:23 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
> On Tue, 2018-06-05 at 10:05 -0700, Nick Desaulniers wrote:
> > #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
> > !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
> > -#define inline inline __attribute__((always_inline,unused)) notrace
> > -#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace
> > -#define __inline __inline __attribute__((always_inline,unused)) notrace
> > +#define inline \
> > + inline __attribute__((always_inline, unused, gnu_inline)) notrace
> > +#define __inline__ \
> > + __inline__ __attribute__((always_inline, unused, gnu_inline)) notrace
> > +#define __inline \
> > + __inline __attribute__((always_inline, unused, gnu_inline)) notrace
>
> Perhaps these are simpler as
>
> #define __inline__ inline
> #define __inline inline
>
> > #else
> > /* A lot of inline functions can cause havoc with function tracing */
> > -#define inline inline __attribute__((unused)) notrace
> > -#define __inline__ __inline__ __attribute__((unused)) notrace
> > -#define __inline __inline __attribute__((unused)) notrace
> > +#define inline inline __attribute__((unused, gnu_inline)) notrace
> > +#define __inline__ __inline__ __attribute__((unused, gnu_inline)) notrace
> > +#define __inline __inline __attribute__((unused, gnu_inline)) notrace
> > #endif
>
> And only set once along with:
>
> > #define __always_inline inline __attribute__((always_inline))
>
> And perhaps this __always_inline should be updated
> with gnu_inline as well
>

Great idea, I'll pick this up and add you to the Suggested-by: tag in
v3. Thanks Joe!
--
Thanks,
~Nick Desaulniers