[vala/staging] errormodule: Don't write unreachable goto-statement



commit b23b95e3fe441a9f38d780988fa94501d202b3e9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Feb 18 13:02:28 2017 +0100

    errormodule: Don't write unreachable goto-statement
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778304

 codegen/valagerrormodule.vala |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 041779b..c0f08bc 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -315,7 +315,10 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 
                foreach (CatchClause clause in stmt.get_catch_clauses ()) {
                        current_catch = clause;
-                       ccode.add_goto ("__finally%d".printf (this_try_id));
+                       // avoid writing unreachable goto-statement
+                       if (stmt.after_try_block_reachable) {
+                               ccode.add_goto ("__finally%d".printf (this_try_id));
+                       }
                        clause.emit (this);
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]