Commit d2b02a3d by Marcel Admiraal

Remove do{ } while(0) wrapper around error macros.

As pointed out by Faless, a do{ } while(0) wrapper around a continue or break just ends the do{ } while(0) loop. The do{ } while(0) loop exists to enable the macro to be used as a function which requires a semicolon. The alternative approach is to use an if(1) { } else ((void)0) wrapper. Since the macro already has an if(unlikely(m_cond)) { } this patch simply adds the else ((void)0) to this if statement instead. For consistency all the macros have been updated in the same way, and trailing else warnings corrected. However, the wrappers around ERR_PRINT and WARN_PRINT were removed, because they generated too many ambiguous trailing else warnings. They are also single line macros so a wrapper is not needed.
parent 343b29a6
......@@ -1721,8 +1721,7 @@ bool CSharpInstance::has_method(const StringName &p_method) const {
Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
if (!script.is_valid())
ERR_FAIL_V(Variant());
ERR_FAIL_COND_V(!script.is_valid(), Variant());
GD_MONO_SCOPE_THREAD_ATTACH;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment