All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
@ 2019-01-14 13:46 Thomas Huth
  2019-01-14 13:52 ` Peter Maydell
  2019-01-14 14:31 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 13+ messages in thread
From: Thomas Huth @ 2019-01-14 13:46 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel, berrange
  Cc: Ronnie Sahlberg, Paolo Bonzini, Peter Lieven, qemu-block

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 compiling with "-fgnu89-inline"
in this case instead.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure b/configure
index 2b9ba7d..aa80c17 100755
--- a/configure
+++ b/configure
@@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
     libiscsi="yes"
     libiscsi_cflags=$($pkg_config --cflags libiscsi)
     libiscsi_libs=$($pkg_config --libs libiscsi)
+    if $pkg_config --exact-version==1.9.0 libiscsi; then
+      # There are some bad inline declarations in scsi-lowlevel.h of
+      # libiscsi 1.9.0 which don't work in gnu99 mode without this:
+      libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
+    fi
   else
     if test "$libiscsi" = "yes" ; then
       feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 13:46 [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode Thomas Huth
@ 2019-01-14 13:52 ` Peter Maydell
  2019-01-14 14:31   ` Daniel P. Berrangé
  2019-01-14 14:31 ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 13+ messages in thread
From: Peter Maydell @ 2019-01-14 13:52 UTC (permalink / raw)
  To: Thomas Huth
  Cc: QEMU Developers, Daniel P. Berrange, Ronnie Sahlberg,
	Paolo Bonzini, Peter Lieven, Qemu-block

On Mon, 14 Jan 2019 at 13:47, Thomas Huth <thuth@redhat.com> 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 compiling with "-fgnu89-inline"
> in this case instead.
>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index 2b9ba7d..aa80c17 100755
> --- a/configure
> +++ b/configure
> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
>      libiscsi="yes"
>      libiscsi_cflags=$($pkg_config --cflags libiscsi)
>      libiscsi_libs=$($pkg_config --libs libiscsi)
> +    if $pkg_config --exact-version==1.9.0 libiscsi; then
> +      # There are some bad inline declarations in scsi-lowlevel.h of
> +      # libiscsi 1.9.0 which don't work in gnu99 mode without this:
> +      libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
> +    fi

Can we suppress the warnings with #pragma instead ?
That would avoid compiling the .o file with different
C semantics.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 13:52 ` Peter Maydell
@ 2019-01-14 14:31   ` Daniel P. Berrangé
  2019-01-14 14:38     ` Thomas Huth
  2019-01-14 14:50     ` Eric Blake
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2019-01-14 14:31 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Thomas Huth, QEMU Developers, Ronnie Sahlberg, Paolo Bonzini,
	Peter Lieven, Qemu-block

On Mon, Jan 14, 2019 at 01:52:01PM +0000, Peter Maydell wrote:
> On Mon, 14 Jan 2019 at 13:47, Thomas Huth <thuth@redhat.com> 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 compiling with "-fgnu89-inline"
> > in this case instead.
> >
> > Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > ---
> >  configure | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/configure b/configure
> > index 2b9ba7d..aa80c17 100755
> > --- a/configure
> > +++ b/configure
> > @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
> >      libiscsi="yes"
> >      libiscsi_cflags=$($pkg_config --cflags libiscsi)
> >      libiscsi_libs=$($pkg_config --libs libiscsi)
> > +    if $pkg_config --exact-version==1.9.0 libiscsi; then
> > +      # There are some bad inline declarations in scsi-lowlevel.h of
> > +      # libiscsi 1.9.0 which don't work in gnu99 mode without this:
> > +      libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
> > +    fi
> 
> Can we suppress the warnings with #pragma instead ?
> That would avoid compiling the .o file with different
> C semantics.

IIUC this is a built-in warning you can't disable, except by changing
the compilation mode to have gnu89 inline semantics :-(

I'd rather we just added  -Wno-error  to libiscsi_cflags instead of
changing compilation mode.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 13:46 [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode Thomas Huth
  2019-01-14 13:52 ` Peter Maydell
