[Libosinfo] [PATCH] Fix build with older GCC

Roman Bogorodskiy bogorodskiy at gmail.com
Mon Jan 25 00:10:44 UTC 2016


Build with older gcc fails with:

  CC       libosinfo_1_0_la-osinfo_avatar_format.lo
In file included from ../osinfo/osinfo_os.h:30,
                 from ../osinfo/osinfo.h:55,
                 from osinfo_avatar_format.c:28:
../osinfo/osinfo_media.h:68: error: redefinition of typedef 'OsinfoMedia'
../osinfo/osinfo_install_script.h:43: error: previous declaration of 'OsinfoMedia' was here

To avoid redefinition, use forward-declaration in a similar way
like it's done for OsinfoOs in osinfo/osinfo_os.h.
---
 osinfo/osinfo_media.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/osinfo/osinfo_media.h b/osinfo/osinfo_media.h
index 8ad39c4..09fbacd 100644
--- a/osinfo/osinfo_media.h
+++ b/osinfo/osinfo_media.h
@@ -65,8 +65,11 @@ typedef enum {
 #define OSINFO_IS_MEDIA_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_MEDIA))
 #define OSINFO_MEDIA_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_MEDIA, OsinfoMediaClass))
 
-typedef struct _OsinfoMedia        OsinfoMedia;
-
+/*
+ * Forward declared in osinfo_install_script.h
+ *
+ * typedef struct _OsinfoMedia        OsinfoMedia;
+ */
 typedef struct _OsinfoMediaClass   OsinfoMediaClass;
 
 typedef struct _OsinfoMediaPrivate OsinfoMediaPrivate;
-- 
2.4.6




More information about the Libosinfo mailing list