qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] libvixl: a64: Skip "-Wunused-variable" for gcc 5.0.0 or higher
@ 2014-10-11 14:07 Chen Gang
  2014-10-11 14:13 ` Chen Gang
  0 siblings, 1 reply; 11+ messages in thread
From: Chen Gang @ 2014-10-11 14:07 UTC (permalink / raw)
  To: peter.maydell, rth, Eric Blake; +Cc: qemu-trivial, qemu-devel

'instructions-a64.h' has unused variables for qemu which can be found by
gcc 5.0.0 or higher. and qemu needs "-Werror", and cause building break.
But they may be used by another projects (not qemu).

So for gcc 5.0.0 or higher, need still keep them, but ignore diagnostic
(still print warning, but not break building). The related warnings:

    CXX   disas/arm-a64.o
  In file included from /upstream/qemu/disas/libvixl/a64/disasm-a64.h:32:0,
                   from disas/arm-a64.cc:20:
  disas/libvixl/a64/instructions-a64.h:98:13: error: 'vixl::kFP32PositiveInfinity' defined but not used [-Werror=unused-variable]
   const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000);
               ^
  disas/libvixl/a64/instructions-a64.h:99:13: error: 'vixl::kFP32NegativeInfinity' defined but not used [-Werror=unused-variable]
   const float kFP32NegativeInfinity = rawbits_to_float(0xff800000);
               ^
  disas/libvixl/a64/instructions-a64.h:100:14: error: 'vixl::kFP64PositiveInfinity' defined but not used [-Werror=unused-variable]
   const double kFP64PositiveInfinity =
                ^
  disas/libvixl/a64/instructions-a64.h:102:14: error: 'vixl::kFP64NegativeInfinity' defined but not used [-Werror=unused-variable]
   const double kFP64NegativeInfinity =
                ^
  disas/libvixl/a64/instructions-a64.h:107:21: error: 'vixl::kFP64SignallingNaN' defined but not used [-Werror=unused-variable]
   static const double kFP64SignallingNaN =
                       ^
  disas/libvixl/a64/instructions-a64.h:109:20: error: 'vixl::kFP32SignallingNaN' defined but not used [-Werror=unused-variable]
   static const float kFP32SignallingNaN = rawbits_to_float(0x7f800001);
                      ^
  disas/libvixl/a64/instructions-a64.h:112:21: error: 'vixl::kFP64QuietNaN' defined but not used [-Werror=unused-variable]
   static const double kFP64QuietNaN =
                       ^
  disas/libvixl/a64/instructions-a64.h:114:20: error: 'vixl::kFP32QuietNaN' defined but not used [-Werror=unused-variable]
   static const float kFP32QuietNaN = rawbits_to_float(0x7fc00001);
                      ^
  disas/libvixl/a64/instructions-a64.h:117:21: error: 'vixl::kFP64DefaultNaN' defined but not used [-Werror=unused-variable]
   static const double kFP64DefaultNaN =
                       ^
  disas/libvixl/a64/instructions-a64.h:119:20: error: 'vixl::kFP32DefaultNaN' defined but not used [-Werror=unused-variable]
   static const float kFP32DefaultNaN = rawbits_to_float(0x7fc00000);
                      ^
  cc1plus: all warnings being treated as errors
  make: *** [disas/arm-a64.o] Error 1

After this patch, can pass upstream gcc 5.0.0 building (print warning,
but not break building), and fedora 20 gcc 4.8.1 building (not find
warnings).

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 disas/libvixl/a64/instructions-a64.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/disas/libvixl/a64/instructions-a64.h b/disas/libvixl/a64/instructions-a64.h
index d5b90c5..5f707f3 100644
--- a/disas/libvixl/a64/instructions-a64.h
+++ b/disas/libvixl/a64/instructions-a64.h
@@ -95,6 +95,12 @@ const unsigned kDoubleExponentBits = 11;
 const unsigned kFloatMantissaBits = 23;
 const unsigned kFloatExponentBits = 8;
 
+/* For QEMU, gcc 5.0.0 or higher finds unused variables, so ignore diagnostic */
+#if __GNUC__ >= 5
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
 const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000);
 const float kFP32NegativeInfinity = rawbits_to_float(0xff800000);
 const double kFP64PositiveInfinity =
@@ -118,6 +124,9 @@ static const double kFP64DefaultNaN =
     rawbits_to_double(UINT64_C(0x7ff8000000000000));
 static const float kFP32DefaultNaN = rawbits_to_float(0x7fc00000);
 
+#if __GNUC__ >= 5
+#pragma GCC diagnostic pop
+#endif
 
 enum LSDataSize {
   LSByte        = 0,
-- 
1.9.3

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

end of thread, other threads:[~2014-10-15  9:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-11 14:07 [Qemu-devel] [PATCH v2] libvixl: a64: Skip "-Wunused-variable" for gcc 5.0.0 or higher Chen Gang
2014-10-11 14:13 ` Chen Gang
2014-10-11 21:25   ` Peter Maydell
2014-10-12  0:32     ` Chen Gang
2014-10-12  7:50       ` Peter Maydell
2014-10-12 11:19         ` Chen Gang
2014-10-13 14:59         ` Eric Blake
2014-10-13 15:07           ` Peter Maydell
2014-10-14 19:58     ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-10-14 20:47       ` Chen Gang
2014-10-15  9:55         ` Chen Gang

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).