summaryrefslogtreecommitdiff
path: root/vala/valaenumvaluetype.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-06-18 23:34:09 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2019-07-04 12:18:11 +0200
commit70c4b16d83c90959e806cc055fb0dd65bef0cab3 (patch)
tree96ae54a6a8ff37201aefcb0f5147f3e92f7a882f /vala/valaenumvaluetype.vala
parentb35b0b1a673e498fbb065a6fb7b68bc714142826 (diff)
downloadvala-70c4b16d83c90959e806cc055fb0dd65bef0cab3.tar.gz
codegen: Don't write declaration of extern symbols with given header
The corresponding header will provide the declaration and therefore fix build with -Werror=redundant-decls. Set cheader_filename for implicit to_string() method of enums which is transformed into symbol calls from glib-object.h. This avoids the leak of an superfluous prototype of that method into the generated c code. Fixes https://gitlab.gnome.org/GNOME/vala/issues/745
Diffstat (limited to 'vala/valaenumvaluetype.vala')
-rw-r--r--vala/valaenumvaluetype.vala1
1 files changed, 1 insertions, 0 deletions
diff --git a/vala/valaenumvaluetype.vala b/vala/valaenumvaluetype.vala
index 896371323..be8ac15d0 100644
--- a/vala/valaenumvaluetype.vala
+++ b/vala/valaenumvaluetype.vala
@@ -48,6 +48,7 @@ public class Vala.EnumValueType : ValueType {
to_string_method = new Method ("to_string", string_type);
to_string_method.access = SymbolAccessibility.PUBLIC;
to_string_method.is_extern = true;
+ to_string_method.set_attribute_string ("CCode", "cheader_filename", "glib-object.h");
to_string_method.owner = type_symbol.scope;
to_string_method.this_parameter = new Parameter ("this", this);
to_string_method.scope.add (to_string_method.this_parameter.name, to_string_method.this_parameter);