From 3b2083801bf300e27b6a911be87e889dec5c34eb Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sun, 20 Dec 2020 22:03:27 +1100 Subject: [PATCH] cgen: fix module builds when -usecache is on by default --- vlib/v/gen/cgen.v | 2 +- vlib/v/gen/fn.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index c63e1d8a7c..295b5d6d55 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -969,7 +969,7 @@ fn (mut g Gen) stmt(node ast.Stmt) { println('build module `$g.module_built` fn `$node.name`') } } - if g.pref.use_cache { + if g.pref.use_cache && g.pref.build_mode != .build_module { // We are using prebuilt modules, we do not need to generate // their functions in main.c. if node.mod != 'main' && node.mod != 'help' && !should_bundle_module { diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index a20b505320..5ce79084a0 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -113,7 +113,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) { arg_start_pos := g.out.len fargs, fargtypes := g.fn_args(it.params, it.is_variadic) arg_str := g.out.after(arg_start_pos) - if it.no_body || (g.pref.use_cache && it.is_builtin) || skip { + if it.no_body || ((g.pref.use_cache && g.pref.build_mode != .build_module) && it.is_builtin) || skip { // Just a function header. Builtin function bodies are defined in builtin.o g.definitions.writeln(');') // // NO BODY') g.writeln(');')