[vala] codegen: Fix C warning in destructors
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Fix C warning in destructors
- Date: Thu, 21 Oct 2010 08:22:35 +0000 (UTC)
commit cfc03c4907a20da8c97bdbee9f52881b813f885d
Author: Jürg Billeter <j bitron ch>
Date: Thu Oct 21 10:18:40 2010 +0200
codegen: Fix C warning in destructors
codegen/valaccodebasemodule.vala | 9 +++++++++
codegen/valagtypemodule.vala | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 561f535..678d139 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -36,6 +36,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
public ArrayList<LocalVariable> temp_ref_vars = new ArrayList<LocalVariable> ();
public int next_temp_var_id;
public bool current_method_inner_error;
+ public bool current_method_return;
public Map<string,string> variable_name_map = new HashMap<string,string> (str_hash, str_equal);
public EmitContext (Symbol? symbol = null) {
@@ -215,6 +216,11 @@ public class Vala.CCodeBaseModule : CodeGenerator {
set { emit_context.current_method_inner_error = value; }
}
+ public bool current_method_return {
+ get { return emit_context.current_method_return; }
+ set { emit_context.current_method_return = value; }
+ }
+
public int next_coroutine_state = 1;
int next_block_id = 0;
Map<Block,int> block_map = new HashMap<Block,int> ();
@@ -3371,6 +3377,9 @@ public class Vala.CCodeBaseModule : CodeGenerator {
if (return_expression_symbol != null) {
return_expression_symbol.active = true;
}
+
+ // required for destructors
+ current_method_return = true;
}
public string get_symbol_lock_name (string symname) {
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 61c61f1..9ad6b08 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1654,8 +1654,10 @@ public class Vala.GTypeModule : GErrorModule {
ccode.add_declaration ("GError *", new CCodeVariableDeclarator.zero ("_inner_error_", new CCodeConstant ("NULL")));
}
- // support return statements in destructors
- ccode.add_label ("_return");
+ if (current_method_return) {
+ // support return statements in destructors
+ ccode.add_label ("_return");
+ }
}
pop_context ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]