[Openmp-commits] [openmp] a6440b0 - [openmp] [test] Fix warnings about printf format mismatches on Windows
Martin Storsjö via Openmp-commits
openmp-commits at lists.llvm.org
Thu Nov 17 22:52:45 PST 2022
Author: Martin Storsjö
Date: 2022-11-18T08:50:26+02:00
New Revision: a6440b0fc535f660334cb48ca002e2fb34f5c4b4
URL: https://github.com/llvm/llvm-project/commit/a6440b0fc535f660334cb48ca002e2fb34f5c4b4
DIFF: https://github.com/llvm/llvm-project/commit/a6440b0fc535f660334cb48ca002e2fb34f5c4b4.diff
LOG: [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
Added:
Modified:
openmp/runtime/test/omp_testsuite.h
Removed:
################################################################################
diff --git a/openmp/runtime/test/omp_testsuite.h b/openmp/runtime/test/omp_testsuite.h
index b1dcf8ff2ad7..ef2ae20ec58c 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;
More information about the Openmp-commits
mailing list