Replaced ASSUME(false) with UNREACHABLE.

This commit is contained in:
Tom Lally 2022-08-27 20:40:25 +01:00
parent f33540faa1
commit 73a8e6faac
8 changed files with 20 additions and 14 deletions

View file

@ -518,7 +518,7 @@ void LatteOverlay_translateScreenPosition(ScreenPosition pos, const Vector2f& wi
direction = -1;
break;
default:
ASSUME(false);
UNREACHABLE;
}
}

View file

@ -1463,7 +1463,7 @@ void OpenGLRenderer::shader_bind(RendererShader* shader)
prevGeometryShaderProgram = program;
break;
default:
ASSUME(false);
UNREACHABLE;
}
catchOpenGLError();
@ -1494,7 +1494,7 @@ void OpenGLRenderer::shader_unbind(RendererShader::ShaderType shaderType)
prevGeometryShaderProgram = -1;
break;
default:
ASSUME(false);
UNREACHABLE;
}
}

View file

@ -270,7 +270,7 @@ void RendererShaderGL::ShaderCacheLoading_begin(uint64 cacheTitleId)
usePrecompiled = false;
break;
default:
ASSUME(false);
UNREACHABLE;
}
forceLog_printf("Using precompiled shaders: %s", usePrecompiled ? "true" : "false");

View file

@ -3412,7 +3412,7 @@ VkDescriptorSetInfo::~VkDescriptorSetInfo()
break;
}
default:
ASSUME(false);
UNREACHABLE;
}
// update global stats
performanceMonitor.vk.numDescriptorSamplerTextures.decrement(statsNumSamplerTextures);

View file

@ -528,7 +528,7 @@ uint64 VulkanRenderer::GetDescriptorSetStateHash(LatteDecompilerShader* shader)
texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_GS;
break;
default:
ASSUME(false);
UNREACHABLE;
}
auto texture = m_state.boundTexture[hostTextureUnit];
@ -590,7 +590,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo*
break;
}
default:
ASSUME(false);
UNREACHABLE;
}
// create new descriptor set
@ -646,7 +646,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo*
texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_GS;
break;
default:
ASSUME(false);
UNREACHABLE;
}
auto textureView = m_state.boundTexture[hostTextureUnit];
@ -996,7 +996,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo*
break;
}
default:
ASSUME(false);
UNREACHABLE;
}
return dsInfo;

View file

@ -174,7 +174,7 @@ std::unique_ptr<uint8[]> MetaInfo::GetIcon(uint32& size) const
return nullptr;
}
default:
ASSUME(false);
UNREACHABLE;
}
return nullptr;
}

View file

@ -219,6 +219,15 @@ typedef union _LARGE_INTEGER {
inline T& operator^= (T& a, T b) { return reinterpret_cast<T&>( reinterpret_cast<std::underlying_type<T>::type&>(a) ^= static_cast<std::underlying_type<T>::type>(b) ); }
#endif
#if defined(_MSC_VER)
#define UNREACHABLE __assume(false)
#elif defined(__GNUC__)
#define UNREACHABLE __builtin_unreachable();
#else
#warning "No implementation for UNREACHABLE"
#define UNREACHABLE
#endif
// MEMPTR
#include "Common/MemPtr.h"
@ -230,7 +239,6 @@ typedef union _LARGE_INTEGER {
#define DLLIMPORT __declspec(dllimport)
#define DEBUG_BREAK __debugbreak()
#define NOINLINE __declspec(noinline)
#define ASSUME(X) __assume(X)
#define THREAD_LOCAL __declspec(thread)
#define POPCNT(X) __popcnt((X))
#else
@ -240,8 +248,6 @@ typedef union _LARGE_INTEGER {
#include <csignal>
#define DEBUG_BREAK raise(SIGTRAP)
#define NOINLINE __attribute__((noinline))
// fixme: random stack overflow solution. use it with caution
#define ASSUME(X) do { if (!(X)) __builtin_unreachable(); } while (0)
#define THREAD_LOCAL __thread
#define POPCNT(X) __builtin_popcount((X))
#endif

View file

@ -941,7 +941,7 @@ wxString wxTitleManagerList::GetTitleEntryText(const TitleEntry& entry, ItemColu
//return wxStringFormat2("{}", entry.format);
}
default:
ASSUME(false);
UNREACHABLE;
}
return wxEmptyString;