diff options
| author | Robert Love <rml@tech9.net> | 2002-12-28 04:09:48 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-12-28 04:09:48 -0800 |
| commit | 8ad65876172145c1d26caa837bf5ebe4fe4db7fb (patch) | |
| tree | 5ddc7f3f8daa42bea8530822df10df62cbaffd19 /include/linux | |
| parent | fb7d196b9a65a800e5d841c2543267383e6bf3cd (diff) | |
[PATCH] deprecated function attribute
This patch adds support for usage of the attribute as "deprecated" and
is backward-compatible. Usage is:
int deprecated foo(void)
etc..
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.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/compiler.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 6b19413b47a6..51cfdb71594b 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -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) \ |
