[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.
This commit is contained in:
Joseph Huber 2025-02-04 06:48:23 -06:00 committed by GitHub
parent d7aa6e379e
commit daefb1b012
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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@