Re: [protocol] macros: Use GLib's G_DEPRECATED macro if available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 21, 2016 at 07:13:42PM +0100, Francois Gouget wrote:
> On Wed, 9 Nov 2016, Christophe Fergeau wrote:
> [...]
> > I believe all of these were more or less directly imported from glib.
> > Grepping around, I could only find SPICE_GNUC_VISIBLE, SPICE_GNUC_NORETURN,
> > SPICE_GNUC_UNUSED, SPICE_GNUC_PRINTF and SPICE_GNUC_DEPRECATED being
> > used. At this point, I'd just make sure the other ones emit a (compile
> > time) warning when they are used unless some magic define is set, and
> > drop them after a while.
> 
> I'm not sure how to do that:
>  * If I'm not mistaken a #warning directive must be used alone on a 
>    line but this is not how __attribute__ is used. Furthermore I doubt 
>    #warning would even work if put inside a macro and putting it inside 
>    the #ifdef would warn about the macro being defined, not about it 
>    being used.
> 
>  * I could define the macro to something like 'define FOO to use this 
>    macro' but this would generate a compilation error, not a compilation 
>    warning.

Ah, good point, forgot that they are macros, and that G_DEPRECATED can't
be used with them. Given that most of them go with function
prototypes, we could do something like

#define SPICE_GNUC_PURE  __attribute__ ((__pure__, warning("deprecated, use -DFOO or GG_GNUC_PURE instead")))

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]