From 9740c024037b58a90de94c2b21d443e1ab7f6f4d Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 19 Jul 2014 18:50:44 +0200 Subject: [PATCH] wrlib: re-introduce the optimize_for_speed flag for binary compatibility The commit #d1f9b801 removed it because the code behind it is actually useless, unfortunately removing the flag itself from the structure is breaking the compatibility of the API. To avoid problems, this patch re-introduces the flag in the structure, but not the code behind it so it is useless, and adds an attribute so that gcc will report its use as deprecated, to help application migration. Signed-off-by: Christophe CURIS --- wrlib/wraster.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/wrlib/wraster.h b/wrlib/wraster.h index c5655db1..992a8e95 100644 --- a/wrlib/wraster.h +++ b/wrlib/wraster.h @@ -52,6 +52,22 @@ #endif +/* + * Define some macro to provide attributes for the compiler + * + * These attributes help producing better code and/or detecting bugs, however not all compiler support them + * as they are not standard. + * Because we're a public API header, we can't count on autoconf to detect them for us, so we use that #if + * mechanism and define an internal macro appropriately. Please note that the macro are not considered being + * part of the public API. + */ +#if __GNUC__ >= 3 +#define __wrlib_deprecated(msg) __attribute__ ((deprecated(msg))) +#else +#define __wrlib_deprecated(msg) +#endif + + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -160,6 +176,9 @@ typedef struct RContext { struct { unsigned int use_shared_pixmap:1; + unsigned int optimize_for_speed:1 + __wrlib_deprecated("Flag optimize_for_speed in RContext is not used anymore " + "and will be removed in future version, please do not use"); } flags; } RContext; @@ -481,4 +500,10 @@ extern int RErrorCode; } #endif /* __cplusplus */ +/* + * The definitions below are done for internal use only + * We undef them so users of the library may not misuse them + */ +#undef __wrlib_deprecated + #endif -- 2.11.4.GIT