From: Rico Tzschichholz Date: Wed, 17 Jan 2018 12:09:06 +0000 (+0100) Subject: codegen: Add public/private separator comments to type/instance structs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05a160cecacf8ce6d78e1ef4c63a35762e1fa815;p=thirdparty%2Fvala.git codegen: Add public/private separator comments to type/instance structs See https://gitlab.gnome.org/GNOME/vala/issues/598 --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 9227260e0..91f96d1c0 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -222,6 +222,11 @@ public class Vala.GTypeModule : GErrorModule { instance_struct.add_field ("volatile int", "ref_count"); } + if (context.abi_stability) { + // add "/*< public >*/" separator + instance_struct.add_comment ("< public >"); + } + if (is_gtypeinstance) { decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %sPrivate".printf (instance_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (get_ccode_name (cl))))); @@ -234,6 +239,11 @@ public class Vala.GTypeModule : GErrorModule { type_struct.add_field ("%sClass".printf (get_ccode_name (cl.base_class)), "parent_class"); } + if (context.abi_stability) { + // add "/*< public >*/" separator + type_struct.add_comment ("< public >"); + } + if (is_fundamental) { type_struct.add_field ("void", "(*finalize) (%s *self)".printf (get_ccode_name (cl))); } @@ -280,6 +290,12 @@ public class Vala.GTypeModule : GErrorModule { } } + if (context.abi_stability) { + // add "/*< private >*/" separator + instance_struct.add_comment ("< private >"); + type_struct.add_comment ("< private >"); + } + if (cl.is_compact && cl.base_class == null && !has_struct_member) { // add dummy member, C doesn't allow empty structs instance_struct.add_field ("int", "dummy"); @@ -2094,6 +2110,11 @@ public class Vala.GTypeModule : GErrorModule { type_struct.add_field ("GTypeInterface", "parent_iface"); + if (context.abi_stability) { + // add "/*< public >*/" separator + type_struct.add_comment ("< public >"); + } + if (iface.get_attribute ("GenericAccessors") != null) { foreach (TypeParameter p in iface.get_type_parameters ()) { string method_name = "get_%s_type".printf (p.name.down ()); @@ -2195,6 +2216,11 @@ public class Vala.GTypeModule : GErrorModule { } } + if (context.abi_stability) { + // add "/*< private >*/" separator + type_struct.add_comment ("< private >"); + } + decl_space.add_type_definition (type_struct); var type_fun = new InterfaceRegisterFunction (iface);