Commit 57e5bed
committed
[OpenMP] Fix KMP_OS_AIX handling
When building `openmp` on Linux/sparc64, I get
```
In file included fromopenmp/runtime/src/kmp_utility.cpp:16:
openmp/runtime/src/kmp_wrapper_getpid.h:47:2: warning: No gettid found, use getpid instead [-W#warnings]
47 | #warning No gettid found, use getpid instead
| ^
```
This is highly confusing since `<sys/syscall.h>` **does** define
`SYS_gettid` and the header is supposed to be included:
```
#if !defined(KMP_OS_AIX) && !defined(KMP_OS_HAIKU)
#include <sys/syscall.h>
#endif
```
However, this actually is **not** the case for two reasons:
- `KMP_OS_HAIKU` is always defined, either as 1 on Haiku or as 0 otherwise.
- `KMP_OS_AIX` is even worse: it is only defined as 1 on on AIX, but
undefined otherwise.
All those `KMP_OS_*` macros are supposed to always be defined as 1/0 as
appropriate, and to be checked with `#if`, not `#ifdef`. AIX is violating
this, causing the problem above.
Other targets probably get `<sys/syscall.h>` indirectly otherwise, but
Linux/sparc64 does not.
This patch fixes this by also defining `KMP_OS_AIX` as 0 on other OSes and
changing the checks to `#if` as necessary.
Tested on `sparc64-unknown-linux-gnu`, `sparcv9-sun-solaris2.11`,
`amd64-pc-solaris2.11`, and `x86_64-pc-linux-gnu`.1 parent 4c587f5 commit 57e5bed
File tree
4 files changed
+6
-5
lines changed- openmp/runtime/src
4 files changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
824 | | - | |
| 824 | + | |
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5468 | 5468 | | |
5469 | 5469 | | |
5470 | 5470 | | |
5471 | | - | |
| 5471 | + | |
5472 | 5472 | | |
5473 | 5473 | | |
5474 | 5474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
166 | | - | |
| 167 | + | |
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments