Re: [AD] fixed gcc warning

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> The attached patch makes Allegro's C-only version compile with --enable-
> strict-warn and gcc 3.3.4. Without it, I get this:
>
> src/c/cstretch.c: In function `stretch_line15':
> src/c/cstretch.c:104: warning: use of cast expressions as lvalues is
> deprecated
>
> And some more of that.

My bad, I forgot to check the C-only version.

> After someone confirms there's no problem with it (there'd be no more
> need at all for the type parameter now, and I'm not too sure what the
> cast around an lavalue actually does - so I might be overlooking
> something), I'll commit it.

Without the extension (i.e. by following ISO C), the expression

(unsigned char*) s

is not a lvalue (ISO C99 6.5.4 §4 note 85 :-) so it can't be the destination 
of an assignment.


I think this part of the patch is wrong:

-type *s = (type*) sptr;                                                   \
+unsigned char *s = sptr;                                                   \

because of

    set(d, get(s));                                                        \

where the 'get' can be the dereference operator '*', as in

static void stretch_line15(unsigned long dptr, unsigned char *sptr)
{
   DECLARE_STRETCHER(unsigned short, sizeof(unsigned short), bmp_write15, *);
}

-- 
Eric Botcazou




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/