svn commit: r335053 - in head/sys: compat/freebsd32 compat/linux fs/nfsclient kern sys

Bruce Evans brde at optusnet.com.au
Thu Jun 14 08:26:05 UTC 2018


On Thu, 14 Jun 2018, Hans Petter Selasky wrote:

> On 06/13/18 14:22, Bruce Evans wrote:
>> [... inlines for makedev(), etc.]
>
> Can you use all macros here? This breaks OFED, because __makedev() is used to 
> initialize variables.

See another reply.

I will change them to macros and fear breaking them with a gccism instead
of with with inlines.

I should have worried more about the inlines.  Plain inline is only in C99
or a gcc extension starting in gcc-2.mumble.  Portability of sys/types.h is
more important than for any other header in the system except sys/cdevs.h.
So it must compile with C90 compilers and should compile with K&R compilers.
For makedev(), etc., it spells inline as __inline so the inline feature
can be turned off easily (the functions then become static and repeated
every time sys/types.h is included, but this probably happens anyway with
-O0 and it works for any compiler).

Turning off the statement-expression feature needed to write safe
macros is not so easy.  In <sys>, this feature is only used in
mostly-kernel headers and in stdatomic.h.

Bruce


More information about the svn-src-head mailing list