From 1e121d36a46c9b8692b74e86353efa559d5ddc15 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sat, 12 Oct 2019 17:53:42 +1100 Subject: [PATCH] compiler: module cache. const init - fix implicit declaration of function warning (#2303) compiler: module cache. const init - fix implicit declaration of function warning (#2303) --- compiler/main.v | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/main.v b/compiler/main.v index 18aa5613a2..4db131aa69 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -350,10 +350,6 @@ fn (v mut V) compile() { // All definitions mut def := strings.new_builder(10000)// Avoid unnecessary allocations - if v.pref.build_mode == .build_module { - init_fn_name := v.mod.replace('.', '__') + '__init_consts' - def.writeln('void $init_fn_name();') - } $if !js { def.writeln(cgen.includes.join_lines()) def.writeln(cgen.typedefs.join_lines()) @@ -401,6 +397,7 @@ fn (v mut V) generate_init() { mut call_mod_init := '' mut call_mod_init_consts := '' if 'builtin' in v.cached_mods { + v.cgen.genln('void builtin__init_consts();') call_mod_init_consts += 'builtin__init_consts();\n' } for mod in v.table.imports { @@ -409,6 +406,7 @@ fn (v mut V) generate_init() { call_mod_init += '${init_fn_name}();\n' } if mod in v.cached_mods { + v.cgen.genln('void ${init_fn_name}_consts();') call_mod_init_consts += '${init_fn_name}_consts();\n' } }