Bad cpu_data macro in include/asm-*/processor.h

Nathan Myers (ncm@nospam.cantrip.org)
Thu, 15 Nov 2001 01:52:30 -0800


In building 2.4.15-pre4 for non-SMP, I get a compile error at
kernel/i386/setup.c, line 2791. This is traceable to
include/asm-{i386,mips}/processor.h, the line

#define cpu_data &boot_cpu_data

has a very stupid non-syntactic macro. (This is line 54 in the mips
header, 79 in the x86 header.) The minimal fix is obvious:

#define cpu_data (&boot_cpu_data)

What stinky code, anyhow. Why not make it a one-element array
to begin with?

I grepped for other similar macros with

grep -n '#define[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*[ ][ ]*[^-A-Za-z0-9_\\{"( ]' */*.h */*/*.h | less

and found more (mostly involving unary operator~) in

asm-m68k/bvme*.h
asm-mips/asm.h,
asm-mips64/asm.h
asm-ppc/io.h
asm-arm/arch-l7200/aug_reg.h
linux/pci.h
linux/ps2esdi.h
net/irda/nsc-ircc.h
net/irda/w83977af_ir.h

If you check for things like
#define FOO -1
which should be
#define FOO (-1)
you find zillions more.

Feh.

Nathan Myers
ncm@nospam.cantrip.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/