Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change when we can ERR_FAIL_COND and ERR_FAIL_CONV_V to static_assert #36385

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/register_core_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion drivers/vulkan/rendering_device_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion main/tests/test_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down