[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] mbsstr: fix warnings reported by gcc -Wcast-align on ARM
From: |
Bruno Haible |
Subject: |
Re: [PATCH] mbsstr: fix warnings reported by gcc -Wcast-align on ARM |
Date: |
Sun, 3 Oct 2010 13:27:10 +0200 |
User-agent: |
KMail/1.9.9 |
Hi,
Dmitry V. Levin wrote:
> * lib/mbsstr.c (knuth_morris_pratt_multibyte): Assign a raw memory
> pointer returned by nmalloca() right to the variable of type
> "mbchar_t *" thus removing redundant proxy variable of type "char *".
Thanks for the patch, but I don't feel that it is an improvement over the
existing code: it makes the code harder to understand.
I allocate a variable 'memory' that contains both 'needle_mbchars' and
'table'. When I call free(memory), it is clear that both are freed.
Whereas in your rewrite, 'table' becomes an backpack on 'needle_mbchars',
and when you write free(needle_mbchars), one keeps wondering why there
is no free(table).
> mbsstr.c:50: error: cast increases required alignment of target type
> [-Wcast-align]
How is one supposed to write address computations needed for dissecting
a memory block into several memory blocks, when this warning is enabled?
With 'void *' I cannot do address arithmetic. With 'char *' I get these
warnings. 'uintptr_t'? Berk, no.
In summary, please turn off -Werror when compiling gnulib code. We don't
guarantee the absence of warnings.
Bruno
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH] mbsstr: fix warnings reported by gcc -Wcast-align on ARM,
Bruno Haible <=