From: Juerg Billeter Date: Tue, 5 Feb 2008 18:45:05 +0000 (+0000) Subject: assume that control flow ends when invoking a method with the [NoReturn] X-Git-Tag: VALA_0_1_7~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=219f6fce7119df0caed4721162abc27d6dae1b2d;p=platform%2Fupstream%2Fvala.git assume that control flow ends when invoking a method with the [NoReturn] 2008-02-05 Juerg Billeter * vala/valacfgbuilder.vala: assume that control flow ends when invoking a method with the [NoReturn] attribute * vapi/glib-2.0.vapi: add [NoReturn] to assert_not_reached svn path=/trunk/; revision=974 --- diff --git a/ChangeLog b/ChangeLog index a1119bb..39eb778 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-02-05 Jürg Billeter + * vala/valacfgbuilder.vala: assume that control flow ends when + invoking a method with the [NoReturn] attribute + + * vapi/glib-2.0.vapi: add [NoReturn] to assert_not_reached + +2008-02-05 Jürg Billeter + * vala/valasemanticanalyzer.vala: set tree_can_fail for assignments that can fail diff --git a/vala/valacfgbuilder.vala b/vala/valacfgbuilder.vala index 165b1c9..470b47a 100644 --- a/vala/valacfgbuilder.vala +++ b/vala/valacfgbuilder.vala @@ -166,6 +166,16 @@ public class Vala.CFGBuilder : CodeVisitor { current_block.add_node (stmt); handle_errors (stmt); + + if (stmt.expression is InvocationExpression) { + var expr = (InvocationExpression) stmt.expression; + var ma = expr.call as MemberAccess; + if (ma.symbol_reference != null && ma.symbol_reference.get_attribute ("NoReturn") != null) { + current_block = null; + unreachable_reported = false; + return; + } + } } public override void visit_if_statement (IfStatement! stmt) { diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index feb3732..bf7ee3b 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -1395,6 +1395,7 @@ namespace GLib { public static void return_if_fail (bool expr); public static void assert (bool expr); + [NoReturn] public static void assert_not_reached (); /* Message Logging */