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:
@@ -4,6 +4,7 @@
|
|||||||
module ast
|
module ast
|
||||||
|
|
||||||
import v.cflag
|
import v.cflag
|
||||||
|
import v.checker.constants
|
||||||
|
|
||||||
// check if cflag is in table
|
// check if cflag is in table
|
||||||
pub fn (t &Table) has_cflag(flag cflag.CFlag) bool {
|
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')
|
return error('flag is empty')
|
||||||
}
|
}
|
||||||
mut fos := ''
|
mut fos := ''
|
||||||
mut allowed_os_overrides := ['linux', 'darwin', 'freebsd', 'openbsd', 'windows', 'mingw',
|
mut allowed_os_overrides := []string{}
|
||||||
'solaris', 'android', 'termux']
|
allowed_os_overrides << constants.valid_comptime_not_user_defined
|
||||||
allowed_os_overrides << ctimedefines
|
allowed_os_overrides << ctimedefines
|
||||||
for os_override in allowed_os_overrides {
|
for os_override in allowed_os_overrides {
|
||||||
if !flag.starts_with(os_override) {
|
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_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian']
|
||||||
valid_comptime_if_other = ['apk', 'js', 'debug', 'prod', 'test', 'glibc', 'prealloc',
|
valid_comptime_if_other = ['apk', 'js', 'debug', 'prod', 'test', 'glibc', 'prealloc',
|
||||||
'no_bounds_checking', 'freestanding', 'threads', 'js_node', 'js_browser', 'js_freestanding',
|
'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()
|
valid_comptime_not_user_defined = all_valid_comptime_idents()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user