Go to the documentation of this file.
19 #ifndef GRPC_SUPPORT_PORT_PLATFORM_H
20 #define GRPC_SUPPORT_PORT_PLATFORM_H
23 #if __cplusplus >= 201402L
24 #define GRPC_DEPRECATED(reason) [[deprecated(reason)]]
26 #define GRPC_DEPRECATED(reason)
27 #endif // __cplusplus >= 201402L
32 #ifndef GPR_ABSEIL_SYNC
33 #if defined(__APPLE__)
37 #define GPR_ABSEIL_SYNC 1
39 #endif // GPR_ABSEIL_SYNC
42 #if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
43 #ifndef WIN32_LEAN_AND_MEAN
44 #define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
45 #define WIN32_LEAN_AND_MEAN
67 #if !defined(GRPC_DLL)
68 #if defined(GRPC_DLL_EXPORTS)
69 #define GRPC_DLL __declspec(dllexport)
70 #elif defined(GRPC_DLL_IMPORTS)
71 #define GRPC_DLL __declspec(dllimport)
74 #endif // defined(GRPC_DLL_EXPORTS)
78 #if !defined(GRPCXX_DLL)
79 #if defined(GRPCXX_DLL_EXPORTS)
80 #define GRPCXX_DLL __declspec(dllexport)
81 #elif defined(GRPCXX_DLL_IMPORTS)
82 #define GRPCXX_DLL __declspec(dllimport)
85 #endif // defined(GRPCXX_DLL_EXPORTS)
90 #if defined(GPR_DLL_EXPORTS)
91 #define GPR_DLL __declspec(dllexport)
92 #elif defined(GPR_DLL_IMPORTS)
93 #define GPR_DLL __declspec(dllimport)
96 #endif // defined(GPR_DLL_EXPORTS)
100 #define GRPC_NOMINMX_WAS_NOT_DEFINED
108 "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
110 #if (_WIN32_WINNT < 0x0600)
112 "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
115 #ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
116 #undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
117 #undef WIN32_LEAN_AND_MEAN
120 #ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED
121 #undef GRPC_NOMINMAX_WAS_NOT_DEFINED
135 #if !defined(GPR_NO_AUTODETECT_PLATFORM)
136 #if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
137 #if defined(_WIN64) || defined(WIN64)
138 #define GPR_ARCH_64 1
140 #define GPR_ARCH_32 1
142 #define GPR_PLATFORM_STRING "windows"
143 #define GPR_WINDOWS 1
144 #define GPR_WINDOWS_SUBPROCESS 1
145 #define GPR_WINDOWS_ENV
147 #define GPR_GETPID_IN_UNISTD_H 1
148 #define GPR_MSYS_TMPFILE
149 #define GPR_POSIX_LOG
150 #define GPR_POSIX_STRING
151 #define GPR_POSIX_TIME
153 #define GPR_GETPID_IN_PROCESS_H 1
154 #define GPR_WINDOWS_TMPFILE
155 #define GPR_WINDOWS_LOG
156 #define GPR_WINDOWS_CRASH_HANDLER 1
157 #define GPR_WINDOWS_STAT
158 #define GPR_WINDOWS_STRING
159 #define GPR_WINDOWS_TIME
162 #define GPR_GCC_ATOMIC 1
164 #define GPR_WINDOWS_ATOMIC 1
166 #elif defined(ANDROID) || defined(__ANDROID__)
167 #define GPR_PLATFORM_STRING "android"
168 #define GPR_ANDROID 1
169 #ifndef __ANDROID_API__
170 #error "__ANDROID_API__ must be defined for Android builds."
172 #if __ANDROID_API__ < 21
173 #error "Requires Android API v21 and above"
180 #define GPR_ARCH_64 1
182 #define GPR_ARCH_32 1
184 #define GPR_CPU_POSIX 1
185 #define GPR_GCC_SYNC 1
186 #define GPR_POSIX_ENV 1
187 #define GPR_POSIX_TMPFILE 1
188 #define GPR_POSIX_STAT 1
189 #define GPR_ANDROID_LOG 1
190 #define GPR_POSIX_STRING 1
191 #define GPR_POSIX_SUBPROCESS 1
192 #define GPR_POSIX_SYNC 1
193 #define GPR_POSIX_TIME 1
194 #define GPR_HAS_PTHREAD_H 1
195 #define GPR_GETPID_IN_UNISTD_H 1
196 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
197 #if defined(__has_include)
198 #if __has_include(<android/ndk-version.h>)
199 #include <android/ndk-version.h>
202 #include <linux/version.h>
203 #elif defined(__linux__)
204 #define GPR_PLATFORM_STRING "linux"
208 #ifndef _DEFAULT_SOURCE
209 #define _DEFAULT_SOURCE
214 #include <features.h>
215 #define GPR_CPU_LINUX 1
216 #define GPR_GCC_ATOMIC 1
218 #define GPR_LINUX_LOG
219 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
220 #define GPR_LINUX_ENV 1
221 #define GPR_POSIX_TMPFILE 1
222 #define GPR_POSIX_STAT 1
223 #define GPR_POSIX_STRING 1
224 #define GPR_POSIX_SUBPROCESS 1
225 #define GPR_POSIX_SYNC 1
226 #define GPR_POSIX_TIME 1
227 #define GPR_HAS_PTHREAD_H 1
228 #define GPR_GETPID_IN_UNISTD_H 1
230 #define GPR_ARCH_64 1
232 #define GPR_ARCH_32 1
235 #define GPR_POSIX_CRASH_HANDLER 1
236 #ifdef __GLIBC_PREREQ
237 #if __GLIBC_PREREQ(2, 12)
238 #define GPR_LINUX_PTHREAD_NAME 1
242 #define GPR_LINUX_PTHREAD_NAME 1
244 #include <linux/version.h>
246 #define GPR_MUSL_LIBC_COMPAT 1
248 #elif defined(__ASYLO__)
249 #define GPR_ARCH_64 1
250 #define GPR_CPU_POSIX 1
251 #define GPR_PLATFORM_STRING "asylo"
252 #define GPR_GCC_SYNC 1
253 #define GPR_POSIX_STAT 1
254 #define GPR_POSIX_SYNC 1
255 #define GPR_POSIX_STRING 1
256 #define GPR_POSIX_LOG 1
257 #define GPR_POSIX_TIME 1
258 #define GPR_POSIX_ENV 1
260 #define GRPC_POSIX_SOCKET 1
261 #define GRPC_POSIX_SOCKETADDR
262 #define GRPC_POSIX_SOCKETUTILS 1
263 #define GRPC_TIMER_USE_GENERIC 1
264 #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
265 #define GRPC_POSIX_WAKEUP_FD 1
266 #define GRPC_HAVE_MSG_NOSIGNAL 1
267 #define GRPC_HAVE_UNIX_SOCKET 1
269 #define GPR_NO_AUTODETECT_PLATFORM 1
270 #elif defined(__APPLE__)
271 #include <Availability.h>
272 #include <TargetConditionals.h>
277 #define GPR_PLATFORM_STRING "ios"
278 #define GPR_CPU_IPHONE 1
279 #define GRPC_CFSTREAM 1
280 #ifndef GRPC_IOS_EVENT_ENGINE_CLIENT
281 #define GRPC_IOS_EVENT_ENGINE_CLIENT 1
286 #define GPR_PLATFORM_STRING "osx"
287 #define GPR_CPU_POSIX 1
288 #define GPR_POSIX_CRASH_HANDLER 1
291 #define GPR_GCC_ATOMIC 1
292 #define GPR_POSIX_LOG 1
293 #define GPR_POSIX_ENV 1
294 #define GPR_POSIX_TMPFILE 1
295 #define GPR_POSIX_STAT 1
296 #define GPR_POSIX_STRING 1
297 #define GPR_POSIX_SUBPROCESS 1
298 #define GPR_POSIX_SYNC 1
299 #define GPR_POSIX_TIME 1
300 #define GPR_HAS_PTHREAD_H 1
301 #define GPR_GETPID_IN_UNISTD_H 1
302 #ifndef GRPC_CFSTREAM
303 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
306 #define GPR_ARCH_64 1
308 #define GPR_ARCH_32 1
310 #elif defined(__FreeBSD__)
311 #define GPR_PLATFORM_STRING "freebsd"
315 #define GPR_FREEBSD 1
316 #define GPR_CPU_POSIX 1
317 #define GPR_GCC_ATOMIC 1
318 #define GPR_POSIX_LOG 1
319 #define GPR_POSIX_ENV 1
320 #define GPR_POSIX_TMPFILE 1
321 #define GPR_POSIX_STAT 1
322 #define GPR_POSIX_STRING 1
323 #define GPR_POSIX_SUBPROCESS 1
324 #define GPR_POSIX_SYNC 1
325 #define GPR_POSIX_TIME 1
326 #define GPR_HAS_PTHREAD_H 1
327 #define GPR_GETPID_IN_UNISTD_H 1
328 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
330 #define GPR_ARCH_64 1
332 #define GPR_ARCH_32 1
334 #elif defined(__OpenBSD__)
335 #define GPR_PLATFORM_STRING "openbsd"
339 #define GPR_OPENBSD 1
340 #define GPR_CPU_POSIX 1
341 #define GPR_GCC_ATOMIC 1
342 #define GPR_POSIX_LOG 1
343 #define GPR_POSIX_ENV 1
344 #define GPR_POSIX_TMPFILE 1
345 #define GPR_POSIX_STAT 1
346 #define GPR_POSIX_STRING 1
347 #define GPR_POSIX_SUBPROCESS 1
348 #define GPR_POSIX_SYNC 1
349 #define GPR_POSIX_TIME 1
350 #define GPR_HAS_PTHREAD_H 1
351 #define GPR_GETPID_IN_UNISTD_H 1
352 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
354 #define GPR_ARCH_64 1
356 #define GPR_ARCH_32 1
358 #elif defined(__sun) && defined(__SVR4)
359 #define GPR_PLATFORM_STRING "solaris"
360 #define GPR_SOLARIS 1
361 #define GPR_CPU_POSIX 1
362 #define GPR_GCC_ATOMIC 1
363 #define GPR_POSIX_LOG 1
364 #define GPR_POSIX_ENV 1
365 #define GPR_POSIX_TMPFILE 1
366 #define GPR_POSIX_STAT 1
367 #define GPR_POSIX_STRING 1
368 #define GPR_POSIX_SUBPROCESS 1
369 #define GPR_POSIX_SYNC 1
370 #define GPR_POSIX_TIME 1
371 #define GPR_HAS_PTHREAD_H 1
372 #define GPR_GETPID_IN_UNISTD_H 1
374 #define GPR_ARCH_64 1
376 #define GPR_ARCH_32 1
379 #define GPR_PLATFORM_STRING "aix"
384 #define GPR_CPU_POSIX 1
385 #define GPR_GCC_ATOMIC 1
386 #define GPR_POSIX_LOG 1
387 #define GPR_POSIX_ENV 1
388 #define GPR_POSIX_TMPFILE 1
389 #define GPR_POSIX_STAT 1
390 #define GPR_POSIX_STRING 1
391 #define GPR_POSIX_SUBPROCESS 1
392 #define GPR_POSIX_SYNC 1
393 #define GPR_POSIX_TIME 1
394 #define GPR_HAS_PTHREAD_H 1
395 #define GPR_GETPID_IN_UNISTD_H 1
397 #define GPR_ARCH_64 1
399 #define GPR_ARCH_32 1
401 #elif defined(__NetBSD__)
404 #define GPR_PLATFORM_STRING "netbsd"
409 #define GPR_CPU_POSIX 1
410 #define GPR_GCC_ATOMIC 1
411 #define GPR_GCC_TLS 1
412 #define GPR_POSIX_LOG 1
413 #define GPR_POSIX_ENV 1
414 #define GPR_POSIX_TMPFILE 1
415 #define GPR_POSIX_STAT 1
416 #define GPR_POSIX_STRING 1
417 #define GPR_POSIX_SUBPROCESS 1
418 #define GPR_POSIX_SYNC 1
419 #define GPR_POSIX_TIME 1
420 #define GPR_GETPID_IN_UNISTD_H 1
421 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
423 #define GPR_ARCH_64 1
425 #define GPR_ARCH_32 1
427 #elif defined(__native_client__)
428 #define GPR_PLATFORM_STRING "nacl"
432 #ifndef _DEFAULT_SOURCE
433 #define _DEFAULT_SOURCE
439 #define GPR_CPU_POSIX 1
440 #define GPR_GCC_ATOMIC 1
441 #define GPR_POSIX_LOG 1
442 #define GPR_POSIX_ENV 1
443 #define GPR_POSIX_TMPFILE 1
444 #define GPR_POSIX_STAT 1
445 #define GPR_POSIX_STRING 1
446 #define GPR_POSIX_SUBPROCESS 1
447 #define GPR_POSIX_SYNC 1
448 #define GPR_POSIX_TIME 1
449 #define GPR_HAS_PTHREAD_H 1
450 #define GPR_GETPID_IN_UNISTD_H 1
452 #define GPR_ARCH_64 1
454 #define GPR_ARCH_32 1
456 #elif defined(__Fuchsia__)
458 #define GPR_FUCHSIA 1
459 #define GPR_ARCH_64 1
460 #define GPR_PLATFORM_STRING "fuchsia"
461 #include <features.h>
464 #define GPR_MUSL_LIBC_COMPAT 1
465 #define GPR_CPU_POSIX 1
466 #define GPR_GCC_ATOMIC 1
467 #define GPR_POSIX_LOG 1
468 #define GPR_POSIX_SYNC 1
469 #define GPR_POSIX_ENV 1
470 #define GPR_POSIX_TMPFILE 1
471 #define GPR_POSIX_STAT 1
472 #define GPR_POSIX_SUBPROCESS 1
473 #define GPR_POSIX_SYNC 1
474 #define GPR_POSIX_STRING 1
475 #define GPR_POSIX_TIME 1
476 #define GPR_HAS_PTHREAD_H 1
477 #define GPR_GETPID_IN_UNISTD_H 1
478 #define GRPC_ROOT_PEM_PATH "/config/ssl/cert.pem"
479 #elif defined(__HAIKU__)
480 #define GPR_PLATFORM_STRING "haiku"
487 #define GPR_CPU_POSIX 1
488 #define GPR_GCC_ATOMIC 1
489 #define GPR_POSIX_LOG 1
490 #define GPR_POSIX_ENV 1
491 #define GPR_POSIX_TMPFILE 1
492 #define GPR_POSIX_STAT 1
493 #define GPR_POSIX_STRING 1
494 #define GPR_POSIX_SUBPROCESS 1
495 #define GPR_POSIX_SYNC 1
496 #define GPR_POSIX_TIME 1
497 #define GPR_HAS_PTHREAD_H 1
498 #define GPR_GETPID_IN_UNISTD_H 1
499 #define GPR_SUPPORT_CHANNELS_FROM_FD 1
501 #define GPR_ARCH_64 1
503 #define GPR_ARCH_32 1
505 #elif defined(__QNX__) || defined(__QNXNTO__)
506 #define GPR_PLATFORM_STRING "qnx"
507 #define GPR_CPU_POSIX 1
508 #define GPR_GCC_ATOMIC 1
509 #define GPR_POSIX_LOG 1
510 #define GPR_POSIX_ENV 1
511 #define GPR_POSIX_TMPFILE 1
512 #define GPR_POSIX_STAT 1
513 #define GPR_POSIX_STRING 1
514 #define GPR_POSIX_SYNC 1
515 #define GPR_POSIX_TIME 1
516 #define GPR_HAS_PTHREAD_H 1
517 #define GPR_GETPID_IN_UNISTD_H 1
519 #define GPR_ARCH_64 1
521 #define GPR_ARCH_32 1
524 #error "Could not auto-detect platform"
528 #if defined(__has_include)
529 #if __has_include(<atomic>)
530 #define GRPC_HAS_CXX11_ATOMIC
534 #ifndef GPR_PLATFORM_STRING
535 #warning "GPR_PLATFORM_STRING not auto-detected"
536 #define GPR_PLATFORM_STRING "unknown"
540 #undef GPR_FORBID_UNREACHABLE_CODE
541 #define GPR_FORBID_UNREACHABLE_CODE 1
546 typedef __int8 int8_t;
547 typedef __int16 int16_t;
548 typedef __int32 int32_t;
549 typedef __int64 int64_t;
550 typedef unsigned __int8 uint8_t;
551 typedef unsigned __int16 uint16_t;
552 typedef unsigned __int32 uint32_t;
553 typedef unsigned __int64 uint64_t;
573 #define GPR_CYCLE_COUNTER_FALLBACK 1
575 #define GPR_CYCLE_COUNTER_FALLBACK 1
579 #ifndef GPR_CACHELINE_SIZE_LOG
580 #if defined(__i386__) || defined(__x86_64__)
581 #define GPR_CACHELINE_SIZE_LOG 6
583 #ifndef GPR_CACHELINE_SIZE_LOG
586 #define GPR_CACHELINE_SIZE_LOG 6
590 #define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG)
593 #if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED)
594 #undef GPR_GCC_ATOMIC
595 #define GPR_GCC_SYNC 1
599 #if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
600 defined(GPR_WINDOWS_ATOMIC) != \
602 #error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WINDOWS_ATOMIC
605 #if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1
606 #error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
609 #if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WINDOWS) + \
610 defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
612 #error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WINDOWS, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
617 #define GPR_MAX_ALIGNMENT 16
623 #ifndef GRPC_IF_NAMETOINDEX
624 #define GRPC_IF_NAMETOINDEX 1
628 #if defined(__GNUC__) && !defined(__MINGW32__)
629 #define GRPC_UNUSED __attribute__((unused))
635 #ifndef GPR_PRINT_FORMAT_CHECK
637 #define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \
638 __attribute__((format(printf, FORMAT_STR, ARGS)))
640 #define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
644 #ifndef GPR_HAS_CPP_ATTRIBUTE
645 #ifdef __has_cpp_attribute
646 #define GPR_HAS_CPP_ATTRIBUTE(a) __has_cpp_attribute(a)
648 #define GPR_HAS_CPP_ATTRIBUTE(a) 0
652 #if defined(__GNUC__) && !defined(__MINGW32__)
653 #define GPR_ALIGN_STRUCT(n) __attribute__((aligned(n)))
655 #define GPR_ALIGN_STRUCT(n)
658 #ifndef GRPC_MUST_USE_RESULT
659 #if GPR_HAS_CPP_ATTRIBUTE(nodiscard)
660 #define GRPC_MUST_USE_RESULT [[nodiscard]]
661 #elif defined(__GNUC__) && !defined(__MINGW32__)
662 #define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))
664 #define GRPC_MUST_USE_RESULT
666 #ifdef USE_STRICT_WARNING
675 #define GRPC_MUST_USE_RESULT_WHEN_USE_STRICT_WARNING GRPC_MUST_USE_RESULT
677 #define GRPC_MUST_USE_RESULT_WHEN_USE_STRICT_WARNING
681 #ifndef GRPC_REINITIALIZES
682 #if defined(__clang__)
683 #if GPR_HAS_CPP_ATTRIBUTE(clang::reinitializes)
684 #define GRPC_REINITIALIZES [[clang::reinitializes]]
686 #define GRPC_REINITIALIZES
689 #define GRPC_REINITIALIZES
693 #ifndef GPR_HAS_ATTRIBUTE
694 #ifdef __has_attribute
695 #define GPR_HAS_ATTRIBUTE(a) __has_attribute(a)
697 #define GPR_HAS_ATTRIBUTE(a) 0
701 #if GPR_HAS_ATTRIBUTE(noreturn)
702 #define GPR_ATTRIBUTE_NORETURN __attribute__((noreturn))
704 #define GPR_ATTRIBUTE_NORETURN
707 #if defined(GPR_FORBID_UNREACHABLE_CODE) && GPR_FORBID_UNREACHABLE_CODE
708 #define GPR_UNREACHABLE_CODE(STATEMENT)
718 #define GPR_UNREACHABLE_CODE(STATEMENT) \
720 gpr_unreachable_code(#STATEMENT, __FILE__, __LINE__); \
730 #define GRPCAPI GPRAPI
734 #define CENSUSAPI GRPCAPI
737 #ifndef GPR_HAS_FEATURE
739 #define GPR_HAS_FEATURE(a) __has_feature(a)
741 #define GPR_HAS_FEATURE(a) 0
745 #ifndef GPR_ATTRIBUTE_NOINLINE
746 #if GPR_HAS_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__))
747 #define GPR_ATTRIBUTE_NOINLINE __attribute__((noinline))
748 #define GPR_HAS_ATTRIBUTE_NOINLINE 1
750 #define GPR_ATTRIBUTE_NOINLINE
754 #ifndef GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
756 #if GPR_HAS_CPP_ATTRIBUTE(clang::always_inline)
757 #define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION [[clang::always_inline]]
758 #elif GPR_HAS_ATTRIBUTE(always_inline)
759 #define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION __attribute__((always_inline))
762 #define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
766 #define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
770 #ifndef GPR_NO_UNIQUE_ADDRESS
771 #if GPR_HAS_CPP_ATTRIBUTE(no_unique_address)
772 #define GPR_NO_UNIQUE_ADDRESS [[no_unique_address]]
774 #define GPR_NO_UNIQUE_ADDRESS
778 #ifndef GRPC_DEPRECATED
779 #if GPR_HAS_CPP_ATTRIBUTE(deprecated)
780 #define GRPC_DEPRECATED(reason) [[deprecated(reason)]]
782 #define GRPC_DEPRECATED(reason)
786 #ifndef GPR_ATTRIBUTE_WEAK
789 #if (GPR_HAS_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__))) && \
790 !(defined(__llvm__) && defined(_WIN32))
791 #define GPR_ATTRIBUTE_WEAK __attribute__((weak))
792 #define GPR_HAS_ATTRIBUTE_WEAK 1
794 #define GPR_ATTRIBUTE_WEAK
798 #ifndef GPR_ATTRIBUTE_NO_TSAN
799 #if GPR_HAS_FEATURE(thread_sanitizer)
800 #define GPR_ATTRIBUTE_NO_TSAN __attribute__((no_sanitize("thread")))
802 #ifndef GPR_ATTRIBUTE_NO_TSAN
803 #define GPR_ATTRIBUTE_NO_TSAN
808 #ifndef GRPC_TSAN_SUPPRESSED
809 #if defined(__SANITIZE_THREAD__)
810 #define GRPC_TSAN_ENABLED
811 #elif GPR_HAS_FEATURE(thread_sanitizer)
812 #define GRPC_TSAN_ENABLED
817 #ifndef GRPC_ASAN_SUPPRESSED
818 #if defined(__SANITIZE_ADDRESS__)
819 #define GRPC_ASAN_ENABLED
820 #elif GPR_HAS_FEATURE(address_sanitizer)
821 #define GRPC_ASAN_ENABLED
826 #ifndef GRPC_ALLOW_EXCEPTIONS
828 #if defined(_MSC_VER) && defined(_CPPUNWIND)
829 #define GRPC_ALLOW_EXCEPTIONS 1
830 #elif defined(__EXCEPTIONS)
831 #define GRPC_ALLOW_EXCEPTIONS 1
833 #define GRPC_ALLOW_EXCEPTIONS 0
837 #define GRPC_ALLOW_EXCEPTIONS 1
839 #define GRPC_ALLOW_EXCEPTIONS 0
845 #define GRPC_HAS_BUILTIN(a) __has_builtin(a)
847 #define GRPC_HAS_BUILTIN(a) 0
854 #define GPR_LIKELY(x) __builtin_expect((x), 1)
855 #define GPR_UNLIKELY(x) __builtin_expect((x), 0)
857 #define GPR_LIKELY(x) (x)
858 #define GPR_UNLIKELY(x) (x)
861 #ifndef __STDC_FORMAT_MACROS
862 #define __STDC_FORMAT_MACROS
870 #ifndef GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND
872 #define GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND __declspec(empty_bases)
874 #define GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND
878 #define GRPC_CALLBACK_API_NONEXPERIMENTAL
885 #if __clang__ && __clang_major__ <= 12 && __has_feature(memory_sanitizer)
886 #undef GPR_NO_UNIQUE_ADDRESS
887 #define GPR_NO_UNIQUE_ADDRESS