Re: [PATCH] deprecated function attribute

Robert Love (rml@tech9.net)
28 Dec 2002 15:50:12 -0500


On Sat, 2002-12-28 at 13:53, Daniel Jacobowitz wrote:

> > If we want to be preemptive, we can rename the above to "__deprecated__"
> > but I think plain "deprecated" is much better looking.
>
> Eek, please call it something else - something that looks visibly like
> a syntax rather than a name. __deprecated or __deprecated__ or
> DEPRECATED.

Like I said, that is fine with me...

Attached. Still untested :-)

Robert Love

compiler.h | 13 +++++++++++++
1 files changed, 13 insertions(+)

diff -urN linux-2.5.53/include/linux/compiler.h linux/include/linux/compiler.h
--- linux-2.5.53/include/linux/compiler.h 2002-12-28 12:38:56.000000000 -0500
+++ linux/include/linux/compiler.h 2002-12-28 12:45:03.000000000 -0500
@@ -13,6 +13,19 @@
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)

+/*
+ * Allow us to mark functions as 'deprecated' and have gcc emit a nice
+ * warning for each use, in hopes of speeding the functions removal.
+ * Usage is:
+ * int deprecated foo(void)
+ * and then gcc will emit a warning for each usage of the function.
+ */
+#if __GNUC__ == 3
+#define __deprecated__ __attribute__((deprecated))
+#else
+#define __deprecated__
+#endif
+
/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */
#define RELOC_HIDE(ptr, off) \

-
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/