v2: be silent by default

pull/4170/head
Delyan Angelov 2020-03-31 20:58:44 +03:00 committed by GitHub
parent 2fe0e80569
commit 50143ad9bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 12 deletions

View File

@ -322,7 +322,7 @@ pub fn (v mut V) compile2() {
verror('Cannot build with msvc on ${os.user_os()}')
}
//cgen.genln('// Generated by V')
println('compile2()')
//println('compile2()')
if v.pref.verbosity.is_higher_or_equal(.level_three) {
println('all .v files before:')
println(v.files)

View File

@ -40,12 +40,12 @@ pub fn (b mut Builder) gen_c(v_files []string) string {
b.parse_imports()
t1 := time.ticks()
parse_time := t1 - t0
println('PARSE: ${parse_time}ms')
b.info('PARSE: ${parse_time}ms')
//
b.checker.check_files(b.parsed_files)
t2 := time.ticks()
check_time := t2 - t1
println('CHECK: ${check_time}ms')
b.info('CHECK: ${check_time}ms')
if b.checker.nr_errors > 0 {
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)
t3 := time.ticks()
gen_time := t3 - t2
println('C GEN: ${gen_time}ms')
println('cgen done')
b.info('C GEN: ${gen_time}ms')
// println('cgen done')
// println(res)
return res
}
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 {
panic(err)
}
@ -75,15 +75,15 @@ pub fn (b mut Builder) build_x64(v_files []string, out_file string) {
b.parse_imports()
t1 := time.ticks()
parse_time := t1 - t0
println('PARSE: ${parse_time}ms')
b.info('PARSE: ${parse_time}ms')
b.checker.check_files(b.parsed_files)
t2 := time.ticks()
check_time := t2 - t1
println('CHECK: ${check_time}ms')
b.info('CHECK: ${check_time}ms')
x64.gen(b.parsed_files, out_file)
t3 := time.ticks()
gen_time := t3 - t2
println('x64 GEN: ${gen_time}ms')
b.info('x64 GEN: ${gen_time}ms')
}
// 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]
fn module_path(mod string) string {
// submodule support

View File

@ -1974,7 +1974,7 @@ fn (g mut Gen) write_init_function() {
g.writeln('}')
if g.autofree {
g.writeln('void _vcleanup() {')
g.writeln('puts("cleaning up...");')
//g.writeln('puts("cleaning up...");')
if g.is_importing_os() {
g.writeln('free(_const_os__args.data);')
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"));')
}
for t in all_tfuncs {
g.writeln('')
if g.pref.is_stats {
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('')
if g.pref.is_stats {
g.writeln('\tBenchedTests_end_testing(&bt);')
}

View File

@ -1095,7 +1095,7 @@ fn (p mut Parser) for_statement() ast.Stmt {
// for i := 0; i < 10; i++ {
else if p.peek_tok.kind in [.decl_assign, .assign, .semicolon] || p.tok.kind == .semicolon {
mut init := ast.Stmt{}
mut cond := ast.Expr{}
mut cond := p.new_true_expr()
// mut inc := ast.Stmt{}
mut inc := ast.Expr{}
mut has_init := false
@ -1702,7 +1702,7 @@ fn (p mut Parser) global_decl() ast.GlobalDecl {
}
p.next()
name := p.check_name()
println(name)
// println(name)
typ := p.parse_type()
if p.tok.kind == .assign {
p.next()
@ -1904,3 +1904,7 @@ fn verror(s string) {
println(s)
exit(1)
}
fn (p &Parser) new_true_expr() ast.Expr {
return ast.BoolLiteral{ val: true }
}