fix compilation of tcmalloc_unittest.cc on older llvm-gcc

This commit is contained in:
Aliaksey Kandratsenka 2017-05-14 20:24:27 -07:00
parent b1d88662cb
commit 53f15325d9
1 changed files with 6 additions and 0 deletions

View File

@ -1079,8 +1079,14 @@ struct GlobalNallocx {
#if defined(__GNUC__)
#if defined(__APPLE__)
// llvm-gcc on older osex that I have access to, doesn't like arg-ful
// constructor attribute.
static void check_global_nallocx() __attribute__((constructor));
#else
// 101 is the max user priority.
static void check_global_nallocx() __attribute__((constructor(101)));
#endif
static void check_global_nallocx() { CHECK_GT(nallocx(99, 0), 99); }
#endif // __GNUC__