diff options
author | Joseph Huber <huberjn@outlook.com> | 2025-02-04 06:48:23 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-04 06:48:23 -0600 |
commit | daefb1b0121498ea48a0ed6514f11fb66872bafc (patch) | |
tree | 88c7052589c67fe018210b8a29dc8242d493cef3 /openmp/runtime/src | |
parent | d7aa6e379e612be4f5de3fc7bae53a5d19498049 (diff) | |
download | llvm-daefb1b0121498ea48a0ed6514f11fb66872bafc.zip llvm-daefb1b0121498ea48a0ed6514f11fb66872bafc.tar.gz llvm-daefb1b0121498ea48a0ed6514f11fb66872bafc.tar.bz2 |
[OpenMP] Make `omp.h` work when compiled with `-ffreestanding` (#125618)
Summary:
Freestanding builds have `stddef.h` and `stdint.h` but not `stdlib.h`.
We don't actually use any `stdlib.h` definitions in the OpenMP headers,
and some definitions from this header are usable without the OpenMP
runtime (allocators) so we should be able to do this. This ignores the
include if possible, removing the implicit include would possibly break
some applications so it stays here.
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r-- | openmp/runtime/src/include/omp.h.var | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/openmp/runtime/src/include/omp.h.var b/openmp/runtime/src/include/omp.h.var index dee46e5..82f9d07 100644 --- a/openmp/runtime/src/include/omp.h.var +++ b/openmp/runtime/src/include/omp.h.var @@ -15,8 +15,14 @@ #ifndef __OMP_H # define __OMP_H +# ifndef __has_include +# define __has_include(x) 0 +# endif + # include <stddef.h> -# include <stdlib.h> +# if (__has_include(<stdlib.h>)) +# include <stdlib.h> +# endif # include <stdint.h> # define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@ |