Re: 'static inline' vs macros for kernel functions ? (was how to handle name clashes in linux/freebsd kernel sources ?)

From: John Baldwin <jhb_at_freebsd.org>
Date: Tue, 26 Jun 2007 16:25:00 -0400
On Tuesday 26 June 2007 03:31:30 pm Luigi Rizzo wrote:
> This is related to the post attached at the end of this email.
> 
> In this commit:
> 
>     CVS log for src/sys/sys/systm.h
>     Revision 1.252: download - view: text, markup, annotated - select for 
diffs
>     Fri Mar 9 22:41:01 2007 UTC (3 months, 2 weeks ago) by jhb
> 
> msleep() changed from a function to a macro wrapping _sleep().
> 
> Being a macro, it is a lot harder to hide it in case of name clashes
> such as the one mentioned below.
> 
> This raises the question - what is the point in using macros
> in cases like this where we could use static inline function and
> probably even exploit better compiler checks ?
> 
> Would it be possible to revert msleep() to a real function ?

FreeBSD already uses macros all over the place in sys/*.h.  Go duke it out 
with bde_at_. :)  You can always #undef msleep and redefine it to something 
else.

-- 
John Baldwin
Received on Tue Jun 26 2007 - 18:31:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC