diff --git a/vlib/compiler/cheaders.v b/vlib/compiler/cheaders.v index 1c028dc9c4..d31d96f508 100644 --- a/vlib/compiler/cheaders.v +++ b/vlib/compiler/cheaders.v @@ -21,8 +21,10 @@ const ( #endif // for __offset_of +#ifndef __offsetof #define __offsetof(s,memb) \\ ((size_t)((char *)&((s *)0)->memb - (char *)0)) +#endif #define OPTION_CAST(x) (x) ' diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 386707ae8d..7fd9e38aa3 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -1056,7 +1056,7 @@ pub fn new_v(args []string) &V { is_live: '-live' in args sanitize: '-sanitize' in args // nofmt: '-nofmt' in args - + show_c_cmd: '-show_c_cmd' in args translated: 'translated' in args is_run: 'run' in args @@ -1075,7 +1075,7 @@ pub fn new_v(args []string) &V { building_v: !is_repl && (rdir_name == 'compiler' || rdir_name == 'v.v' || dir.contains('vlib')) comptime_define: comptime_define // is_fmt: comptime_define == 'vfmt' - + user_mod_path: user_mod_path vlib_path: vlib_path vpath: vpath @@ -1133,7 +1133,6 @@ pub fn env_vflags_and_os_args() []string { } pub fn vfmt(args []string) { - println('running vfmt...') file := args.last() if !os.exists(file) { println('"$file" does not exist') @@ -1147,11 +1146,13 @@ pub fn vfmt(args []string) { // launch_tool('vfmt', '-d vfmt') vroot := os.dir(vexe) os.chdir(vroot) + println('building vfmt... (it will be cached soon)') ret := os.system('$vexe -o $vroot/tools/vfmt -d vfmt v.v') if ret != 0 { println('err') return } + println('running vfmt...') os.exec('$vroot/tools/vfmt $file')or{ panic(err) }