From dd27d0a2a38101de01e663ceb3663feecc7feaf2 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Tue, 22 Dec 2020 19:21:05 +1100 Subject: [PATCH] cgen/builder: make unused-command-line-argument a warning & cgen module_built fix --- vlib/v/builder/cc.v | 2 +- vlib/v/gen/cgen.v | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 5e7b4b1296..7967429a48 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -194,7 +194,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { '-Wcast-qual', '-Wdate-time', '-Wduplicated-branches', '-Wduplicated-cond', '-Wformat=2', '-Winit-self', '-Winvalid-pch', '-Wjump-misses-init', '-Wlogical-op', '-Wmultichar', '-Wnested-externs', '-Wnull-dereference', '-Wpacked', '-Wpointer-arith', '-Wshadow', '-Wswitch-default', '-Wswitch-enum', '-Wno-unused-parameter', - '-Wno-unknown-warning-option', '-Wno-format-nonliteral'] + '-Wno-unknown-warning-option', '-Wno-format-nonliteral', '-Wno-unused-command-line-argument'] if v.pref.os == .ios { ccoptions.args << '-framework Foundation' ccoptions.args << '-framework UIKit' diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 82708505d0..d5885f75c9 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -144,12 +144,12 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string if pref.build_mode == .build_module { // TODO: detect this properly for all cases // either get if from an earlier stage or use the lookup paths - if pref.path.contains('vlib' + os.path_separator) { - module_built = pref.path.after('vlib' + os.path_separator).replace(os.path_separator, - '.') - } else if pref.path.contains('.vmodules' + os.path_separator) { - module_built = pref.path.after('.vmodules' + os.path_separator).replace(os.path_separator, - '.') + for dir_name in ['vlib', '.vmodules', 'modules'] { + if pref.path.contains(dir_name + os.path_separator) { + module_built = pref.path.after(dir_name + os.path_separator).replace(os.path_separator, + '.') + break + } } } mut timers_should_print := false