From c933eb7accce31e74a244ea5ed0c6bd5b0aa14ca Mon Sep 17 00:00:00 2001 From: "Mateo Dev .59" Date: Thu, 20 Feb 2020 11:13:08 -0300 Subject: [PATCH] Change when we can ERR_FAIL_COND and ERR_FAIL_CONV_V to static_assert --- core/register_core_types.cpp | 2 +- drivers/vulkan/rendering_device_vulkan.cpp | 2 +- main/tests/test_string.cpp | 2 +- servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 07a252ad315..b0ba8ed194e 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -100,7 +100,7 @@ extern void unregister_variant_methods(); void register_core_types() { //consistency check - ERR_FAIL_COND(sizeof(Callable) > 16); + static_assert(sizeof(Callable) <= 16); ObjectDB::setup(); ResourceCache::setup(); diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 2bf8a160915..8cea8ebb868 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -6862,7 +6862,7 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context) { max_descriptors_per_pool = GLOBAL_DEF("rendering/vulkan/descriptor_pools/max_descriptors_per_pool", 64); //check to make sure DescriptorPoolKey is good - ERR_FAIL_COND(sizeof(uint64_t) * 3 < UNIFORM_TYPE_MAX * sizeof(uint16_t)); + static_assert(sizeof(uint64_t) * 3 >= UNIFORM_TYPE_MAX * sizeof(uint16_t)); draw_list = NULL; draw_list_count = 0; diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index eef3d9b84c7..84731746fa4 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -1172,7 +1172,7 @@ MainLoop *test() { /** A character length != wchar_t may be forced, so the tests won't work */ - ERR_FAIL_COND_V(sizeof(CharType) != sizeof(wchar_t), NULL); + static_assert(sizeof(CharType) == sizeof(wchar_t)); int count = 0; int passed = 0; diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp index 54f330ecdd4..78fff0c381a 100644 --- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp @@ -2480,7 +2480,7 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) { state.time = 0; - ERR_FAIL_COND(sizeof(PushConstant) != 128); + static_assert(sizeof(PushConstant) == 128); } bool RasterizerCanvasRD::free(RID p_rid) {