@ 2019-01-14 14:31 ` Philippe Mathieu-Daudé
  2019-01-14 14:36   ` Thomas Huth
  1 sibling, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-14 14:31 UTC (permalink / raw)
  To: Thomas Huth, Peter Maydell, qemu-devel, berrange
  Cc: Paolo Bonzini, Peter Lieven, qemu-block, Ronnie Sahlberg

On 1/14/19 2:46 PM, 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 compiling with "-fgnu89-inline"
> in this case instead.
> 
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/configure b/configure
> index 2b9ba7d..aa80c17 100755
> --- a/configure
> +++ b/configure
> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
>      libiscsi="yes"
>      libiscsi_cflags=$($pkg_config --cflags libiscsi)
>      libiscsi_libs=$($pkg_config --libs libiscsi)
> +    if $pkg_config --exact-version==1.9.0 libiscsi; then

The first offending commit is d327ab09c which got included in 1.8.0, so
using "exact" is not correct. Maybe:

       if ! $pkg_config --atleast-version=1.10 libiscsi; then

> +      # There are some bad inline declarations in scsi-lowlevel.h of
> +      # libiscsi 1.9.0 which don't work in gnu99 mode without this:
> +      libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
> +    fi
>    else
>      if test "$libiscsi" = "yes" ; then
>        feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
> 

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:31 ` Philippe Mathieu-Daudé
@ 2019-01-14 14:36   ` Thomas Huth
  2019-01-14 15:15     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2019-01-14 14:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Peter Maydell, qemu-devel, berrange
  Cc: Paolo Bonzini, Peter Lieven, qemu-block, Ronnie Sahlberg

