[Mesa-dev] [PATCH 5/5] mesa: replace _mesa_problem() with unreachable() in pack.c

Timothy Arceri tarceri at itsqueeze.com
Tue May 9 03:04:50 UTC 2017


---
 src/mesa/main/pack.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 760c46a..94a6d28 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -453,22 +453,21 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
                }
             }
             else {
                for (i = 0; i < n; i++)
                   indexes[i] = s[i*2+1] & 0xff;  /* lower 8 bits */
             }
          }
          break;
 
       default:
-         _mesa_problem(NULL, "bad srcType in extract_uint_indexes");
-         return;
+         unreachable("bad srcType in extract_uint_indexes");
    }
 }
 
 
 /*
  * Unpack a row of stencil data from a client buffer according to
  * the pixel unpacking parameters.
  * This is (or will be) used by glDrawPixels
  *
  * Args:  ctx - the context
@@ -578,21 +577,21 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
          case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
             {
                GLuint *dst = (GLuint *) dest;
                GLuint i;
                for (i = 0; i < n; i++) {
                   dst[i*2+1] = indexes[i] & 0xff; /* lower 8 bits */
                }
             }
             break;
          default:
-            _mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
+            unreachable("bad dstType in _mesa_unpack_stencil_span");
       }
 
       free(indexes);
    }
 }
 
 
 void
 _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
                          GLenum dstType, GLvoid *dest, const GLubyte *source,
@@ -725,21 +724,21 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
             *dst |= ((source[i] != 0) << shift);
             shift--;
             if (shift < 0) {
                shift = 7;
                dst++;
             }
          }
       }
       break;
    default:
-      _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
+      unreachable("bad type in _mesa_pack_index_span");
    }
 
    free(stencil);
 }
 
 #define DEPTH_VALUES(GLTYPE, GLTYPE2FLOAT)                              \
     do {                                                                \
         GLuint i;                                                       \
         const GLTYPE *src = (const GLTYPE *)source;                     \
         for (i = 0; i < n; i++) {                                       \
@@ -1116,22 +1115,21 @@ _mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
          GLuint i;
          for (i = 0; i < n; i++) {
             dst[i] = _mesa_float_to_half(depthSpan[i]);
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap2( (GLushort *) dst, n );
          }
       }
       break;
    default:
-      _mesa_problem(ctx, "bad type in _mesa_pack_depth_span (%s)",
-                    _mesa_enum_to_string(dstType));
+      unreachable("bad type in _mesa_pack_depth_span()");
    }
 
    free(depthCopy);
 }
 
 
 
 /**
  * Pack depth and stencil values as GL_DEPTH_STENCIL (GL_UNSIGNED_INT_24_8 etc)
  */
-- 
2.9.3



More information about the mesa-dev mailing list