Alignment issue of iobuf functions
Neal H. Walfield
neal at walfield.org
Wed Jan 6 11:36:06 CET 2016
Hi Niibe,
On Tue, 05 Jan 2016 02:53:05 +0100,
NIIBE Yutaka wrote:
> Then, I see compiler warnings like:
> =========================
> ../../gnupg/common/iobuf.c: In function `file_filter':
> ../../gnupg/common/iobuf.c:581:8: warning: cast increases required
> alignment of target type [-Wcast-align]
> *(char **) buf = "file_filter(fd)";
> ^
> =========================
>
> This is because of the argument BUF is declared as byte * and we cast
> to (char **), where the alignment condition for (byte *) and the one
> for (char **) could be different. So, the warning is relevant.
>
> I think that our usage of (byte *) here is actually (void *). I'm not
> sure if changing to (void *) is better or not.
Unfortunately, we are overloading the buf parameter too much.
I'm guessing this is not the only warning that you getting for this,
right? file_es_filter and block_filter, for instance, use the same
pattern.
:) Neal
More information about the Gnupg-devel
mailing list