On 2019-01-14 15:31, Philippe Mathieu-Daudé wrote:
> On 1/14/19 2:46 PM, 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 compiling with "-fgnu89-inline"
>> in this case instead.
>>
>> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  configure | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 2b9ba7d..aa80c17 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
>>      libiscsi="yes"
>>      libiscsi_cflags=$($pkg_config --cflags libiscsi)
>>      libiscsi_libs=$($pkg_config --libs libiscsi)
>> +    if $pkg_config --exact-version==1.9.0 libiscsi; then
> 
> The first offending commit is d327ab09c which got included in 1.8.0, so
> using "exact" is not correct.
We require at least version 1.9.0, so the only version which can have
this problem when compiling QEMU is 1.9.0.

 Thomas

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:31   ` Daniel P. Berrangé
@ 2019-01-14 14:38     ` Thomas Huth
  2019-01-14 14:50     ` Eric Blake
  1 sibling, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2019-01-14 14:38 UTC (permalink / raw)
  To: Daniel P. Berrangé, Peter Maydell
  Cc: QEMU Developers, Ronnie Sahlberg, Paolo Bonzini, Peter Lieven,
	Qemu-block

On 2019-01-14 15:31, Daniel P. Berrangé wrote:
> On Mon, Jan 14, 2019 at 01:52:01PM +0000, Peter Maydell wrote:
>> On Mon, 14 Jan 2019 at 13:47, Thomas Huth <thuth@redhat.com> 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 compiling with "-fgnu89-inline"
>>> in this case instead.
>>>
>>> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>  configure | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index 2b9ba7d..aa80c17 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
>>>      libiscsi="yes"
>>>      libiscsi_cflags=$($pkg_config --cflags libiscsi)
>>>      libiscsi_libs=$($pkg_config --libs libiscsi)
>>> +    if $pkg_config --exact-version==1.9.0 libiscsi; then
>>> +      # There are some bad inline declarations in scsi-lowlevel.h of
>>> +      # libiscsi 1.9.0 which don't work in gnu99 mode without this:
>>> +      libiscsi_cflags="-fgnu89-inline $libiscsi_cflags"
>>> +    fi
>>
>> Can we suppress the warnings with #pragma instead ?
>> That would avoid compiling the .o file with different
>> C semantics.
> 
> IIUC this is a built-in warning you can't disable, except by changing
> the compilation mode to have gnu89 inline semantics :-(

Right, I just tried things like:

#pragma GCC diagnostic ignored "-Wunused-function"

but nothing seems to help here. Looks like this can not be disabled
seperately.

> I'd rather we just added  -Wno-error  to libiscsi_cflags instead of
> changing compilation mode.

Fine for me, too.

 Thomas

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:31   ` Daniel P. Berrangé
  2019-01-14 14:38     ` Thomas Huth
@ 2019-01-14 14:50     ` Eric Blake
  2019-01-14 14:53       ` Thomas Huth
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Blake @ 2019-01-14 14:50 UTC (permalink / raw)
  To: Daniel P. Berrangé, Peter Maydell
  Cc: Thomas Huth, Qemu-block, Peter Lieven, QEMU Developers,
	Ronnie Sahlberg, Paolo Bonzini

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

On 1/14/19 8:31 AM, Daniel P. Berrangé wrote:

>>
>> Can we suppress the warnings with #pragma instead ?
>> That would avoid compiling the .o file with different
>> C semantics.
> 
> IIUC this is a built-in warning you can't disable, except by changing
> the compilation mode to have gnu89 inline semantics :-(

Could we instead fix the warning by one of:

Using pragma to declare the header as a system header (used to silence
warnings from misbehaving external headers),

and/or adding #defines around the inclusion of the header to neutralize
the poor warnings, but without changing the compilation mode of the
entire project

-- 
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] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:50     ` Eric Blake
@ 2019-01-14 14:53       ` Thomas Huth
  2019-01-14 15:02         ` Eric Blake
  2019-01-14 15:05         ` Daniel P. Berrangé
  0 siblings, 2 replies; 13+ messages in thread
From: Thomas Huth @ 2019-01-14 14:53 UTC (permalink / raw)
  To: Eric Blake, Daniel P. Berrangé, Peter Maydell
  Cc: Qemu-block, Peter Lieven, QEMU Developers, Ronnie Sahlberg,
	Paolo Bonzini

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

On 2019-01-14 15:50, Eric Blake wrote:
> On 1/14/19 8:31 AM, Daniel P. Berrangé wrote:
> 
>>>
>>> Can we suppress the warnings with #pragma instead ?
>>> That would avoid compiling the .o file with different
>>> C semantics.
>>
>> IIUC this is a built-in warning you can't disable, except by changing
>> the compilation mode to have gnu89 inline semantics :-(
> 
> Could we instead fix the warning by one of:
> 
> Using pragma to declare the header as a system header (used to silence
> warnings from misbehaving external headers),

How do you do that?

> and/or adding #defines around the inclusion of the header to neutralize
> the poor warnings,

You mean something like:

#define inline /* nothing */

?

... sounds quite ugly to me, too.

> but without changing the compilation mode of the
> entire project

The patch is only changing libiscsi_cflags, so it's not affecting the
entire project, but just the files that use libiscsi.

 Thomas


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

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:53       ` Thomas Huth
@ 2019-01-14 15:02         ` Eric Blake
  2019-01-14 15:23           ` Thomas Huth
  2019-01-14 15:05         ` Daniel P. Berrangé
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Blake @ 2019-01-14 15:02 UTC (permalink / raw)
  To: Thomas Huth, Daniel P. Berrangé, Peter Maydell
  Cc: Qemu-block, Peter Lieven, QEMU Developers, Ronnie Sahlberg,
	Paolo Bonzini

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

On 1/14/19 8:53 AM, Thomas Huth wrote:
> On 2019-01-14 15:50, Eric Blake wrote:
>> On 1/14/19 8:31 AM, Daniel P. Berrangé wrote:
>>
>>>>
>>>> Can we suppress the warnings with #pragma instead ?
>>>> That would avoid compiling the .o file with different
>>>> C semantics.
>>>
>>> IIUC this is a built-in warning you can't disable, except by changing
>>> the compilation mode to have gnu89 inline semantics :-(
>>
>> Could we instead fix the warning by one of:
>>
>> Using pragma to declare the header as a system header (used to silence
>> warnings from misbehaving external headers),
> 
> How do you do that?

Using -isystem instead of -I - but that means rewriting the output of
pkg-config.

> 
>> and/or adding #defines around the inclusion of the header to neutralize
>> the poor warnings,
> 
> You mean something like:
> 
> #define inline /* nothing */

or
https://stackoverflow.com/questions/1867065/how-to-suppress-gcc-warnings-from-library-headers
mentions:

// save diagnostic state
#pragma GCC diagnostic push

// turn off the specific warning. Can also use "-Wall"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>

// turn the warnings back on
#pragma GCC diagnostic pop

> 
> ?
> 
> ... sounds quite ugly to me, too.
> 
>> but without changing the compilation mode of the
>> entire project
> 
> The patch is only changing libiscsi_cflags, so it's not affecting the
> entire project, but just the files that use libiscsi.

Even so, limiting the damage to just the wrapper file that includes the
problematic header rather than changing the command line for the entire
compilation of those files that use libiscsi is even more precise.

-- 
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] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:53       ` Thomas Huth
  2019-01-14 15:02         ` Eric Blake
@ 2019-01-14 15:05         ` Daniel P. Berrangé
  1 sibling, 0 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2019-01-14 15:05 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Eric Blake, Peter Maydell, Qemu-block, Peter Lieven,
	QEMU Developers, Ronnie Sahlberg, Paolo Bonzini

