Bug 1480834 - 4. Specify -Werror for pthread_cond_timedwait_monotonic_np check; r=glandium

On 64-bit Android, `pthread_cond_timedwait_monotonic_np` is only
available for API 28+. The issue is, even though the NDK header does not
define `pthread_cond_timedwait_monotonic_np` for API 27 and below, the
NDK library _does_ include the function (in order to support builds
targeting API 28+).

During our configure test, the compiler only emits a warning about
`pthread_cond_timedwait_monotonic_np` being undefined, but linking
succeeds because the function is present in the library. Because linking
succeeds, the test inadvertently passes. This patch adds a '-Werror'
flag to the compilation, so the warning turns into an error to make the
test fail.

Differential Revision: https://phabricator.services.mozilla.com/D4482
This commit is contained in:
Jim Chen 2018-09-13 12:09:25 -04:00
Родитель d92debaff7
Коммит 216db72bef
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -1472,6 +1472,11 @@ Darwin)
;;
esac
dnl Turn on warnings-as-errors to prevent implicit declaration of
dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
dnl inadvertently pass even if the function does not really exist.
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
ac_cv_pthread_cond_timedwait_monotonic_np,
AC_TRY_LINK([#include <pthread.h>],
@ -1481,6 +1486,7 @@ AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
fi
CFLAGS=$_SAVE_CFLAGS
AC_CACHE_CHECK(
[for res_ninit()],