[Pixman] [PATCH] Make the combiner macros less likely to cause name collisions.
Alexander Shulgin
alex.shulgin at gmail.com
Tue Jul 6 23:01:56 PDT 2010
On Wed, Jul 7, 2010 at 02:18, Søren Sandmann <sandmann at daimi.au.dk> wrote:
> From: Søren Sandmann Pedersen <ssp at redhat.com>
>
> Protect the arguments to the combiner macros with parentheses, and
> prefix their temporary variables with underscores to avoid name space
> collisions with the surrounding code.
> ---
> pixman/pixman-combine.h.template | 152 +++++++++++++++++++-------------------
> 1 files changed, 76 insertions(+), 76 deletions(-)
>
> diff --git a/pixman/pixman-combine.h.template b/pixman/pixman-combine.h.template
> index 2f6392f..012ada7 100644
> --- a/pixman/pixman-combine.h.template
> +++ b/pixman/pixman-combine.h.template
> @@ -31,7 +31,7 @@
> (((comp2_t) (a) * MASK) / (b))
>
> #define ADD_UNc(x, y, t) \
> - ((t) = x + y, \
> + ((t) = (x) + (y), \
> (comp4_t) (comp1_t) ((t) | (0 - ((t) >> G_SHIFT))))
>
> #define DIV_ONE_UNc(x) \
> @@ -84,15 +84,15 @@
> #define UNcx4_MUL_UNc(x, a) \
> do \
> { \
> - comp4_t r1, r2, t; \
> + comp4_t __r1, __r2, __t; \
Are you aware that double leading underscore is reserved for C
compiler's internal use in any context? And especially with names
like __r1 you are more likely to trigger the theoretical undefined
behavior here, as these look like x64 registers names.
--
Alex
More information about the Pixman
mailing list