diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c3a9b4766..3f7367d170 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -257,10 +257,10 @@ jobs: run: | git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/ .\.github\workflows\windows-install-sdl.bat -# - name: Build -# run: | -# gcc --version -# .\make.bat -gcc + - name: Build + run: | + gcc --version + .\make.bat -gcc # - name: Test # run: | # .\v.exe -silent test-compiler diff --git a/cmd/v/internal/compile/msvc.v b/cmd/v/internal/compile/msvc.v index 810eae928d..9a2572efbb 100644 --- a/cmd/v/internal/compile/msvc.v +++ b/cmd/v/internal/compile/msvc.v @@ -52,7 +52,8 @@ fn find_windows_kit_internal(key RegKey, versions []string) ?string { if value[length - 1] != u16(0) { value[length] = u16(0) } - return string_from_wide(value) + res := string_from_wide(value) + return res } } } diff --git a/vlib/os/const_windows.v b/vlib/os/const_windows.v index d919e45447..4520e9c9ce 100644 --- a/vlib/os/const_windows.v +++ b/vlib/os/const_windows.v @@ -2,7 +2,7 @@ module os // Ref - winnt.h const ( - SUCCESS = 0 // ERROR_SUCCESS + success = 0 // ERROR_SUCCESS ERROR_INSUFFICIENT_BUFFER = 130 ) @@ -77,7 +77,7 @@ const ( ENABLE_INSERT_MODE = 0x0020 ENABLE_LINE_INPUT = 0x0002 ENABLE_MOUSE_INPUT = 0x0010 - ENABLE_PROCESSED_INPUT = 0x0001 + ENABLE_PROCESSED_INPUT = 0x0001 ENABLE_QUICK_EDIT_MODE = 0x0040 ENABLE_WINDOW_INPUT = 0x0008 ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200 diff --git a/vlib/os/os_windows.v b/vlib/os/os_windows.v index 114977479a..d07c0c6451 100644 --- a/vlib/os/os_windows.v +++ b/vlib/os/os_windows.v @@ -198,14 +198,13 @@ pub fn get_file_handle(path string) HANDLE { // get_module_filename retrieves the fully qualified path for the file that contains the specified module. // The module must have been loaded by the current process. pub fn get_module_filename(handle HANDLE) ?string { - success := C.SUCCESS unsafe { mut sz := 4096 // Optimized length mut buf := &u16(malloc(4096)) for { status := int(C.GetModuleFileNameW(handle, voidptr(&buf), sz)) match status { - success { + os.success { _filename := string_from_wide2(buf, sz) return _filename } diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 6cebaacb2c..7d7274c732 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -7,7 +7,6 @@ import ( v.depgraph v.token v.pref - v.util term ) @@ -99,13 +98,7 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string if g.is_test { g.write_tests_main() } - return g.hashes() + g.typedefs.str() + g.definitions.str() + g.out.str() -} - -pub fn (g &Gen) hashes() string { - mut res := c_commit_hash_default.replace('@@@', util.vhash() ) - res += c_current_commit_hash_default.replace('@@@', util.githash( g.pref.building_v ) ) - return res + return c_commit_hash_default + g.typedefs.str() + g.definitions.str() + g.out.str() } pub fn (g mut Gen) init() { @@ -1103,8 +1096,12 @@ fn (g mut Gen) expr(node ast.Expr) { */ ast.SizeOf { - styp := g.typ(it.typ) - g.write('sizeof($styp)') + if it.type_name != '' { + g.write('sizeof($it.type_name)') + } else { + styp := g.typ(it.typ) + g.write('sizeof($styp)') + } } ast.StringLiteral { if it.is_raw { diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 311e0f65e5..1badf3e91d 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -776,21 +776,22 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr { .key_sizeof { p.next() // sizeof p.check(.lpar) - if p.tok.lit == 'C' { - p.next() - p.check(.dot) - } if p.tok.kind == .amp { p.next() } - // type_name := p.check_name() - sizeof_type := p.parse_type() - p.check(.rpar) - node = ast.SizeOf{ - typ: sizeof_type - // type_name: type_name - + if p.tok.lit == 'C' { + p.next() + p.check(.dot) + node = ast.SizeOf{ + type_name: p.check_name() + } + } else { + sizeof_type := p.parse_type() + node = ast.SizeOf{ + typ: sizeof_type + } } + p.check(.rpar) } .key_typeof { p.next()