On Mon, Jan 14, 2019 at 03:53:48PM +0100, Thomas Huth wrote:
> On 2019-01-14 15:50, Eric Blake wrote:
> > On 1/14/19 8:31 AM, Daniel P. Berrangé wrote:
> > 
> >>>
> >>> Can we suppress the warnings with #pragma instead ?
> >>> That would avoid compiling the .o file with different
> >>> C semantics.
> >>
> >> IIUC this is a built-in warning you can't disable, except by changing
> >> the compilation mode to have gnu89 inline semantics :-(
> > 
> > Could we instead fix the warning by one of:
> > 
> > Using pragma to declare the header as a system header (used to silence
> > warnings from misbehaving external headers),
> 
> How do you do that?
> 
> > and/or adding #defines around the inclusion of the header to neutralize
> > the poor warnings,
> 
> You mean something like:
> 
> #define inline /* nothing */
> 
> ?
> 
> ... sounds quite ugly to me, too.

That actually works very nicely, as long as any system headers
used by iscsi.h are already included by QEMU.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 14:36   ` Thomas Huth
@ 2019-01-14 15:15     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-14 15:15 UTC (permalink / raw)
  To: Thomas Huth, Peter Maydell, qemu-devel, berrange
  Cc: Paolo Bonzini, Peter Lieven, qemu-block, Ronnie Sahlberg

On 1/14/19 3:36 PM, Thomas Huth wrote:
> On 2019-01-14 15:31, Philippe Mathieu-Daudé wrote:
>> On 1/14/19 2:46 PM, 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 compiling with "-fgnu89-inline"
>>> in this case instead.
>>>
>>> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>  configure | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index 2b9ba7d..aa80c17 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -4562,6 +4562,11 @@ if test "$libiscsi" != "no" ; then
>>>      libiscsi="yes"
>>>      libiscsi_cflags=$($pkg_config --cflags libiscsi)
>>>      libiscsi_libs=$($pkg_config --libs libiscsi)
>>> +    if $pkg_config --exact-version==1.9.0 libiscsi; then
>>
>> The first offending commit is d327ab09c which got included in 1.8.0, so
>> using "exact" is not correct.
> We require at least version 1.9.0, so the only version which can have
> this problem when compiling QEMU is 1.9.0.

Oh you are right, then:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 15:02         ` Eric Blake
@ 2019-01-14 15:23           ` Thomas Huth
  2019-01-14 15:37             ` Thomas Huth
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2019-01-14 15:23 UTC (permalink / raw)
  To: Eric Blake, Daniel P. Berrangé, Peter Maydell
  Cc: Qemu-block, Peter Lieven, QEMU Developers, Ronnie Sahlberg,
	Paolo Bonzini

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

On 2019-01-14 16:02, Eric Blake wrote:
> On 1/14/19 8:53 AM, Thomas Huth wrote:
>> On 2019-01-14 15:50, Eric Blake wrote:
>>> On 1/14/19 8:31 AM, Daniel P. Berrangé wrote:
>>>
>>>>>
>>>>> Can we suppress the warnings with #pragma instead ?
>>>>> That would avoid compiling the .o file with different
>>>>> C semantics.
>>>>
>>>> IIUC this is a built-in warning you can't disable, except by changing
>>>> the compilation mode to have gnu89 inline semantics :-(
>>>
>>> Could we instead fix the warning by one of:
>>>
>>> Using pragma to declare the header as a system header (used to silence
>>> warnings from misbehaving external headers),
>>
>> How do you do that?
> 
> Using -isystem instead of -I - but that means rewriting the output of
> pkg-config.

That does not work for me on RHEL7: The output of "pkg-config --cflags
libiscsi" is empty since the headers are in a standard location. And
even if I add "-isystem /usr/include" or "-isystem /usr/include/iscsi"
manually, the warning does not go away.

>>> and/or adding #defines around the inclusion of the header to neutralize
>>> the poor warnings,
>>
>> You mean something like:
>>
>> #define inline /* nothing */
> 
> or
> https://stackoverflow.com/questions/1867065/how-to-suppress-gcc-warnings-from-library-headers
> mentions:
> 
> // save diagnostic state
> #pragma GCC diagnostic push
> 
> // turn off the specific warning. Can also use "-Wall"
> #pragma GCC diagnostic ignored "-Wunused-but-set-variable"

That does not work in this case here, too, since there is no dedicated
option to switch this warning on or off.

>> The patch is only changing libiscsi_cflags, so it's not affecting the
>> entire project, but just the files that use libiscsi.
> 
> Even so, limiting the damage to just the wrapper file that includes the
> problematic header rather than changing the command line for the entire
> compilation of those files that use libiscsi is even more precise.

Then our only option is "#define inline /* nothing */", as far as I can
see...

 Thomas




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

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

* Re: [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
  2019-01-14 15:23           ` Thomas Huth
@ 2019-01-14 15:37             ` Thomas Huth
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2019-01-14 15:37 UTC (permalink / raw)
  To: Eric Blake, Daniel P. Berrangé, Peter Maydell
  Cc: Qemu-block, Peter Lieven, QEMU Developers, Ronnie Sahlberg,
	Paolo Bonzini

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

On 2019-01-14 16:23, Thomas Huth wrote:
> On 2019-01-14 16:02, Eric Blake wrote:
>> On 1/14/19 8:53 AM, Thomas Huth wrote:
[...]
>>> The patch is only changing libiscsi_cflags, so it's not affecting the
>>> entire project, but just the files that use libiscsi.
>>
>> Even so, limiting the damage to just the wrapper file that includes the
>> problematic header rather than changing the command line for the entire
>> compilation of those files that use libiscsi is even more precise.
> 
> Then our only option is "#define inline /* nothing */", as far as I can
> see...

Or this one, which seems to be a better idea to me:

#define inline __attribute__((gnu_inline))

gnu_inline should give the same behavior like the "inline" keywords in
gnu89 mode.

 Thomas


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

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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14 13:46 [Qemu-devel] [PATCH] configure: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode Thomas Huth
2019-01-14 13:52 ` Peter Maydell
2019-01-14 14:31   ` Daniel P. Berrangé
2019-01-14 14:38     ` Thomas Huth
2019-01-14 14:50     ` Eric Blake
2019-01-14 14:53       ` Thomas Huth
2019-01-14 15:02         ` Eric Blake
2019-01-14 15:23           ` Thomas Huth
2019-01-14 15:37             ` Thomas Huth
2019-01-14 15:05         ` Daniel P. Berrangé
2019-01-14 14:31 ` Philippe Mathieu-Daudé
2019-01-14 14:36   ` Thomas Huth
2019-01-14 15:15     ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.