[Openmp-commits] [openmp] [OpenMP] Fix a condition for KMP_OS_SOLARIS. (PR #71831)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 9 09:41:08 PST 2023


https://github.com/xingxue-ibm created https://github.com/llvm/llvm-project/pull/71831

Line 75 of  `z_Linux_util.cpp` checks `#ifdef KMP_OS_SOLARIS` which is always true regardless of the building platform because macro `KMP_OS_SOLARIS` is always defined in line 23 of `kmp_platform.h`: `define KMP_OS_SOLARIS 0`. This causes a compiler warning, such as the following on Linux.
```
.../llvm-project/openmp/runtime/src/z_Linux_util.cpp:77:9: warning: 'TIMEVAL_TO_TIMESPEC' macro redefined [-Wmacro-redefined]
   77 | #define TIMEVAL_TO_TIMESPEC(tv, ts)                                            \
      |         ^
/usr/include/sys/time.h:38:10: note: previous definition is here
   38 | # define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
      |          ^
```

>From 971b8bc5dcc6cbeecd686ce75f5b5260133b40be Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Thu, 9 Nov 2023 12:22:16 -0500
Subject: [PATCH] Fix #ifdef KMP_OS_SOLARIS.

---
 openmp/runtime/src/z_Linux_util.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index e17bed2a4f76614..9e1a7c7736298db 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -72,7 +72,7 @@ struct kmp_sys_timer {
   struct timespec start;
 };
 
-#ifdef KMP_OS_SOLARIS
+#if KMP_OS_SOLARIS
 // Convert timeval to timespec.
 #define TIMEVAL_TO_TIMESPEC(tv, ts)                                            \
   do {                                                                         \



More information about the Openmp-commits mailing list