[build] Hush the Solaris compiler about enum abuse.

Sun Studio 12 doesn't like it when we mix our
enum values and types.  We do that a lot on purpose
so the warnings from compiles were very verbose.
This commit is contained in:
M Joonas Pihlaja 2009-09-02 04:29:18 +01:00
parent f081a5ff55
commit c086b40a93
2 changed files with 27 additions and 2 deletions

View file

@ -111,21 +111,40 @@ AC_DEFUN([CAIRO_CC_TRY_FLAG_SILENT],
fi
])
dnl find a -Werror equivalent
AC_DEFUN([CAIRO_CC_CHECK_WERROR],
[dnl
_test_WERROR=${WERROR+set}
if test "z$_test_WERROR" != zset; then
WERROR=""
for _werror in -Werror -errwarn; do
AC_MSG_CHECKING([whether $CC supports $_werror])
CAIRO_CC_TRY_FLAG_SILENT(
[$_werror],,
[WERROR="$WERROR $_werror"],
[:])
AC_MSG_RESULT($cairo_cc_flag)
done
fi
])
dnl check compiler flags possibly using -Werror if available.
AC_DEFUN([CAIRO_CC_TRY_FLAG],
[dnl (flags..., optional program, true-action, false-action)
CAIRO_CC_CHECK_WERROR
AC_MSG_CHECKING([whether $CC supports $1])
CAIRO_CC_TRY_FLAG_SILENT([-Werror $1], [$2], [$3], [$4])
CAIRO_CC_TRY_FLAG_SILENT([$WERROR $1], [$2], [$3], [$4])
AC_MSG_RESULT([$cairo_cc_flag])
])
dnl check compiler/ld flags
AC_DEFUN([CAIRO_CC_TRY_LINK_FLAG],
[dnl
CAIRO_CC_CHECK_WERROR
AC_MSG_CHECKING([whether $CC supports $1])
_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror $1"
CFLAGS="$CFLAGS $WERROR $1"
AC_LINK_IFELSE([int main(void){ return 0;} ],
[cairo_cc_flag=yes],
[cairo_cc_flag=no])

View file

@ -19,6 +19,12 @@ MAYBE_WARN="-Wall -Wextra \
-Wno-missing-field-initializers -Wno-unused-parameter \
-Wno-attributes -Wno-long-long -Winline"
dnl Sun Studio 12 likes to rag at us for abusing enums like
dnl having cairo_status_t variables hold cairo_int_status_t
dnl values. It's bad, we know. Now please be quiet.
MAYBE_WARN="$MAYBE_WARN -erroff=E_ENUM_TYPE_MISMATCH_ARG \
-erroff=E_ENUM_TYPE_MISMATCH_OP"
dnl We also abuse the warning-flag facility to enable other compiler
dnl options. Namely, the following:
MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"