Subject: Re: Proposal: eliminate all macros in the kernel
To: None <tls@rek.tjls.com>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 11/21/2005 07:07:40
> I think we're very much in agreement about this.  Just to be clear, I am
> suggesting that we *first* move from macros to inline functions -- a
> change that is primarily syntactic, which should have little or no impact
> on performance but improve readability and maintainability of code, *then*
> carefully consider which of those functions should be inline at all: any
> resulting changes at that point should be much simpler to make because
> the macros will have already been converted to function form.

inline functions and non-inline functions involve different
header requirements.  so if you likely make them non-inline functions
later, just do it as a single step.

macro:
	#define	SOMEMACRO(x)	((x)->x_member)

inline:
	inline int
	somemacro(struct x *x)
	{
		return x->x_member;
	}

non-inline:
	struct x;
	int somemacro(struct x *);

note that only inline version needs to pull definition of "struct x"
even when "somemacro" is not used at all.

YAMAMOTO Takashi