diff --git a/vlib/time/time_darwin.c.v b/vlib/time/time_darwin.c.v index adcc0fbdae..45976080d0 100644 --- a/vlib/time/time_darwin.c.v +++ b/vlib/time/time_darwin.c.v @@ -42,7 +42,9 @@ fn init_time_base() C.mach_timebase_info_data_t { fn sys_mono_now_darwin() u64 { tm := C.mach_absolute_time() if time.time_base.denom == 0 { - C.mach_timebase_info(&time.time_base) + unsafe { + C.mach_timebase_info(&time.time_base) + } } return (tm - time.start_time) * time.time_base.numer / time.time_base.denom } @@ -53,7 +55,9 @@ fn sys_mono_now_darwin() u64 { fn vpc_now_darwin() u64 { tm := C.mach_absolute_time() if time.time_base.denom == 0 { - C.mach_timebase_info(&time.time_base) + unsafe { + C.mach_timebase_info(&time.time_base) + } } return (tm - time.start_time) * time.time_base.numer / time.time_base.denom } diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index bb091c459a..a2d37f898f 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -308,7 +308,19 @@ pub fn (b Builder) v_files_from_dir(dir string) []string { if b.pref.is_verbose { println('v_files_from_dir ("$dir")') } - return b.pref.should_compile_filtered_files(dir, files) + res := b.pref.should_compile_filtered_files(dir, files) + if res.len == 0 { + // Perhaps the .v files are stored in /src/ ? + src_path := os.join_path(dir, 'src') + if os.exists(src_path) { + if b.pref.is_verbose { + println('v_files_from_dir ("$src_path") (/src/)') + } + files = os.ls(src_path) or { panic(err) } + return b.pref.should_compile_filtered_files(src_path, files) + } + } + return res } pub fn (b Builder) log(s string) { diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index c19b980a8d..010db9a888 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3244,6 +3244,11 @@ pub fn (mut c Checker) prefix_expr(mut node ast.PrefixExpr) ast.Type { ast.InfixExpr, ast.StringLiteral, ast.StringInterLiteral] { c.error('cannot take the address of $expr', node.pos) } + if mut node.right is ast.Ident { + if node.right.kind == .constant && !c.inside_unsafe && c.pref.experimental { + c.warn('cannot take an address of const outside `unsafe`', node.right.pos) + } + } if mut node.right is ast.IndexExpr { typ_sym := c.table.sym(node.right.left_type) mut is_mut := false