summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-12-08 10:41:50 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2018-12-08 10:48:58 +0100
commit3763b4c6c296fa3bc467050ae50e1dc320e85039 (patch)
treee815148c1a8063e507556fc76fb11cbe2ab4cb30
parent5b7ae27fc42f114c65e444fe052c3ecdcfadbccf (diff)
downloadvala-3763b4c6c296fa3bc467050ae50e1dc320e85039.tar.gz
codegen: Always emit constants with initializer-list
generate_constant_declaration() handles both definition and declaration. This is important when using --use-header where the actual definition would never be written and we ended up with an "extern const ..." in the header only. Fixes https://gitlab.gnome.org/GNOME/vala/issues/81
-rw-r--r--codegen/valaccodebasemodule.vala4
1 files changed, 4 insertions, 0 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c4d00aba5..9012567c4 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -644,6 +644,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
if (sym.anonymous) {
return !decl_space.is_header && CodeContext.get ().use_header;
}
+ // constants with initializer-list are special
+ if (sym is Constant && ((Constant) sym).value is InitializerList) {
+ return false;
+ }
if (sym.external_package || (!decl_space.is_header && CodeContext.get ().use_header && !sym.is_internal_symbol ())) {
// add feature test macros
foreach (unowned string feature_test_macro in get_ccode_feature_test_macros (sym).split (",")) {