mesa: Make unreachable macro take a string argument.

To aid in debugging.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner 2014-06-29 19:12:04 -07:00
parent e658440234
commit a3d10c2c30
7 changed files with 17 additions and 16 deletions

View 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");
}
/**

View 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);

View 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;

View 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

View File

@ -86,8 +86,7 @@ protected:
virtual vec4_instruction *emit_urb_write_opcode(bool complete)
{
assert(!"Not reached");
unreachable();
unreachable("Not reached");
}
};

View File

@ -89,8 +89,7 @@ protected:
virtual vec4_instruction *emit_urb_write_opcode(bool complete)
{
assert(!"Not reached");
unreachable();
unreachable("Not reached");
}
};

View 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
/*