Bug 1817727 - Disable test_filename_sanitize.js on mac because of permafailures....
[gecko.git] / js / src / vtune / ittnotify_config.h
blobf7ba01aa8ded6c64461d69834e49a95cf04becf7
1 /* <copyright>
2 This file is provided under a dual BSD/GPLv2 license. When using or
3 redistributing this file, you may do so under either license.
5 GPL LICENSE SUMMARY
7 Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of version 2 of the GNU General Public License as
11 published by the Free Software Foundation.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 The full GNU General Public License is included in this distribution
22 in the file called LICENSE.GPL.
24 Contact Information:
25 http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
27 BSD LICENSE
29 Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
30 All rights reserved.
32 Redistribution and use in source and binary forms, with or without
33 modification, are permitted provided that the following conditions
34 are met:
36 * Redistributions of source code must retain the above copyright
37 notice, this list of conditions and the following disclaimer.
38 * Redistributions in binary form must reproduce the above copyright
39 notice, this list of conditions and the following disclaimer in
40 the documentation and/or other materials provided with the
41 distribution.
42 * Neither the name of Intel Corporation nor the names of its
43 contributors may be used to endorse or promote products derived
44 from this software without specific prior written permission.
46 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
48 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
49 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
50 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 </copyright> */
58 #ifndef _ITTNOTIFY_CONFIG_H_
59 #define _ITTNOTIFY_CONFIG_H_
61 /** @cond exclude_from_documentation */
62 #ifndef ITT_OS_WIN
63 # define ITT_OS_WIN 1
64 #endif /* ITT_OS_WIN */
66 #ifndef ITT_OS_LINUX
67 # define ITT_OS_LINUX 2
68 #endif /* ITT_OS_LINUX */
70 #ifndef ITT_OS_MAC
71 # define ITT_OS_MAC 3
72 #endif /* ITT_OS_MAC */
74 #ifndef ITT_OS_FREEBSD
75 # define ITT_OS_FREEBSD 4
76 #endif /* ITT_OS_FREEBSD */
78 #ifndef ITT_OS
79 # if defined WIN32 || defined _WIN32
80 # define ITT_OS ITT_OS_WIN
81 # elif defined( __APPLE__ ) && defined( __MACH__ )
82 # define ITT_OS ITT_OS_MAC
83 # elif defined( __FreeBSD__ )
84 # define ITT_OS ITT_OS_FREEBSD
85 # else
86 # define ITT_OS ITT_OS_LINUX
87 # endif
88 #endif /* ITT_OS */
90 #ifndef ITT_PLATFORM_WIN
91 # define ITT_PLATFORM_WIN 1
92 #endif /* ITT_PLATFORM_WIN */
94 #ifndef ITT_PLATFORM_POSIX
95 # define ITT_PLATFORM_POSIX 2
96 #endif /* ITT_PLATFORM_POSIX */
98 #ifndef ITT_PLATFORM_MAC
99 # define ITT_PLATFORM_MAC 3
100 #endif /* ITT_PLATFORM_MAC */
102 #ifndef ITT_PLATFORM_FREEBSD
103 # define ITT_PLATFORM_FREEBSD 4
104 #endif /* ITT_PLATFORM_FREEBSD */
106 #ifndef ITT_PLATFORM
107 # if ITT_OS==ITT_OS_WIN
108 # define ITT_PLATFORM ITT_PLATFORM_WIN
109 # elif ITT_OS==ITT_OS_MAC
110 # define ITT_PLATFORM ITT_PLATFORM_MAC
111 # elif ITT_OS==ITT_OS_FREEBSD
112 # define ITT_PLATFORM ITT_PLATFORM_FREEBSD
113 # else
114 # define ITT_PLATFORM ITT_PLATFORM_POSIX
115 # endif
116 #endif /* ITT_PLATFORM */
118 #if defined(_UNICODE) && !defined(UNICODE)
119 #define UNICODE
120 #endif
122 #include <stddef.h>
123 #if ITT_PLATFORM==ITT_PLATFORM_WIN
124 #include <tchar.h>
125 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
126 #include <stdint.h>
127 #if defined(UNICODE) || defined(_UNICODE)
128 #include <wchar.h>
129 #endif /* UNICODE || _UNICODE */
130 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
132 #ifndef ITTAPI_CDECL
133 # if ITT_PLATFORM==ITT_PLATFORM_WIN
134 # define ITTAPI_CDECL __cdecl
135 # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
136 # if defined _M_IX86 || defined __i386__
137 # define ITTAPI_CDECL __attribute__ ((cdecl))
138 # else /* _M_IX86 || __i386__ */
139 # define ITTAPI_CDECL /* actual only on x86 platform */
140 # endif /* _M_IX86 || __i386__ */
141 # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
142 #endif /* ITTAPI_CDECL */
144 #ifndef STDCALL
145 # if ITT_PLATFORM==ITT_PLATFORM_WIN
146 # define STDCALL __stdcall
147 # else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
148 # if defined _M_IX86 || defined __i386__
149 # define STDCALL __attribute__ ((stdcall))
150 # else /* _M_IX86 || __i386__ */
151 # define STDCALL /* supported only on x86 platform */
152 # endif /* _M_IX86 || __i386__ */
153 # endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
154 #endif /* STDCALL */
156 #define ITTAPI ITTAPI_CDECL
157 #define LIBITTAPI ITTAPI_CDECL
159 /* TODO: Temporary for compatibility! */
160 #define ITTAPI_CALL ITTAPI_CDECL
161 #define LIBITTAPI_CALL ITTAPI_CDECL
163 #if ITT_PLATFORM==ITT_PLATFORM_WIN
164 /* use __forceinline (VC++ specific) */
165 #define ITT_INLINE __forceinline
166 #define ITT_INLINE_ATTRIBUTE /* nothing */
167 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
169 * Generally, functions are not inlined unless optimization is specified.
170 * For functions declared inline, this attribute inlines the function even
171 * if no optimization level was specified.
173 #ifdef __STRICT_ANSI__
174 #define ITT_INLINE static
175 #define ITT_INLINE_ATTRIBUTE __attribute__((unused))
176 #else /* __STRICT_ANSI__ */
177 #define ITT_INLINE static inline
178 #define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
179 #endif /* __STRICT_ANSI__ */
180 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
181 /** @endcond */
183 #ifndef ITT_ARCH_IA32
184 # define ITT_ARCH_IA32 1
185 #endif /* ITT_ARCH_IA32 */
187 #ifndef ITT_ARCH_IA32E
188 # define ITT_ARCH_IA32E 2
189 #endif /* ITT_ARCH_IA32E */
191 #ifndef ITT_ARCH_ARM
192 # define ITT_ARCH_ARM 4
193 #endif /* ITT_ARCH_ARM */
195 #ifndef ITT_ARCH_PPC64
196 # define ITT_ARCH_PPC64 5
197 #endif /* ITT_ARCH_PPC64 */
199 #ifndef ITT_ARCH
200 # if defined _M_IX86 || defined __i386__
201 # define ITT_ARCH ITT_ARCH_IA32
202 # elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
203 # define ITT_ARCH ITT_ARCH_IA32E
204 # elif defined _M_IA64 || defined __ia64__
205 # define ITT_ARCH ITT_ARCH_IA64
206 # elif defined _M_ARM || defined __arm__
207 # define ITT_ARCH ITT_ARCH_ARM
208 # elif defined __powerpc64__
209 # define ITT_ARCH ITT_ARCH_PPC64
210 # endif
211 #endif
213 #ifdef __cplusplus
214 # define ITT_EXTERN_C extern "C"
215 # define ITT_EXTERN_C_BEGIN extern "C" {
216 # define ITT_EXTERN_C_END }
217 #else
218 # define ITT_EXTERN_C /* nothing */
219 # define ITT_EXTERN_C_BEGIN /* nothing */
220 # define ITT_EXTERN_C_END /* nothing */
221 #endif /* __cplusplus */
223 #define ITT_TO_STR_AUX(x) #x
224 #define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
226 #define __ITT_BUILD_ASSERT(expr, suffix) do { \
227 static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
228 __itt_build_check_##suffix[0] = 0; \
229 } while(0)
230 #define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
231 #define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
233 #define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
235 /* Replace with snapshot date YYYYMMDD for promotion build. */
236 #define API_VERSION_BUILD 20151119
238 #ifndef API_VERSION_NUM
239 #define API_VERSION_NUM 0.0.0
240 #endif /* API_VERSION_NUM */
242 #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
243 " (" ITT_TO_STR(API_VERSION_BUILD) ")"
245 /* OS communication functions */
246 #if ITT_PLATFORM==ITT_PLATFORM_WIN
247 #include "util/WindowsWrapper.h"
248 typedef HMODULE lib_t;
249 typedef DWORD TIDT;
250 typedef CRITICAL_SECTION mutex_t;
251 #define MUTEX_INITIALIZER { 0 }
252 #define strong_alias(name, aliasname) /* empty for Windows */
253 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
254 #include <dlfcn.h>
255 #if defined(UNICODE) || defined(_UNICODE)
256 #include <wchar.h>
257 #endif /* UNICODE */
258 #ifndef _GNU_SOURCE
259 #define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
260 #endif /* _GNU_SOURCE */
261 #ifndef __USE_UNIX98
262 #define __USE_UNIX98 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein pthread.h missing dependency on __USE_XOPEN2K8 */
263 #endif /*__USE_UNIX98*/
264 #include <pthread.h>
265 typedef void* lib_t;
266 typedef pthread_t TIDT;
267 typedef pthread_mutex_t mutex_t;
268 #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
269 #define _strong_alias(name, aliasname) \
270 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
271 #define strong_alias(name, aliasname) _strong_alias(name, aliasname)
272 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
274 #if ITT_PLATFORM==ITT_PLATFORM_WIN
275 #define __itt_get_proc(lib, name) GetProcAddress(lib, name)
276 #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
277 #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
278 #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
279 #define __itt_load_lib(name) LoadLibraryA(name)
280 #define __itt_unload_lib(handle) FreeLibrary(handle)
281 #define __itt_system_error() (int)GetLastError()
282 #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
283 #define __itt_fstrnlen(s, l) strnlen_s(s, l)
284 #define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l)
285 #define __itt_fstrdup(s) _strdup(s)
286 #define __itt_thread_id() GetCurrentThreadId()
287 #define __itt_thread_yield() SwitchToThread()
288 #ifndef ITT_SIMPLE_INIT
289 ITT_INLINE long
290 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
291 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
293 return InterlockedIncrement(ptr);
295 #endif /* ITT_SIMPLE_INIT */
297 #define DL_SYMBOLS (1)
298 #define PTHREAD_SYMBOLS (1)
300 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
301 #define __itt_get_proc(lib, name) dlsym(lib, name)
302 #define __itt_mutex_init(mutex) {\
303 pthread_mutexattr_t mutex_attr; \
304 int error_code = pthread_mutexattr_init(&mutex_attr); \
305 if (error_code) \
306 __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
307 error_code); \
308 error_code = pthread_mutexattr_settype(&mutex_attr, \
309 PTHREAD_MUTEX_RECURSIVE); \
310 if (error_code) \
311 __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
312 error_code); \
313 error_code = pthread_mutex_init(mutex, &mutex_attr); \
314 if (error_code) \
315 __itt_report_error(__itt_error_system, "pthread_mutex_init", \
316 error_code); \
317 error_code = pthread_mutexattr_destroy(&mutex_attr); \
318 if (error_code) \
319 __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
320 error_code); \
322 #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
323 #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
324 #define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
325 #define __itt_unload_lib(handle) dlclose(handle)
326 #define __itt_system_error() errno
327 #define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
329 /* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */
330 #ifdef SDL_STRNLEN_S
331 #define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l)
332 #else
333 #define __itt_fstrnlen(s, l) strlen(s)
334 #endif /* SDL_STRNLEN_S */
335 #ifdef SDL_STRNCPY_S
336 #define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
337 #else
338 #define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, l)
339 #endif /* SDL_STRNCPY_S */
341 #define __itt_fstrdup(s) strdup(s)
342 #define __itt_thread_id() pthread_self()
343 #define __itt_thread_yield() sched_yield()
344 #if ITT_ARCH==ITT_ARCH_IA64
345 #ifdef __INTEL_COMPILER
346 #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
347 #else /* __INTEL_COMPILER */
348 /* TODO: Add Support for not Intel compilers for IA-64 architecture */
349 #endif /* __INTEL_COMPILER */
350 #elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */
351 ITT_INLINE long
352 __TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE;
353 ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
355 long result;
356 __asm__ __volatile__("lock\nxadd %0,%1"
357 : "=r"(result),"=m"(*(int*)ptr)
358 : "0"(addend), "m"(*(int*)ptr)
359 : "memory");
360 return result;
362 #elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
363 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
364 #endif /* ITT_ARCH==ITT_ARCH_IA64 */
365 #ifndef ITT_SIMPLE_INIT
366 ITT_INLINE long
367 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
368 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
370 return __TBB_machine_fetchadd4(ptr, 1) + 1L;
372 #endif /* ITT_SIMPLE_INIT */
374 void* dlopen(const char*, int);
375 void* dlsym(void*, const char*);
376 int dlclose(void*);
377 #define DL_SYMBOLS (1)
379 int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
380 int pthread_mutex_lock(pthread_mutex_t*);
381 int pthread_mutex_unlock(pthread_mutex_t*);
382 int pthread_mutex_destroy(pthread_mutex_t*);
383 int pthread_mutexattr_init(pthread_mutexattr_t*);
384 int pthread_mutexattr_settype(pthread_mutexattr_t*, int);
385 int pthread_mutexattr_destroy(pthread_mutexattr_t*);
386 pthread_t pthread_self(void);
387 #define PTHREAD_SYMBOLS (1)
389 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
391 typedef enum {
392 __itt_collection_normal = 0,
393 __itt_collection_paused = 1
394 } __itt_collection_state;
396 typedef enum {
397 __itt_thread_normal = 0,
398 __itt_thread_ignored = 1
399 } __itt_thread_state;
401 #pragma pack(push, 8)
403 typedef struct ___itt_thread_info
405 const char* nameA; /*!< Copy of original name in ASCII. */
406 #if defined(UNICODE) || defined(_UNICODE)
407 const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
408 #else /* UNICODE || _UNICODE */
409 void* nameW;
410 #endif /* UNICODE || _UNICODE */
411 TIDT tid;
412 __itt_thread_state state; /*!< Thread state (paused or normal) */
413 int extra1; /*!< Reserved to the runtime */
414 void* extra2; /*!< Reserved to the runtime */
415 struct ___itt_thread_info* next;
416 } __itt_thread_info;
418 #include "vtune/ittnotify_types.h" /* For __itt_group_id definition */
420 typedef struct ___itt_api_info_20101001
422 const char* name;
423 void** func_ptr;
424 void* init_func;
425 __itt_group_id group;
426 } __itt_api_info_20101001;
428 typedef struct ___itt_api_info
430 const char* name;
431 void** func_ptr;
432 void* init_func;
433 void* null_func;
434 __itt_group_id group;
435 } __itt_api_info;
437 typedef struct __itt_counter_info
439 const char* nameA; /*!< Copy of original name in ASCII. */
440 #if defined(UNICODE) || defined(_UNICODE)
441 const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
442 #else /* UNICODE || _UNICODE */
443 void* nameW;
444 #endif /* UNICODE || _UNICODE */
445 const char* domainA; /*!< Copy of original name in ASCII. */
446 #if defined(UNICODE) || defined(_UNICODE)
447 const wchar_t* domainW; /*!< Copy of original name in UNICODE. */
448 #else /* UNICODE || _UNICODE */
449 void* domainW;
450 #endif /* UNICODE || _UNICODE */
451 unsigned type;
452 long index;
453 int extra1; /*!< Reserved to the runtime */
454 void* extra2; /*!< Reserved to the runtime */
455 struct __itt_counter_info* next;
456 } __itt_counter_info_t;
458 struct ___itt_domain;
459 struct ___itt_string_handle;
461 typedef struct ___itt_global
463 unsigned char magic[8];
464 unsigned long version_major;
465 unsigned long version_minor;
466 unsigned long version_build;
467 volatile long api_initialized;
468 volatile long mutex_initialized;
469 volatile long atomic_counter;
470 mutex_t mutex;
471 lib_t lib;
472 void* error_handler;
473 const char** dll_path_ptr;
474 __itt_api_info* api_list_ptr;
475 struct ___itt_global* next;
476 /* Joinable structures below */
477 __itt_thread_info* thread_list;
478 struct ___itt_domain* domain_list;
479 struct ___itt_string_handle* string_list;
480 __itt_collection_state state;
481 __itt_counter_info_t* counter_list;
482 } __itt_global;
484 #pragma pack(pop)
486 #define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
487 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
488 if (h != NULL) { \
489 h->tid = t; \
490 h->nameA = NULL; \
491 h->nameW = n ? _wcsdup(n) : NULL; \
492 h->state = s; \
493 h->extra1 = 0; /* reserved */ \
494 h->extra2 = NULL; /* reserved */ \
495 h->next = NULL; \
496 if (h_tail == NULL) \
497 (gptr)->thread_list = h; \
498 else \
499 h_tail->next = h; \
503 #define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
504 h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
505 if (h != NULL) { \
506 h->tid = t; \
507 h->nameA = n ? __itt_fstrdup(n) : NULL; \
508 h->nameW = NULL; \
509 h->state = s; \
510 h->extra1 = 0; /* reserved */ \
511 h->extra2 = NULL; /* reserved */ \
512 h->next = NULL; \
513 if (h_tail == NULL) \
514 (gptr)->thread_list = h; \
515 else \
516 h_tail->next = h; \
520 #define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
521 h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
522 if (h != NULL) { \
523 h->flags = 1; /* domain is enabled by default */ \
524 h->nameA = NULL; \
525 h->nameW = name ? _wcsdup(name) : NULL; \
526 h->extra1 = 0; /* reserved */ \
527 h->extra2 = NULL; /* reserved */ \
528 h->next = NULL; \
529 if (h_tail == NULL) \
530 (gptr)->domain_list = h; \
531 else \
532 h_tail->next = h; \
536 #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) { \
553 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
554 if (h != NULL) { \
555 h->strA = NULL; \
556 h->strW = name ? _wcsdup(name) : NULL; \
557 h->extra1 = 0; /* reserved */ \
558 h->extra2 = NULL; /* reserved */ \
559 h->next = NULL; \
560 if (h_tail == NULL) \
561 (gptr)->string_list = h; \
562 else \
563 h_tail->next = h; \
567 #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
568 h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
569 if (h != NULL) { \
570 h->strA = name ? __itt_fstrdup(name) : NULL; \
571 h->strW = NULL; \
572 h->extra1 = 0; /* reserved */ \
573 h->extra2 = NULL; /* reserved */ \
574 h->next = NULL; \
575 if (h_tail == NULL) \
576 (gptr)->string_list = h; \
577 else \
578 h_tail->next = h; \
582 #define NEW_COUNTER_W(gptr,h,h_tail,name,domain,type) { \
583 h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
584 if (h != NULL) { \
585 h->nameA = NULL; \
586 h->nameW = name ? _wcsdup(name) : NULL; \
587 h->domainA = NULL; \
588 h->domainW = name ? _wcsdup(domain) : NULL; \
589 h->type = type; \
590 h->index = 0; \
591 h->next = NULL; \
592 if (h_tail == NULL) \
593 (gptr)->counter_list = h; \
594 else \
595 h_tail->next = h; \
599 #define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \
600 h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
601 if (h != NULL) { \
602 h->nameA = name ? __itt_fstrdup(name) : NULL; \
603 h->nameW = NULL; \
604 h->domainA = domain ? __itt_fstrdup(domain) : NULL; \
605 h->domainW = NULL; \
606 h->type = type; \
607 h->index = 0; \
608 h->next = NULL; \
609 if (h_tail == NULL) \
610 (gptr)->counter_list = h; \
611 else \
612 h_tail->next = h; \
616 #endif /* _ITTNOTIFY_CONFIG_H_ */