From: Martin Storsjö Date: Tue, 8 Nov 2022 09:45:41 +0000 (+0200) Subject: [openmp] [test] Fix warnings about printf format mismatches on Windows X-Git-Tag: upstream/17.0.6~27258 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6440b0fc535f660334cb48ca002e2fb34f5c4b4;p=platform%2Fupstream%2Fllvm.git [openmp] [test] Fix warnings about printf format mismatches on Windows This fixes warnings like this: ``` openmp/runtime/test/omp_testsuite.h:107:60: warning: format specifies type 'unsigned int' but the argument has type 'DWORD' (aka 'unsigned long') [-Wformat] fprintf(stderr, "CreateThread() failed: Error #%u.\n", GetLastError()); ~~ ^~~~~~~~~~~~~~ %lu ``` Differential Revision: https://reviews.llvm.org/D137747 --- diff --git a/openmp/runtime/test/omp_testsuite.h b/openmp/runtime/test/omp_testsuite.h index b1dcf8f..ef2ae20 100644 --- a/openmp/runtime/test/omp_testsuite.h +++ b/openmp/runtime/test/omp_testsuite.h @@ -104,7 +104,8 @@ static int pthread_create(pthread_t *thread, void *attr, info->arg = arg; pthread = CreateThread(NULL, 0, __thread_func_wrapper, info, 0, NULL); if (pthread == NULL) { - fprintf(stderr, "CreateThread() failed: Error #%u.\n", GetLastError()); + fprintf(stderr, "CreateThread() failed: Error #%u.\n", + (unsigned) GetLastError()); exit(1); } *thread = pthread; @@ -116,12 +117,13 @@ static int pthread_join(pthread_t thread, void **retval) { rc = WaitForSingleObject(thread, INFINITE); if (rc == WAIT_FAILED) { fprintf(stderr, "WaitForSingleObject() failed: Error #%u.\n", - GetLastError()); + (unsigned) GetLastError()); exit(1); } rc = CloseHandle(thread); if (rc == 0) { - fprintf(stderr, "CloseHandle() failed: Error #%u.\n", GetLastError()); + fprintf(stderr, "CloseHandle() failed: Error #%u.\n", + (unsigned) GetLastError()); exit(1); } return 0;