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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to