mirror of
https://github.com/vlang/v.git
synced 2025-09-13 17:36:52 -04:00
cgen: add autofree
comptime check (#21197)
This commit is contained in:
parent
01a94483bc
commit
d692d884e3
@ -10,7 +10,7 @@ pub const valid_comptime_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_
|
||||
pub const valid_comptime_if_other = ['apk', 'js', 'debug', 'prod', 'test', 'glibc', 'prealloc',
|
||||
'no_bounds_checking', 'freestanding', 'threads', 'js_node', 'js_browser', 'js_freestanding',
|
||||
'interpreter', 'es5', 'profile', 'wasm32', 'wasm32_emscripten', 'wasm32_wasi', 'fast_math',
|
||||
'native']
|
||||
'native', 'autofree']
|
||||
pub const valid_comptime_not_user_defined = all_valid_comptime_idents()
|
||||
pub const valid_comptime_compression_types = ['none', 'zlib']
|
||||
|
||||
|
@ -919,6 +919,9 @@ fn (mut c Checker) comptime_if_branch(mut cond ast.Expr, pos token.Pos) Comptime
|
||||
'no_bounds_checking' {
|
||||
return if cname in c.pref.compile_defines_all { .eval } else { .skip }
|
||||
}
|
||||
'autofree' {
|
||||
return if c.pref.autofree { .eval } else { .skip }
|
||||
}
|
||||
'freestanding' {
|
||||
return if c.pref.is_bare && !c.pref.output_cross_c { .eval } else { .skip }
|
||||
}
|
||||
|
@ -1098,6 +1098,9 @@ fn (mut g Gen) comptime_if_to_ifdef(name string, is_comptime_option bool) !strin
|
||||
'freestanding' {
|
||||
return '_VFREESTANDING'
|
||||
}
|
||||
'autofree' {
|
||||
return '_VAUTOFREE'
|
||||
}
|
||||
// architectures:
|
||||
'amd64' {
|
||||
return '__V_amd64'
|
||||
|
@ -286,6 +286,9 @@ fn (mut g JsGen) comptime_if_to_ifdef(name string, is_comptime_option bool) !str
|
||||
'freestanding' {
|
||||
return '_VFREESTANDING'
|
||||
}
|
||||
'autofree' {
|
||||
return '_VAUTOFREE'
|
||||
}
|
||||
// architectures:
|
||||
'amd64' {
|
||||
return '(\$process.arch == "x64")'
|
||||
|
Loading…
x
Reference in New Issue
Block a user