Module: Mesa
Branch: master
Commit: 0ce370a84b1c9381b34769dc4958e0ef413502f6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ce370a84b1c9381b34769dc4958e0ef413502f6

Author: Matt Turner <[email protected]>
Date:   Mon Nov 23 16:23:29 2015 -0800

mesa: Use unreachable() instead of a default case.

(And add an unreachable() in one place that didn't have a default case)

---

 src/mesa/main/shaderobj.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index be80752..53836f1 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -127,8 +127,7 @@ _mesa_shader_enum_to_shader_stage(GLenum v)
    case GL_COMPUTE_SHADER:
       return MESA_SHADER_COMPUTE;
    default:
-      assert(0 && "bad value in _mesa_shader_enum_to_shader_stage()");
-      return MESA_SHADER_VERTEX;
+      unreachable("bad value in _mesa_shader_enum_to_shader_stage()");
    }
 }
 
@@ -159,7 +158,6 @@ static inline gl_shader_stage
 _mesa_shader_stage_from_subroutine_uniform(GLenum subuniform)
 {
    switch (subuniform) {
-   default:
    case GL_VERTEX_SUBROUTINE_UNIFORM:
       return MESA_SHADER_VERTEX;
    case GL_GEOMETRY_SUBROUTINE_UNIFORM:
@@ -173,6 +171,7 @@ _mesa_shader_stage_from_subroutine_uniform(GLenum 
subuniform)
    case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
       return MESA_SHADER_TESS_EVAL;
    }
+   unreachable("not reached");
 }
 
 static inline gl_shader_stage
@@ -192,13 +191,13 @@ _mesa_shader_stage_from_subroutine(GLenum subroutine)
    case GL_TESS_EVALUATION_SUBROUTINE:
       return MESA_SHADER_TESS_EVAL;
    }
+   unreachable("not reached");
 }
 
 static inline GLenum
 _mesa_shader_stage_to_subroutine(gl_shader_stage stage)
 {
    switch (stage) {
-   default:
    case MESA_SHADER_VERTEX:
       return GL_VERTEX_SUBROUTINE;
    case MESA_SHADER_GEOMETRY:
@@ -212,13 +211,13 @@ _mesa_shader_stage_to_subroutine(gl_shader_stage stage)
    case MESA_SHADER_TESS_EVAL:
       return GL_TESS_EVALUATION_SUBROUTINE;
    }
+   unreachable("not reached");
 }
 
 static inline GLenum
 _mesa_shader_stage_to_subroutine_uniform(gl_shader_stage stage)
 {
    switch (stage) {
-   default:
    case MESA_SHADER_VERTEX:
       return GL_VERTEX_SUBROUTINE_UNIFORM;
    case MESA_SHADER_GEOMETRY:
@@ -232,6 +231,7 @@ _mesa_shader_stage_to_subroutine_uniform(gl_shader_stage 
stage)
    case MESA_SHADER_TESS_EVAL:
       return GL_TESS_EVALUATION_SUBROUTINE_UNIFORM;
    }
+   unreachable("not reached");
 }
 
 extern bool

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to