[Libguestfs] [PATCH] lib: avoid pragma usage in journal.c

Richard W.M. Jones rjones at redhat.com
Tue Aug 20 17:30:44 UTC 2013


On Tue, Aug 20, 2013 at 04:33:01PM +0200, Olaf Hering wrote:
> journal.c: In function 'guestfs__journal_get':
> journal.c:120:9: error: #pragma GCC diagnostic not allowed inside functions
> journal.c:121:9: error: #pragma GCC diagnostic not allowed inside functions
> journal.c:123:9: error: #pragma GCC diagnostic not allowed inside functions
> make[3]: *** [libguestfs_la-journal.lo] Error 1
> 
> Signed-off-by: Olaf Hering <olaf at aepfle.de>
> ---
> 
> Not compiled.
> 
>  src/journal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/journal.c b/src/journal.c
> index cac8040..61ab352 100644
> --- a/src/journal.c
> +++ b/src/journal.c
> @@ -117,10 +117,8 @@ guestfs__journal_get (guestfs_h *g)
>               "size=%zu, i=%zu", size, i);
>        goto err;
>      }
> -#pragma GCC diagnostic push
> -#pragma GCC diagnostic ignored "-Wcast-align"
> -    len = be64toh (* (uint64_t *) &buf[i]);
> -#pragma GCC diagnostic pop
> +    memcpy(&len, &buf[i], sizeof(len));
> +    len = be64toh (len);

Yes, this is a much better way of doing it.  There are probably
a few others like this.

Thanks - I have pushed this patch and the other one you posted.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list