Skip to content

Commit f876d2b

Browse files
authored
[COMGR] Fix compiling tests on Windows with msvc (llvm#809)
2 parents a3af9dc + 3d77fd5 commit f876d2b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

amd/comgr/test/common.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
#include <errno.h>
5454
#include <fcntl.h>
5555

56+
#if defined(_WIN64)
57+
typedef __int64 ssize_t;
58+
#elif defined(_WIN32)
59+
typedef long ssize_t;
60+
#endif
61+
5662
void fail(const char *format, ...) {
5763
va_list ap;
5864
va_start(ap, format);
@@ -327,7 +333,7 @@ void checkCount(const char *id, amd_comgr_data_set_t dataSet,
327333
dataKindString(dataKind), expected);
328334
}
329335

330-
size_t WriteFile(int FD, const char *Buffer, size_t Size) {
336+
size_t WriteFileCustom(int FD, const char *Buffer, size_t Size) {
331337
size_t BytesWritten = 0;
332338

333339
while (BytesWritten < Size) {

amd/comgr/test/file_map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main(int argc, char *argv[]) {
2121

2222
const char *Buffer = "abcdefghi";
2323
size_t Length = strlen(Buffer);
24-
size_t Bytes = WriteFile(FD, Buffer, Length);
24+
size_t Bytes = WriteFileCustom(FD, Buffer, Length);
2525
if (Bytes != Length) {
2626
fail("Write failed with ret %d", Bytes);
2727
}

0 commit comments

Comments
 (0)