mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Add G_GNUC_DEPRECATED_FOR macro
It would be good, error reporting-wise, to be able to signal which function should be used instead of a deprecated one. GCC 4.5 added an optional "message" payload to the deprecated attribute, so that: void f1 (void) __attribute__((deprecated("Use f2 instead"))); Will expand to: warning: f1 is deprecated: Use f2 instead Instead of just printing: warning: f1 is deprecated Since we already have a G_GNUC_DEPRECATED macro we should provide a G_GNUC_DEPRECATED_FOR macro defined as: G_GNUC_DEPRECATED_FOR(bar) Which would expand the deprecation message to "Use bar instead" automatically. The deprecation message should probably be similar to what we use in gtk-doc to match up with the documentation. https://bugzilla.gnome.org/show_bug.cgi?id=614965
This commit is contained in:
parent
8f82b994c9
commit
38e2273207
@ -107,6 +107,13 @@
|
||||
#define G_GNUC_DEPRECATED
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
#define G_GNUC_DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
#else
|
||||
#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
|
||||
# define G_GNUC_MAY_ALIAS __attribute__((may_alias))
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user