summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-06-29 19:12:04 -0700
committerMatt Turner <[email protected]>2014-07-01 08:55:52 -0700
commita3d10c2c304c65e37a940edbbc84f37e5cf88f33 (patch)
tree790babf96d52b777ba2663927b985c447ed78b72
parente65844023492c1ebc12c3fd299fe614164fe32a2 (diff)
mesa: Make unreachable macro take a string argument.
To aid in debugging. Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/glsl/opt_vectorize.cpp3
-rw-r--r--src/mesa/drivers/common/meta.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_clear.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_reg.h3
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp3
-rw-r--r--src/mesa/main/compiler.h14
7 files changed, 17 insertions, 16 deletions
diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
index f9a3b618345..28534a86ade 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 f313f5645b4..f1f57297c02 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2592,8 +2592,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 5efdf7163cb..df34c724073 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 fc2e0b0ba22..24346bed671 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 fd517f87c09..066746556e8 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 7563aef8bf2..78c758c3679 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 60069172434..79d8740e590 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
/*