v: add -cstrict for optionally turning on all ccoptions.wargs
parent
5ae3b81337
commit
d90be54850
|
@ -17,6 +17,10 @@ see also `v help build`.
|
|||
Can be specified multiple times to provide multiple flags.
|
||||
Use quotes to wrap the flag argument if it contains spaces.
|
||||
|
||||
-cstrict
|
||||
Turn on additional C warnings. This slows down compilation
|
||||
slightly (~10-10% for gcc), but sometimes provides better diagnosis.
|
||||
|
||||
-showcc
|
||||
Prints the C command that is used to build the program.
|
||||
|
||||
|
|
|
@ -378,14 +378,17 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
|
|||
}
|
||||
v.ccoptions = ccoptions
|
||||
// setup the cache too, so that different compilers/options do not interfere:
|
||||
v.pref.cache_manager.set_temporary_options(ccoptions.thirdparty_object_args([
|
||||
v.pref.cache_manager.set_temporary_options(v.thirdparty_object_args(v.ccoptions, [
|
||||
ccoptions.guessed_compiler,
|
||||
]))
|
||||
}
|
||||
|
||||
fn (ccoptions CcompilerOptions) all_args() []string {
|
||||
fn (v &Builder) all_args(ccoptions CcompilerOptions) []string {
|
||||
mut all := []string{}
|
||||
all << ccoptions.env_cflags
|
||||
if v.pref.is_cstrict {
|
||||
all << ccoptions.wargs
|
||||
}
|
||||
all << ccoptions.args
|
||||
all << ccoptions.o_args
|
||||
all << ccoptions.pre_args
|
||||
|
@ -396,7 +399,7 @@ fn (ccoptions CcompilerOptions) all_args() []string {
|
|||
return all
|
||||
}
|
||||
|
||||
fn (ccoptions CcompilerOptions) thirdparty_object_args(middle []string) []string {
|
||||
fn (v &Builder) thirdparty_object_args(ccoptions CcompilerOptions, middle []string) []string {
|
||||
mut all := []string{}
|
||||
all << ccoptions.env_cflags
|
||||
all << ccoptions.args
|
||||
|
@ -611,7 +614,7 @@ fn (mut v Builder) cc() {
|
|||
}
|
||||
}
|
||||
//
|
||||
all_args := v.ccoptions.all_args()
|
||||
all_args := v.all_args(v.ccoptions)
|
||||
v.dump_c_options(all_args)
|
||||
str_args := all_args.join(' ')
|
||||
// write args to response file
|
||||
|
@ -953,7 +956,7 @@ fn (mut v Builder) build_thirdparty_obj_file(path string, moduleflags []cflag.CF
|
|||
all_options << moduleflags.c_options_before_target()
|
||||
all_options << '-o "$opath"'
|
||||
all_options << '-c "$cfile"'
|
||||
cc_options := v.ccoptions.thirdparty_object_args(all_options).join(' ')
|
||||
cc_options := v.thirdparty_object_args(v.ccoptions, all_options).join(' ')
|
||||
cmd := '$v.pref.ccompiler $cc_options'
|
||||
$if trace_thirdparty_obj_files ? {
|
||||
println('>>> build_thirdparty_obj_files cmd: $cmd')
|
||||
|
|
|
@ -166,6 +166,7 @@ pub mut:
|
|||
cache_manager vcache.CacheManager
|
||||
is_help bool // -h, -help or --help was passed
|
||||
gc_mode GarbageCollectionMode = .no_gc // .no_gc, .boehm, .boehm_leak, ...
|
||||
is_cstrict bool // turn on more C warnings; slightly slower
|
||||
// checker settings:
|
||||
checker_match_exhaustive_cutoff_limit int = 10
|
||||
}
|
||||
|
@ -227,6 +228,9 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
|
|||
'-silent' {
|
||||
res.output_mode = .silent
|
||||
}
|
||||
'-cstrict' {
|
||||
res.is_cstrict = true
|
||||
}
|
||||
'-gc' {
|
||||
gc_mode := cmdline.option(current_args, '-gc', '')
|
||||
match gc_mode {
|
||||
|
|
Loading…
Reference in New Issue