From: Robert Love <rml@tech9.net>
To: Alexander Kellett <lypanov@kde.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
torvalds@transmeta.com, linux-kernel@vger.kernel.org,
william stinson <wstinson@wanadoo.fr>,
trivial@rustcorp.com.au
Subject: [PATCH] deprecated function attribute
Date: 28 Dec 2002 12:51:18 -0500 [thread overview]
Message-ID: <1041097877.1066.9.camel@icbm> (raw)
In-Reply-To: <20021228153009.GA29614@groucho.verza.com>
On Sat, 2002-12-28 at 10:30, Alexander Kellett wrote:
> can gcc 3.2's __attribute__((deprecated)) be used?
I just tested it and it seems to work. If we mark a function as
deprecated, then each use of the function emits a warning like:
foo.c:12: warning: `baz' is deprecated (declared at bar.c:60)
Which is very informative, giving both the location of each usage and
where the little bastard is declared.
It seems like this was added in gcc 3.0, not 3.2? It was at least in
3.1...
Attached patch adds support for usage of the attribute as "deprecated"
and is backward-compatible. Usage is:
int deprecated foo(void)
etc.. The attached patch is _entirely_ 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) \
next prev parent reply other threads:[~2002-12-28 17:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-28 0:57 [PATCH] Mark deprecated functions so they give a warning on use Rusty Russell
2002-12-28 5:54 ` Richard Henderson
2002-12-28 15:30 ` Alexander Kellett
2002-12-28 17:51 ` Robert Love [this message]
2002-12-28 18:03 ` [PATCH] deprecated function attribute Robert Love
2002-12-28 18:53 ` Daniel Jacobowitz
2002-12-28 20:50 ` Robert Love
-- strict thread matches above, loose matches on Subject: below --
2002-12-28 23:32 william stinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1041097877.1066.9.camel@icbm \
--to=rml@tech9.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lypanov@kde.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@transmeta.com \
--cc=trivial@rustcorp.com.au \
--cc=wstinson@wanadoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox