[cogl/wip/standalone: 6/13] core: Introduce _COGL_ASSERT_NOT_REACHED
- From: Damien Lespiau <dlespiau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/standalone: 6/13] core: Introduce _COGL_ASSERT_NOT_REACHED
- Date: Mon, 27 Feb 2012 17:46:09 +0000 (UTC)
commit 83344891b9608d5b3fbbfaa6d738e3fe8e7194f9
Author: Damien Lespiau <damien lespiau intel com>
Date: Mon Feb 27 14:03:59 2012 +0000
core: Introduce _COGL_ASSERT_NOT_REACHED
So we don't need to import the gtester stuff from glib in the standalone
version of Cogl (keeping it light!).
cogl/cogl-bitmap.c | 2 +-
cogl/cogl-clip-stack.c | 4 ++--
cogl/cogl-context.c | 4 ++--
cogl/cogl-pipeline-fragend-glsl.c | 2 +-
cogl/cogl-pipeline-opengl.c | 6 +++---
cogl/cogl-shader.c | 2 +-
cogl/cogl-util.h | 6 ++++++
cogl/cogl2-path.c | 2 +-
cogl/driver/gl/cogl-texture-driver-gl.c | 4 ++--
cogl/driver/gles/cogl-texture-driver-gles.c | 4 ++--
cogl/winsys/cogl-texture-pixmap-x11.c | 4 ++--
cogl/winsys/cogl-winsys-egl.c | 4 ++--
12 files changed, 25 insertions(+), 19 deletions(-)
---
diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c
index 20fd808..37a4594 100644
--- a/cogl/cogl-bitmap.c
+++ b/cogl/cogl-bitmap.c
@@ -458,7 +458,7 @@ _cogl_bitmap_bind (CoglBitmap *bitmap,
ptr = _cogl_buffer_bind (bitmap->buffer,
COGL_BUFFER_BIND_TARGET_PIXEL_PACK);
else
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
/* The data pointer actually stores the offset */
return GPOINTER_TO_INT (bitmap->data) + ptr;
diff --git a/cogl/cogl-clip-stack.c b/cogl/cogl-clip-stack.c
index 358c199..5f7b505 100644
--- a/cogl/cogl-clip-stack.c
+++ b/cogl/cogl-clip-stack.c
@@ -126,7 +126,7 @@ set_clip_plane (CoglFramebuffer *framebuffer,
switch (ctx->driver)
{
default:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
case COGL_DRIVER_GLES1:
@@ -736,7 +736,7 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
break;
default:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
entry = parent;
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index fb27160..49a836a 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -222,7 +222,7 @@ cogl_context_new (CoglDisplay *display,
#endif
default:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
context->attribute_name_states_hash =
@@ -585,7 +585,7 @@ _cogl_context_update_features (CoglContext *context,
return _cogl_gles_update_features (context, error);
#endif
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
void
diff --git a/cogl/cogl-pipeline-fragend-glsl.c b/cogl/cogl-pipeline-fragend-glsl.c
index 1cc36cb..dfe8ed5 100644
--- a/cogl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/cogl-pipeline-fragend-glsl.c
@@ -988,7 +988,7 @@ add_alpha_test_snippet (CoglPipeline *pipeline,
case COGL_PIPELINE_ALPHA_FUNC_ALWAYS:
case COGL_PIPELINE_ALPHA_FUNC_NEVER:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
}
diff --git a/cogl/cogl-pipeline-opengl.c b/cogl/cogl-pipeline-opengl.c
index 3237dc4..ca16a8c 100644
--- a/cogl/cogl-pipeline-opengl.c
+++ b/cogl/cogl-pipeline-opengl.c
@@ -345,7 +345,7 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
/* It doesn't make sense to enable ARBfp for the vertex program */
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
@@ -358,7 +358,7 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
{
case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
/* It doesn't make sense to enable ARBfp for the vertex program */
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
@@ -624,7 +624,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
switch (cull_face_state->mode)
{
case COGL_PIPELINE_CULL_FACE_MODE_NONE:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
case COGL_PIPELINE_CULL_FACE_MODE_FRONT:
GE( ctx, glCullFace (GL_FRONT) );
diff --git a/cogl/cogl-shader.c b/cogl/cogl-shader.c
index 9b09b10..a023178 100644
--- a/cogl/cogl-shader.c
+++ b/cogl/cogl-shader.c
@@ -358,7 +358,7 @@ _cogl_shader_compile_real (CoglHandle handle,
gl_type = GL_FRAGMENT_SHADER;
break;
default:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
}
diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h
index d657c76..b546762 100644
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@ -169,6 +169,7 @@ _cogl_util_popcountl (unsigned long num)
#ifdef COGL_HAS_GLIB_SUPPORT
#define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR)
#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)
+#define _COGL_ASSERT_NOT_REACHED (g_assert_not_reached ())
#else
#define _COGL_RETURN_IF_FAIL(EXPR) do { \
if (!(EXPR)) \
@@ -190,6 +191,11 @@ _cogl_util_popcountl (unsigned long num)
return (VAL); \
}; \
} while(0)
+#define _COGL_ASSERT_NOT_REACHED do { \
+ fprintf (stderr, "file %s: line %d: reached an unexpected code path", \
+ __FILE__, \
+ __LINE__); \
+ } while (0)
#endif /* COGL_HAS_GLIB_SUPPORT */
/* Match a CoglPixelFormat according to channel masks, color depth,
diff --git a/cogl/cogl2-path.c b/cogl/cogl2-path.c
index d9426ae..c632fe6 100644
--- a/cogl/cogl2-path.c
+++ b/cogl/cogl2-path.c
@@ -1173,7 +1173,7 @@ _cogl_path_tesselator_vertex (void *vertex_data,
break;
default:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
tess->vertex_number++;
diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c
index 6cb0048..fc0c7fd 100644
--- a/cogl/driver/gl/cogl-texture-driver-gl.c
+++ b/cogl/driver/gl/cogl-texture-driver-gl.c
@@ -78,7 +78,7 @@ _cogl_texture_driver_gen (GLenum gl_target,
break;
default:
- g_assert_not_reached();
+ _COGL_ASSERT_NOT_REACHED;
}
}
}
@@ -518,7 +518,7 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_ANY:
case COGL_PIXEL_FORMAT_YUV:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
}
diff --git a/cogl/driver/gles/cogl-texture-driver-gles.c b/cogl/driver/gles/cogl-texture-driver-gles.c
index 3c83a45..af1122e 100644
--- a/cogl/driver/gles/cogl-texture-driver-gles.c
+++ b/cogl/driver/gles/cogl-texture-driver-gles.c
@@ -78,7 +78,7 @@ _cogl_texture_driver_gen (GLenum gl_target,
break;
default:
- g_assert_not_reached();
+ _COGL_ASSERT_NOT_REACHED;
}
}
}
@@ -487,7 +487,7 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_ANY:
case COGL_PIXEL_FORMAT_YUV:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
break;
}
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index 0723ab3..60e47ff 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -158,7 +158,7 @@ process_damage_event (CoglTexturePixmapX11 *tex_pixmap,
break;
default:
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
/* If the damage already covers the whole rectangle then we don't
@@ -670,7 +670,7 @@ _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
_cogl_texture_pixmap_x11_update (tex_pixmap, FALSE);
}
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
return COGL_INVALID_HANDLE;
}
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 5d96ac4..e47e642 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -102,7 +102,7 @@ static void
_cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
{
/* This function must be overridden by a platform winsys */
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
/* Updates all the function pointers */
@@ -156,7 +156,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
GError **error)
{
/* This function must be overridden by a platform winsys */
- g_assert_not_reached ();
+ _COGL_ASSERT_NOT_REACHED;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]