[Openmp-commits] [openmp] 074f12e - [OpenMP] Fix the build on Windows

Yuki Okushi via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 9 06:12:53 PDT 2022


Author: Yuki Okushi
Date: 2022-06-09T22:12:42+09:00
New Revision: 074f12e46795c91ba2c0effe7b93c39af5b0a3ac

URL: https://github.com/llvm/llvm-project/commit/074f12e46795c91ba2c0effe7b93c39af5b0a3ac
DIFF: https://github.com/llvm/llvm-project/commit/074f12e46795c91ba2c0effe7b93c39af5b0a3ac.diff

LOG: [OpenMP] Fix the build on Windows

The code expanded from kmp_barrier.h uses some `KMP_INTERNAL_*`s,
so the definitions have to be placed before it.

Fixes #55815

Differential Revision: https://reviews.llvm.org/D126873

Added: 
    

Modified: 
    openmp/runtime/src/kmp.h

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 41d3b64357304..57798e2edc670 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -106,6 +106,12 @@ class kmp_stats_list;
 #include <xmmintrin.h>
 #endif
 
+// The below has to be defined before including "kmp_barrier.h".
+#define KMP_INTERNAL_MALLOC(sz) malloc(sz)
+#define KMP_INTERNAL_FREE(p) free(p)
+#define KMP_INTERNAL_REALLOC(p, sz) realloc((p), (sz))
+#define KMP_INTERNAL_CALLOC(n, sz) calloc((n), (sz))
+
 #include "kmp_debug.h"
 #include "kmp_lock.h"
 #include "kmp_version.h"
@@ -3462,11 +3468,6 @@ extern void ___kmp_thread_free(kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL);
 #define __kmp_thread_free(th, ptr)                                             \
   ___kmp_thread_free((th), (ptr)KMP_SRC_LOC_CURR)
 
-#define KMP_INTERNAL_MALLOC(sz) malloc(sz)
-#define KMP_INTERNAL_FREE(p) free(p)
-#define KMP_INTERNAL_REALLOC(p, sz) realloc((p), (sz))
-#define KMP_INTERNAL_CALLOC(n, sz) calloc((n), (sz))
-
 extern void __kmp_push_num_threads(ident_t *loc, int gtid, int num_threads);
 
 extern void __kmp_push_proc_bind(ident_t *loc, int gtid,


        


More information about the Openmp-commits mailing list