gfx/cairo/nonfatal-assertions.patch
author bzbarsky@mit.edu
Fri, 13 Jul 2007 22:02:22 -0700
changeset 3470 6de619ad05c81ed6fccd234807d09a98fb09cf83
parent 2975 6351aa336ac91d1dd1d2d3cb49cb2e56c2615a8a
child 3843 5f784dc1e4e344202397ba8a026b00168194b3ee
permissions -rw-r--r--
Adding test.

Index: gfx/cairo/cairo/src/cairoint.h
===================================================================
RCS file: /cvsroot/mozilla/gfx/cairo/cairo/src/cairoint.h,v
retrieving revision 1.34
diff -u -p -1 -2 -r1.34 cairoint.h
--- gfx/cairo/cairo/src/cairoint.h	4 Apr 2007 01:09:16 -0000	1.34
+++ gfx/cairo/cairo/src/cairoint.h	1 Jun 2007 02:05:18 -0000
@@ -231,24 +231,31 @@ typedef void *cairo_mutex_t;
 #define FALSE 0
 #endif
 
 #ifndef TRUE
 #define TRUE 1
 #endif
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
 #endif
 
 #ifndef MOZILLA_CAIRO_NOT_DEFINED
+/* Make assertions non-fatal */
+#ifndef NDEBUG
+#undef assert
+#define assert(expr) \
+    do { if (!(expr)) fprintf(stderr, "Assertion failed at %s:%d: %s\n", \
+          __FILE__, __LINE__, #expr); } while (0)
+#endif
 #ifndef INT32_MAX
 # ifdef INT_MAX
 #  define INT32_MAX INT_MAX
 #  define INT32_MIN INT_MIN
 # else
 #  define INT32_MAX 2147483647
 #  define INT32_MIN (-2147483647 - 1)
 # endif
 #endif
 #endif
 
 /* Size in bytes of buffer to use off the stack per functions.