1
0
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:
Delyan Angelov
2020-03-19 15:50:37 +02:00
committed by GitHub
parent dd96421a9f
commit 0fbb056ac7
6 changed files with 57 additions and 44 deletions

View File

@ -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 {

View File

@ -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'])

View File

@ -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] {

View File

@ -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