From 0d4e2a3275092289ca0b2d4a6904c065dc2ef835 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 4 Nov 2016 05:05:22 -0600 Subject: [PATCH] configure: add `-Wno-nullability-completeness` for xform output Mac OS X header files for 10.12 include `_Nullable` and `_Nonnull` annotations. When those appear in xform output, they're no longer counted as being in system headers, and so nullability completeness is enabled. Disable is explicitly when the flag is supported. --- racket/src/configure | 31 +++++++++++++++++++++++++++++++ racket/src/racket/configure.ac | 20 ++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/racket/src/configure b/racket/src/configure index 6f66522ed4..24b1245bf4 100755 --- a/racket/src/configure +++ b/racket/src/configure @@ -3218,6 +3218,7 @@ use_flag_pthread=yes use_flag_posix_pthread=no skip_iconv_check=no check_page_size=yes +try_no_nullability_completeness=no MAKE_LOCAL_RACKET=no-local-racket @@ -4828,6 +4829,12 @@ fi # and that breaks static allocation of fd_sets try_poll_syscall=yes + # -pthread is not needed and triggers a warning + use_flag_pthread=no + + # Use -Wno-nullability-completeness if supported + try_no_nullability_completeness=yes + # ".a" is typically not useful, since we always build a ".dylib": if test "${enable_libs}" == "" ; then INSTALL_LIBS_ENABLE=no-install @@ -5871,6 +5878,30 @@ if test "${LFS_CFLAGS}" != "" && test "${LFS_CFLAGS}" != "undefined"; then MZOPTIONS="${MZOPTIONS} ${LFS_CFLAGS}" fi +if test "${try_no_nullability_completeness}" = "yes" ; then + msg="for -Wno-nullability-completeness" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking $msg" >&5 +$as_echo_n "checking $msg... " >&6; } + OLD_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -Wno-nullability-completeness" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main() { return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + nonullcomp=yes +else + nonullcomp=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$nonullcomp" = "yes" ; then + GC2OPTIONS="$GC2OPTIONS -Wno-nullability-completeness" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nonullcomp" >&5 +$as_echo "$nonullcomp" >&6; } + CFLAGS="${OLD_CFLAGS}" +fi + ###### Get data sizes, stack direction, and endianness ####### # The cast to long int works around a bug in the HP C Compiler diff --git a/racket/src/racket/configure.ac b/racket/src/racket/configure.ac index b079501037..085c450650 100644 --- a/racket/src/racket/configure.ac +++ b/racket/src/racket/configure.ac @@ -474,6 +474,7 @@ use_flag_pthread=yes use_flag_posix_pthread=no skip_iconv_check=no check_page_size=yes +try_no_nullability_completeness=no MAKE_LOCAL_RACKET=no-local-racket @@ -894,6 +895,12 @@ case "$host_os" in # and that breaks static allocation of fd_sets try_poll_syscall=yes + # -pthread is not needed and triggers a warning + use_flag_pthread=no + + # Use -Wno-nullability-completeness if supported + try_no_nullability_completeness=yes + # ".a" is typically not useful, since we always build a ".dylib": if test "${enable_libs}" == "" ; then INSTALL_LIBS_ENABLE=no-install @@ -1323,6 +1330,19 @@ if test "${LFS_CFLAGS}" != "" && test "${LFS_CFLAGS}" != "undefined"; then MZOPTIONS="${MZOPTIONS} ${LFS_CFLAGS}" fi +if test "${try_no_nullability_completeness}" = "yes" ; then + [ msg="for -Wno-nullability-completeness" ] + AC_MSG_CHECKING($msg) + OLD_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -Wno-nullability-completeness" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])], nonullcomp=yes, nonullcomp=no) + if test "$nonullcomp" = "yes" ; then + GC2OPTIONS="$GC2OPTIONS -Wno-nullability-completeness" + fi + AC_MSG_RESULT($nonullcomp) + CFLAGS="${OLD_CFLAGS}" +fi + ###### Get data sizes, stack direction, and endianness ####### AC_CHECK_SIZEOF(char)