Skip to content

Commit

Permalink
Add do..while(0) wrappers to macros without one.
Browse files Browse the repository at this point in the history
- Add do..while(0) wrapper to ERR_FAIL_NULL macros.
- Add do..while(0) wrapper to ERR_FAIL_COND macros.
- Add do..while(0) wrapper to ERR_CONTINUE macros.
- Add do..while(0) wrapper to ERR_BREAK macros.
- Add do..while(0) wrapper to CRASH_COND macros.
- Add do..while(0) wrapper to ERR_FAIL macros.
- Add do..while(0) wrapper to ERR_PRINT macros.
- Add do..while(0) wrapper to WARN_PRINT macros.
- Add do..while(0) wrapper to WARN_DEPRECATED macros.
- Add do..while(0) wrapper to CRASH_NOW macros.
  • Loading branch information
madmiraal committed Feb 5, 2020
1 parent f0db135 commit 6d69cd4
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 89 deletions.
158 changes: 79 additions & 79 deletions core/error_macros.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/math/bsp_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ static int _bsp_create_node(const Face3 *p_faces, const Vector<int> &p_indices,
ERR_FAIL_COND_V(p_nodes.size() == BSP_Tree::MAX_NODES, -1);

// should not reach here
ERR_FAIL_COND_V(p_indices.size() == 0, -1)
ERR_FAIL_COND_V(p_indices.size() == 0, -1);

int ic = p_indices.size();
const int *indices = p_indices.ptr();
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_vcs_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void EditorVCSInterface::_bind_methods() {

bool EditorVCSInterface::_initialize(String p_project_root_path) {

WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed.")
WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed.");
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion editor/import/editor_scene_importer_gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Error EditorSceneImporterGLTF::_parse_scenes(GLTFState &state) {
if (state.json.has("scene")) {
loaded_scene = state.json["scene"];
} else {
WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene.")
WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene.");
}

if (scenes.size()) {
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/version_control_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void VersionControlEditorPlugin::_refresh_stage_area() {
}
} else {

WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu.")
WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/assimp/editor_scene_importer_assimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
Spatial *parent_node = parent_lookup->value();

ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root,
"Parent node invalid even though lookup successful, out of ram?")
"Parent node invalid even though lookup successful, out of ram?");

if (spatial != state.root) {
parent_node->add_child(spatial);
Expand Down
2 changes: 1 addition & 1 deletion modules/bullet/area_bullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool AreaBullet::is_monitoring() const {
}

void AreaBullet::main_shape_changed() {
CRASH_COND(!get_main_shape())
CRASH_COND(!get_main_shape());
btGhost->setCollisionShape(get_main_shape());
}

Expand Down
2 changes: 1 addition & 1 deletion modules/bullet/rigid_body_bullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void RigidBodyBullet::destroy_kinematic_utilities() {
}

void RigidBodyBullet::main_shape_changed() {
CRASH_COND(!get_main_shape())
CRASH_COND(!get_main_shape());
btBody->setCollisionShape(get_main_shape());
set_continuous_collision_detection(is_continuous_collision_detection_enabled()); // Reset
}
Expand Down
2 changes: 1 addition & 1 deletion scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ bool Viewport::_gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_che

void Viewport::_gui_input_event(Ref<InputEvent> p_event) {

ERR_FAIL_COND(p_event.is_null())
ERR_FAIL_COND(p_event.is_null());

//?
/*
Expand Down
4 changes: 2 additions & 2 deletions scene/resources/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2374,13 +2374,13 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
if (tex3d.is_null()) {
f->close();
memdelete(f);
ERR_FAIL_COND_V(tex3d.is_null(), RES())
ERR_FAIL_COND_V(tex3d.is_null(), RES());
}
} else if (header[0] == 'G' && header[1] == 'D' && header[2] == 'A' && header[3] == 'T') {
if (texarr.is_null()) {
f->close();
memdelete(f);
ERR_FAIL_COND_V(texarr.is_null(), RES())
ERR_FAIL_COND_V(texarr.is_null(), RES());
}
} else {

Expand Down

0 comments on commit 6d69cd4

Please sign in to comment.