compiler: tidy flag order
parent
570e5f968d
commit
e78e284380
|
@ -83,16 +83,6 @@ fn (v mut V) cc() {
|
|||
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 {
|
||||
a << '-fsanitize=leak'
|
||||
}
|
||||
|
@ -115,6 +105,7 @@ fn (v mut V) cc() {
|
|||
if os.dir_exists(v.out_name) {
|
||||
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 {
|
||||
a << '-x objective-c'
|
||||
}
|
||||
|
@ -127,12 +118,17 @@ fn (v mut V) cc() {
|
|||
if v.os == .mac {
|
||||
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() {
|
||||
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 << libs
|
||||
// macOS code can include objective C TODO remove once objective C is replaced with C
|
||||
// Without these libs compilation will fail on Linux
|
||||
// || os.user_os() == 'linux'
|
||||
if v.pref.build_mode != .build && (v.os == .linux || v.os == .freebsd || v.os == .openbsd ||
|
||||
|
|
|
@ -83,7 +83,8 @@ fn (table mut Table) parse_cflag(cflag string) {
|
|||
if index == -1 || (i != -1 && i < index) {
|
||||
index = i
|
||||
}
|
||||
} if index != -1 && flag[index] == ` ` && flag[index+1] == `-` {
|
||||
}
|
||||
if index != -1 && flag[index] == ` ` && flag[index+1] == `-` {
|
||||
for f in allowed_flags {
|
||||
i := index+f.len
|
||||
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()
|
||||
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()
|
||||
flag = flag.right(index+1).trim_space()
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
value = flag.trim_space()
|
||||
index = -1
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e4504fd25d7d23797ccfef336a33491c0d654129
|
Loading…
Reference in New Issue