summaryrefslogtreecommitdiff
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2020-02-08 08:35:52 +0100
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2020-02-08 11:21:46 +0100
commitd2b02a3d7b0ed88ab73e05197169ba795f308a8a (patch)
treee7fad2f2e3fb865c126cb775e53a5b990ed13d5a /modules/mono/csharp_script.cpp
parent343b29a651429eb57bf5acf95a14e2ff1773ab88 (diff)
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.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 752fc9e2cc..2847f3b414 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -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;