qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
@ 2019-01-14 16:04 Thomas Huth
  2019-01-14 16:42 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2019-01-14 16:04 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel, berrange
  Cc: Ronnie Sahlberg, Paolo Bonzini, Peter Lieven, qemu-block,
	Eric Blake

The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad
"inline" prototype definitions which GCC refuses to compile in its
gnu99 mode:

In file included from block/iscsi.c:52:0:
/usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function
‘scsi_set_uint16’ declared but never defined [-Werror]
 inline void scsi_set_uint16(unsigned char *c, uint16_t val);
             ^
/usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function
‘scsi_set_uint32’ declared but never defined [-Werror]
 inline void scsi_set_uint32(unsigned char *c, uint32_t val);
             ^
[...]

This has been fixed by upstream libiscsi in version 1.10.0 (see
https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but
since we still want to support 1.9.0 for CentOS 7 / RHEL7, we
have to work-around the issue by redefining the "inline" keyword
to use the old "gnu89" mode behavior via "gnu_inline" instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 block/iscsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/iscsi.c b/block/iscsi.c
index a7e8c1f..ff47320 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -49,7 +49,9 @@
 /* Conflict between scsi/utils.h and libiscsi! :( */
 #define SCSI_XFER_NONE ISCSI_XFER_NONE
 #include <iscsi/iscsi.h>
+#define inline __attribute__((gnu_inline))  /* required for libiscsi v1.9.0 */
 #include <iscsi/scsi-lowlevel.h>
+#undef inline
 #undef SCSI_XFER_NONE
 QEMU_BUILD_BUG_ON((int)SCSI_XFER_NONE != (int)ISCSI_XFER_NONE);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v3] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 16:04 [Qemu-devel] [PATCH v3] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode Thomas Huth
@ 2019-01-14 16:42 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2019-01-14 16:42 UTC (permalink / raw)
  To: Thomas Huth, Peter Maydell, qemu-devel, berrange
  Cc: Ronnie Sahlberg, Paolo Bonzini, Peter Lieven, qemu-block

[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

On 1/14/19 10:04 AM, Thomas Huth wrote:
> The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad
> "inline" prototype definitions which GCC refuses to compile in its
> gnu99 mode:
> 
> In file included from block/iscsi.c:52:0:
> /usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function
> ‘scsi_set_uint16’ declared but never defined [-Werror]
>  inline void scsi_set_uint16(unsigned char *c, uint16_t val);
>              ^
> /usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function
> ‘scsi_set_uint32’ declared but never defined [-Werror]
>  inline void scsi_set_uint32(unsigned char *c, uint32_t val);
>              ^
> [...]
> 
> This has been fixed by upstream libiscsi in version 1.10.0 (see
> https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but
> since we still want to support 1.9.0 for CentOS 7 / RHEL7, we
> have to work-around the issue by redefining the "inline" keyword
> to use the old "gnu89" mode behavior via "gnu_inline" instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  block/iscsi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index a7e8c1f..ff47320 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -49,7 +49,9 @@
>  /* Conflict between scsi/utils.h and libiscsi! :( */
>  #define SCSI_XFER_NONE ISCSI_XFER_NONE
>  #include <iscsi/iscsi.h>
> +#define inline __attribute__((gnu_inline))  /* required for libiscsi v1.9.0 */
>  #include <iscsi/scsi-lowlevel.h>
> +#undef inline
>  #undef SCSI_XFER_NONE
>  QEMU_BUILD_BUG_ON((int)SCSI_XFER_NONE != (int)ISCSI_XFER_NONE);

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-14 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-14 16:04 [Qemu-devel] [PATCH v3] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode Thomas Huth
2019-01-14 16:42 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).