mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: remove special case for malloc
This commit is contained in:
parent
d98bb44490
commit
7aff0cb84f
@ -12,8 +12,7 @@ const (
|
|||||||
c_reserved = ['delete', 'exit', 'unix',
|
c_reserved = ['delete', 'exit', 'unix',
|
||||||
// 'print',
|
// 'print',
|
||||||
// 'ok',
|
// 'ok',
|
||||||
'error', 'calloc', 'free', 'panic',
|
'error', 'calloc', 'malloc', 'free', 'panic',
|
||||||
// 'malloc',
|
|
||||||
// Full list of C reserved words, from: https://en.cppreference.com/w/c/keyword
|
// Full list of C reserved words, from: https://en.cppreference.com/w/c/keyword
|
||||||
'auto', 'char', 'default', 'do', 'double', 'extern', 'float', 'inline', 'int', 'long', 'register', 'restrict', 'short', 'signed', 'sizeof', 'static', 'switch', 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while', ]
|
'auto', 'char', 'default', 'do', 'double', 'extern', 'float', 'inline', 'int', 'long', 'register', 'restrict', 'short', 'signed', 'sizeof', 'static', 'switch', 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while', ]
|
||||||
)
|
)
|
||||||
@ -589,7 +588,7 @@ fn (g mut Gen) gen_assign_stmt(assign_stmt ast.AssignStmt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn (g mut Gen) gen_fn_decl(it ast.FnDecl) {
|
fn (g mut Gen) gen_fn_decl(it ast.FnDecl) {
|
||||||
if it.is_c || it.name == 'malloc' {
|
if it.is_c {
|
||||||
// || it.no_body {
|
// || it.no_body {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2122,6 +2121,9 @@ fn comp_if_to_ifdef(name string) string {
|
|||||||
'glibc' {
|
'glibc' {
|
||||||
return '__GLIBC__'
|
return '__GLIBC__'
|
||||||
}
|
}
|
||||||
|
'prealloc' {
|
||||||
|
return 'VPREALLOC'
|
||||||
|
}
|
||||||
'no_bounds_checking' {
|
'no_bounds_checking' {
|
||||||
return 'NO_BOUNDS_CHECK'
|
return 'NO_BOUNDS_CHECK'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user