Skip to contentSkip to conversation

gcc: rename CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET to CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE

PATCH Applied Gerd Hoffmann 4 participants 7 messages Jan 9, 2013 – Jan 15, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gcc: rename CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET to CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE

---
 configure            |    6 +++---
 coroutine-ucontext.c |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
configure +3 -3
index 4f050ea..9357035 100755
@@ -3078,7 +3078,7 @@ int main(void) {
 }
 EOF
 if compile_prog "-Werror" "" ; then
-    pragma_disable_unused_but_set=yes
+    pragma_diagnostic_available=yes
 fi
 
 ########################################
@@ -3650,8 +3650,8 @@ if test "$linux_magic_h" = "yes" ; then
   echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
 fi
 
-if test "$pragma_disable_unused_but_set" = "yes" ; then
-  echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak
+if test "$pragma_diagnostic_available" = "yes" ; then
+  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
 fi
 
 if test "$valgrind_h" = "yes" ; then
coroutine-ucontext.c +2 -2
index 2ed703a..a9c30e9 100644
@@ -200,7 +200,7 @@ Coroutine *qemu_coroutine_new(void)
 }
 
 #ifdef CONFIG_VALGRIND_H
-#ifdef CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET
+#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
 /* Work around an unused variable in the valgrind.h macro... */
 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 #endif
@@ -208,7 +208,7 @@ static inline void valgrind_stack_deregister(CoroutineUContext *co)
 {
     VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id);
 }
-#ifdef CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET
+#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
 #pragma GCC diagnostic error "-Wunused-but-set-variable"
 #endif
 #endif
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 pixman: fix warning

---
 include/ui/qemu-pixman.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/ui/qemu-pixman.h +7 -0
index 3c05c83..016fd87 100644
@@ -6,7 +6,14 @@
 #ifndef QEMU_PIXMAN_H
 #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 "console.h"
 
Signature · 1 line
1.7.1
Applied
#2 lore raw

Re: [Qemu-devel] [PATCH 2/2] pixman: fix warning

Thanks, applied.

Quoted 30 lines · Gerd Hoffmann
---
 include/ui/qemu-pixman.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/ui/qemu-pixman.h +7 -1
index 3c05c83..016fd87 100644
@@ -6,7 +6,14 @@
 #ifndef QEMU_PIXMAN_H
 #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 "console.h"
 
--

1.7.1

#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] pixman: fix warning

In reply to Gerd Hoffmann

Am 09.01.2013 10:17, schrieb Gerd Hoffmann:

Quoted 16 lines
---
 include/ui/qemu-pixman.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/ui/qemu-pixman.h +1 -0
index 3c05c83..016fd87 100644
@@ -6,7 +6,14 @@
 #ifndef QEMU_PIXMAN_H
 #define QEMU_PIXMAN_H
 
+/* pixman-0.16.0 headers have a redundant declaration */

include/ui/qemu-pixman.h line 19

Quoted 10 lines
include/ui/qemu-pixman.h +6 -0
+#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 "console.h"
 

Unfortunately this did not help on SLES11 SP2. I don't spot any typo in your patches, it looked neat; CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE does not get defined in config-host.h it seems.

Using the pragmas unconditionally results in change from:

CC qemu-timer.o
cc1: warnings being treated as errors
In file included from /home/andreas/QEMU/qemu-s390/include/ui/qemu-pixman.h:13,

                 from /home/andreas/QEMU/qemu-s390/include/ui/console.h:4,
                 from /home/andreas/QEMU/qemu-s390/qemu-timer.c:27:

/usr/include/pixman-1/pixman.h:225: error: redundant redeclaration of ‘pixman_transform_from_pixman_f_transform’ /usr/include/pixman-1/pixman.h:221: error: previous declaration of ‘pixman_transform_from_pixman_f_transform’ was here
make: *** [qemu-timer.o] Fehler 1

to:

CC qemu-timer.o
cc1: warnings being treated as errors
In file included from /home/andreas/QEMU/qemu-s390/include/ui/qemu-pixman.h:13,

                 from /home/andreas/QEMU/qemu-s390/include/ui/console.h:4,
                 from /home/andreas/QEMU/qemu-s390/qemu-timer.c:27:

/usr/include/pixman-1/pixman.h:221: error: previous declaration of ‘pixman_transform_from_pixman_f_transform’ was here
make: *** [qemu-timer.o] Fehler 1

gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] pixman: fix warning

Hi,

Quoted 3 lines

Unfortunately this did not help on SLES11 SP2. I don't spot any typo in your patches, it looked neat; CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE does not get defined in config-host.h it seems.

