crt: test: Convert assert_winapi_seek to macro with caller information In assert message include handle/offset/method parameters and line number of caller. This allows to figure out on which line the assert failed.
diff --git a/mingw-w64-crt/testcases/t_fseeki64.c b/mingw-w64-crt/testcases/t_fseeki64.c index 1daa2d1..4cc36a9 100644 --- a/mingw-w64-crt/testcases/t_fseeki64.c +++ b/mingw-w64-crt/testcases/t_fseeki64.c
@@ -5,11 +5,12 @@ #include <fcntl.h> #include <windows.h> -static void assert_winapi_seek(HANDLE handle, LONGLONG offset, DWORD method) { - LARGE_INTEGER li = { .QuadPart = offset }; - li.LowPart = SetFilePointer(handle, li.LowPart, &li.HighPart, method); - assert(li.LowPart != INVALID_SET_FILE_POINTER || GetLastError() == NO_ERROR); -} +#define assert_winapi_seek(handle, offset, method) do { \ + LARGE_INTEGER li = { .QuadPart = (offset) }; \ + li.LowPart = SetFilePointer((handle), li.LowPart, &li.HighPart, (method)); \ + if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) \ + _assert("SetFilePointer(" #handle ", LARGE_INTEGER(" #offset "), " #method ") failed", __FILE__, __LINE__); \ +} while (0) int main() { FILE *file;