diff mbox

pixman: remove -Wredundand-decls

Message ID 1365993073-4659-1-git-send-email-aik@ozlabs.ru
State New
Headers show

Commit Message

Alexey Kardashevskiy April 15, 2013, 2:31 a.m. UTC
The assert.h header file from Fedora18 does not have #ifdef-#endif
brackets around __assertXXXX function so it cannot compile with
the -Wredundant-decls switch on.

Some Linux distributions (such as Debian Wheezy) still do have those
brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
so we should not be using -Wredundant-decls.

The patch removes it.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 include/ui/qemu-pixman.h |    6 ------
 1 file changed, 6 deletions(-)

Comments

Markus Armbruster April 15, 2013, 7:08 a.m. UTC | #1
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> The assert.h header file from Fedora18 does not have #ifdef-#endif
> brackets around __assertXXXX function so it cannot compile with
> the -Wredundant-decls switch on.
>
> Some Linux distributions (such as Debian Wheezy) still do have those
> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
> the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
> so we should not be using -Wredundant-decls.
>
> The patch removes it.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  include/ui/qemu-pixman.h |    6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
> index b032f52..6f473f9 100644
> --- a/include/ui/qemu-pixman.h
> +++ b/include/ui/qemu-pixman.h
> @@ -7,13 +7,7 @@
>  #define QEMU_PIXMAN_H
>  
>  /* pixman-0.16.0 headers have a redundant declaration */
> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
> -#pragma GCC diagnostic ignored "-Wredundant-decls"
> -#endif
>  #include <pixman.h>
> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
> -#pragma GCC diagnostic error "-Wredundant-decls"
> -#endif
>  
>  #include "qemu/typedefs.h"

Patch description doesn't seem to fit the patch.  The patch doesn't
remove -Wredundant-decls, it removes its suppression in one specific
place.  Please advise.

Oh, and use a spell-checker :)
Alexey Kardashevskiy April 15, 2013, 7:12 a.m. UTC | #2
On 04/15/2013 05:08 PM, Markus Armbruster wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> The assert.h header file from Fedora18 does not have #ifdef-#endif
>> brackets around __assertXXXX function so it cannot compile with
>> the -Wredundant-decls switch on.
>>
>> Some Linux distributions (such as Debian Wheezy) still do have those
>> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
>> the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
>> so we should not be using -Wredundant-decls.
>>
>> The patch removes it.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>   include/ui/qemu-pixman.h |    6 ------
>>   1 file changed, 6 deletions(-)
>>
>> diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
>> index b032f52..6f473f9 100644
>> --- a/include/ui/qemu-pixman.h
>> +++ b/include/ui/qemu-pixman.h
>> @@ -7,13 +7,7 @@
>>   #define QEMU_PIXMAN_H
>>
>>   /* pixman-0.16.0 headers have a redundant declaration */
>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>> -#pragma GCC diagnostic ignored "-Wredundant-decls"
>> -#endif
>>   #include <pixman.h>
>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>> -#pragma GCC diagnostic error "-Wredundant-decls"
>> -#endif
>>
>>   #include "qemu/typedefs.h"
>
> Patch description doesn't seem to fit the patch.  The patch doesn't
> remove -Wredundant-decls, it removes its suppression in one specific
> place.  Please advise.

The patch removes both suppression AND enabling, the second chunk enabled 
this check back after #include, no matter if it was enabled or not.


> Oh, and use a spell-checker :)

The one build into thunderbird does not show any spelling errors (except 
file names, of course) :)
Peter Maydell April 15, 2013, 7:18 a.m. UTC | #3
On 15 April 2013 03:31, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> The assert.h header file from Fedora18 does not have #ifdef-#endif
> brackets around __assertXXXX function so it cannot compile with
> the -Wredundant-decls switch on.
>
> Some Linux distributions (such as Debian Wheezy) still do have those
> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
> the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
> so we should not be using -Wredundant-decls.
>
> The patch removes it.

This commit message seems to be missing any mention of
which versions of pixman this change breaks and why
it's OK now to break compiling against them...

> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  include/ui/qemu-pixman.h |    6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
> index b032f52..6f473f9 100644
> --- a/include/ui/qemu-pixman.h
> +++ b/include/ui/qemu-pixman.h
> @@ -7,13 +7,7 @@
>  #define QEMU_PIXMAN_H
>
>  /* pixman-0.16.0 headers have a redundant declaration */

...and if it's a correct change it should be removing the
comment as well, since it would no longer apply.

> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
> -#pragma GCC diagnostic ignored "-Wredundant-decls"
> -#endif
>  #include <pixman.h>
> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
> -#pragma GCC diagnostic error "-Wredundant-decls"
> -#endif
>
>  #include "qemu/typedefs.h"
>
> --
> 1.7.10.4

thanks
-- PMM
Alexey Kardashevskiy April 15, 2013, 7:26 a.m. UTC | #4
On 04/15/2013 05:18 PM, Peter Maydell wrote:
> On 15 April 2013 03:31, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>> The assert.h header file from Fedora18 does not have #ifdef-#endif
>> brackets around __assertXXXX function so it cannot compile with
>> the -Wredundant-decls switch on.
>>
>> Some Linux distributions (such as Debian Wheezy) still do have those
>> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
>> the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
>> so we should not be using -Wredundant-decls.
>>
>> The patch removes it.
>
> This commit message seems to be missing any mention of
> which versions of pixman this change breaks and why
> it's OK now to break compiling against them...


The change does not _break_ anything. By default, it will just generate 
warnings, but only if "-Wredundant-decls" is set.

The second removed chunk in the patch is the problem as it:
1) enables -Wredundant-decls even if it was not enabled before;
2) makes -Wredundant-decls an error, not just a warning.

Default assert.h shipped with Fedora Core 18 (pretty recent and popular 
distribution, I would say) cannot compile with -Wredundant-decls as an 
error so we should either avoid -Wredundant-decls or watch where we include 
assert.h very carefully.



>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>   include/ui/qemu-pixman.h |    6 ------
>>   1 file changed, 6 deletions(-)
>>
>> diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
>> index b032f52..6f473f9 100644
>> --- a/include/ui/qemu-pixman.h
>> +++ b/include/ui/qemu-pixman.h
>> @@ -7,13 +7,7 @@
>>   #define QEMU_PIXMAN_H
>>
>>   /* pixman-0.16.0 headers have a redundant declaration */
>
> ...and if it's a correct change it should be removing the
> comment as well, since it would no longer apply.
>
>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>> -#pragma GCC diagnostic ignored "-Wredundant-decls"
>> -#endif
>>   #include <pixman.h>
>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>> -#pragma GCC diagnostic error "-Wredundant-decls"
>> -#endif
>>
>>   #include "qemu/typedefs.h"
>>
>> --
>> 1.7.10.4
>
> thanks
> -- PMM
>
Peter Maydell April 15, 2013, 7:30 a.m. UTC | #5
On 15 April 2013 08:26, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> On 04/15/2013 05:18 PM, Peter Maydell wrote:
>>
>> On 15 April 2013 03:31, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>
>>> The assert.h header file from Fedora18 does not have #ifdef-#endif
>>> brackets around __assertXXXX function so it cannot compile with
>>> the -Wredundant-decls switch on.
>>>
>>> Some Linux distributions (such as Debian Wheezy) still do have those
>>> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
>>> the version of assert.h on http://sourceware.org/git/?p=glibc.git does
>>> not
>>> so we should not be using -Wredundant-decls.
>>>
>>> The patch removes it.
>>
>>
>> This commit message seems to be missing any mention of
>> which versions of pixman this change breaks and why
>> it's OK now to break compiling against them...
>
>
>
> The change does not _break_ anything.

The change breaks the fix that the code was put in to deal with,
ie that pixman-0.16's header files generate warnings, which the
default development qemu will turn into errors with -Werror, which
means we won't compile.

> The second removed chunk in the patch is the problem as it:
> 1) enables -Wredundant-decls even if it was not enabled before;
> 2) makes -Wredundant-decls an error, not just a warning.

This is because not all versions of gcc have the push/pop warning
pragma.

> Default assert.h shipped with Fedora Core 18 (pretty recent and popular
> distribution, I would say) cannot compile with -Wredundant-decls as an error

This appears to be a bug in Fedora.

