mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fix 3 last C warnings and make sure no new warnings are introduced
This commit is contained in:
parent
ac7824b669
commit
f45d3f07ed
@ -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('}')
|
||||
|
@ -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(' ')
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user