Re: [PATCH] warning: `__attribute_used__' redefined

From: Jeff Chua
Date: Wed Feb 11 2004 - 08:08:04 EST


On Tue, 10 Feb 2004, Linus Torvalds wrote:

> On Tue, 10 Feb 2004, Andrew Morton wrote:
> > ah, thanks.
> > Like this?
> That will just break. The reason for the "compiler.h" include is the
> "__user" part of fpstate, so now you'll get a parse error later if
> non-kernel code includes this.
>
> So the rule should still be: don't include kernel headers from user
> programs. But if it's needed for some reason, that #ifdef needs to be
> somewhere else (inside "compiler.h" or something).

So, what's wrong with the patch I posted earlier. I've verified that it
works with just one place to patch, and that makes all warnings went away.

Patch attached here again.

Thanks,
Jeff

--- linux-2.6.2/include/linux/compiler-gcc2.h Wed Feb 4 11:45:02 2004
+++ linux-2.6.3-rc2/include/linux/compiler-gcc2.h Tue Feb 10 14:30:04 2004
@@ -12,6 +12,10 @@
# define __builtin_expect(x, expected_value) (x)
#endif

+#ifdef __attribute_used__
+#undef __attribute_used__
+#endif
+
#define __attribute_used__ __attribute__((__unused__))

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