compiler: fix sizeof and cc
parent
3588c3363d
commit
e6354567e5
|
@ -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'
|
||||
|
|
|
@ -2348,11 +2348,7 @@ fn (p mut Parser) factor() string {
|
|||
p.fgen('sizeof(')
|
||||
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)
|
||||
}
|
||||
mut sizeof_typ := p.get_type()
|
||||
p.check(.rpar)
|
||||
p.gen('$sizeof_typ)')
|
||||
p.fgen('$sizeof_typ)')
|
||||
|
|
Loading…
Reference in New Issue