vte r2053 - in trunk: . src



Author: behdad
Date: Wed Jun  4 18:30:20 2008
New Revision: 2053
URL: http://svn.gnome.org/viewvc/vte?rev=2053&view=rev

Log:
2008-06-04  Behdad Esfahbod  <behdad gnome org>

        Bug 536632 â vte build failure in ring.c:210: error: expected
        expression before 'do'

        * src/debug.h:
        * src/ring.c:
        * src/ring.h:
        With latest glib (after bug #519026), g_error is expanding to
        "do {...} while(0)" instead of "{...}".  This breaks build in
        debugging mode.  Use g_critical instead.  Also add some
        G_STMT_START/END to some macros.



Modified:
   trunk/ChangeLog
   trunk/src/debug.h
   trunk/src/ring.c
   trunk/src/ring.h

Modified: trunk/src/debug.h
==============================================================================
--- trunk/src/debug.h	(original)
+++ trunk/src/debug.h	Wed Jun  4 18:30:20 2008
@@ -60,7 +60,7 @@
 
 #if defined(__GNUC__) && G_HAVE_GNUC_VARARGS
 #define _vte_debug_print(flags, fmt, ...) \
-	_VTE_DEBUG_IF(flags) g_printerr(fmt, ##__VA_ARGS__)
+	G_STMT_START { _VTE_DEBUG_IF(flags) g_printerr(fmt, ##__VA_ARGS__); } G_STMT_END
 #else
 #include <stdarg.h>
 #include <glib/gstdio.h>

Modified: trunk/src/ring.c
==============================================================================
--- trunk/src/ring.c	(original)
+++ trunk/src/ring.c	Wed Jun  4 18:30:20 2008
@@ -37,7 +37,7 @@
 	}
 }
 #else
-#define _vte_ring_validate(ring)
+#define _vte_ring_validate(ring) G_STMT_START {} G_STMT_END
 #endif
 
 /**

Modified: trunk/src/ring.h
==============================================================================
--- trunk/src/ring.h	(original)
+++ trunk/src/ring.h	Wed Jun  4 18:30:20 2008
@@ -40,28 +40,28 @@
 };
 
 #define _vte_ring_contains(__ring, __position) \
-	((__position >= (__ring)->delta) && \
-	 (__position < (__ring)->delta + (__ring)->length))
+	(((__position) >= (__ring)->delta) && \
+	 ((__position) < (__ring)->delta + (__ring)->length))
 #define _vte_ring_delta(__ring) ((__ring)->delta)
 #define _vte_ring_length(__ring) ((__ring)->length)
 #define _vte_ring_next(__ring) ((__ring)->delta + (__ring)->length)
 #define _vte_ring_max(__ring) ((__ring)->max)
-#define _vte_ring_is_cached(__ring, __v) ((__ring)->cached_item == __v)
+#define _vte_ring_is_cached(__ring, __v) ((__ring)->cached_item == (__v))
 #define _vte_ring_get_cached_data(__ring) ((__ring)->cached_data)
-#define _vte_ring_set_cache(__ring, __v, __data) ((__ring)->cached_item = __v, (__ring)->cached_data = __data)
+#define _vte_ring_set_cache(__ring, __v, __data) ((__ring)->cached_item = (__v), (__ring)->cached_data = (__data))
 #ifdef VTE_DEBUG
 #define _vte_ring_at(__ring, __position) \
-	((__ring)->array[__position % (__ring)->max] ? \
-	 (__ring)->array[__position % (__ring)->max] : \
-	 (g_error("NULL at %ld(->%ld) delta %ld, length %ld, max %ld next %ld" \
+	((__ring)->array[(__position) % (__ring)->max] ? \
+	 (__ring)->array[(__position) % (__ring)->max] : \
+	 (g_critical("NULL at %ld(->%ld) delta %ld, length %ld, max %ld next %ld" \
 		  " at %d\n", \
-		  __position, __position % (__ring)->max, \
+		  (__position), (__position) % (__ring)->max, \
 		  (__ring)->delta, (__ring)->length, (__ring)->max, \
 		  (__ring)->delta + (__ring)->length, \
 		  __LINE__), (gpointer) NULL))
 #else
 #define _vte_ring_at(__ring, __position) \
-	((__ring)->array[__position % (__ring)->max])
+	((__ring)->array[(__position) % (__ring)->max])
 #endif
 #define _vte_ring_index(__ring, __cast, __position) \
 	(__cast) _vte_ring_at(__ring, __position)



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