To aid in debugging. --- src/glsl/opt_vectorize.cpp | 3 +-- src/mesa/drivers/common/meta.c | 3 +-- src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 4 +--- src/mesa/drivers/dri/i965/brw_reg.h | 3 +-- src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp | 3 +-- src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp | 3 +-- src/mesa/main/compiler.h | 14 +++++++++++--- 7 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp index f9a3b61..28534a8 100644 --- a/src/glsl/opt_vectorize.cpp +++ b/src/glsl/opt_vectorize.cpp @@ -227,8 +227,7 @@ write_mask_to_swizzle(unsigned write_mask) case WRITEMASK_Z: return SWIZZLE_Z; case WRITEMASK_W: return SWIZZLE_W; } - assert(!"not reached"); - unreachable(); + unreachable("not reached"); } /** diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 1a2e453..3db3611 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2613,8 +2613,7 @@ _mesa_meta_setup_texture_coords(GLenum faceTarget, coord = coords3; break; default: - assert(0); - unreachable(); + unreachable("not reached"); } coord[3] = (float) (slice / 6); diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp index 5efdf71..df34c72 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp @@ -337,9 +337,7 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw, x_scaledown = 2; break; default: - assert(!"Unexpected sample count for fast clear"); - unreachable(); - break; + unreachable("Unexpected sample count for fast clear"); } y_scaledown = 2; x_align = x_scaledown * 2; diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h index fc2e0b0..24346be 100644 --- a/src/mesa/drivers/dri/i965/brw_reg.h +++ b/src/mesa/drivers/dri/i965/brw_reg.h @@ -358,9 +358,8 @@ brw_vecn_reg(unsigned width, unsigned file, unsigned nr, unsigned subnr) case 16: return brw_vec16_reg(file, nr, subnr); default: - assert(!"Invalid register width"); + unreachable("Invalid register width"); } - unreachable(); } static inline struct brw_reg diff --git a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp index fd517f8..0667465 100644 --- a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp @@ -86,8 +86,7 @@ protected: virtual vec4_instruction *emit_urb_write_opcode(bool complete) { - assert(!"Not reached"); - unreachable(); + unreachable("Not reached"); } }; diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp index 7563aef..78c758c 100644 --- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp +++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp @@ -89,8 +89,7 @@ protected: virtual vec4_instruction *emit_urb_write_opcode(bool complete) { - assert(!"Not reached"); - unreachable(); + unreachable("Not reached"); } }; diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 6006917..79d8740 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -253,15 +253,23 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) * function" warnings. */ #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5 -#define unreachable() __builtin_unreachable() +#define unreachable(str) \ +do { \ + assert(!str); \ + __builtin_unreachable(); \ +} while (0) #elif (defined(__clang__) && defined(__has_builtin)) # if __has_builtin(__builtin_unreachable) -# define unreachable() __builtin_unreachable() +# define unreachable(str) \ +do { \ + assert(!str); \ + __builtin_unreachable(); \ +} while (0) # endif #endif #ifndef unreachable -#define unreachable() +#define unreachable(str) #endif /* -- 1.8.3.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev