[glib] tests: Fix for non-GCC



commit c58a7b8c7454aa82895c8d325e964ac94f79ae3b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Nov 6 16:45:12 2013 +0800

    tests: Fix for non-GCC
    
    Remove uses of using empty arrays in initialization and structs, and build
    tests that rely on GCCisms on GCC only.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711047

 glib/tests/mem-overflow.c |    6 ++++
 gobject/tests/param.c     |   64 ++++++++++++++++++++++----------------------
 2 files changed, 38 insertions(+), 32 deletions(-)
---
diff --git a/glib/tests/mem-overflow.c b/glib/tests/mem-overflow.c
index d072e5d..e0c28e5 100644
--- a/glib/tests/mem-overflow.c
+++ b/glib/tests/mem-overflow.c
@@ -21,7 +21,9 @@
 
 /* We test for errors in optimize-only definitions in gmem.h */
 
+#ifdef __GNUC__
 #pragma GCC optimize (1)
+#endif
 
 #include "glib.h"
 #include <stdlib.h>
@@ -169,6 +171,7 @@ mem_overflow (void)
   CHECK_SUBPROCESS_PASS (realloc_0);
 }
 
+#ifdef __GNUC__
 typedef struct
 {
 } Empty;
@@ -193,6 +196,7 @@ empty_alloc (void)
   g_test_trap_subprocess ("/mem/empty-alloc/subprocess", 0, 0);
   g_test_trap_assert_passed ();
 }
