Skip to content

Commit 074f12e

Browse files
committed
[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 llvm#55815 Differential Revision: https://reviews.llvm.org/D126873
1 parent 8feb92a commit 074f12e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

openmp/runtime/src/kmp.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ class kmp_stats_list;
106106
#include <xmmintrin.h>
107107
#endif
108108

109+
// The below has to be defined before including "kmp_barrier.h".
110+
#define KMP_INTERNAL_MALLOC(sz) malloc(sz)
111+
#define KMP_INTERNAL_FREE(p) free(p)
112+
#define KMP_INTERNAL_REALLOC(p, sz) realloc((p), (sz))
113+
#define KMP_INTERNAL_CALLOC(n, sz) calloc((n), (sz))
114+
109115
#include "kmp_debug.h"
110116
#include "kmp_lock.h"
111117
#include "kmp_version.h"
@@ -3462,11 +3468,6 @@ extern void ___kmp_thread_free(kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL);
34623468
#define __kmp_thread_free(th, ptr) \
34633469
___kmp_thread_free((th), (ptr)KMP_SRC_LOC_CURR)
34643470

3465-
#define KMP_INTERNAL_MALLOC(sz) malloc(sz)
3466-
#define KMP_INTERNAL_FREE(p) free(p)
3467-
#define KMP_INTERNAL_REALLOC(p, sz) realloc((p), (sz))
3468-
#define KMP_INTERNAL_CALLOC(n, sz) calloc((n), (sz))
3469-
34703471
extern void __kmp_push_num_threads(ident_t *loc, int gtid, int num_threads);
34713472

34723473
extern void __kmp_push_proc_bind(ident_t *loc, int gtid,

0 commit comments

Comments
 (0)