From: Rico Tzschichholz Date: Tue, 14 Jun 2022 13:31:17 +0000 (+0200) Subject: codegen: Make sure to initialize static collections X-Git-Tag: 0.56.2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b98d970f52c7094c70cd65c8c9624e6b7a85bfc3;p=thirdparty%2Fvala.git codegen: Make sure to initialize static collections --- diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala index 25a0d11af..30d196b9e 100644 --- a/codegen/valaccode.vala +++ b/codegen/valaccode.vala @@ -26,6 +26,9 @@ namespace Vala { static unowned CCodeAttribute get_ccode_attribute (CodeNode node) { if (ccode_attribute_cache_index == null) { ccode_attribute_cache_index = CodeNode.get_attribute_cache_index (); + + // make sure static collections are initialized + CCodeBaseModule.init (); } unowned AttributeCache? attr = node.get_attribute_cache (ccode_attribute_cache_index); diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 121344373..c30f0dae9 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -405,6 +405,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { predefined_marshal_set.add ("VOID:VARIANT"); predefined_marshal_set.add ("BOOLEAN:BOXED,BOXED"); + init (); + } + + public static void init () { + if (reserved_identifiers != null) { + return; + } + reserved_identifiers = new HashSet (str_hash, str_equal); // C99 keywords