Commit b5db2b49 by Nico Weber Committed by Commit Bot

Enable -Wimplicit-fallthrough for ANGLE.

Also teach MSVC that ANGLE_CRASH() can't return. Also fix instances of the warning in build configurations where UNREACHABLE() can return (e.g. release without dcheck_always_on or debug). If the UNREACHABLE()s are truly unreachable, this change has no behavior change. Bug: chromium:810767 Change-Id: I68f3587cf3e268c3ef634dce7ae3d70399859d0f Reviewed-on: https://chromium-review.googlesource.com/914842Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarNico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
parent 4edce336
...@@ -99,9 +99,6 @@ config("extra_warnings") { ...@@ -99,9 +99,6 @@ config("extra_warnings") {
cflags += [ cflags += [
# Remove when crbug.com/428099 is resolved. # Remove when crbug.com/428099 is resolved.
"-Winconsistent-missing-override", "-Winconsistent-missing-override",
# TODO(thakis): Consider enabling this, https://crbug.com/807632
"-Wno-implicit-fallthrough",
] ]
} }
} }
......
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// aligned_memory: Defines ANGLE_FALLTHROUGH. Do not include in public headers.
//
#ifndef COMMON_ANGLE_FALLTHROUGH_H_
#define COMMON_ANGLE_FALLTHROUGH_H_
// When clang suggests inserting [[clang::fallthrough]], it first checks if
// it knows of a macro expanding to it, and if so suggests inserting the
// macro. This means that this macro must be used only in code internal
// to ANGLE, so that ANGLE's user code doesn't end up getting suggestions
// for ANGLE_FALLTHROUGH instead of the user-specific fallthrough macro.
// So do not include this header in any of ANGLE's public headers.
#if defined(__clang__)
#define ANGLE_FALLTHROUGH [[clang::fallthrough]]
#else
#define ANGLE_FALLTHROUGH
#endif
#endif // COMMON_ANGLE_FALLTHROUGH_H_
...@@ -220,14 +220,16 @@ std::ostream &FmtHexInt(std::ostream &os, T value) ...@@ -220,14 +220,16 @@ std::ostream &FmtHexInt(std::ostream &os, T value)
#if defined(COMPILER_GCC) || defined(__clang__) #if defined(COMPILER_GCC) || defined(__clang__)
#define ANGLE_CRASH() __builtin_trap() #define ANGLE_CRASH() __builtin_trap()
#else #else
#define ANGLE_CRASH() ((void)(*(volatile char *)0 = 0)) #define ANGLE_CRASH() ((void)(*(volatile char *)0 = 0)), __assume(0)
#endif #endif
#if !defined(NDEBUG) #if !defined(NDEBUG)
#define ANGLE_ASSERT_IMPL(expression) assert(expression) #define ANGLE_ASSERT_IMPL(expression) assert(expression)
#define ANGLE_ASSERT_IMPL_IS_NORETURN 0
#else #else
// TODO(jmadill): Detect if debugger is attached and break. // TODO(jmadill): Detect if debugger is attached and break.
#define ANGLE_ASSERT_IMPL(expression) ANGLE_CRASH() #define ANGLE_ASSERT_IMPL(expression) ANGLE_CRASH()
#define ANGLE_ASSERT_IMPL_IS_NORETURN 1
#endif // !defined(NDEBUG) #endif // !defined(NDEBUG)
// A macro asserting a condition and outputting failures to the debug log // A macro asserting a condition and outputting failures to the debug log
...@@ -236,6 +238,7 @@ std::ostream &FmtHexInt(std::ostream &os, T value) ...@@ -236,6 +238,7 @@ std::ostream &FmtHexInt(std::ostream &os, T value)
(expression ? static_cast<void>(0) : ((ERR() << "\t! Assert failed in " << __FUNCTION__ << "(" \ (expression ? static_cast<void>(0) : ((ERR() << "\t! Assert failed in " << __FUNCTION__ << "(" \
<< __LINE__ << "): " << #expression), \ << __LINE__ << "): " << #expression), \
ANGLE_ASSERT_IMPL(expression))) ANGLE_ASSERT_IMPL(expression)))
#define UNREACHABLE_IS_NORETURN ANGLE_ASSERT_IMPL_IS_NORETURN
#else #else
// These are just dummy values. // These are just dummy values.
#define COMPACT_ANGLE_LOG_EX_ASSERT(ClassName, ...) \ #define COMPACT_ANGLE_LOG_EX_ASSERT(ClassName, ...) \
...@@ -249,6 +252,7 @@ constexpr LogSeverity LOG_ASSERT = LOG_EVENT; ...@@ -249,6 +252,7 @@ constexpr LogSeverity LOG_ASSERT = LOG_EVENT;
#define ASSERT(condition) \ #define ASSERT(condition) \
ANGLE_LAZY_STREAM(ANGLE_LOG_STREAM(ASSERT), false ? !(condition) : false) \ ANGLE_LAZY_STREAM(ANGLE_LOG_STREAM(ASSERT), false ? !(condition) : false) \
<< "Check failed: " #condition ". " << "Check failed: " #condition ". "
#define UNREACHABLE_IS_NORETURN 0
#endif // defined(ANGLE_ENABLE_ASSERTS) #endif // defined(ANGLE_ENABLE_ASSERTS)
#define UNUSED_VARIABLE(variable) ((void)variable) #define UNUSED_VARIABLE(variable) ((void)variable)
......
...@@ -4993,10 +4993,9 @@ bool TParseContext::binaryOpCommonCheck(TOperator op, ...@@ -4993,10 +4993,9 @@ bool TParseContext::binaryOpCommonCheck(TOperator op,
case EOpIndexDirect: case EOpIndexDirect:
case EOpIndexIndirect: case EOpIndexIndirect:
break; break;
case EOpIndexDirectStruct:
UNREACHABLE();
default: default:
ASSERT(op != EOpIndexDirectStruct);
error(loc, "Invalid operation for variables with an opaque type", error(loc, "Invalid operation for variables with an opaque type",
GetOperatorString(op)); GetOperatorString(op));
return false; return false;
......
...@@ -96,6 +96,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -96,6 +96,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_2D_SNORM; return HLSL_TEXTURE_2D_SNORM;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtIImage2D: case EbtIImage2D:
...@@ -109,6 +112,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -109,6 +112,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_2D_INT4; return HLSL_TEXTURE_2D_INT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtUImage2D: case EbtUImage2D:
...@@ -123,6 +129,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -123,6 +129,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_2D_UINT4; return HLSL_TEXTURE_2D_UINT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtImage3D: case EbtImage3D:
...@@ -139,6 +148,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -139,6 +148,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_3D_SNORM; return HLSL_TEXTURE_3D_SNORM;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtIImage3D: case EbtIImage3D:
...@@ -152,6 +164,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -152,6 +164,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_3D_INT4; return HLSL_TEXTURE_3D_INT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtUImage3D: case EbtUImage3D:
...@@ -165,6 +180,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -165,6 +180,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_3D_UINT4; return HLSL_TEXTURE_3D_UINT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtImage2DArray: case EbtImage2DArray:
...@@ -182,6 +200,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -182,6 +200,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_2D_ARRAY_SNORM; return HLSL_TEXTURE_2D_ARRAY_SNORM;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtIImage2DArray: case EbtIImage2DArray:
...@@ -196,6 +217,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -196,6 +217,9 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_2D_ARRAY_INT4; return HLSL_TEXTURE_2D_ARRAY_INT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
case EbtUImage2DArray: case EbtUImage2DArray:
...@@ -210,12 +234,17 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat ...@@ -210,12 +234,17 @@ HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat
return HLSL_TEXTURE_2D_ARRAY_UINT4; return HLSL_TEXTURE_2D_ARRAY_UINT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
} }
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return HLSL_TEXTURE_UNKNOWN;
#endif
} }
return HLSL_TEXTURE_UNKNOWN;
} }
const char *TextureString(const HLSLTextureGroup textureGroup) const char *TextureString(const HLSLTextureGroup textureGroup)
...@@ -372,6 +401,9 @@ const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat ...@@ -372,6 +401,9 @@ const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtIImageCube: case EbtIImageCube:
{ {
...@@ -385,6 +417,9 @@ const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat ...@@ -385,6 +417,9 @@ const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtUImageCube: case EbtUImageCube:
{ {
...@@ -398,11 +433,18 @@ const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat ...@@ -398,11 +433,18 @@ const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
default: default:
// All other types are identified by their group suffix // All other types are identified by their group suffix
return TextureGroupSuffix(type, imageInternalFormat); return TextureGroupSuffix(type, imageInternalFormat);
} }
#if !UNREACHABLE_IS_NORETURN
UNREACHABLE();
return "_TTS_invalid_";
#endif
} }
HLSLRWTextureGroup RWTextureGroup(const TBasicType type, HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
...@@ -426,6 +468,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -426,6 +468,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtIImage2D: case EbtIImage2D:
{ {
...@@ -439,6 +484,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -439,6 +484,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtUImage2D: case EbtUImage2D:
{ {
...@@ -453,6 +501,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -453,6 +501,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtImage3D: case EbtImage3D:
{ {
...@@ -469,6 +520,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -469,6 +520,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtIImage3D: case EbtIImage3D:
{ {
...@@ -482,6 +536,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -482,6 +536,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtUImage3D: case EbtUImage3D:
{ {
...@@ -495,6 +552,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -495,6 +552,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtImage2DArray: case EbtImage2DArray:
case EbtImageCube: case EbtImageCube:
...@@ -512,6 +572,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -512,6 +572,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtIImage2DArray: case EbtIImage2DArray:
case EbtIImageCube: case EbtIImageCube:
...@@ -526,6 +589,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -526,6 +589,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtUImage2DArray: case EbtUImage2DArray:
case EbtUImageCube: case EbtUImageCube:
...@@ -540,6 +606,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type, ...@@ -540,6 +606,9 @@ HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -660,6 +729,9 @@ const char *RWTextureTypeSuffix(const TBasicType type, ...@@ -660,6 +729,9 @@ const char *RWTextureTypeSuffix(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtIImageCube: case EbtIImageCube:
{ {
...@@ -673,6 +745,9 @@ const char *RWTextureTypeSuffix(const TBasicType type, ...@@ -673,6 +745,9 @@ const char *RWTextureTypeSuffix(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
case EbtUImageCube: case EbtUImageCube:
{ {
...@@ -686,11 +761,18 @@ const char *RWTextureTypeSuffix(const TBasicType type, ...@@ -686,11 +761,18 @@ const char *RWTextureTypeSuffix(const TBasicType type,
default: default:
UNREACHABLE(); UNREACHABLE();
} }
#if !UNREACHABLE_IS_NORETURN
break;
#endif
} }
default: default:
// All other types are identified by their group suffix // All other types are identified by their group suffix
return TextureGroupSuffix(type, imageInternalFormat); return TextureGroupSuffix(type, imageInternalFormat);
} }
#if !UNREACHABLE_IS_NORETURN
UNREACHABLE();
return "_RWTS_invalid_";
#endif
} }
TString DecorateField(const ImmutableString &string, const TStructure &structure) TString DecorateField(const ImmutableString &string, const TStructure &structure)
......
...@@ -216,6 +216,9 @@ GLenum GLVariableType(const TType &type) ...@@ -216,6 +216,9 @@ GLenum GLVariableType(const TType &type)
return GL_FLOAT_VEC4; return GL_FLOAT_VEC4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
} }
else if (type.isMatrix()) else if (type.isMatrix())
...@@ -233,6 +236,9 @@ GLenum GLVariableType(const TType &type) ...@@ -233,6 +236,9 @@ GLenum GLVariableType(const TType &type)
return GL_FLOAT_MAT2x4; return GL_FLOAT_MAT2x4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
case 3: case 3:
...@@ -246,6 +252,9 @@ GLenum GLVariableType(const TType &type) ...@@ -246,6 +252,9 @@ GLenum GLVariableType(const TType &type)
return GL_FLOAT_MAT3x4; return GL_FLOAT_MAT3x4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
case 4: case 4:
...@@ -259,10 +268,16 @@ GLenum GLVariableType(const TType &type) ...@@ -259,10 +268,16 @@ GLenum GLVariableType(const TType &type)
return GL_FLOAT_MAT4; return GL_FLOAT_MAT4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
} }
else else
...@@ -284,6 +299,9 @@ GLenum GLVariableType(const TType &type) ...@@ -284,6 +299,9 @@ GLenum GLVariableType(const TType &type)
return GL_INT_VEC4; return GL_INT_VEC4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
} }
else else
...@@ -306,6 +324,9 @@ GLenum GLVariableType(const TType &type) ...@@ -306,6 +324,9 @@ GLenum GLVariableType(const TType &type)
return GL_UNSIGNED_INT_VEC4; return GL_UNSIGNED_INT_VEC4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
} }
else else
...@@ -328,6 +349,9 @@ GLenum GLVariableType(const TType &type) ...@@ -328,6 +349,9 @@ GLenum GLVariableType(const TType &type)
return GL_BOOL_VEC4; return GL_BOOL_VEC4;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return GL_NONE;
#endif
} }
} }
else else
...@@ -554,7 +578,9 @@ InterpolationType GetInterpolationType(TQualifier qualifier) ...@@ -554,7 +578,9 @@ InterpolationType GetInterpolationType(TQualifier qualifier)
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return INTERPOLATION_SMOOTH; return INTERPOLATION_SMOOTH;
#endif
} }
} }
...@@ -614,7 +640,9 @@ TType GetShaderVariableBasicType(const sh::ShaderVariable &var) ...@@ -614,7 +640,9 @@ TType GetShaderVariableBasicType(const sh::ShaderVariable &var)
return TType(EbtUInt, 4); return TType(EbtUInt, 4);
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return TType(); return TType();
#endif
} }
} }
......
...@@ -438,7 +438,9 @@ bool InternalFormat::isRequiredRenderbufferFormat(const Version &version) const ...@@ -438,7 +438,9 @@ bool InternalFormat::isRequiredRenderbufferFormat(const Version &version) const
return true; return true;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return false; return false;
#endif
} }
} }
...@@ -1269,7 +1271,9 @@ AttributeType GetAttributeType(GLenum enumValue) ...@@ -1269,7 +1271,9 @@ AttributeType GetAttributeType(GLenum enumValue)
return ATTRIBUTE_MAT4x3; return ATTRIBUTE_MAT4x3;
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return ATTRIBUTE_FLOAT; return ATTRIBUTE_FLOAT;
#endif
} }
} }
...@@ -1306,7 +1310,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1306,7 +1310,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_SBYTE4; return VERTEX_FORMAT_SBYTE4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_UNSIGNED_BYTE: case GL_UNSIGNED_BYTE:
switch (components) switch (components)
...@@ -1337,7 +1343,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1337,7 +1343,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_UBYTE4; return VERTEX_FORMAT_UBYTE4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_SHORT: case GL_SHORT:
switch (components) switch (components)
...@@ -1368,7 +1376,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1368,7 +1376,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_SSHORT4; return VERTEX_FORMAT_SSHORT4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_UNSIGNED_SHORT: case GL_UNSIGNED_SHORT:
switch (components) switch (components)
...@@ -1399,7 +1409,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1399,7 +1409,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_USHORT4; return VERTEX_FORMAT_USHORT4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_INT: case GL_INT:
switch (components) switch (components)
...@@ -1430,7 +1442,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1430,7 +1442,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_SINT4; return VERTEX_FORMAT_SINT4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_UNSIGNED_INT: case GL_UNSIGNED_INT:
switch (components) switch (components)
...@@ -1461,7 +1475,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1461,7 +1475,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_UINT4; return VERTEX_FORMAT_UINT4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_FLOAT: case GL_FLOAT:
switch (components) switch (components)
...@@ -1476,7 +1492,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1476,7 +1492,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_FLOAT4; return VERTEX_FORMAT_FLOAT4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_HALF_FLOAT: case GL_HALF_FLOAT:
switch (components) switch (components)
...@@ -1491,7 +1509,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1491,7 +1509,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_HALF4; return VERTEX_FORMAT_HALF4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_FIXED: case GL_FIXED:
switch (components) switch (components)
...@@ -1506,7 +1526,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1506,7 +1526,9 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_FIXED4; return VERTEX_FORMAT_FIXED4;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
case GL_INT_2_10_10_10_REV: case GL_INT_2_10_10_10_REV:
if (pureInteger) if (pureInteger)
...@@ -1522,9 +1544,10 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c ...@@ -1522,9 +1544,10 @@ VertexFormatType GetVertexFormatType(GLenum type, GLboolean normalized, GLuint c
return VERTEX_FORMAT_UINT210; return VERTEX_FORMAT_UINT210;
default: default:
UNREACHABLE(); UNREACHABLE();
break; #if !UNREACHABLE_IS_NORETURN
return VERTEX_FORMAT_INVALID;
#endif
} }
return VERTEX_FORMAT_UBYTE1;
} }
VertexFormatType GetVertexFormatType(const VertexAttribute &attrib) VertexFormatType GetVertexFormatType(const VertexAttribute &attrib)
...@@ -2116,7 +2139,9 @@ size_t GetVertexFormatTypeSize(VertexFormatType vertexFormatType) ...@@ -2116,7 +2139,9 @@ size_t GetVertexFormatTypeSize(VertexFormatType vertexFormatType)
case VERTEX_FORMAT_INVALID: case VERTEX_FORMAT_INVALID:
default: default:
UNREACHABLE(); UNREACHABLE();
#if !UNREACHABLE_IS_NORETURN
return 0; return 0;
#endif
} }
} }
......
...@@ -547,7 +547,6 @@ gl::Error Blit9::setFormatConvertShaders(GLenum destFormat, ...@@ -547,7 +547,6 @@ gl::Error Blit9::setFormatConvertShaders(GLenum destFormat,
switch (destFormat) switch (destFormat)
{ {
default: UNREACHABLE();
case GL_RGBA: case GL_RGBA:
case GL_BGRA_EXT: case GL_BGRA_EXT:
multConst[X] = 1; multConst[X] = 1;
...@@ -625,6 +624,8 @@ gl::Error Blit9::setFormatConvertShaders(GLenum destFormat, ...@@ -625,6 +624,8 @@ gl::Error Blit9::setFormatConvertShaders(GLenum destFormat,
addConst[Z] = 0; addConst[Z] = 0;
addConst[W] = 0; addConst[W] = 0;
break; break;
default: UNREACHABLE();
} }
mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2); mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment