[vala/0.42] codegen: Always emit constants with initializer-list
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] codegen: Always emit constants with initializer-list
- Date: Tue, 18 Dec 2018 09:32:12 +0000 (UTC)
commit 9a63389970781da557a37073c3ac31b6e30f5cde
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Dec 8 10:41:50 2018 +0100
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
codegen/valaccodebasemodule.vala | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 14c9286d5..b7a8e94d3 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -629,6 +629,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 (",")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]