mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast: improve the support for #flag comptime_known_define something
(support #flag wasm32_emscripten etc
)
This commit is contained in:
parent
d2e5c721a0
commit
86f8c55107
@ -4,6 +4,7 @@
|
||||
module ast
|
||||
|
||||
import v.cflag
|
||||
import v.checker.constants
|
||||
|
||||
// check if cflag is in table
|
||||
pub fn (t &Table) has_cflag(flag cflag.CFlag) bool {
|
||||
@ -25,8 +26,8 @@ pub fn (mut t Table) parse_cflag(cflg string, mod string, ctimedefines []string)
|
||||
return error('flag is empty')
|
||||
}
|
||||
mut fos := ''
|
||||
mut allowed_os_overrides := ['linux', 'darwin', 'freebsd', 'openbsd', 'windows', 'mingw',
|
||||
'solaris', 'android', 'termux']
|
||||
mut allowed_os_overrides := []string{}
|
||||
allowed_os_overrides << constants.valid_comptime_not_user_defined
|
||||
allowed_os_overrides << ctimedefines
|
||||
for os_override in allowed_os_overrides {
|
||||
if !flag.starts_with(os_override) {
|
||||
|
@ -10,7 +10,7 @@ pub const (
|
||||
valid_comptime_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian']
|
||||
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_emscripten']
|
||||
'interpreter', 'es5', 'profile', 'wasm32', 'wasm32_emscripten', 'wasm32_wasi']
|
||||
valid_comptime_not_user_defined = all_valid_comptime_idents()
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user