[Cogl] [Patch][Cogl-1.18]: Fix build Cogl on non-GCC

Fan Chun-wei fanc999 at yahoo.com.tw
Thu Apr 17 19:39:21 PDT 2014


Hello Neil,

(Sorry, I forgot to send this patch to the list-sorry for the double-post, oops :|)

> <snip>Perhaps it would be better to just always use the ISO version to
> make the code a bit cleaner.<snip> 

OK, here comes the patch for the same purpose using ISO-style varargs...

With blessings, thank you for the reviews!

-------------- next part --------------
From 3a3848dc5867ea7de1275aa9f8bcddcd8fd17af4 Mon Sep 17 00:00:00 2001
From: Chun-wei Fan <fanchunwei at src.gnome.org>
Date: Fri, 18 Apr 2014 10:33:15 +0800
Subject: [PATCH] cogl/cogl-gtype-private.h: Fix Build on non-GCC

Commit 1b2dd815 (Registers gtypes for all public objects and structs)
introduced GCCism's in its use of varargs, which broke the build of Cogl
on other non-GCC compilers, such as Visual Studio.

Define the COGL_GTYPE_DEFINE_BASE_CLASS and COGL_GTYPE_DEFINE_CLASS macros
using ISO-style varargs so that the build of Cogl can be fixed on non-GCC
compilers.
---
 cogl/cogl-gtype-private.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cogl/cogl-gtype-private.h b/cogl/cogl-gtype-private.h
index 03832ef..8498385 100644
--- a/cogl/cogl-gtype-private.h
+++ b/cogl/cogl-gtype-private.h
@@ -133,9 +133,9 @@ cogl_##name##_get_gtype (void)                                      \
     return type_id__volatile;                                           \
   }
 
-#define COGL_GTYPE_DEFINE_BASE_CLASS(Name,name,interfaces...)      \
-  _COGL_GTYPE_DEFINE_BASE_CLASS_BEGIN(Name,name)                   \
-  {interfaces;}                                                    \
+#define COGL_GTYPE_DEFINE_BASE_CLASS(Name,name,...)      \
+  _COGL_GTYPE_DEFINE_BASE_CLASS_BEGIN(Name,name)         \
+  {__VA_ARGS__;}                                         \
   _COGL_GTYPE_DEFINE_BASE_CLASS_END()
 
 #define _COGL_GTYPE_DEFINE_INTERFACE_EXTENDED_BEGIN(Name,name)          \
@@ -230,7 +230,7 @@ cogl_##name##_get_gtype (void)                                      \
     } /* closes name##_get_type() */
 
 
-#define COGL_GTYPE_DEFINE_CLASS(Name,name,interfaces...)                \
+#define COGL_GTYPE_DEFINE_CLASS(Name,name,...)                          \
   typedef struct _Cogl##Name##Class Cogl##Name##Class;                  \
   struct _Cogl##Name##Class {                                           \
     CoglObjectClass parent_class;                                       \
@@ -239,7 +239,7 @@ cogl_##name##_get_gtype (void)                                      \
                                          cogl_##name,                   \
                                          cogl_object_get_gtype(),       \
                                          0)                             \
-  {interfaces;}                                                         \
+  {__VA_ARGS__;}                                                        \
   _COGL_GTYPE_DEFINE_TYPE_EXTENDED_END()                                \
   static void                                                           \
   cogl_##name##_init (Cogl##Name *instance)                             \
-- 
1.8.3.msysgit.0



More information about the Cogl mailing list