diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-07-13 20:14:03 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-07-13 20:14:03 +0200 |
commit | 08bfe93a91eb60c7534883d64b177766ff5b36bf (patch) | |
tree | 57fcd7148a93314f883c0ea9c73346e8f3bc6cdb /codegen/valatyperegisterfunction.vala | |
parent | a96983dbe6079ff7c174d5dc536d35eb4b2d4bd4 (diff) | |
download | vala-08bfe93a91eb60c7534883d64b177766ff5b36bf.tar.gz |
codegen: Don't emit g_type_add_instance_private() for dynamic types
This fixes warnings like "sys:1: Warning: cannot add private field to
invalid (non-instantiatable) type ..."
Regression of df56f916e52e5efe3876afed59a6190f6cead1c8
Diffstat (limited to 'codegen/valatyperegisterfunction.vala')
-rw-r--r-- | codegen/valatyperegisterfunction.vala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala index cb0db6844..c0ceecd9d 100644 --- a/codegen/valatyperegisterfunction.vala +++ b/codegen/valatyperegisterfunction.vala @@ -218,10 +218,14 @@ public abstract class Vala.TypeRegisterFunction { } if (cl != null && (cl.has_private_fields || cl.get_type_parameters ().size > 0)) { - var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_add_instance_private")); - ccall.add_argument (new CCodeIdentifier (type_id_name)); - ccall.add_argument (new CCodeIdentifier ("sizeof (%sPrivate)".printf (get_ccode_name (cl)))); - type_init.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("%s_private_offset".printf (get_ccode_name (cl))), ccall))); + if (!plugin) { + var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_add_instance_private")); + ccall.add_argument (new CCodeIdentifier (type_id_name)); + ccall.add_argument (new CCodeIdentifier ("sizeof (%sPrivate)".printf (get_ccode_name (cl)))); + type_init.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("%s_private_offset".printf (get_ccode_name (cl))), ccall))); + } else { + type_init.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("%s_private_offset".printf (get_ccode_name (cl))), new CCodeIdentifier ("sizeof (%sPrivate)".printf (get_ccode_name (cl)))))); + } } if (!plugin) { |