From e78e284380c8e2a9958a28b836114dd315b99ced Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sun, 8 Sep 2019 02:19:17 +1000 Subject: [PATCH] compiler: tidy flag order --- compiler/cc.v | 20 ++++++++------------ compiler/cflags.v | 9 ++++++--- thirdparty/freetype | 1 + 3 files changed, 15 insertions(+), 15 deletions(-) create mode 160000 thirdparty/freetype diff --git a/compiler/cc.v b/compiler/cc.v index ffd6a2166f..98398c2d91 100644 --- a/compiler/cc.v +++ b/compiler/cc.v @@ -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 || diff --git a/compiler/cflags.v b/compiler/cflags.v index 2b50876f44..fd7490a98f 100644 --- a/compiler/cflags.v +++ b/compiler/cflags.v @@ -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 } diff --git a/thirdparty/freetype b/thirdparty/freetype new file mode 160000 index 0000000000..e4504fd25d --- /dev/null +++ b/thirdparty/freetype @@ -0,0 +1 @@ +Subproject commit e4504fd25d7d23797ccfef336a33491c0d654129