prevent inlining in heap-checker unittest

The test relies on stuff "mmaper" function not being inlined, but
compilers are getting smarter and latest clang actually does inline it
now. Adding volatile to pointer declaration fixes it.
This commit is contained in:
Aliaksey Kandratsenka 2020-04-19 22:50:16 -07:00
parent e521472f1a
commit 98ccd0f102

View File

@ -1298,7 +1298,7 @@ static inline uintptr_t GetFunctionAddress (void* (*func)(uintptr_t*))
#endif
// to trick complier into preventing inlining
static void* (*mmapper_addr)(uintptr_t* addr) = &Mmapper;
static void* (* volatile mmapper_addr)(uintptr_t* addr) = &Mmapper;
// TODO(maxim): copy/move this to memory_region_map_unittest
// TODO(maxim): expand this test to include mmap64, mremap and sbrk calls.