Skip to content

Commit eef9b5f

Browse files
authored
builtin,os: fix compiling V programs with latest clang 16 on windows (clang 16 is stricter than clang 14) (#19095)
1 parent 64029a2 commit eef9b5f

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

vlib/builtin/builtin_windows.c.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,7 @@ pub fn winapi_lasterr_str() string {
286286
}
287287
mut msgbuf := &u16(0)
288288
res := C.FormatMessage(C.FORMAT_MESSAGE_ALLOCATE_BUFFER | C.FORMAT_MESSAGE_FROM_SYSTEM | C.FORMAT_MESSAGE_IGNORE_INSERTS,
289-
C.NULL, err_msg_id, C.MAKELANGID(C.LANG_NEUTRAL, C.SUBLANG_DEFAULT), &msgbuf,
290-
0, C.NULL)
289+
0, err_msg_id, 0, voidptr(&msgbuf), 0, 0)
291290
err_msg := if res == 0 {
292291
'Win-API error ${err_msg_id}'
293292
} else {

vlib/builtin/cfns.c.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ fn C.FindClose(hFindFile voidptr)
349349
// macro
350350
fn C.MAKELANGID(lgid voidptr, srtid voidptr) int
351351

352-
fn C.FormatMessage(dwFlags u32, lpSource voidptr, dwMessageId u32, dwLanguageId u32, lpBuffer voidptr, nSize int, arguments ...voidptr) voidptr
352+
fn C.FormatMessage(dwFlags u32, lpSource voidptr, dwMessageId u32, dwLanguageId u32, lpBuffer voidptr, nSize u32, arguments ...voidptr) u32
353353

354354
fn C.CloseHandle(voidptr) int
355355

vlib/os/os_windows.c.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ fn ptr_win_get_error_msg(code u32) voidptr {
262262
return buf
263263
}
264264
C.FormatMessage(os.format_message_allocate_buffer | os.format_message_from_system | os.format_message_ignore_inserts,
265-
0, code, C.MAKELANGID(os.lang_neutral, os.sublang_default), voidptr(&buf), 0,
266-
0)
265+
0, code, 0, voidptr(&buf), 0, 0)
267266
return buf
268267
}
269268

0 commit comments

Comments
 (0)