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

gen: fixes C warnings by appending U after unsigned integer literals (#6384)

This commit is contained in:
Daniel Däschle 2020-09-16 14:50:41 +02:00 committed by GitHub
parent 5da698b4bf
commit 3a795e6d9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1963,6 +1963,10 @@ fn (mut g Gen) expr(node ast.Expr) {
// } // }
// g.write(')(') // g.write(')(')
g.expr(node.expr) g.expr(node.expr)
if node.expr is ast.IntegerLiteral &&
node.typ in [table.u64_type, table.u32_type, table.u16_type] {
g.write('U')
}
g.write('))') g.write('))')
} }
} }