+#endif
 
 int
 main (int   argc,
@@ -224,8 +228,10 @@ main (int   argc,
   g_test_add_func ("/mem/overflow/subprocess/malloc_0", mem_overflow_malloc_0);
   g_test_add_func ("/mem/overflow/subprocess/realloc_0", mem_overflow_realloc_0);
 
+#ifdef __GNUC__
   g_test_add_func ("/mem/empty-alloc", empty_alloc);
   g_test_add_func ("/mem/empty-alloc/subprocess", empty_alloc_subprocess);
+#endif
 
   return g_test_run();
 }
diff --git a/gobject/tests/param.c b/gobject/tests/param.c
index 0215dc0..92948a9 100644
--- a/gobject/tests/param.c
+++ b/gobject/tests/param.c
@@ -535,56 +535,56 @@ test_interface_default_init (TestInterfaceInterface *iface)
 
 static gint valid_impl_types[48][4] = {
                     /* a    b    c    GObject */
-    /* 'a-' */       { },
+    /* 'a-' */       { 0, },
     /* 'a-r' */      { 'v', 'v', '<', '<' },
     /* 'a-w' */      { 'v', '>', '>', 'v' },
     /* 'a-rw' */     { 'v', '=', '=', '=' },
-    /* 'a-c */       { },
-    /* 'a-rc' */     { },
+    /* 'a-c */       { 0, },
+    /* 'a-rc' */     { 0, },
     /* 'a-wc' */     { 'v', '>', '>', 'v' },
     /* 'a-rwc' */    { 'v', '=', '=', '=' },
-    /* 'a-C */       { },
-    /* 'a-rC' */     { },
+    /* 'a-C */       { 0, },
+    /* 'a-rC' */     { 0, },
     /* 'a-wC' */     { 'v', '>', '>', 'v' },
     /* 'a-rwC' */    { 'v', '=', '=', '=' },
-    /* 'a-cC */      { },
-    /* 'a-rcC' */    { },
-    /* 'a-wcC' */    { },
-    /* 'a-rwcC' */   { },
+    /* 'a-cC */      { 0, },
+    /* 'a-rcC' */    { 0, },
+    /* 'a-wcC' */    { 0, },
+    /* 'a-rwcC' */   { 0, },
 
-    /* 'b-' */       { },
+    /* 'b-' */       { 0, },
     /* 'b-r' */      { '<', 'v', '<', '<' },
     /* 'b-w' */      { 'v', 'v', '>', 'v' },
     /* 'b-rw' */     { '=', 'v', '=', '=' },
-    /* 'b-c */       { },
-    /* 'b-rc' */     { },
+    /* 'b-c */       { 0, },
+    /* 'b-rc' */     { 0, },
     /* 'b-wc' */     { 'v', 'v', '>', 'v' },
     /* 'b-rwc' */    { '=', 'v', '=', '=' },
-    /* 'b-C */       { },
-    /* 'b-rC' */     { },
+    /* 'b-C */       { 0, },
+    /* 'b-rC' */     { 0, },
     /* 'b-wC' */     { 'v', 'v', '>', 'v' },
     /* 'b-rwC' */    { '=', 'v', '=', '=' },
-    /* 'b-cC */      { },
-    /* 'b-rcC' */    { },
-    /* 'b-wcC' */    { },
-    /* 'b-rwcC' */   { },
+    /* 'b-cC */      { 0, },
+    /* 'b-rcC' */    { 0, },
+    /* 'b-wcC' */    { 0, },
+    /* 'b-rwcC' */   { 0, },
 
-    /* 'c-' */       { },
+    /* 'c-' */       { 0, },
     /* 'c-r' */      { '<', '<', 'v', '<' },
     /* 'c-w' */      { '>', '>', 'v', 'v' },
     /* 'c-rw' */     { '=', '=', 'v', '=' },
-    /* 'c-c */       { },
-    /* 'c-rc' */     { },
+    /* 'c-c */       { 0, },
+    /* 'c-rc' */     { 0, },
     /* 'c-wc' */     { '>', '>', 'v', 'v' },
     /* 'c-rwc' */    { '=', '=', 'v', '=' },
-    /* 'c-C */       { },
-    /* 'c-rC' */     { },
+    /* 'c-C */       { 0, },
+    /* 'c-rC' */     { 0, },
     /* 'c-wC' */     { '>', '>', 'v', 'v' },
     /* 'c-rwC' */    { '=', '=', 'v', '=' },
-    /* 'c-cC */      { },
-    /* 'c-rcC' */    { },
-    /* 'c-wcC' */    { },
-    /* 'c-rwcC' */   { }
+    /* 'c-cC */      { 0, },
+    /* 'c-rcC' */    { 0, },
+    /* 'c-wcC' */    { 0, },
+    /* 'c-rwcC' */   { 0, }
 };
 
 /* We also try to change the flags.  We must ensure that all
@@ -624,16 +624,16 @@ static gint valid_impl_types[48][4] = {
  */
 static gint valid_impl_flags[16][16] = {
                  /* ''   r    w    rw   c    rc   wc   rwc  C    rC   wC   rwC  cC   rcC  wcC  rwcC */
-    /* '*-' */    { },
+    /* '*-' */    { 0, },
     /* '*-r' */   { 'i', 'v', 'f', 'v', 'i', 'i', 'f', 'v', 'i', 'i', 'f', 'v', 'i', 'i', 'i', 'i' },
     /* '*-w' */   { 'i', 'f', 'v', 'v', 'i', 'i', 'v', 'v', 'i', 'i', 'r', 'r', 'i', 'i', 'i', 'i' },
     /* '*-rw' */  { 'i', 'f', 'f', 'v', 'i', 'i', 'f', 'v', 'i', 'i', 'f', 'r', 'i', 'i', 'i', 'i' },
-    /* '*-c */    { },
-    /* '*-rc' */  { },
+    /* '*-c */    { 0, },
+    /* '*-rc' */  { 0, },
     /* '*-wc' */  { 'i', 'f', 'v', 'v', 'i', 'i', 'v', 'v', 'i', 'i', 'r', 'r', 'i', 'i', 'i', 'i' },
     /* '*-rwc' */ { 'i', 'f', 'f', 'v', 'i', 'i', 'f', 'v', 'i', 'i', 'f', 'r', 'i', 'i', 'i', 'i' },
-    /* '*-C */    { },
-    /* '*-rC' */  { },
+    /* '*-C */    { 0, },
+    /* '*-rC' */  { 0, },
     /* '*-wC' */  { 'i', 'f', 'v', 'v', 'i', 'i', 'v', 'v', 'i', 'i', 'v', 'v', 'i', 'i', 'i', 'i' },
     /* '*-rwC' */ { 'i', 'f', 'f', 'v', 'i', 'i', 'f', 'v', 'i', 'i', 'f', 'v', 'i', 'i', 'i', 'i' },
 };


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