v2: be silent by default
parent
2fe0e80569
commit
50143ad9bf
|
@ -322,7 +322,7 @@ pub fn (v mut V) compile2() {
|
||||||
verror('Cannot build with msvc on ${os.user_os()}')
|
verror('Cannot build with msvc on ${os.user_os()}')
|
||||||
}
|
}
|
||||||
//cgen.genln('// Generated by V')
|
//cgen.genln('// Generated by V')
|
||||||
println('compile2()')
|
//println('compile2()')
|
||||||
if v.pref.verbosity.is_higher_or_equal(.level_three) {
|
if v.pref.verbosity.is_higher_or_equal(.level_three) {
|
||||||
println('all .v files before:')
|
println('all .v files before:')
|
||||||
println(v.files)
|
println(v.files)
|
||||||
|
|
|
@ -40,12 +40,12 @@ pub fn (b mut Builder) gen_c(v_files []string) string {
|
||||||
b.parse_imports()
|
b.parse_imports()
|
||||||
t1 := time.ticks()
|
t1 := time.ticks()
|
||||||
parse_time := t1 - t0
|
parse_time := t1 - t0
|
||||||
println('PARSE: ${parse_time}ms')
|
b.info('PARSE: ${parse_time}ms')
|
||||||
//
|
//
|
||||||
b.checker.check_files(b.parsed_files)
|
b.checker.check_files(b.parsed_files)
|
||||||
t2 := time.ticks()
|
t2 := time.ticks()
|
||||||
check_time := t2 - t1
|
check_time := t2 - t1
|
||||||
println('CHECK: ${check_time}ms')
|
b.info('CHECK: ${check_time}ms')
|
||||||
if b.checker.nr_errors > 0 {
|
if b.checker.nr_errors > 0 {
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
@ -53,14 +53,14 @@ pub fn (b mut Builder) gen_c(v_files []string) string {
|
||||||
res := gen.cgen(b.parsed_files, b.table, b.pref)
|
res := gen.cgen(b.parsed_files, b.table, b.pref)
|
||||||
t3 := time.ticks()
|
t3 := time.ticks()
|
||||||
gen_time := t3 - t2
|
gen_time := t3 - t2
|
||||||
println('C GEN: ${gen_time}ms')
|
b.info('C GEN: ${gen_time}ms')
|
||||||
println('cgen done')
|
// println('cgen done')
|
||||||
// println(res)
|
// println(res)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (b mut Builder) build_c(v_files []string, out_file string) {
|
pub fn (b mut Builder) build_c(v_files []string, out_file string) {
|
||||||
println('build_c($out_file)')
|
b.info('build_c($out_file)')
|
||||||
mut f := os.create(out_file) or {
|
mut f := os.create(out_file) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -75,15 +75,15 @@ pub fn (b mut Builder) build_x64(v_files []string, out_file string) {
|
||||||
b.parse_imports()
|
b.parse_imports()
|
||||||
t1 := time.ticks()
|
t1 := time.ticks()
|
||||||
parse_time := t1 - t0
|
parse_time := t1 - t0
|
||||||
println('PARSE: ${parse_time}ms')
|
b.info('PARSE: ${parse_time}ms')
|
||||||
b.checker.check_files(b.parsed_files)
|
b.checker.check_files(b.parsed_files)
|
||||||
t2 := time.ticks()
|
t2 := time.ticks()
|
||||||
check_time := t2 - t1
|
check_time := t2 - t1
|
||||||
println('CHECK: ${check_time}ms')
|
b.info('CHECK: ${check_time}ms')
|
||||||
x64.gen(b.parsed_files, out_file)
|
x64.gen(b.parsed_files, out_file)
|
||||||
t3 := time.ticks()
|
t3 := time.ticks()
|
||||||
gen_time := t3 - t2
|
gen_time := t3 - t2
|
||||||
println('x64 GEN: ${gen_time}ms')
|
b.info('x64 GEN: ${gen_time}ms')
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse all deps from already parsed files
|
// parse all deps from already parsed files
|
||||||
|
@ -197,6 +197,12 @@ pub fn (b &Builder) log(s string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn (b &Builder) info(s string) {
|
||||||
|
if b.pref.verbosity.is_higher_or_equal(.level_one) {
|
||||||
|
println(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[inline]
|
[inline]
|
||||||
fn module_path(mod string) string {
|
fn module_path(mod string) string {
|
||||||
// submodule support
|
// submodule support
|
||||||
|
|
|
@ -1974,7 +1974,7 @@ fn (g mut Gen) write_init_function() {
|
||||||
g.writeln('}')
|
g.writeln('}')
|
||||||
if g.autofree {
|
if g.autofree {
|
||||||
g.writeln('void _vcleanup() {')
|
g.writeln('void _vcleanup() {')
|
||||||
g.writeln('puts("cleaning up...");')
|
//g.writeln('puts("cleaning up...");')
|
||||||
if g.is_importing_os() {
|
if g.is_importing_os() {
|
||||||
g.writeln('free(_const_os__args.data);')
|
g.writeln('free(_const_os__args.data);')
|
||||||
g.writeln('string_free(_const_os__wd_at_startup);')
|
g.writeln('string_free(_const_os__wd_at_startup);')
|
||||||
|
@ -2612,6 +2612,7 @@ pub fn (g mut Gen) write_tests_main() {
|
||||||
g.writeln('\tBenchedTests bt = start_testing(${all_tfuncs.len}, tos3("$g.pref.path"));')
|
g.writeln('\tBenchedTests bt = start_testing(${all_tfuncs.len}, tos3("$g.pref.path"));')
|
||||||
}
|
}
|
||||||
for t in all_tfuncs {
|
for t in all_tfuncs {
|
||||||
|
g.writeln('')
|
||||||
if g.pref.is_stats {
|
if g.pref.is_stats {
|
||||||
g.writeln('\tBenchedTests_testing_step_start(&bt, tos3("$t"));')
|
g.writeln('\tBenchedTests_testing_step_start(&bt, tos3("$t"));')
|
||||||
}
|
}
|
||||||
|
@ -2620,6 +2621,7 @@ pub fn (g mut Gen) write_tests_main() {
|
||||||
g.writeln('\tBenchedTests_testing_step_end(&bt);')
|
g.writeln('\tBenchedTests_testing_step_end(&bt);')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g.writeln('')
|
||||||
if g.pref.is_stats {
|
if g.pref.is_stats {
|
||||||
g.writeln('\tBenchedTests_end_testing(&bt);')
|
g.writeln('\tBenchedTests_end_testing(&bt);')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ fn (p mut Parser) for_statement() ast.Stmt {
|
||||||
// for i := 0; i < 10; i++ {
|
// for i := 0; i < 10; i++ {
|
||||||
else if p.peek_tok.kind in [.decl_assign, .assign, .semicolon] || p.tok.kind == .semicolon {
|
else if p.peek_tok.kind in [.decl_assign, .assign, .semicolon] || p.tok.kind == .semicolon {
|
||||||
mut init := ast.Stmt{}
|
mut init := ast.Stmt{}
|
||||||
mut cond := ast.Expr{}
|
mut cond := p.new_true_expr()
|
||||||
// mut inc := ast.Stmt{}
|
// mut inc := ast.Stmt{}
|
||||||
mut inc := ast.Expr{}
|
mut inc := ast.Expr{}
|
||||||
mut has_init := false
|
mut has_init := false
|
||||||
|
@ -1702,7 +1702,7 @@ fn (p mut Parser) global_decl() ast.GlobalDecl {
|
||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
name := p.check_name()
|
name := p.check_name()
|
||||||
println(name)
|
// println(name)
|
||||||
typ := p.parse_type()
|
typ := p.parse_type()
|
||||||
if p.tok.kind == .assign {
|
if p.tok.kind == .assign {
|
||||||
p.next()
|
p.next()
|
||||||
|
@ -1904,3 +1904,7 @@ fn verror(s string) {
|
||||||
println(s)
|
println(s)
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn (p &Parser) new_true_expr() ast.Expr {
|
||||||
|
return ast.BoolLiteral{ val: true }
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue