1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: minor fixes. v2 can now compile itself!

This commit is contained in:
Alexander Medvednikov 2020-03-22 16:55:42 +01:00
parent 99de98ffc7
commit b69ebd73b2
2 changed files with 5 additions and 3 deletions

View File

@ -210,7 +210,7 @@ pub fn exec(cmd string) ?Result {
res.write_bytes( buf, vstrlen(buf) )
}
soutput := res.str().trim_space()
res.free()
//res.free()
exit_code := vpclose(f)
// if exit_code != 0 {
// return error(res)

View File

@ -54,7 +54,9 @@ pub fn cgen(files []ast.File, table &table.Table) string {
for file in files {
g.file = file
// println('\ncgen "$g.file.path" nr_stmts=$file.stmts.len')
if g.file.path == '' || g.file.path.ends_with('.vv') || g.file.path.contains('/vlib/') {
building_v := g.file.path.contains('/vlib/') || g.file.path.contains('cmd/v')
is_test := g.file.path.ends_with('.vv')
if g.file.path == '' || is_test || building_v {
// cgen test or building V
// println('autofree=false')
g.autofree = false
@ -100,7 +102,7 @@ pub fn (g mut Gen) typ(t table.Type) string {
if styp.starts_with('C__') {
styp = styp[3..]
}
if styp in ['stat', 'dirent*', 'tm', 'tm*', 'winsize', 'sigaction'] {
if styp in ['stat', 'dirent*', 'tm', 'tm*', 'winsize', 'sigaction', 'timeval'] {
// TODO perf and other C structs
styp = 'struct $styp'
}