I guess the correct workaround for that bug is going to be either:

 * wrap assert.h the same way we wrap pixman.h
 * drop -Wredundant-decls :-(

-- PMM
Alexey Kardashevskiy April 15, 2013, 7:45 a.m. UTC | #6
On 04/15/2013 05:30 PM, Peter Maydell wrote:
> On 15 April 2013 08:26, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>> On 04/15/2013 05:18 PM, Peter Maydell wrote:
>>>
>>> On 15 April 2013 03:31, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>>
>>>> The assert.h header file from Fedora18 does not have #ifdef-#endif
>>>> brackets around __assertXXXX function so it cannot compile with
>>>> the -Wredundant-decls switch on.
>>>>
>>>> Some Linux distributions (such as Debian Wheezy) still do have those
>>>> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
>>>> the version of assert.h on http://sourceware.org/git/?p=glibc.git does
>>>> not
>>>> so we should not be using -Wredundant-decls.
>>>>
>>>> The patch removes it.
>>>
>>>
>>> This commit message seems to be missing any mention of
>>> which versions of pixman this change breaks and why
>>> it's OK now to break compiling against them...
>>
>>
>>
>> The change does not _break_ anything.
>
> The change breaks the fix that the code was put in to deal with,
> ie that pixman-0.16's header files generate warnings, which the
> default development qemu will turn into errors with -Werror, which
> means we won't compile.
>
>> The second removed chunk in the patch is the problem as it:
>> 1) enables -Wredundant-decls even if it was not enabled before;
>> 2) makes -Wredundant-decls an error, not just a warning.
>
> This is because not all versions of gcc have the push/pop warning
> pragma.
>
>> Default assert.h shipped with Fedora Core 18 (pretty recent and popular
>> distribution, I would say) cannot compile with -Wredundant-decls as an error
>
> This appears to be a bug in Fedora.


Rather glibc as it is still in glibc's master branch:
http://sourceware.org/git/?p=glibc.git;a=blob;f=assert/assert.h;h=1bb9b2d50f92da3b17cc0b937ecd6141a87dc196;hb=HEAD

Or am I looking at wrong git?

> I guess the correct workaround for that bug is going to be either:
>
>   * wrap assert.h the same way we wrap pixman.h
>   * drop -Wredundant-decls :-(


The second option seems less ugly.
Markus Armbruster April 15, 2013, 8:23 a.m. UTC | #7
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 04/15/2013 05:08 PM, Markus Armbruster wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>
>>> The assert.h header file from Fedora18 does not have #ifdef-#endif
>>> brackets around __assertXXXX function so it cannot compile with
>>> the -Wredundant-decls switch on.
>>>
>>> Some Linux distributions (such as Debian Wheezy) still do have those
>>> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
>>> the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
>>> so we should not be using -Wredundant-decls.
>>>
>>> The patch removes it.
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>>   include/ui/qemu-pixman.h |    6 ------
>>>   1 file changed, 6 deletions(-)
>>>
>>> diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
>>> index b032f52..6f473f9 100644
>>> --- a/include/ui/qemu-pixman.h
>>> +++ b/include/ui/qemu-pixman.h
>>> @@ -7,13 +7,7 @@
>>>   #define QEMU_PIXMAN_H
>>>
>>>   /* pixman-0.16.0 headers have a redundant declaration */
>>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>>> -#pragma GCC diagnostic ignored "-Wredundant-decls"
>>> -#endif
>>>   #include <pixman.h>
>>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>>> -#pragma GCC diagnostic error "-Wredundant-decls"
>>> -#endif
>>>
>>>   #include "qemu/typedefs.h"
>>
>> Patch description doesn't seem to fit the patch.  The patch doesn't
>> remove -Wredundant-decls, it removes its suppression in one specific
>> place.  Please advise.
>
> The patch removes both suppression AND enabling, the second chunk
> enabled this check back after #include, no matter if it was enabled or
> not.

Trouble is there is no second chunk.

If you're proposing to remove -Wredundant-decls globally, you'll have to
explain what problems exactly it causes.

>> Oh, and use a spell-checker :)
>
> The one build into thunderbird does not show any spelling errors
> (except file names, of course) :)

