[Openmp-commits] [openmp] [OpenMP] Add an 'stddef.h' include to 'omp.h' (PR #73876)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 29 16:10:03 PST 2023


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/73876

Summary:
We use `size_t` internally in the omp.h header, which is normally
provided by `stdlib.h` which is already included. Howevever, some cases
when using `-ffreestanding` can result in this not being defined via
`stdlib.h`. This patch simply adds an explicit inclusion of this header,
which is provided by the `clang` resource directory, to resolve this in
all cases.


>From 3fc2ba6a15554f2459f0cdf2e59ba5dd2e041a69 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 29 Nov 2023 18:06:50 -0600
Subject: [PATCH] [OpenMP] Add an 'stddef.h' include to 'omp.h'

Summary:
We use `size_t` internally in the omp.h header, which is normally
provided by `stdlib.h` which is already included. Howevever, some cases
when using `-ffreestanding` can result in this not being defined via
`stdlib.h`. This patch simply adds an explicit inclusion of this header,
which is provided by the `clang` resource directory, to resolve this in
all cases.
---
 openmp/runtime/src/include/omp.h.var | 1 +
 1 file changed, 1 insertion(+)

diff --git a/openmp/runtime/src/include/omp.h.var b/openmp/runtime/src/include/omp.h.var
index 0dd3a533a365059..a1488ae9d21c616 100644
--- a/openmp/runtime/src/include/omp.h.var
+++ b/openmp/runtime/src/include/omp.h.var
@@ -15,6 +15,7 @@
 #ifndef __OMP_H
 #   define __OMP_H
 
+#   include <stddef.h>
 #   include <stdlib.h>
 #   include <stdint.h>
 



More information about the Openmp-commits mailing list