do not define __offsetof twice

pull/3182/head
Alexander Medvednikov 2019-12-22 01:01:44 +03:00
parent 5cfbc7bab5
commit 749d3ec14d
2 changed files with 6 additions and 3 deletions

View File

@ -21,8 +21,10 @@ const (
#endif #endif
// for __offset_of // for __offset_of
#ifndef __offsetof
#define __offsetof(s,memb) \\ #define __offsetof(s,memb) \\
((size_t)((char *)&((s *)0)->memb - (char *)0)) ((size_t)((char *)&((s *)0)->memb - (char *)0))
#endif
#define OPTION_CAST(x) (x) #define OPTION_CAST(x) (x)
' '

View File

@ -1133,7 +1133,6 @@ pub fn env_vflags_and_os_args() []string {
} }
pub fn vfmt(args []string) { pub fn vfmt(args []string) {
println('running vfmt...')
file := args.last() file := args.last()
if !os.exists(file) { if !os.exists(file) {
println('"$file" does not exist') println('"$file" does not exist')
@ -1147,11 +1146,13 @@ pub fn vfmt(args []string) {
// launch_tool('vfmt', '-d vfmt') // launch_tool('vfmt', '-d vfmt')
vroot := os.dir(vexe) vroot := os.dir(vexe)
os.chdir(vroot) os.chdir(vroot)
println('building vfmt... (it will be cached soon)')
ret := os.system('$vexe -o $vroot/tools/vfmt -d vfmt v.v') ret := os.system('$vexe -o $vroot/tools/vfmt -d vfmt v.v')
if ret != 0 { if ret != 0 {
println('err') println('err')
return return
} }
println('running vfmt...')
os.exec('$vroot/tools/vfmt $file')or{ os.exec('$vroot/tools/vfmt $file')or{
panic(err) panic(err)
} }