fix 3 last C warnings and make sure no new warnings are introduced

pull/2222/head
Alexander Medvednikov 2019-10-04 05:40:08 +03:00
parent ac7824b669
commit f45d3f07ed
4 changed files with 16 additions and 3 deletions

View File

@ -277,7 +277,7 @@ fn (p mut Parser) gen_struct_str(typ Type) {
sb.writeln('fn (a $typ.name) str() string {\nreturn')
sb.writeln("'{")
for field in typ.fields {
sb.writeln('\t$field.name: \$a.${field.name}')
sb.writeln('\t$field.name: $' + 'a.${field.name}')
}
sb.writeln("\n}'")
sb.writeln('}')

View File

@ -1078,6 +1078,19 @@ fn (v &V) test_v() {
println('vlib/ is missing, it must be next to the V executable')
exit(1)
}
if !os.dir_exists(parent_dir + '/compiler') {
println('compiler/ is missing, it must be next to the V executable')
exit(1)
}
// Make sure v.c can be compiled without warnings
$if mac {
os.system('$vexe -o v.c compiler')
if os.system('cc -Werror v.c') != 0 {
println('cc failed to build v.c without warnings')
exit(1)
}
println('v.c can be compiled without warnings. This is good :)')
}
// Emily: pass args from the invocation to the test
// e.g. `v -g -os msvc test v` -> `$vexe -g -os msvc $file`
mut joined_args := args.right(1).join(' ')

View File

@ -252,7 +252,7 @@ pub fn (n i64) hex() string {
19
}
hex := malloc(len)
count := int(C.sprintf(*char(hex), '0x%lx', n))
count := int(C.sprintf(*char(hex), '0x%llx', n))
return tos(hex, count)
}

View File

@ -38,7 +38,7 @@ struct C.tm {
tm_sec int
}
fn C.time(int) i64
fn C.time(int) C.time_t
pub fn now() Time {
t := C.time(0)