mesa: Make unreachable macro take a string argument.
authorMatt Turner <mattst88@gmail.com>
Mon, 30 Jun 2014 02:12:04 +0000 (19:12 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 1 Jul 2014 15:55:52 +0000 (08:55 -0700)
To aid in debugging.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/opt_vectorize.cpp
src/mesa/drivers/common/meta.c
src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
src/mesa/drivers/dri/i965/brw_reg.h
src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp
src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
src/mesa/main/compiler.h

index f9a3b618345af7378156873a921c4ecf945c175c..28534a86ade10a04e19c4020422c25e494ba78c0 100644 (file)
@@ -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");
 }
 
 /**
index f313f5645b42fafcf8d43c198569c7e971c92521..f1f57297c02e639d59012f630dad32e2779805f6 100644 (file)
@@ -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);
index 5efdf7163cbdc1164397e4ba4660811b31d9c6fd..df34c7240730f668fa06ef2fda091809d86ffbca 100644 (file)
@@ -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;
index fc2e0b0ba2236913207a22eddc3e7760381d8e30..24346bed671e289b7efd86941ce8ad42f970ffed 100644 (file)
@@ -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
index fd517f87c096679900617dae2d2b4ba5efd7eb71..066746556e817c8f217c797cef7ef79e63ee4404 100644 (file)
@@ -86,8 +86,7 @@ protected:
 
    virtual vec4_instruction *emit_urb_write_opcode(bool complete)
    {
-      assert(!"Not reached");
-      unreachable();
+      unreachable("Not reached");
    }
 };
 
index 7563aef8bf28cc335a0ebac85ee1e04e7ecba691..78c758c3679dc6ebe86c78c9ce877a08c4ccba68 100644 (file)
@@ -89,8 +89,7 @@ protected:
 
    virtual vec4_instruction *emit_urb_write_opcode(bool complete)
    {
-      assert(!"Not reached");
-      unreachable();
+      unreachable("Not reached");
    }
 };
 
index 600691724345329009d09a279f5e8bdeec41c962..79d8740e5901858234b4db289c40456fee9d5bfb 100644 (file)
@@ -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
 
 /*