diff options
-rw-r--r-- | codegen/valaccodebasemodule.vala | 10 | ||||
-rw-r--r-- | codegen/valaccodedelegatemodule.vala | 8 | ||||
-rw-r--r-- | codegen/valaccodemethodmodule.vala | 3 | ||||
-rw-r--r-- | codegen/valaccodestructmodule.vala | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 5 | ||||
-rw-r--r-- | tests/annotations/deprecated-delegate-minimal.vala | 6 | ||||
-rw-r--r-- | tests/annotations/deprecated-enum-minimal.vala | 8 | ||||
-rw-r--r-- | tests/annotations/deprecated-method-minimal.vala | 6 | ||||
-rw-r--r-- | tests/annotations/deprecated-property-minimal.vala | 13 | ||||
-rw-r--r-- | tests/annotations/deprecated-struct-minimal.vala | 9 |
10 files changed, 73 insertions, 3 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index e000d229e..412ec82d4 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -828,7 +828,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { var cenum = new CCodeEnum (get_ccode_name (en)); - cenum.modifiers |= (en.version.deprecated ? CCodeModifiers.DEPRECATED : 0); + if (en.version.deprecated) { + if (context.profile == Profile.GOBJECT) { + decl_space.add_include ("glib.h"); + } + cenum.modifiers |= CCodeModifiers.DEPRECATED; + } var current_cfile = cfile; cfile = decl_space; @@ -1649,6 +1654,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { } if (prop.version.deprecated) { + if (context.profile == Profile.GOBJECT) { + decl_space.add_include ("glib.h"); + } function.modifiers |= CCodeModifiers.DEPRECATED; } diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala index dd3e0fcf6..b0770a5a0 100644 --- a/codegen/valaccodedelegatemodule.vala +++ b/codegen/valaccodedelegatemodule.vala @@ -111,7 +111,13 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule { } var ctypedef = new CCodeTypeDefinition (get_ccode_name (creturn_type), cfundecl); - ctypedef.modifiers |= (d.version.deprecated ? CCodeModifiers.DEPRECATED : 0); + + if (d.version.deprecated) { + if (context.profile == Profile.GOBJECT) { + decl_space.add_include ("glib.h"); + } + ctypedef.modifiers |= CCodeModifiers.DEPRECATED; + } decl_space.add_type_declaration (ctypedef); } diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala index fc39060bf..f15c660ee 100644 --- a/codegen/valaccodemethodmodule.vala +++ b/codegen/valaccodemethodmodule.vala @@ -178,6 +178,9 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule { } if (m.version.deprecated) { + if (context.profile == Profile.GOBJECT) { + decl_space.add_include ("glib.h"); + } function.modifiers |= CCodeModifiers.DEPRECATED; } diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala index 2eab9e0e1..edd392304 100644 --- a/codegen/valaccodestructmodule.vala +++ b/codegen/valaccodestructmodule.vala @@ -77,7 +77,13 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule { } var instance_struct = new CCodeStruct ("_%s".printf (get_ccode_name (st))); - instance_struct.modifiers |= (st.version.deprecated ? CCodeModifiers.DEPRECATED : 0); + + if (st.version.deprecated) { + if (context.profile == Profile.GOBJECT) { + decl_space.add_include ("glib.h"); + } + instance_struct.modifiers |= CCodeModifiers.DEPRECATED; + } foreach (Field f in st.get_fields ()) { if (f.binding == MemberBinding.INSTANCE) { diff --git a/tests/Makefile.am b/tests/Makefile.am index f0e164198..2979f644f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -737,6 +737,11 @@ TESTS = \ gtktemplate/gtkchild-without-gtktemplate.test \ gtktemplate/gtktemplate-gtkwidget-subclass.test \ annotations/deprecated.vala \ + annotations/deprecated-delegate-minimal.vala \ + annotations/deprecated-enum-minimal.vala \ + annotations/deprecated-method-minimal.vala \ + annotations/deprecated-property-minimal.vala \ + annotations/deprecated-struct-minimal.vala \ annotations/description.vala \ annotations/noaccessormethod.test \ scanner/comment-not-closed.test \ diff --git a/tests/annotations/deprecated-delegate-minimal.vala b/tests/annotations/deprecated-delegate-minimal.vala new file mode 100644 index 000000000..3e34e8657 --- /dev/null +++ b/tests/annotations/deprecated-delegate-minimal.vala @@ -0,0 +1,6 @@ +[Version (deprecated = true)] +[CCode (has_target = false)] +delegate void Foo (); + +void main () { +} diff --git a/tests/annotations/deprecated-enum-minimal.vala b/tests/annotations/deprecated-enum-minimal.vala new file mode 100644 index 000000000..91f0be73e --- /dev/null +++ b/tests/annotations/deprecated-enum-minimal.vala @@ -0,0 +1,8 @@ +[Version (deprecated = true)] +[CCode (has_type_id = false)] +enum Foo { + BAR +} + +void main () { +} diff --git a/tests/annotations/deprecated-method-minimal.vala b/tests/annotations/deprecated-method-minimal.vala new file mode 100644 index 000000000..99aba27e8 --- /dev/null +++ b/tests/annotations/deprecated-method-minimal.vala @@ -0,0 +1,6 @@ +[Version (deprecated = true)] +void foo () { +} + +void main () { +} diff --git a/tests/annotations/deprecated-property-minimal.vala b/tests/annotations/deprecated-property-minimal.vala new file mode 100644 index 000000000..a52e7733f --- /dev/null +++ b/tests/annotations/deprecated-property-minimal.vala @@ -0,0 +1,13 @@ +[CCode (has_type_id = false)] +[SimpleType] +struct Foo { + void* _bar; + [Version (deprecated = true)] + public void* bar { + get { return _bar; } + set { _bar = value; } + } +} + +void main () { +} diff --git a/tests/annotations/deprecated-struct-minimal.vala b/tests/annotations/deprecated-struct-minimal.vala new file mode 100644 index 000000000..6b1c34493 --- /dev/null +++ b/tests/annotations/deprecated-struct-minimal.vala @@ -0,0 +1,9 @@ +[Version (deprecated = true)] +[CCode (has_type_id = false)] +[SimpleType] +struct Foo { + public void* bar; +} + +void main () { +} |