arounb
-Wredundand-decls
Alexey Kardashevskiy April 15, 2013, 9:50 a.m. UTC | #8
On 04/15/2013 06:23 PM, Markus Armbruster wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> On 04/15/2013 05:08 PM, Markus Armbruster wrote:
>>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>>
>>>> The assert.h header file from Fedora18 does not have #ifdef-#endif
>>>> brackets around __assertXXXX function so it cannot compile with
>>>> the -Wredundant-decls switch on.
>>>>
>>>> Some Linux distributions (such as Debian Wheezy) still do have those
>>>> brackets arounb __assertXXXX functions (#ifndef _ASSERT_H_DECLS) but
>>>> the version of assert.h on http://sourceware.org/git/?p=glibc.git does not
>>>> so we should not be using -Wredundant-decls.
>>>>
>>>> The patch removes it.
>>>>
>>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>>> ---
>>>>    include/ui/qemu-pixman.h |    6 ------
>>>>    1 file changed, 6 deletions(-)
>>>>
>>>> diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
>>>> index b032f52..6f473f9 100644
>>>> --- a/include/ui/qemu-pixman.h
>>>> +++ b/include/ui/qemu-pixman.h
>>>> @@ -7,13 +7,7 @@
>>>>    #define QEMU_PIXMAN_H
>>>>
>>>>    /* pixman-0.16.0 headers have a redundant declaration */
>>>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>>>> -#pragma GCC diagnostic ignored "-Wredundant-decls"
>>>> -#endif
>>>>    #include <pixman.h>
>>>> -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
>>>> -#pragma GCC diagnostic error "-Wredundant-decls"
>>>> -#endif
>>>>
>>>>    #include "qemu/typedefs.h"
>>>
>>> Patch description doesn't seem to fit the patch.  The patch doesn't
>>> remove -Wredundant-decls, it removes its suppression in one specific
>>> place.  Please advise.
>>
>> The patch removes both suppression AND enabling, the second chunk
>> enabled this check back after #include, no matter if it was enabled or
>> not.
>
> Trouble is there is no second chunk.


The patch removes 3 lines twice. The second 3 lines contain:
"#pragma GCC diagnostic error "-Wredundant-decls""

This enables the check.

My bad, it is not "patch" chunk. Sorry for confusing.

>
> If you're proposing to remove -Wredundant-decls globally, you'll have to
> explain what problems exactly it causes.

Besides assert.h is just broken and should not be included twice when 
-Wredundant-decls, I got a lot of this when did cross compilation (for 
ppc64 on x86_64):

   CC    hw/bt/sdp.o
In file included from 
/home/alexey/pcipassthru/qemu-impreza/include/qapi/qmp/qobject.h:36:0,
                  from 
/home/alexey/pcipassthru/qemu-impreza/include/qapi/qmp/qdict.h:16,
                  from 
/home/alexey/pcipassthru/qemu-impreza/include/ui/console.h:5,
                  from ui/qemu-pixman.c:7:
/home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13: 
error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
/home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13: 
note: previous declaration of '__assert_fail' was here
/home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13: 
error: redundant redeclaration of '__assert_perror_fail' 
[-Werror=redundant-decls]
/home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13: 
note: previous declaration of '__assert_perror_fail' was here
/home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:79:13: 
error: redundant redeclaration of '__assert' [-Werror=redundant-decls]
/home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:79:13: 
note: previous declaration of '__assert' was here
In file included from 
/home/alexey/pcipassthru/qemu-impreza/include/qapi/qmp/qobject.h:36:0,
                  from 
/home/alexey/pcipassthru/qemu-impreza/include/qapi/qmp/qdict.h:16,
                  from 
/home/alexey/pcipassthru/qemu-impreza/include/ui/console.h:5,
                  from ui/console.c:25:


If we disable that warning, I do not what we loose. The "bug" above is not 
a bug at all.


>
>>> Oh, and use a spell-checker :)
>>
>> The one build into thunderbird does not show any spelling errors
>> (except file names, of course) :)
>
> arounb
> -Wredundand-decls

Ah. My bad :(
Peter Maydell April 15, 2013, 10:01 a.m. UTC | #9
On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
> error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
> note: previous declaration of '__assert_fail' was here
> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
> error: redundant redeclaration of '__assert_perror_fail'
> [-Werror=redundant-decls]

This copy of assert.h seems to be broken. The declarations
should be guarded (by _ASSERT_H_DECLS in my system's copy).
If it's widespread we might have to work around this.

> If we disable that warning, I do not what we loose. The "bug" above is not a
> bug at all.

What we lose is that we are no longer informed when people
inadvertently introduce redundant declarations into QEMU itself.

-- PMM
Peter Maydell April 15, 2013, 10:40 a.m. UTC | #10
On 15 April 2013 11:01, Peter Maydell <peter.maydell@linaro.org> wrote:
> This copy of assert.h seems to be broken. The declarations
> should be guarded (by _ASSERT_H_DECLS in my system's copy).

FWIW, the _ASSERT_H_DECLS fix appears to be a Debian specific
patch (added in 2003; I can't find any record of it ever being
submitted upstream).

-- PMM
Alexey Kardashevskiy April 15, 2013, 10:52 a.m. UTC | #11
On 04/15/2013 08:01 PM, Peter Maydell wrote:
> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>> error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>> note: previous declaration of '__assert_fail' was here
>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>> error: redundant redeclaration of '__assert_perror_fail'
>> [-Werror=redundant-decls]
>
> This copy of assert.h seems to be broken. The declarations
> should be guarded (by _ASSERT_H_DECLS in my system's copy).

Debian? It uses eglibc which is fork (or clone?) of glibc.

> If it's widespread we might have to work around this.

It is in fedora 18 and glibc's git master branch. Why "if"?

And this is not it. I just managed to suppress others with 
-Wredundand-decls, like the one with strtold() defined twice in 
/usr/include/stdlib.h and /usr/include/bits/stdlib-ldbl.h and some others.


I suspect I am getting these errors because I am the only person who is 
trying to cross compile or/and when host and target endianness differ.

Does anyone do cross compilation (with different endianness?) on a regular 
basis? My colleagues do not :)


>> If we disable that warning, I do not what we loose. The "bug" above is not a
>> bug at all.
>
> What we lose is that we are no longer informed when people
> inadvertently introduce redundant declarations into QEMU itself.
Peter Maydell April 15, 2013, 11 a.m. UTC | #12
On 15 April 2013 11:52, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> I suspect I am getting these errors because I am the only person who is
> trying to cross compile or/and when host and target endianness differ.

Cross compilation or otherwise should have zero effect here.
You may be hitting more issues because your target libc
happens to be one that not very many other people are targetting.

-- PMM
Alexey Kardashevskiy April 15, 2013, 11:08 a.m. UTC | #13
On 04/15/2013 09:00 PM, Peter Maydell wrote:
> On 15 April 2013 11:52, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>> I suspect I am getting these errors because I am the only person who
>> is trying to cross compile or/and when host and target endianness
>> differ.
>
> Cross compilation or otherwise should have zero effect here.

When I build on native ppc64 system (***) with fc18, everything is ok.
When I build on x86_64 with headers/libraries simply copied from the (***),
I get these errors. gcc is 4.7.2 on ppc64 machine and 4.6.3..4.8.0 on
x86_64 (cross compiler).


> You may be hitting more issues because your target libc happens to be
> one that not very many other people are targetting.

Is standard glibc not popular any more? Wow. Neither RHEL (5.0+) nor Fedora
(16, 18) has that _ASSERT_H_DECLS in assert.h. So what is the target for
the QEMU people then?
Peter Maydell April 15, 2013, 11:14 a.m. UTC | #14
On 15 April 2013 12:08, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> On 04/15/2013 09:00 PM, Peter Maydell wrote:
>> You may be hitting more issues because your target libc happens to be
>> one that not very many other people are targetting.
>
>
> Is standard glibc not popular any more? Wow. Neither RHEL (5.0+) nor Fedora
> (16, 18) has that _ASSERT_H_DECLS in assert.h. So what is the target for
> the QEMU people then?

Well, compilation of QEMU against glibc for ppc64 probably
doesn't get much testing.

-- PMM
Alexey Kardashevskiy April 15, 2013, 11:20 a.m. UTC | #15
On 04/15/2013 09:14 PM, Peter Maydell wrote:
> On 15 April 2013 12:08, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>> On 04/15/2013 09:00 PM, Peter Maydell wrote:
>>> You may be hitting more issues because your target libc happens to be
>>> one that not very many other people are targetting.
>>
>>
>> Is standard glibc not popular any more? Wow. Neither RHEL (5.0+) nor Fedora
>> (16, 18) has that _ASSERT_H_DECLS in assert.h. So what is the target for
>> the QEMU people then?
>
> Well, compilation of QEMU against glibc for ppc64 probably
> doesn't get much testing.

assert.h is exactly the same on my thinkpad (x86_64) with fedora18 as all 
(most?) standard headers. If I replace powerpc64-linux-gcc with the 
standard x86_64 gcc, I get the same error.
Markus Armbruster April 15, 2013, 12:57 p.m. UTC | #16
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 04/15/2013 08:01 PM, Peter Maydell wrote:
>> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>> error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>> note: previous declaration of '__assert_fail' was here
>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>>> error: redundant redeclaration of '__assert_perror_fail'
>>> [-Werror=redundant-decls]
>>
>> This copy of assert.h seems to be broken. The declarations
>> should be guarded (by _ASSERT_H_DECLS in my system's copy).
>
> Debian? It uses eglibc which is fork (or clone?) of glibc.
>
>> If it's widespread we might have to work around this.
>
> It is in fedora 18 and glibc's git master branch. Why "if"?

It's in Fedora 17, too, but I *don't* get a warning.  Suspecting your
compiler.  --version?

[...]
Alexey Kardashevskiy April 15, 2013, 1:03 p.m. UTC | #17
On 04/15/2013 10:57 PM, Markus Armbruster wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> On 04/15/2013 08:01 PM, Peter Maydell wrote:
>>> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>> error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>> note: previous declaration of '__assert_fail' was here
>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>>>> error: redundant redeclaration of '__assert_perror_fail'
>>>> [-Werror=redundant-decls]
>>>
>>> This copy of assert.h seems to be broken. The declarations
>>> should be guarded (by _ASSERT_H_DECLS in my system's copy).
>>
>> Debian? It uses eglibc which is fork (or clone?) of glibc.
>>
>>> If it's widespread we might have to work around this.
>>
>> It is in fedora 18 and glibc's git master branch. Why "if"?
>
> It's in Fedora 17, too, but I *don't* get a warning.  Suspecting your
> compiler.  --version?


powerpc64-linux-gcc 4.6.3, 4.7.2, 4.8.0, all the same. I'll try to track it 
down tomorrow why it all works when host and target are the same (pretty 
sure this is the cse) but I just do not get it... It is just me who sees 
obvious error in assert.h which is caused by -Wno-redundant-decls? Even if 
you do not hit this now, you will get there eventually.
Markus Armbruster April 15, 2013, 3:55 p.m. UTC | #18
Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 04/15/2013 10:57 PM, Markus Armbruster wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>
>>> On 04/15/2013 08:01 PM, Peter Maydell wrote:
>>>> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>> error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>> note: previous declaration of '__assert_fail' was here
>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>>>>> error: redundant redeclaration of '__assert_perror_fail'
>>>>> [-Werror=redundant-decls]
>>>>
>>>> This copy of assert.h seems to be broken. The declarations
>>>> should be guarded (by _ASSERT_H_DECLS in my system's copy).
>>>
>>> Debian? It uses eglibc which is fork (or clone?) of glibc.
>>>
>>>> If it's widespread we might have to work around this.
>>>
>>> It is in fedora 18 and glibc's git master branch. Why "if"?
>>
>> It's in Fedora 17, too, but I *don't* get a warning.  Suspecting your
>> compiler.  --version?
>
>
> powerpc64-linux-gcc 4.6.3, 4.7.2, 4.8.0, all the same. I'll try to
> track it down tomorrow why it all works when host and target are the
> same (pretty sure this is the cse) but I just do not get it... It is
> just me who sees obvious error in assert.h which is caused by
> -Wno-redundant-decls? Even if you do not hit this now, you will get
> there eventually.

I don't doubt your gcc+libc is in error.  I just don't want to lose a
useful warning because of that.

Workaround: configure --disable-werror
Alexey Kardashevskiy April 15, 2013, 10:48 p.m. UTC | #19
On 04/16/2013 01:55 AM, Markus Armbruster wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> On 04/15/2013 10:57 PM, Markus Armbruster wrote:
>>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>>
>>>> On 04/15/2013 08:01 PM, Peter Maydell wrote:
>>>>> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>>> error: redundant redeclaration of '__assert_fail' [-Werror=redundant-decls]
>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>>> note: previous declaration of '__assert_fail' was here
>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>>>>>> error: redundant redeclaration of '__assert_perror_fail'
>>>>>> [-Werror=redundant-decls]
>>>>>
>>>>> This copy of assert.h seems to be broken. The declarations
>>>>> should be guarded (by _ASSERT_H_DECLS in my system's copy).
>>>>
>>>> Debian? It uses eglibc which is fork (or clone?) of glibc.
>>>>
>>>>> If it's widespread we might have to work around this.
>>>>
>>>> It is in fedora 18 and glibc's git master branch. Why "if"?
>>>
>>> It's in Fedora 17, too, but I *don't* get a warning.  Suspecting your
>>> compiler.  --version?
>>
>>
>> powerpc64-linux-gcc 4.6.3, 4.7.2, 4.8.0, all the same. I'll try to
>> track it down tomorrow why it all works when host and target are the
>> same (pretty sure this is the cse) but I just do not get it... It is
>> just me who sees obvious error in assert.h which is caused by
>> -Wno-redundant-decls? Even if you do not hit this now, you will get
>> there eventually.
>
> I don't doubt your gcc+libc is in error.  I just don't want to lose a
> useful warning because of that.
 >
> Workaround: configure --disable-werror

This workaround does NOT work if pragmas used. "#pragma GCC diagnostic 
error "-Wredundant-decls"" re-enables warnings as errors.
Alexey Kardashevskiy April 16, 2013, 3:16 a.m. UTC | #20
On 04/16/2013 08:48 AM, Alexey Kardashevskiy wrote:
> On 04/16/2013 01:55 AM, Markus Armbruster wrote:
>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>
>>> On 04/15/2013 10:57 PM, Markus Armbruster wrote:
>>>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>>>
>>>>> On 04/15/2013 08:01 PM, Peter Maydell wrote:
>>>>>> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>>>>
>>>>>>> error: redundant redeclaration of '__assert_fail'
>>>>>>> [-Werror=redundant-decls]
>>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>>>>
>>>>>>> note: previous declaration of '__assert_fail' was here
>>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>>>>>>>
>>>>>>> error: redundant redeclaration of '__assert_perror_fail'
>>>>>>> [-Werror=redundant-decls]
>>>>>>
>>>>>> This copy of assert.h seems to be broken. The declarations
>>>>>> should be guarded (by _ASSERT_H_DECLS in my system's copy).
>>>>>
>>>>> Debian? It uses eglibc which is fork (or clone?) of glibc.
>>>>>
>>>>>> If it's widespread we might have to work around this.
>>>>>
>>>>> It is in fedora 18 and glibc's git master branch. Why "if"?
>>>>
>>>> It's in Fedora 17, too, but I *don't* get a warning.  Suspecting your
>>>> compiler.  --version?
>>>
>>>
>>> powerpc64-linux-gcc 4.6.3, 4.7.2, 4.8.0, all the same. I'll try to
>>> track it down tomorrow why it all works when host and target are the
>>> same (pretty sure this is the cse) but I just do not get it... It is
>>> just me who sees obvious error in assert.h which is caused by
>>> -Wno-redundant-decls? Even if you do not hit this now, you will get
>>> there eventually.
>>
>> I don't doubt your gcc+libc is in error.  I just don't want to lose a
>> useful warning because of that.
>  >
>> Workaround: configure --disable-werror
>
> This workaround does NOT work if pragmas used. "#pragma GCC diagnostic
> error "-Wredundant-decls"" re-enables warnings as errors.


Kind of offtopic but still...

I think this is just beautiful. Fedora18, x86_64, NO cross compiler. gcc 
does not apply -Wredundant-decls to /usr/include/* but does it for all 
other headers and in the case of cross compilation I hit this case.

Does anyone know the way to tell gcc that libc headers are not at 
/usr/include but somewhere else?



[aik@aik ~]$ cp /usr/include/assert.h ./
[aik@aik ~]$
[aik@aik ~]$ cat a.c
#pragma GCC diagnostic error "-Wredundant-decls"

#ifdef USEMINE
#include "assert.h"
#include "assert.h"
#else
#include <assert.h>
#include <assert.h>
#endif

int main(int argc, char **argv){ return 0; }
[aik@aik ~]$
[aik@aik ~]$ gcc a.c -o a
[aik@aik ~]$ gcc a.c -o a -DUSEMINE
In file included from a.c:5:0:
assert.h:68:13: error: redundant redeclaration of ‘__assert_fail’ 
[-Werror=redundant-decls]
In file included from a.c:4:0:
assert.h:68:13: note: previous declaration of ‘__assert_fail’ was here
In file included from a.c:5:0:
assert.h:73:13: error: redundant redeclaration of ‘__assert_perror_fail’ 
[-Werror=redundant-decls]
In file included from a.c:4:0:
assert.h:73:13: note: previous declaration of ‘__assert_perror_fail’ was here
In file included from a.c:5:0:
assert.h:80:13: error: redundant redeclaration of ‘__assert’ 
[-Werror=redundant-decls]
In file included from a.c:4:0:
assert.h:80:13: note: previous declaration of ‘__assert’ was here
cc1: some warnings being treated as errors
[aik@aik ~]$
Markus Armbruster April 16, 2013, 7:57 a.m. UTC | #21
Gcc issue, perhaps Paolo [cc'ed] got an idea.

Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> On 04/16/2013 08:48 AM, Alexey Kardashevskiy wrote:
>> On 04/16/2013 01:55 AM, Markus Armbruster wrote:
>>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>>
>>>> On 04/15/2013 10:57 PM, Markus Armbruster wrote:
>>>>> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>>>>>
>>>>>> On 04/15/2013 08:01 PM, Peter Maydell wrote:
>>>>>>> On 15 April 2013 10:50, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>>>>>
>>>>>>>> error: redundant redeclaration of '__assert_fail'
>>>>>>>> [-Werror=redundant-decls]
>>>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:67:13:
>>>>>>>>
>>>>>>>> note: previous declaration of '__assert_fail' was here
>>>>>>>> /home/alexey/pcipassthru/qemu-impreza/../lib4qemu/usr/include/assert.h:72:13:
>>>>>>>>
>>>>>>>> error: redundant redeclaration of '__assert_perror_fail'
>>>>>>>> [-Werror=redundant-decls]
>>>>>>>
>>>>>>> This copy of assert.h seems to be broken. The declarations
>>>>>>> should be guarded (by _ASSERT_H_DECLS in my system's copy).
>>>>>>
>>>>>> Debian? It uses eglibc which is fork (or clone?) of glibc.
>>>>>>
>>>>>>> If it's widespread we might have to work around this.
>>>>>>
>>>>>> It is in fedora 18 and glibc's git master branch. Why "if"?
>>>>>
>>>>> It's in Fedora 17, too, but I *don't* get a warning.  Suspecting your
>>>>> compiler.  --version?
>>>>
>>>>
>>>> powerpc64-linux-gcc 4.6.3, 4.7.2, 4.8.0, all the same. I'll try to
>>>> track it down tomorrow why it all works when host and target are the
>>>> same (pretty sure this is the cse) but I just do not get it... It is
>>>> just me who sees obvious error in assert.h which is caused by
>>>> -Wno-redundant-decls? Even if you do not hit this now, you will get
>>>> there eventually.
>>>
>>> I don't doubt your gcc+libc is in error.  I just don't want to lose a
>>> useful warning because of that.
>>  >
>>> Workaround: configure --disable-werror
>>
>> This workaround does NOT work if pragmas used. "#pragma GCC diagnostic
>> error "-Wredundant-decls"" re-enables warnings as errors.
>
>
> Kind of offtopic but still...
>
> I think this is just beautiful. Fedora18, x86_64, NO cross
> compiler. gcc does not apply -Wredundant-decls to /usr/include/* but
> does it for all other headers and in the case of cross compilation I
> hit this case.
>
> Does anyone know the way to tell gcc that libc headers are not at
> /usr/include but somewhere else?
>
>
>
> [aik@aik ~]$ cp /usr/include/assert.h ./
> [aik@aik ~]$
> [aik@aik ~]$ cat a.c
> #pragma GCC diagnostic error "-Wredundant-decls"
>
> #ifdef USEMINE
> #include "assert.h"
> #include "assert.h"
> #else
> #include <assert.h>
> #include <assert.h>
> #endif
>
> int main(int argc, char **argv){ return 0; }
> [aik@aik ~]$
> [aik@aik ~]$ gcc a.c -o a
> [aik@aik ~]$ gcc a.c -o a -DUSEMINE
> In file included from a.c:5:0:
> assert.h:68:13: error: redundant redeclaration of ‘__assert_fail’
> [-Werror=redundant-decls]
> In file included from a.c:4:0:
> assert.h:68:13: note: previous declaration of ‘__assert_fail’ was here
> In file included from a.c:5:0:
> assert.h:73:13: error: redundant redeclaration of
> ‘__assert_perror_fail’ [-Werror=redundant-decls]
> In file included from a.c:4:0:
> assert.h:73:13: note: previous declaration of ‘__assert_perror_fail’ was here
> In file included from a.c:5:0:
> assert.h:80:13: error: redundant redeclaration of ‘__assert’
> [-Werror=redundant-decls]
> In file included from a.c:4:0:
> assert.h:80:13: note: previous declaration of ‘__assert’ was here
> cc1: some warnings being treated as errors
> [aik@aik ~]$
diff mbox

Patch

diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
index b032f52..6f473f9 100644
--- a/include/ui/qemu-pixman.h
+++ b/include/ui/qemu-pixman.h
@@ -7,13 +7,7 @@ 
 #define QEMU_PIXMAN_H
 
 /* pixman-0.16.0 headers have a redundant declaration */
-#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
 #include <pixman.h>
-#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
-#pragma GCC diagnostic error "-Wredundant-decls"
-#endif
 
 #include "qemu/typedefs.h"