[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / openmp / runtime / src / thirdparty / ittnotify / ittnotify_config.h
blobff37eb4ed175e676090de07fa78490256c43a221
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _ITTNOTIFY_CONFIG_H_
11 #define _ITTNOTIFY_CONFIG_H_
13 /** @cond exclude_from_documentation */
14 #ifndef ITT_OS_WIN
15 #define ITT_OS_WIN 1
16 #endif /* ITT_OS_WIN */
18 #ifndef ITT_OS_LINUX
19 #define ITT_OS_LINUX 2
20 #endif /* ITT_OS_LINUX */
22 #ifndef ITT_OS_MAC
23 #define ITT_OS_MAC 3
24 #endif /* ITT_OS_MAC */
26 #ifndef ITT_OS_FREEBSD
27 #define ITT_OS_FREEBSD 4
28 #endif /* ITT_OS_FREEBSD */
30 #ifndef ITT_OS
31 #if defined WIN32 || defined _WIN32
32 #define ITT_OS ITT_OS_WIN
33 #elif defined(__APPLE__) && defined(__MACH__)
34 #define ITT_OS ITT_OS_MAC
35 #elif defined(__FreeBSD__)
36 #define ITT_OS ITT_OS_FREEBSD
37 #else
38 #define ITT_OS ITT_OS_LINUX
39 #endif
40 #endif /* ITT_OS */
42 #ifndef ITT_PLATFORM_WIN
43 #define ITT_PLATFORM_WIN 1
44 #endif /* ITT_PLATFORM_WIN */
46 #ifndef ITT_PLATFORM_POSIX
47 #define ITT_PLATFORM_POSIX 2
48 #endif /* ITT_PLATFORM_POSIX */
50 #ifndef ITT_PLATFORM_MAC
51 #define ITT_PLATFORM_MAC 3
52 #endif /* ITT_PLATFORM_MAC */
54 #ifndef ITT_PLATFORM_FREEBSD
55 #define ITT_PLATFORM_FREEBSD 4
56 #endif /* ITT_PLATFORM_FREEBSD */
58 #ifndef ITT_PLATFORM
59 #if ITT_OS == ITT_OS_WIN
60 #define ITT_PLATFORM ITT_PLATFORM_WIN
61 #elif ITT_OS == ITT_OS_MAC
62 #define ITT_PLATFORM ITT_PLATFORM_MAC
63 #elif ITT_OS == ITT_OS_FREEBSD
64 #define ITT_PLATFORM ITT_PLATFORM_FREEBSD
65 #else
66 #define ITT_PLATFORM ITT_PLATFORM_POSIX
67 #endif
68 #endif /* ITT_PLATFORM */
70 #if defined(_UNICODE) && !defined(UNICODE)
71 #define UNICODE
72 #endif
74 #include <stddef.h>
75 #if ITT_PLATFORM == ITT_PLATFORM_WIN
76 #include <tchar.h>
77 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
78 #include <stdint.h>
79 #if defined(UNICODE) || defined(_UNICODE)
80 #include <wchar.h>
81 #endif /* UNICODE || _UNICODE */
82 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
84 #ifndef ITTAPI_CDECL
85 #if ITT_PLATFORM == ITT_PLATFORM_WIN
86 #define ITTAPI_CDECL __cdecl
87 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
88 #if defined _M_IX86 || defined __i386__
89 #define ITTAPI_CDECL __attribute__((cdecl))
90 #else /* _M_IX86 || __i386__ */
91 #define ITTAPI_CDECL /* actual only on x86 platform */
92 #endif /* _M_IX86 || __i386__ */
93 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
94 #endif /* ITTAPI_CDECL */
96 #ifndef STDCALL
97 #if ITT_PLATFORM == ITT_PLATFORM_WIN
98 #define STDCALL __stdcall
99 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
100 #if defined _M_IX86 || defined __i386__
101 #define STDCALL __attribute__((stdcall))
102 #else /* _M_IX86 || __i386__ */
103 #define STDCALL /* supported only on x86 platform */
104 #endif /* _M_IX86 || __i386__ */
105 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
106 #endif /* STDCALL */
108 #define ITTAPI ITTAPI_CDECL
109 #define LIBITTAPI ITTAPI_CDECL
111 /* TODO: Temporary for compatibility! */
112 #define ITTAPI_CALL ITTAPI_CDECL
113 #define LIBITTAPI_CALL ITTAPI_CDECL
115 #if ITT_PLATFORM == ITT_PLATFORM_WIN
116 /* use __forceinline (VC++ specific) */
117 #if defined(__MINGW32__) && !defined(__cplusplus)
118 #define ITT_INLINE \
119 static __inline__ __attribute__((__always_inline__, __gnu_inline__))
120 #else
121 #define ITT_INLINE static __forceinline
122 #endif /* __MINGW32__ */
124 #define ITT_INLINE_ATTRIBUTE /* nothing */
125 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
127 * Generally, functions are not inlined unless optimization is specified.
128 * For functions declared inline, this attribute inlines the function even
129 * if no optimization level was specified.
131 #ifdef __STRICT_ANSI__
132 #define ITT_INLINE static
133 #define ITT_INLINE_ATTRIBUTE __attribute__((unused))
134 #else /* __STRICT_ANSI__ */
135 #define ITT_INLINE static inline
136 #define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
137 #endif /* __STRICT_ANSI__ */
138 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
139 /** @endcond */
141 #ifndef ITT_ARCH_IA32
142 #define ITT_ARCH_IA32 1
143 #endif /* ITT_ARCH_IA32 */
145 #ifndef ITT_ARCH_IA32E
146 #define ITT_ARCH_IA32E 2
147 #endif /* ITT_ARCH_IA32E */
149 #ifndef ITT_ARCH_IA64
150 #define ITT_ARCH_IA64 3
151 #endif /* ITT_ARCH_IA64 */
153 #ifndef ITT_ARCH_ARM
154 #define ITT_ARCH_ARM 4
155 #endif /* ITT_ARCH_ARM */
157 #ifndef ITT_ARCH_PPC64
158 #define ITT_ARCH_PPC64 5
159 #endif /* ITT_ARCH_PPC64 */
161 #ifndef ITT_ARCH_ARM64
162 #define ITT_ARCH_ARM64 6
163 #endif /* ITT_ARCH_ARM64 */
165 #ifndef ITT_ARCH_VE
166 #define ITT_ARCH_VE 8
167 #endif /* ITT_ARCH_VE */
169 #ifndef ITT_ARCH
170 #if defined _M_IX86 || defined __i386__
171 #define ITT_ARCH ITT_ARCH_IA32
172 #elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
173 #define ITT_ARCH ITT_ARCH_IA32E
174 #elif defined _M_IA64 || defined __ia64__
175 #define ITT_ARCH ITT_ARCH_IA64
176 #elif defined _M_ARM || defined __arm__
177 #define ITT_ARCH ITT_ARCH_ARM
178 #elif defined __aarch64__
179 #define ITT_ARCH ITT_ARCH_ARM64
180 #elif defined __powerpc64__
181 #define ITT_ARCH ITT_ARCH_PPC64
182 #elif defined __ve__
183 #define ITT_ARCH ITT_ARCH_VE
184 #endif
185 #endif
187 #ifdef __cplusplus
188 #define ITT_EXTERN_C extern "C"
189 #define ITT_EXTERN_C_BEGIN extern "C" {
190 #define ITT_EXTERN_C_END }
191 #else
192 #define ITT_EXTERN_C /* nothing */
193 #define ITT_EXTERN_C_BEGIN /* nothing */
194 #define ITT_EXTERN_C_END /* nothing */
195 #endif /* __cplusplus */
197 #define ITT_TO_STR_AUX(x) #x
198 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
200 #define __ITT_BUILD_ASSERT(expr, suffix) \
201 do { \
202 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
203 __itt_build_check_##suffix[0] = 0; \
204 } while (0)
205 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
206 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
208 #define ITT_MAGIC \
209 { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
211 /* Replace with snapshot date YYYYMMDD for promotion build. */
212 #define API_VERSION_BUILD 20180723
214 #ifndef API_VERSION_NUM
215 #define API_VERSION_NUM 3.20.1
216 #endif /* API_VERSION_NUM */
218 #define API_VERSION \
219 "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) " (" ITT_TO_STR( \
220 API_VERSION_BUILD) ")"
222 /* OS communication functions */
223 #if ITT_PLATFORM == ITT_PLATFORM_WIN
224 #include <windows.h>
225 typedef HMODULE lib_t;
226 typedef DWORD TIDT;
227 typedef CRITICAL_SECTION mutex_t;
228 #ifdef __cplusplus
229 #define MUTEX_INITIALIZER \
231 #else
232 #define MUTEX_INITIALIZER \
233 { 0 }
234 #endif
235 #define strong_alias(name, aliasname) /* empty for Windows */
236 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
237 #include <dlfcn.h>
238 #if defined(UNICODE) || defined(_UNICODE)
239 #include <wchar.h>
240 #endif /* UNICODE */
241 #ifndef _GNU_SOURCE
242 #define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
243 #endif /* _GNU_SOURCE */
244 #ifndef __USE_UNIX98
245 #define __USE_UNIX98 \
246 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein \
247 pthread.h missing dependency on __USE_XOPEN2K8 */
248 #endif /*__USE_UNIX98*/
249 #include <pthread.h>
250 typedef void *lib_t;
251 typedef pthread_t TIDT;
252 typedef pthread_mutex_t mutex_t;
253 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
254 #define _strong_alias(name, aliasname) \
255 extern __typeof(name) aliasname __attribute__((alias(#name)));
256 #define strong_alias(name, aliasname) _strong_alias(name, aliasname)
257 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
259 #if ITT_PLATFORM == ITT_PLATFORM_WIN
260 #define __itt_get_proc(lib, name) GetProcAddress(lib, name)
261 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
262 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
263 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
264 #define __itt_load_lib(name) LoadLibraryA(name)
265 #define __itt_unload_lib(handle) FreeLibrary(handle)
266 #define __itt_system_error() (int)GetLastError()
267 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
268 #define __itt_fstrnlen(s, l) strnlen_s(s, l)
269 #define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l)
270 #define __itt_fstrdup(s) _strdup(s)
271 #define __itt_thread_id() GetCurrentThreadId()
272 #define __itt_thread_yield() SwitchToThread()
273 #ifndef ITT_SIMPLE_INIT
274 ITT_INLINE long
275 __itt_interlocked_increment(volatile long *ptr) ITT_INLINE_ATTRIBUTE;
276 ITT_INLINE long __itt_interlocked_increment(volatile long *ptr) {
277 return InterlockedIncrement(ptr);
279 #endif /* ITT_SIMPLE_INIT */
281 #define DL_SYMBOLS (1)
282 #define PTHREAD_SYMBOLS (1)
284 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
285 #define __itt_get_proc(lib, name) dlsym(lib, name)
286 #define __itt_mutex_init(mutex) \
288 pthread_mutexattr_t mutex_attr; \
289 int error_code = pthread_mutexattr_init(&mutex_attr); \
290 if (error_code) \
291 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
292 error_code); \
293 error_code = \
294 pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE); \
295 if (error_code) \
296 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
297 error_code); \
298 error_code = pthread_mutex_init(mutex, &mutex_attr); \
299 if (error_code) \
300 __itt_report_error(__itt_error_system, "pthread_mutex_init", \
301 error_code); \
302 error_code = pthread_mutexattr_destroy(&mutex_attr); \
303 if (error_code) \
304 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
305 error_code); \
307 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
308 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
309 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
310 #define __itt_unload_lib(handle) dlclose(handle)
311 #define __itt_system_error() errno
312 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
314 /* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */
315 #ifdef SDL_STRNLEN_S
316 #define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l)
317 #else
318 #define __itt_fstrnlen(s, l) strlen(s)
319 #endif /* SDL_STRNLEN_S */
320 #ifdef SDL_STRNCPY_S
321 #define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
322 #else
323 #define __itt_fstrcpyn(s1, b, s2, l) \
325 if (b > 0) { \
326 /* 'volatile' is used to suppress the warning that a destination */ \
327 /* bound depends on the length of the source. */ \
328 volatile size_t num_to_copy = \
329 (size_t)(b - 1) < (size_t)(l) ? (size_t)(b - 1) : (size_t)(l); \
330 strncpy(s1, s2, num_to_copy); \
331 s1[num_to_copy] = 0; \
334 #endif /* SDL_STRNCPY_S */
336 #define __itt_fstrdup(s) strdup(s)
337 #define __itt_thread_id() pthread_self()
338 #define __itt_thread_yield() sched_yield()
339 #if ITT_ARCH == ITT_ARCH_IA64
340 #ifdef __INTEL_COMPILER
341 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
342 #else /* __INTEL_COMPILER */
343 /* TODO: Add Support for not Intel compilers for IA-64 architecture */
344 #endif /* __INTEL_COMPILER */
345 #elif ITT_ARCH == ITT_ARCH_IA32 || \
346 ITT_ARCH == ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */
347 ITT_INLINE long __TBB_machine_fetchadd4(volatile void *ptr,
348 long addend) ITT_INLINE_ATTRIBUTE;
349 ITT_INLINE long __TBB_machine_fetchadd4(volatile void *ptr, long addend) {
350 long result;
351 __asm__ __volatile__("lock\nxadd %0,%1"
352 : "=r"(result), "=m"(*(volatile int *)ptr)
353 : "0"(addend), "m"(*(volatile int *)ptr)
354 : "memory");
355 return result;
357 #else
358 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
359 #endif /* ITT_ARCH==ITT_ARCH_IA64 */
360 #ifndef ITT_SIMPLE_INIT
361 ITT_INLINE long
362 __itt_interlocked_increment(volatile long *ptr) ITT_INLINE_ATTRIBUTE;
363 ITT_INLINE long __itt_interlocked_increment(volatile long *ptr) {
364 return __TBB_machine_fetchadd4(ptr, 1) + 1L;
366 #endif /* ITT_SIMPLE_INIT */
368 void *dlopen(const char *, int) __attribute__((weak));
369 void *dlsym(void *, const char *) __attribute__((weak));
370 int dlclose(void *) __attribute__((weak));
371 #define DL_SYMBOLS (dlopen && dlsym && dlclose)
373 int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *)
374 __attribute__((weak));
375 int pthread_mutex_lock(pthread_mutex_t *) __attribute__((weak));
376 int pthread_mutex_unlock(pthread_mutex_t *) __attribute__((weak));
377 int pthread_mutex_destroy(pthread_mutex_t *) __attribute__((weak));
378 int pthread_mutexattr_init(pthread_mutexattr_t *) __attribute__((weak));
379 int pthread_mutexattr_settype(pthread_mutexattr_t *, int) __attribute__((weak));
380 int pthread_mutexattr_destroy(pthread_mutexattr_t *) __attribute__((weak));
381 pthread_t pthread_self(void) __attribute__((weak));
382 #define PTHREAD_SYMBOLS \
383 (pthread_mutex_init && pthread_mutex_lock && pthread_mutex_unlock && \
384 pthread_mutex_destroy && pthread_mutexattr_init && \
385 pthread_mutexattr_settype && pthread_mutexattr_destroy && pthread_self)
387 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
389 typedef enum {
390 __itt_collection_normal = 0,
391 __itt_collection_paused = 1
392 } __itt_collection_state;
394 typedef enum {
395 __itt_thread_normal = 0,
396 __itt_thread_ignored = 1
397 } __itt_thread_state;
399 #pragma pack(push, 8)
401 typedef struct ___itt_thread_info {
402 const char *nameA; /*!< Copy of original name in ASCII. */
403 #if defined(UNICODE) || defined(_UNICODE)
404 const wchar_t *nameW; /*!< Copy of original name in UNICODE. */
405 #else /* UNICODE || _UNICODE */
406 void *nameW;
407 #endif /* UNICODE || _UNICODE */
408 TIDT tid;
409 __itt_thread_state state; /*!< Thread state (paused or normal) */
410 int extra1; /*!< Reserved to the runtime */
411 void *extra2; /*!< Reserved to the runtime */
412 struct ___itt_thread_info *next;
413 } __itt_thread_info;
415 #include "ittnotify_types.h" /* For __itt_group_id definition */
417 typedef struct ___itt_api_info_20101001 {
418 const char *name;
419 void **func_ptr;
420 void *init_func;
421 __itt_group_id group;
422 } __itt_api_info_20101001;
424 typedef struct ___itt_api_info {
425 const char *name;
426 void **func_ptr;
427 void *init_func;
428 void *null_func;
429 __itt_group_id group;
430 } __itt_api_info;
432 typedef struct __itt_counter_info {
433 const char *nameA; /*!< Copy of original name in ASCII. */
434 #if defined(UNICODE) || defined(_UNICODE)
435 const wchar_t *nameW; /*!< Copy of original name in UNICODE. */
436 #else /* UNICODE || _UNICODE */
437 void *nameW;
438 #endif /* UNICODE || _UNICODE */
439 const char *domainA; /*!< Copy of original name in ASCII. */
440 #if defined(UNICODE) || defined(_UNICODE)
441 const wchar_t *domainW; /*!< Copy of original name in UNICODE. */
442 #else /* UNICODE || _UNICODE */
443 void *domainW;
444 #endif /* UNICODE || _UNICODE */
445 int type;
446 long index;
447 int extra1; /*!< Reserved to the runtime */
448 void *extra2; /*!< Reserved to the runtime */
449 struct __itt_counter_info *next;
450 } __itt_counter_info_t;
452 struct ___itt_domain;
453 struct ___itt_string_handle;
454 struct ___itt_histogram;
456 typedef struct ___itt_global {
457 unsigned char magic[8];
458 unsigned long version_major;
459 unsigned long version_minor;
460 unsigned long version_build;
461 volatile long api_initialized;
462 volatile long mutex_initialized;
463 volatile long atomic_counter;
464 mutex_t mutex;
465 lib_t lib;
466 void *error_handler;
467 const char **dll_path_ptr;
468 __itt_api_info *api_list_ptr;
469 struct ___itt_global *next;
470 /* Joinable structures below */
471 __itt_thread_info *thread_list;
472 struct ___itt_domain *domain_list;
473 struct ___itt_string_handle *string_list;
474 __itt_collection_state state;
475 __itt_counter_info_t *counter_list;
476 unsigned int ipt_collect_events;
477 struct ___itt_histogram *histogram_list;
478 } __itt_global;
480 #pragma pack(pop)
482 #define NEW_THREAD_INFO_W(gptr, h, h_tail, t, s, n) \
484 h = (__itt_thread_info *)malloc(sizeof(__itt_thread_info)); \
485 if (h != NULL) { \
486 h->tid = t; \
487 h->nameA = NULL; \
488 h->nameW = n ? _wcsdup(n) : NULL; \
489 h->state = s; \
490 h->extra1 = 0; /* reserved */ \
491 h->extra2 = NULL; /* reserved */ \
492 h->next = NULL; \
493 if (h_tail == NULL) \
494 (gptr)->thread_list = h; \
495 else \
496 h_tail->next = h; \
500 #define NEW_THREAD_INFO_A(gptr, h, h_tail, t, s, n) \
502 h = (__itt_thread_info *)malloc(sizeof(__itt_thread_info)); \
503 if (h != NULL) { \
504 h->tid = t; \
505 h->nameA = n ? __itt_fstrdup(n) : NULL; \
506 h->nameW = NULL; \
507 h->state = s; \
508 h->extra1 = 0; /* reserved */ \
509 h->extra2 = NULL; /* reserved */ \
510 h->next = NULL; \
511 if (h_tail == NULL) \
512 (gptr)->thread_list = h; \
513 else \
514 h_tail->next = h; \
518 #define NEW_DOMAIN_W(gptr, h, h_tail, name) \
520 h = (__itt_domain *)malloc(sizeof(__itt_domain)); \
521 if (h != NULL) { \
522 h->flags = 1; /* domain is enabled by default */ \
523 h->nameA = NULL; \
524 h->nameW = name ? _wcsdup(name) : NULL; \
525 h->extra1 = 0; /* reserved */ \
526 h->extra2 = NULL; /* reserved */ \
527 h->next = NULL; \
528 if (h_tail == NULL) \
529 (gptr)->domain_list = h; \
530 else \
531 h_tail->next = h; \
535 #define NEW_DOMAIN_A(gptr, h, h_tail, name) \
537 h = (__itt_domain *)malloc(sizeof(__itt_domain)); \
538 if (h != NULL) { \
539 h->flags = 1; /* domain is enabled by default */ \
540 h->nameA = name ? __itt_fstrdup(name) : NULL; \
541 h->nameW = NULL; \
542 h->extra1 = 0; /* reserved */ \
543 h->extra2 = NULL; /* reserved */ \
544 h->next = NULL; \
545 if (h_tail == NULL) \
546 (gptr)->domain_list = h; \
547 else \
548 h_tail->next = h; \
552 #define NEW_STRING_HANDLE_W(gptr, h, h_tail, name) \
554 h = (__itt_string_handle *)malloc(sizeof(__itt_string_handle)); \
555 if (h != NULL) { \
556 h->strA = NULL; \
557 h->strW = name ? _wcsdup(name) : NULL; \
558 h->extra1 = 0; /* reserved */ \
559 h->extra2 = NULL; /* reserved */ \
560 h->next = NULL; \
561 if (h_tail == NULL) \
562 (gptr)->string_list = h; \
563 else \
564 h_tail->next = h; \
568 #define NEW_STRING_HANDLE_A(gptr, h, h_tail, name) \
570 h = (__itt_string_handle *)malloc(sizeof(__itt_string_handle)); \
571 if (h != NULL) { \
572 h->strA = name ? __itt_fstrdup(name) : NULL; \
573 h->strW = NULL; \
574 h->extra1 = 0; /* reserved */ \
575 h->extra2 = NULL; /* reserved */ \
576 h->next = NULL; \
577 if (h_tail == NULL) \
578 (gptr)->string_list = h; \
579 else \
580 h_tail->next = h; \
584 #define NEW_COUNTER_W(gptr, h, h_tail, name, domain, type) \
586 h = (__itt_counter_info_t *)malloc(sizeof(__itt_counter_info_t)); \
587 if (h != NULL) { \
588 h->nameA = NULL; \
589 h->nameW = name ? _wcsdup(name) : NULL; \
590 h->domainA = NULL; \
591 h->domainW = name ? _wcsdup(domain) : NULL; \
592 h->type = type; \
593 h->index = 0; \
594 h->next = NULL; \
595 if (h_tail == NULL) \
596 (gptr)->counter_list = h; \
597 else \
598 h_tail->next = h; \
602 #define NEW_COUNTER_A(gptr, h, h_tail, name, domain, type) \
604 h = (__itt_counter_info_t *)malloc(sizeof(__itt_counter_info_t)); \
605 if (h != NULL) { \
606 h->nameA = name ? __itt_fstrdup(name) : NULL; \
607 h->nameW = NULL; \
608 h->domainA = domain ? __itt_fstrdup(domain) : NULL; \
609 h->domainW = NULL; \
610 h->type = type; \
611 h->index = 0; \
612 h->next = NULL; \
613 if (h_tail == NULL) \
614 (gptr)->counter_list = h; \
615 else \
616 h_tail->next = h; \
620 #define NEW_HISTOGRAM_W(gptr, h, h_tail, domain, name, x_type, y_type) \
622 h = (__itt_histogram *)malloc(sizeof(__itt_histogram)); \
623 if (h != NULL) { \
624 h->domain = domain; \
625 h->nameA = NULL; \
626 h->nameW = name ? _wcsdup(name) : NULL; \
627 h->x_type = x_type; \
628 h->y_type = y_type; \
629 h->extra1 = 0; \
630 h->extra2 = NULL; \
631 if (h_tail == NULL) \
632 (gptr)->histogram_list = h; \
633 else \
634 h_tail->next = h; \
638 #define NEW_HISTOGRAM_A(gptr, h, h_tail, domain, name, x_type, y_type) \
640 h = (__itt_histogram *)malloc(sizeof(__itt_histogram)); \
641 if (h != NULL) { \
642 h->domain = domain; \
643 h->nameA = name ? __itt_fstrdup(name) : NULL; \
644 h->nameW = NULL; \
645 h->x_type = x_type; \
646 h->y_type = y_type; \
647 h->extra1 = 0; \
648 h->extra2 = NULL; \
649 if (h_tail == NULL) \
650 (gptr)->histogram_list = h; \
651 else \
652 h_tail->next = h; \
656 #endif /* _ITTNOTIFY_CONFIG_H_ */