1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: tidy flag order

This commit is contained in:
joe-conigliaro 2019-09-08 02:19:17 +10:00 committed by Alexander Medvednikov
parent 570e5f968d
commit e78e284380
3 changed files with 15 additions and 15 deletions

View File

@ -83,16 +83,6 @@ fn (v mut V) cc() {
libs += ' "$ModPath/vlib/${imp}.o"' libs += ' "$ModPath/vlib/${imp}.o"'
} }
} }
// -I flags
/*
mut args := ''
for flag in v.get_os_cflags() {
if !flag.starts_with('-l') {
args += flag.value
args += ' '
}
}
*/
if v.pref.sanitize { if v.pref.sanitize {
a << '-fsanitize=leak' a << '-fsanitize=leak'
} }
@ -115,6 +105,7 @@ fn (v mut V) cc() {
if os.dir_exists(v.out_name) { if os.dir_exists(v.out_name) {
cerror('\'$v.out_name\' is a directory') cerror('\'$v.out_name\' is a directory')
} }
// macOS code can include objective C TODO remove once objective C is replaced with C
if v.os == .mac { if v.os == .mac {
a << '-x objective-c' a << '-x objective-c'
} }
@ -127,12 +118,17 @@ fn (v mut V) cc() {
if v.os == .mac { if v.os == .mac {
a << '-mmacosx-version-min=10.7' a << '-mmacosx-version-min=10.7'
} }
// add all flags // add all flags (-I -l -L etc) not .o files
for flag in v.get_os_cflags() { for flag in v.get_os_cflags() {
if flag.value.ends_with('.o') { continue }
a << flag.format()
}
// add .o files
for flag in v.get_os_cflags() {
if !flag.value.ends_with('.o') { continue }
a << flag.format() a << flag.format()
} }
a << libs a << libs
// macOS code can include objective C TODO remove once objective C is replaced with C
// Without these libs compilation will fail on Linux // Without these libs compilation will fail on Linux
// || os.user_os() == 'linux' // || os.user_os() == 'linux'
if v.pref.build_mode != .build && (v.os == .linux || v.os == .freebsd || v.os == .openbsd || if v.pref.build_mode != .build && (v.os == .linux || v.os == .freebsd || v.os == .openbsd ||

View File

@ -83,7 +83,8 @@ fn (table mut Table) parse_cflag(cflag string) {
if index == -1 || (i != -1 && i < index) { if index == -1 || (i != -1 && i < index) {
index = i index = i
} }
} if index != -1 && flag[index] == ` ` && flag[index+1] == `-` { }
if index != -1 && flag[index] == ` ` && flag[index+1] == `-` {
for f in allowed_flags { for f in allowed_flags {
i := index+f.len i := index+f.len
if i < flag.len && f == flag.substr(index, i) { if i < flag.len && f == flag.substr(index, i) {
@ -93,10 +94,12 @@ fn (table mut Table) parse_cflag(cflag string) {
} }
value = flag.left(index).trim_space() value = flag.left(index).trim_space()
flag = flag.right(index).trim_space() flag = flag.right(index).trim_space()
} else if index != -1 && index < flag.len-2 && flag[index] == `,` { }
else if index != -1 && index < flag.len-2 && flag[index] == `,` {
value = flag.left(index).trim_space() value = flag.left(index).trim_space()
flag = flag.right(index+1).trim_space() flag = flag.right(index+1).trim_space()
} else { }
else {
value = flag.trim_space() value = flag.trim_space()
index = -1 index = -1
} }

1
thirdparty/freetype vendored Submodule

@ -0,0 +1 @@
Subproject commit e4504fd25d7d23797ccfef336a33491c0d654129