glsl: Replace most default cases in switches on GLSL type

This makes it easier to find switch-statements that need to be updated
after a new GLSL_TYPE_* is added because the compiler will generate a
warning.

Switch-statements that only had a small number of cases (e.g.,
everything in ir_constant_expression.cpp) were not modified.  I may
regret that decision when we eventually add support for doubles.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2012-12-11 12:56:03 -08:00
parent 416326e337
commit ecfb404e8d
10 changed files with 48 additions and 23 deletions

View File

@@ -623,10 +623,13 @@ type_size(const struct glsl_type *type)
* at link time.
*/
return 1;
default:
assert(0);
return 0;
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
assert(!"Invalid type in type_size");
break;
}
return 0;
}
/**
@@ -2529,7 +2532,10 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
format = uniform_native;
columns = 1;
break;
default:
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_VOID:
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_ERROR:
assert(!"Should not get here.");
break;
}