On Mon, Sep 04, 2023 at 11:51:33PM +0200, Marc Espie wrote:
> On Tue, Sep 05, 2023 at 12:04:24AM +1000, Jonathan Gray wrote:
> > inline is part of gnu89 and c99
> > 
> > Index: defines.h
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/make/defines.h,v
> > retrieving revision 1.15
> > diff -u -p -r1.15 defines.h
> > --- defines.h       14 Oct 2015 13:50:22 -0000      1.15
> > +++ defines.h       4 Sep 2023 13:49:16 -0000
> > @@ -61,16 +61,8 @@ typedef struct Suff_ Suff;
> >  
> >  #ifdef __GNUC__
> >  # define UNUSED    __attribute__((__unused__))
> > -# define HAS_INLINES
> > -# define INLINE  __inline__
> >  #else
> >  # define UNUSED
> > -#endif
> > -
> > -#ifdef HAS_INLINES
> > -# ifndef INLINE
> > -#  define INLINE   inline
> > -# endif
> >  #endif
> >  
> >  /*
> > Index: lst.h
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/make/lst.h,v
> > retrieving revision 1.33
> > diff -u -p -r1.33 lst.h
> > --- lst.h   4 Mar 2021 09:45:31 -0000       1.33
> > +++ lst.h   4 Sep 2023 13:49:52 -0000
> > @@ -159,25 +159,16 @@ extern void * Lst_DeQueue(Lst);
> >  #define Lst_Adv(ln)        ((ln)->nextPtr)
> >  #define Lst_Rev(ln)        ((ln)->prevPtr)
> >  
> > -
> > -/* Inlines are preferable to macros here because of the type checking. */
> > -#ifdef HAS_INLINES
> > -static INLINE LstNode
> > +static inline LstNode
> >  Lst_FindConst(Lst l, FindProcConst cProc, const void *d)
> >  {
> >     return Lst_FindFrom(Lst_First(l), (FindProc)cProc, (void *)d);
> >  }
> >  
> > -static INLINE LstNode
> > +static inline LstNode
> >  Lst_FindFromConst(LstNode ln, FindProcConst cProc, const void *d)
> >  {
> >     return Lst_FindFrom(ln, (FindProc)cProc, (void *)d);
> >  }
> > -#else
> > -#define Lst_FindConst(l, cProc, d) \
> > -   Lst_FindFrom(Lst_First(l), (FindProc)cProc, (void *)d)
> > -#define Lst_FindFromConst(ln, cProc, d) \
> > -   Lst_FindFrom(ln, (FindProc)cProc, (void *)d)
> > -#endif
> >  
> >  #endif /* _LST_H_ */
> > Index: lst.lib/lst.h
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/make/lst.lib/lst.h,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 lst.h
> > --- lst.lib/lst.h   14 Oct 2015 13:52:11 -0000      1.2
> > +++ lst.lib/lst.h   4 Sep 2023 13:50:30 -0000
> > @@ -154,25 +154,16 @@ extern void * Lst_DeQueue(Lst);
> >  #define Lst_Adv(ln)        ((ln)->nextPtr)
> >  #define Lst_Rev(ln)        ((ln)->prevPtr)
> >  
> > -
> > -/* Inlines are preferable to macros here because of the type checking. */
> > -#ifdef HAS_INLINES
> > -static INLINE LstNode
> > +static inline LstNode
> >  Lst_FindConst(Lst l, FindProcConst cProc, const void *d)
> >  {
> >     return Lst_FindFrom(Lst_First(l), (FindProc)cProc, (void *)d);
> >  }
> >  
> > -static INLINE LstNode
> > +static inline LstNode
> >  Lst_FindFromConst(LstNode ln, FindProcConst cProc, const void *d)
> >  {
> >     return Lst_FindFrom(ln, (FindProc)cProc, (void *)d);
> >  }
> > -#else
> > -#define Lst_FindConst(l, cProc, d) \
> > -   Lst_FindFrom(Lst_First(l), (FindProc)cProc, (void *)d)
> > -#define Lst_FindFromConst(ln, cProc, d) \
> > -   Lst_FindFrom(ln, (FindProc)cProc, (void *)d)
> > -#endif
> >  
> >  #endif /* _LST_H_ */
> > 
> > 
> Please Cc: me on make stuff, I don't always see all mails.
> 
> Have you checked it works on gcc3 or gotten someone to check ?
> If so, it's okay.

No, but it must work.  Used in many places, such as:
sys/kern/subr_pool.c:static inline int
usr.bin/sed/process.c:static inline int

Reply via email to