Skip to content

Commit

Permalink
Replaced macros with C++17 attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Dec 3, 2023
1 parent 8378034 commit e9e2e22
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 90 deletions.
10 changes: 5 additions & 5 deletions examples/20-nanovg/nanovg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ static char* cpToUTF8(int cp, char* str)

switch (n)
{
case 6: str[5] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x4000000; BX_FALLTHROUGH;
case 5: str[4] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x200000; BX_FALLTHROUGH;
case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; BX_FALLTHROUGH;
case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; BX_FALLTHROUGH;
case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; BX_FALLTHROUGH;
case 6: str[5] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x4000000; [[fallthrough]];
case 5: str[4] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x200000; [[fallthrough]];
case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; [[fallthrough]];
case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; [[fallthrough]];
case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; [[fallthrough]];
case 1: str[0] = char(cp); break;
}

Expand Down
4 changes: 2 additions & 2 deletions src/bgfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ namespace bgfx

m_exit = true;
}
BX_FALLTHROUGH;
[[fallthrough]];

case CommandBuffer::End:
end = true;
Expand Down Expand Up @@ -3572,7 +3572,7 @@ namespace bgfx
case ErrorState::ContextAllocated:
bx::deleteObject(g_allocator, s_ctx, Context::kAlignment);
s_ctx = NULL;
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::Default:
if (NULL != s_callbackStub)
Expand Down
4 changes: 2 additions & 2 deletions src/renderer_d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,13 +1635,13 @@ namespace bgfx { namespace d3d11
#endif // USE_D3D11_DYNAMIC_LIB

m_dxgi.shutdown();
BX_FALLTHROUGH;
[[fallthrough]];

#if USE_D3D11_DYNAMIC_LIB
case ErrorState::LoadedD3D11:
bx::dlclose(m_d3d11Dll);
m_d3d11Dll = NULL;
BX_FALLTHROUGH;
[[fallthrough]];
#endif // USE_D3D11_DYNAMIC_LIB

case ErrorState::Default:
Expand Down
8 changes: 4 additions & 4 deletions src/renderer_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1581,24 +1581,24 @@ namespace bgfx { namespace d3d12
case ErrorState::CreatedCommandQueue:
m_device->SetPrivateDataInterface(IID_ID3D12CommandQueue, NULL);
m_cmd.shutdown();
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::CreatedDXGIFactory:
DX_RELEASE(m_device, 0);
#if !BX_PLATFORM_LINUX
m_dxgi.shutdown();
#endif // !BX_PLATFORM_LINUX
BX_FALLTHROUGH;
[[fallthrough]];

#if USE_D3D12_DYNAMIC_LIB
case ErrorState::LoadedDXGI:
case ErrorState::LoadedD3D12:
bx::dlclose(m_d3d12Dll);
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::LoadedKernel32:
bx::dlclose(m_kernel32Dll);
BX_FALLTHROUGH;
[[fallthrough]];

#endif // USE_D3D12_DYNAMIC_LIB
case ErrorState::Default:
Expand Down
2 changes: 1 addition & 1 deletion src/renderer_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ namespace bgfx { namespace gl
{
return true;
}
BX_FALLTHROUGH;
[[fallthrough]];

case TextureFormat::RGBA32F:
if (_writeOnly)
Expand Down
24 changes: 12 additions & 12 deletions src/renderer_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ VK_IMPORT_DEVICE
{
m_gpuTimer.shutdown();
}
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::DescriptorCreated:
for (uint32_t ii = 0; ii < m_numFramesInFlight; ++ii)
Expand All @@ -2056,19 +2056,19 @@ VK_IMPORT_DEVICE
}
vkDestroy(m_pipelineCache);
vkDestroy(m_descriptorPool);
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::SwapChainCreated:
m_backBuffer.destroy();
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::CommandQueueCreated:
m_cmd.shutdown();
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::DeviceCreated:
vkDestroyDevice(m_device, m_allocatorCb);
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::InstanceCreated:
if (VK_NULL_HANDLE != m_debugReportCallback)
Expand All @@ -2077,14 +2077,14 @@ VK_IMPORT_DEVICE
}

vkDestroyInstance(m_instance, m_allocatorCb);
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::LoadedVulkan1:
bx::dlclose(m_vulkan1Dll);
m_vulkan1Dll = NULL;
m_allocatorCb = NULL;
unloadRenderDoc(m_renderDocDll);
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::Default:
break;
Expand Down Expand Up @@ -6604,15 +6604,15 @@ VK_DESTROY
{
case ErrorState::AttachmentsCreated:
releaseAttachments();
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::SwapChainCreated:
releaseSwapChain();
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::SurfaceCreated:
releaseSurface();
BX_FALLTHROUGH;
[[fallthrough]];

case ErrorState::Default:
break;
Expand Down Expand Up @@ -7418,7 +7418,7 @@ VK_DESTROY

case VK_ERROR_SURFACE_LOST_KHR:
m_needToRecreateSurface = true;
BX_FALLTHROUGH;
[[fallthrough]];

case VK_ERROR_OUT_OF_DATE_KHR:
case VK_SUBOPTIMAL_KHR:
Expand Down Expand Up @@ -7469,7 +7469,7 @@ VK_DESTROY
{
case VK_ERROR_SURFACE_LOST_KHR:
m_needToRecreateSurface = true;
BX_FALLTHROUGH;
[[fallthrough]];

case VK_ERROR_OUT_OF_DATE_KHR:
case VK_SUBOPTIMAL_KHR:
Expand Down
18 changes: 9 additions & 9 deletions src/shader_dxbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ namespace bgfx
_instruction.primitiveTopology = DxbcPrimitiveTopology::Enum( (token & UINT32_C(0x0001f800) ) >> 11);
break;

case DxbcOpcode::DCL_INPUT_PS: BX_FALLTHROUGH;
case DxbcOpcode::DCL_INPUT_PS: [[fallthrough]];
case DxbcOpcode::DCL_INPUT_PS_SIV:
// 0 1 2 3
// 76543210765432107654321076543210
Expand Down Expand Up @@ -1395,12 +1395,12 @@ namespace bgfx
_instruction.numOperands = info.numOperands;
switch (info.numOperands)
{
case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 6: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 5: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 4: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 3: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 2: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 1: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 0:
if (0 < info.numValues)
{
Expand Down Expand Up @@ -1471,7 +1471,7 @@ namespace bgfx
token |= (_instruction.primitiveTopology << 11) & UINT32_C(0x0001f800);
break;

case DxbcOpcode::DCL_INPUT_PS: BX_FALLTHROUGH;
case DxbcOpcode::DCL_INPUT_PS: [[fallthrough]];
case DxbcOpcode::DCL_INPUT_PS_SIV:
token |= (_instruction.interpolation << 11) & UINT32_C(0x0000f800);
break;
Expand Down Expand Up @@ -1991,7 +1991,7 @@ namespace bgfx
{
case DXBC_CHUNK_SHADER_EX:
_dxbc.shader.shex = true;
BX_FALLTHROUGH;
[[fallthrough]];

case DXBC_CHUNK_SHADER:
size += read(_reader, _dxbc.shader, _err);
Expand Down
Loading

0 comments on commit e9e2e22

Please sign in to comment.