Hmm, anything in config.log? Maybe the sles11 gcc doesn't support the -Wunused-but-set-variable used in the configure test?

Quoted 20 lines

Using the pragmas unconditionally results in change from:

CC qemu-timer.o
cc1: warnings being treated as errors
In file included from /home/andreas/QEMU/qemu-s390/include/ui/qemu-pixman.h:13,

                 from /home/andreas/QEMU/qemu-s390/include/ui/console.h:4,
                 from /home/andreas/QEMU/qemu-s390/qemu-timer.c:27:

/usr/include/pixman-1/pixman.h:225: error: redundant redeclaration of ‘pixman_transform_from_pixman_f_transform’ /usr/include/pixman-1/pixman.h:221: error: previous declaration of ‘pixman_transform_from_pixman_f_transform’ was here
make: *** [qemu-timer.o] Fehler 1

to:

CC qemu-timer.o
cc1: warnings being treated as errors
In file included from /home/andreas/QEMU/qemu-s390/include/ui/qemu-pixman.h:13,

Quoted 5 lines
                 from /home/andreas/QEMU/qemu-s390/include/ui/console.h:4,
                 from /home/andreas/QEMU/qemu-s390/qemu-timer.c:27:

/usr/include/pixman-1/pixman.h:221: error: previous declaration of ‘pixman_transform_from_pixman_f_transform’ was here
make: *** [qemu-timer.o] Fehler 1

That looks like a gcc bug to me.

cheers,
Gerd

#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] pixman: fix warning

Il 15/01/2013 15:29, Gerd Hoffmann ha scritto:

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines

Using the pragmas unconditionally results in change from:

CC qemu-timer.o
cc1: warnings being treated as errors
In file included from /home/andreas/QEMU/qemu-s390/include/ui/qemu-pixman.h:13,

                 from /home/andreas/QEMU/qemu-s390/include/ui/console.h:4,
                 from /home/andreas/QEMU/qemu-s390/qemu-timer.c:27:

/usr/include/pixman-1/pixman.h:225: error: redundant redeclaration of ‘pixman_transform_from_pixman_f_transform’ /usr/include/pixman-1/pixman.h:221: error: previous declaration of ‘pixman_transform_from_pixman_f_transform’ was here
make: *** [qemu-timer.o] Fehler 1

to:

Quoted 9 lines
Quoted 9 lines

CC qemu-timer.o
cc1: warnings being treated as errors
In file included from /home/andreas/QEMU/qemu-s390/include/ui/qemu-pixman.h:13,

                 from /home/andreas/QEMU/qemu-s390/include/ui/console.h:4,
                 from /home/andreas/QEMU/qemu-s390/qemu-timer.c:27:

/usr/include/pixman-1/pixman.h:221: error: previous declaration of ‘pixman_transform_from_pixman_f_transform’ was here
make: *** [qemu-timer.o] Fehler 1

Quoted 1 line

That looks like a gcc bug to me.

Me too. CCing Richard Guenther, or whatever his surname is now :), from SuSE.

Paolo

Applied
#6 lore raw
In reply to Gerd Hoffmann

Thanks, applied.

Quoted 56 lines · Gerd Hoffmann
---
 configure            |    6 +++---
 coroutine-ucontext.c |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
configure +3 -3
index 4f050ea..9357035 100755
@@ -3078,7 +3078,7 @@ int main(void) {
 }
 EOF
 if compile_prog "-Werror" "" ; then
-    pragma_disable_unused_but_set=yes
+    pragma_diagnostic_available=yes
 fi
 
 ########################################
@@ -3650,8 +3650,8 @@ if test "$linux_magic_h" = "yes" ; then
   echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
 fi
 
-if test "$pragma_disable_unused_but_set" = "yes" ; then
-  echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak
+if test "$pragma_diagnostic_available" = "yes" ; then
+  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
 fi
 
 if test "$valgrind_h" = "yes" ; then
coroutine-ucontext.c +2 -3
index 2ed703a..a9c30e9 100644
@@ -200,7 +200,7 @@ Coroutine *qemu_coroutine_new(void)
 }
 
 #ifdef CONFIG_VALGRIND_H
-#ifdef CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET
+#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
 /* Work around an unused variable in the valgrind.h macro... */
 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 #endif
@@ -208,7 +208,7 @@ static inline void valgrind_stack_deregister(CoroutineUContext *co)
 {
     VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id);
 }
-#ifdef CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET
+#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
 #pragma GCC diagnostic error "-Wunused-but-set-variable"
 #endif
 #endif
--

1.7.1