diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc index c5c2ef552f06..a97a70937a43 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc @@ -20,11 +20,11 @@ extern "C" void *__libc_malloc(__sanitizer::uptr size); extern "C" void __libc_free(void *ptr); # define LIBC_MALLOC __libc_malloc # define LIBC_FREE __libc_free -#else // __linux__ && !ANDROID +#else // SANITIZER_LINUX && !SANITIZER_ANDROID # include # define LIBC_MALLOC malloc # define LIBC_FREE free -#endif // __linux__ && !ANDROID +#endif // SANITIZER_LINUX && !SANITIZER_ANDROID namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index 97db9e78b395..1c1a3fbc34ab 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -767,4 +767,4 @@ void AdjustStackSizeLinux(void *attr_, int verbosity) { } // namespace __sanitizer -#endif // __linux__ +#endif // SANITIZER_LINUX diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc index 70128e3fa1c9..baac4a932f5c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc @@ -341,4 +341,4 @@ void InitTlsSize() { } // namespace __sanitizer -#endif // __APPLE__ +#endif // SANITIZER_MAC diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc index 7e94ff1d3389..c640e9477673 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -34,7 +34,7 @@ #if SANITIZER_LINUX #include #include -#endif // __linux__ +#endif // SANITIZER_LINUX namespace __sanitizer { unsigned struct_utsname_sz = sizeof(struct utsname); @@ -53,13 +53,13 @@ namespace __sanitizer { unsigned struct_statfs_sz = sizeof(struct statfs); unsigned struct_epoll_event_sz = sizeof(struct epoll_event); unsigned struct_timespec_sz = sizeof(struct timespec); -#endif // __linux__ +#endif // SANITIZER_LINUX #if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned struct_dirent64_sz = sizeof(struct dirent64); unsigned struct_rlimit64_sz = sizeof(struct rlimit64); unsigned struct_statfs64_sz = sizeof(struct statfs64); -#endif // __linux__ && !__ANDROID__ +#endif // SANITIZER_LINUX && !SANITIZER_ANDROID void* __sanitizer_get_msghdr_iov_iov_base(void* msg, int idx) { return ((struct msghdr *)msg)->msg_iov[idx].iov_base; @@ -80,4 +80,4 @@ namespace __sanitizer { COMPILER_CHECK(sizeof(__sanitizer_pthread_attr_t) >= sizeof(pthread_attr_t)); -#endif // __linux__ || __APPLE__ +#endif // SANITIZER_LINUX || SANITIZER_MAC diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 488810efd360..18b41065e827 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -34,13 +34,13 @@ namespace __sanitizer { extern unsigned struct_statfs_sz; extern unsigned struct_epoll_event_sz; extern unsigned struct_timespec_sz; -#endif // __linux__ +#endif // SANITIZER_LINUX #if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned struct_dirent64_sz; extern unsigned struct_rlimit64_sz; extern unsigned struct_statfs64_sz; -#endif // __linux__ && !__ANDROID__ +#endif // SANITIZER_LINUX && !SANITIZER_ANDROID void* __sanitizer_get_msghdr_iov_iov_base(void* msg, int idx); uptr __sanitizer_get_msghdr_iov_iov_len(void* msg, int idx); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc index 3252f8c7eb31..2aae414fefe9 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -230,4 +230,4 @@ int internal_isatty(fd_t fd) { } // namespace __sanitizer -#endif // __linux__ || __APPLE_ +#endif // SANITIZER_LINUX || __APPLE_ diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h index 2cb64d1a8cd6..b96f09ec4561 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h @@ -98,14 +98,14 @@ class MemoryMappingLayout { return false; } -# if defined __linux__ +# if SANITIZER_LINUX ProcSelfMapsBuff proc_self_maps_; char *current_; // Static mappings cache. static ProcSelfMapsBuff cached_proc_self_maps_; static StaticSpinMutex cache_lock_; // protects cached_proc_self_maps_. -# elif defined __APPLE__ +# elif SANITIZER_MAC template bool NextSegmentLoad(uptr *start, uptr *end, uptr *offset, char filename[], uptr filename_size, diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc index b6c476388996..1731913e043e 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc @@ -382,4 +382,4 @@ uptr SuspendedThreadsList::RegisterCount() { } } // namespace __sanitizer -#endif // __linux__ +#endif // SANITIZER_LINUX diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_itanium.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_itanium.cc index 5e2532ee0af9..e20fb91f0eb5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_itanium.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_itanium.cc @@ -41,4 +41,4 @@ const char *__sanitizer::Demangle(const char *MangledName) { return MangledName; } -#endif // __APPLE__ || __linux__ +#endif // SANITIZER_MAC || SANITIZER_LINUX diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc index 9d53b0530714..00e2bd12cf02 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc @@ -28,7 +28,7 @@ #include #include -#if !SANITIZER_ANDROID && !SANITIZER_ANDROID +#if !SANITIZER_ANDROID #include #endif @@ -123,11 +123,11 @@ bool StartSymbolizerSubprocess(const char *path_to_symbolizer, return true; } -#if SANITIZER_ANDROID || SANITIZER_ANDROID +#if SANITIZER_ANDROID uptr GetListOfModules(LoadedModule *modules, uptr max_modules) { UNIMPLEMENTED(); } -#else // ANDROID +#else // SANITIZER_ANDROID typedef ElfW(Phdr) Elf_Phdr; struct DlIteratePhdrData { @@ -177,8 +177,8 @@ uptr GetListOfModules(LoadedModule *modules, uptr max_modules) { dl_iterate_phdr(dl_iterate_phdr_cb, &data); return data.current_n; } -#endif // ANDROID +#endif // SANITIZER_ANDROID } // namespace __sanitizer -#endif // __linux__ +#endif // SANITIZER_LINUX diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc index 84148f686140..d3cd15a0a792 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc @@ -25,10 +25,11 @@ bool StartSymbolizerSubprocess(const char *path_to_symbolizer, } uptr GetListOfModules(LoadedModule *modules, uptr max_modules) { - // FIXME: Actually implement this on Mac. + // FIXME: Actually implement this on Mac. Just using MemoryMappingLayout + // may be enough for this on Mac. return 0; } } // namespace __sanitizer -#endif // __APPLE__ +#endif // SANITIZER_MAC