[PATCH] PPC/PPC64: Introduce CPU_HAS_FEATURE() macro

Pekka Enberg penberg at cs.helsinki.fi
Sat Feb 5 18:48:19 EST 2005


On Fri, 2005-02-04 at 11:20 -0600, Olof Johansson wrote:
> * cpu-has-feature(cpu-feature-foo) v cpu-has-feature(foo): I picked the
> latter for readability.
> * Renaming CPU_FTR_<x> -> CPU_<x> makes it less obvious that
> it's actually a cpu feature it's describing (i.e. CPU_ALTIVEC vs
> CPU_FTR_ALTIVEC).
> * Renaming would clobber the namespace, CPU_* definitions are used in
> other places in the tree.
> * Can't make it an inline and still use the preprocessor concatenation.

Seriously, if readability is your argument, macro magic is not the
answer. Ok, we can't clobber the CPU_ definitions, so pick another
prefix.

If you want readability, please consider using named enums:

enum cpu_feature {
	CF_ALTIVEC = /* ... */
};

static inline int cpu_has_feature(enum cpu_feature cf) { }

			Pekka




More information about the Linuxppc-dev mailing list