[libvirt] [PATCH] turn off strict-aliasing warnings in two files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without these changes and with gcc-4.4,
I'd get 4 warnings (2 in each file)
about strict-aliasing violations.
-Wstrict-aliasing is worth keeping in general, so I
have disabled it only for the two offending files.

The #if avoids the pragma on versions of gcc that don't recognize it.

>From 7d7f8e5dd9754d2bbca1a0ec2f3a47d4eae9df30 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Fri, 6 Feb 2009 11:45:39 +0100
Subject: [PATCH] turn off strict-aliasing warnings in two files

* qemud/qemud.c: Disable gcc's strict-aliasing warnings in this file.
* src/bridge.c: Likewise.
---
 qemud/qemud.c |    5 +++++
 src/bridge.c  |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/qemud/qemud.c b/qemud/qemud.c
index effb336..c3521e3 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -21,6 +21,11 @@
  * Author: Daniel P. Berrange <berrange@xxxxxxxxxx>
  */

+/* Tell gcc not to warn about aliasing (e.g., sockaddr_in) in this file.  */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif
+
 #include <config.h>

 #include <sys/types.h>
diff --git a/src/bridge.c b/src/bridge.c
index 8e577dd..62fa711 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -19,6 +19,11 @@
  *     Mark McLoughlin <markmc@xxxxxxxxxx>
  */

+/* Tell gcc not to warn about aliasing (e.g., sockaddr_in) in this file.  */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif
+
 #include <config.h>

 #if defined(WITH_BRIDGE)
--
1.6.1.2.511.gc5d3f

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]