compiler: fix sizeof and cc

pull/1927/head
BigBlack 2019-09-11 18:34:19 +08:00 committed by Alexander Medvednikov
parent 3588c3363d
commit e6354567e5
2 changed files with 7 additions and 10 deletions

View File

@ -119,16 +119,17 @@ fn (v mut V) cc() {
a << '-mmacosx-version-min=10.7'
}
cflags := v.get_os_cflags()
// add all flags (-I -l -L etc) not .o files
for flag in cflags {
if flag.value.ends_with('.o') { continue }
a << flag.format()
}
// add .o files
for flag in cflags {
if !flag.value.ends_with('.o') { continue }
a << flag.format()
}
// add all flags (-I -l -L etc) not .o files
for flag in cflags {
if flag.value.ends_with('.o') { continue }
a << flag.format()
}
a << libs
// Without these libs compilation will fail on Linux
// || os.user_os() == 'linux'

View File

@ -2349,10 +2349,6 @@ fn (p mut Parser) factor() string {
p.next()
p.check(.lpar)
mut sizeof_typ := p.get_type()
if sizeof_typ.ends_with('*') {
// Move * from the end to the beginning, as C requires
sizeof_typ = '*' + sizeof_typ.left(sizeof_typ.len - 1)
}
p.check(.rpar)
p.gen('$sizeof_typ)')
p.fgen('$sizeof_typ)')