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

cgen: use *char in all functions with *char args to avoid warnings

This commit is contained in:
Alexander Medvednikov
2019-09-15 15:57:17 +03:00
parent 35f927e64e
commit 48c05b5a45
4 changed files with 35 additions and 27 deletions

View File

@@ -746,14 +746,17 @@ fn (p mut Parser) fn_args(f mut Fn) {
// foo *(1, 2, 3, mut bar)*
fn (p mut Parser) fn_call_args(f mut Fn) &Fn {
// p.gen('(')
// println('fn_call_args() name=$f.name args.len=$f.args.len')
// C func. # of args is not known
// if f.name.starts_with('c_') {
p.check(.lpar)
if f.is_c {
for p.tok != .rpar {
p.bool_expression()
ph := p.cgen.add_placeholder()
typ := p.bool_expression()
// Cast V byteptr to C char* (byte is unsigned in V, that led to C warnings)
if typ == 'byte*' {
p.cgen.set_placeholder(ph, '(char*)')
}
if p.tok == .comma {
p.gen(', ')
p.check(.comma)