From cb7ef0df00e19d87d4d2dd95aff2318df2e17dc3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Jan 2018 12:54:04 -0700 Subject: [PATCH] vbo: replace assert(0) with unreachable() Reviewed-by: Roland Scheidegger --- src/mesa/vbo/vbo_context.h | 8 ++++---- src/mesa/vbo/vbo_exec_array.c | 2 +- src/mesa/vbo/vbo_exec_draw.c | 4 ++-- src/mesa/vbo/vbo_save_api.c | 5 ++--- src/mesa/vbo/vbo_save_draw.c | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 04079b7d329..cd1cbd9641b 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -154,7 +154,7 @@ vbo_draw_method(struct vbo_context *vbo, gl_draw_method method) ctx->Array._DrawArrays = vbo->save.inputs; break; default: - assert(0); + unreachable("Bad VBO drawing method"); } ctx->NewDriverState |= ctx->DriverFlags.NewArray; @@ -178,7 +178,7 @@ vbo_attrtype_to_integer_flag(GLenum format) case GL_UNSIGNED_INT64_ARB: return GL_TRUE; default: - assert(0); + unreachable("Bad vertex attribute type"); return GL_FALSE; } } @@ -195,7 +195,7 @@ vbo_attrtype_to_double_flag(GLenum format) case GL_DOUBLE: return GL_TRUE; default: - assert(0); + unreachable("Bad vertex attribute type"); return GL_FALSE; } } @@ -218,7 +218,7 @@ vbo_get_default_vals_as_union(GLenum format) case GL_UNSIGNED_INT: return (fi_type *)default_int; default: - assert(0); + unreachable("Bad vertex format"); return NULL; } } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 024d4d6c80e..16521ff46d7 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -150,7 +150,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, j = ((const GLuint *) elements)[i]; break; default: - assert(0); + unreachable("Unexpected index buffer type"); } /* check element j of each enabled array */ diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 3aff97e6f11..080d50c10e9 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -159,7 +159,7 @@ vbo_copy_vertices(struct vbo_exec_context *exec) case PRIM_OUTSIDE_BEGIN_END: return 0; default: - assert(0); + unreachable("Unexpected primitive type"); return 0; } } @@ -220,7 +220,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx) } break; default: - assert(0); + unreachable("Bad vertex program mode"); } for (attr = 0; attr < VERT_ATTRIB_MAX ; attr++) { diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 1c575448773..49939ed3cef 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -174,7 +174,7 @@ copy_vertices(struct gl_context *ctx, sz * sizeof(GLfloat)); return i; default: - assert(0); + unreachable("Unexpected primitive type"); return 0; } } @@ -675,8 +675,7 @@ copy_from_current(struct gl_context *ctx) save->attrptr[i][0] = save->current[i][0]; break; case 0: - assert(0); - break; + unreachable("Unexpected vertex attribute size"); } } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index ddf911700f8..a63e0674d89 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -194,7 +194,7 @@ bind_vertex_list(struct gl_context *ctx, } break; default: - assert(0); + unreachable("Bad vertex program mode"); } for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { -- 2.30.2