v.gen.c: reduce slightly the generated C lines with -skip-unused (3940 -> 3699 for hello_world.v)
parent
a706215e52
commit
820fe626e7
|
@ -1264,9 +1264,11 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
}
|
||||
}
|
||||
ast.TypeDecl {
|
||||
if !g.pref.skip_unused {
|
||||
g.writeln('// TypeDecl')
|
||||
}
|
||||
}
|
||||
}
|
||||
if !g.skip_stmt_pos { // && g.stmt_path_pos.len > 0 {
|
||||
g.stmt_path_pos.delete_last()
|
||||
}
|
||||
|
@ -1793,6 +1795,9 @@ fn ctoslit(s string) string {
|
|||
}
|
||||
|
||||
fn (mut g Gen) gen_attrs(attrs []ast.Attr) {
|
||||
if g.pref.skip_unused {
|
||||
return
|
||||
}
|
||||
for attr in attrs {
|
||||
g.writeln('// Attr: [$attr.name]')
|
||||
}
|
||||
|
|
|
@ -86,10 +86,12 @@ fn (mut g Gen) process_fn_decl(node ast.FnDecl) {
|
|||
if skip {
|
||||
g.out.go_back_to(pos)
|
||||
}
|
||||
if !g.pref.skip_unused {
|
||||
if node.language != .c {
|
||||
g.writeln('')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn (mut g Gen) gen_fn_decl(node ast.FnDecl, skip bool) {
|
||||
// TODO For some reason, build fails with autofree with this line
|
||||
|
|
Loading…
Reference in New Issue