mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
hotreload: fix compilation of .so file on macos
This commit is contained in:
10
cmd/v/flag.v
10
cmd/v/flag.v
@ -9,8 +9,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
list_of_flags_that_allow_duplicates = ['cc','d','define','cf','cflags']
|
||||
//list_of_flags contains a list of flags where an argument is expected past it.
|
||||
list_of_flags = [
|
||||
list_of_flags_with_param = [
|
||||
'o', 'output', 'd', 'define', 'b', 'backend', 'cc', 'os', 'target-os', 'arch',
|
||||
'csource', 'cf', 'cflags', 'path'
|
||||
]
|
||||
@ -85,8 +86,11 @@ fn parse_flags(flag string, f mut flag.Instance, prefs mut flag.MainCmdPreferenc
|
||||
exit(1)
|
||||
}
|
||||
else {
|
||||
prefs.unknown_flag = '-$flag'
|
||||
if !(flag in list_of_flags) {
|
||||
if flag in list_of_flags_that_allow_duplicates {
|
||||
f.allow_duplicate()
|
||||
}
|
||||
prefs.unknown_flag = '-$flag'
|
||||
if !(flag in list_of_flags_with_param) {
|
||||
return
|
||||
}
|
||||
f.string() or {
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
v.pref
|
||||
)
|
||||
|
||||
[inline]
|
||||
fn parse_c_options(flag string, f mut flag.Instance, prefs mut pref.Preferences) {
|
||||
match flag {
|
||||
'cc', 'compiler' {
|
||||
@ -23,6 +22,8 @@ fn parse_c_options(flag string, f mut flag.Instance, prefs mut pref.Preferences)
|
||||
exit(1)
|
||||
}
|
||||
prefs.ccompiler = tmp
|
||||
// needed to enable CI compiling of -live examples.
|
||||
f.allow_duplicate()
|
||||
}
|
||||
'cg', 'cdebug' {
|
||||
f.is_equivalent_to(['cg', 'cdebug', 'g', 'debug'])
|
||||
|
@ -32,6 +32,8 @@ fn parse_arguments(args []string) (pref.Preferences, []string) {
|
||||
mut remaining := flag.parse_pref(args, parse_options, &p) or {
|
||||
println('V error: Error while parsing flags.')
|
||||
println(err)
|
||||
println('Args:')
|
||||
println(args)
|
||||
exit(1)
|
||||
}
|
||||
match remaining[0] {
|
||||
|
@ -16,8 +16,7 @@ pub fn parse_pref(args []string, callback fn(string, &Instance, &pref.Preference
|
||||
args: args
|
||||
current_pos: 0
|
||||
}
|
||||
casted_callback := *(&void_cb(&callback))
|
||||
tmp := p.parse_impl(args, voidptr(obj), casted_callback) or {
|
||||
tmp := p.parse_impl(args, voidptr(obj), void_cb(callback)) or {
|
||||
return error(err)
|
||||
}
|
||||
return tmp
|
||||
@ -41,8 +40,7 @@ pub fn parse_main_cmd(args []string, callback fn(string, &Instance, &MainCmdPref
|
||||
args: args
|
||||
current_pos: 0
|
||||
}
|
||||
casted_callback := *(&void_cb(&callback))
|
||||
tmp := p.parse_impl(args, voidptr(obj), casted_callback) or {
|
||||
tmp := p.parse_impl(args, voidptr(obj), void_cb(callback)) or {
|
||||
return error(err)
|
||||
}
|
||||
return tmp
|
||||
|
Reference in New Issue
Block a user