mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
v.pref: support a -n
option, silencing only notices (#20331)
This commit is contained in:
parent
763f94388b
commit
ae82b67ef5
3 changed files with 18 additions and 8 deletions
|
@ -497,8 +497,8 @@ pub fn (mut b Builder) print_warnings_and_errors() {
|
|||
}
|
||||
|
||||
if b.pref.check_only {
|
||||
for file in b.parsed_files {
|
||||
if !b.pref.skip_warnings {
|
||||
if !b.pref.skip_notes {
|
||||
for file in b.parsed_files {
|
||||
for err in file.notices {
|
||||
kind := if b.pref.is_verbose {
|
||||
'${err.reporter} notice #${b.nr_notices}:'
|
||||
|
@ -521,8 +521,8 @@ pub fn (mut b Builder) print_warnings_and_errors() {
|
|||
}
|
||||
}
|
||||
|
||||
for file in b.parsed_files {
|
||||
if !b.pref.skip_warnings {
|
||||
if !b.pref.skip_warnings {
|
||||
for file in b.parsed_files {
|
||||
for err in file.warnings {
|
||||
kind := if b.pref.is_verbose {
|
||||
'${err.reporter} warning #${b.nr_warnings}:'
|
||||
|
@ -547,7 +547,7 @@ pub fn (mut b Builder) print_warnings_and_errors() {
|
|||
if b.pref.is_verbose && b.checker.nr_notices > 1 {
|
||||
println('${b.checker.nr_notices} notices')
|
||||
}
|
||||
if b.checker.nr_notices > 0 && !b.pref.skip_warnings {
|
||||
if b.checker.nr_notices > 0 && !b.pref.skip_notes {
|
||||
for err in b.checker.notices {
|
||||
kind := if b.pref.is_verbose {
|
||||
'${err.reporter} notice #${b.checker.nr_notices}:'
|
||||
|
|
|
@ -214,6 +214,12 @@ NB: the build flags are shared with the run command too:
|
|||
The instrumented version will print detailed timing stats while processing
|
||||
each .v file.
|
||||
|
||||
-n
|
||||
Hide all notices.
|
||||
|
||||
-N
|
||||
Treat *all V notices* as errors.
|
||||
|
||||
-w
|
||||
Hide all warnings.
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ pub mut:
|
|||
//
|
||||
skip_running bool // when true, do no try to run the produced file (set by b.cc(), when -o x.c or -o x.js)
|
||||
skip_warnings bool // like C's "-w", forces warnings to be ignored.
|
||||
skip_notes bool // force notices to be ignored/not shown.
|
||||
warn_impure_v bool // -Wimpure-v, force a warning for JS.fn()/C.fn(), outside of .js.v/.c.v files. TODO: turn to an error by default
|
||||
warns_are_errors bool // -W, like C's "-Werror", treat *every* warning is an error
|
||||
notes_are_errors bool // -N, treat *every* notice as an error
|
||||
|
@ -720,9 +721,15 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
|
|||
'-W' {
|
||||
res.warns_are_errors = true
|
||||
}
|
||||
'-w' {
|
||||
res.skip_warnings = true
|
||||
}
|
||||
'-N' {
|
||||
res.notes_are_errors = true
|
||||
}
|
||||
'-n' {
|
||||
res.skip_notes = true
|
||||
}
|
||||
'-no-rsp' {
|
||||
res.no_rsp = true
|
||||
}
|
||||
|
@ -732,9 +739,6 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
|
|||
'-keepc' {
|
||||
res.reuse_tmpc = true
|
||||
}
|
||||
'-w' {
|
||||
res.skip_warnings = true
|
||||
}
|
||||
'-watch' {
|
||||
eprintln_exit('The -watch option is deprecated. Please use the watch command `v watch file.v` instead.')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue