Bug 1104651 - Make valloc optional, r=glandium

This commit is contained in:
Michael Wu 2014-12-16 20:34:56 -05:00
Родитель d7e1debbbd
Коммит ff7b706c75
3 изменённых файлов: 19 добавлений и 4 удалений

Просмотреть файл

@ -91,10 +91,10 @@ def main():
r'operator new\[\]\(unsigned',
r'memalign',
# These two aren't available on all Linux configurations.
# These three aren't available on all Linux configurations.
#r'posix_memalign',
#r'aligned_alloc',
r'valloc',
#r'valloc',
]
if args.aggressive:

Просмотреть файл

@ -3393,10 +3393,24 @@ for file in $MALLOC_HEADERS; do
fi
done
AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
AC_CHECK_FUNCS(strndup posix_memalign memalign)
AC_CHECK_FUNCS(malloc_usable_size)
dnl In newer bionic headers, valloc is built but not defined,
dnl so we check more carefully here.
AC_MSG_CHECKING([for valloc in malloc.h])
AC_EGREP_HEADER(valloc, malloc.h,
AC_DEFINE(HAVE_VALLOC)
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
AC_MSG_CHECKING([for valloc in unistd.h])
AC_EGREP_HEADER(valloc, unistd.h,
AC_DEFINE(HAVE_VALLOC)
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
dnl See if compiler supports some gcc-style attributes
AC_CACHE_CHECK(for __attribute__((always_inline)),

Просмотреть файл

@ -55,6 +55,7 @@ AllTheNonBasicVanillaNewAllocations()
{
// posix_memalign and aligned_alloc aren't available on all Linux
// configurations.
// valloc was deprecated in Android 5.0
//char *q;
//posix_memalign((void**)&q, 16, 16);
@ -69,7 +70,7 @@ AllTheNonBasicVanillaNewAllocations()
intptr_t(memalign(16, 16)) +
//intptr_t(q) +
//intptr_t(aligned_alloc(16, 16)) +
intptr_t(valloc(4096)) +
//intptr_t(valloc(4096)) +
intptr_t(strdup("dummy"));
printf("%u\n", uint32_t(p)); // make sure |p| is not optimized away