configure.ac: Add -Wlogical-op, if it's not noisy.
This commit is contained in:
parent
61d2d80795
commit
f825f0d04a
|
@ -12229,8 +12229,8 @@ fi
|
|||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wpointer-arith -Werror"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings" >&5
|
||||
$as_echo_n "checking for broken string.h that generates warnings... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wpointer-arith" >&5
|
||||
$as_echo_n "checking for broken string.h that generates warnings with -Wpointer-arith... " >&6; }
|
||||
if test "${ac_cv_c_string_h_warnings+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
@ -12260,6 +12260,39 @@ $as_echo "$ac_cv_c_string_h_warnings" >&6; }
|
|||
EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
|
||||
fi
|
||||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wlogical-op -Werror"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wlogical-op" >&5
|
||||
$as_echo_n "checking for broken string.h that generates warnings with -Wlogical-op... " >&6; }
|
||||
if test "${ac_cv_c_logicalop_noisy+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <string.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char*f(const char *h,char n) {return strchr(h,n);}
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_c_logicalop_noisy=no
|
||||
else
|
||||
ac_cv_c_logicalop_noisy=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_logicalop_noisy" >&5
|
||||
$as_echo "$ac_cv_c_logicalop_noisy" >&6; }
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
if test "$ac_cv_c_logicalop_noisy" = "no"
|
||||
then
|
||||
EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"
|
||||
fi
|
||||
|
||||
if test "x$enable_maintainer_mode" = "xyes"
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror" >&5
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -1673,7 +1673,7 @@ then
|
|||
dnl Check for noisy string.h
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wpointer-arith -Werror"
|
||||
AC_CACHE_CHECK([for broken string.h that generates warnings], ac_cv_c_string_h_warnings,
|
||||
AC_CACHE_CHECK([for broken string.h that generates warnings with -Wpointer-arith], ac_cv_c_string_h_warnings,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[]])],[ac_cv_c_string_h_warnings=no],[ac_cv_c_string_h_warnings=yes]))
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
if test "$ac_cv_c_string_h_warnings" = "no"
|
||||
|
@ -1681,6 +1681,17 @@ then
|
|||
EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
|
||||
fi
|
||||
|
||||
dnl Check for noisy string.h on logical ops
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wlogical-op -Werror"
|
||||
AC_CACHE_CHECK([for broken string.h that generates warnings with -Wlogical-op], ac_cv_c_logicalop_noisy,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=no],[ac_cv_c_logicalop_noisy=yes]))
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
if test "$ac_cv_c_logicalop_noisy" = "no"
|
||||
then
|
||||
EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"
|
||||
fi
|
||||
|
||||
dnl Enable -Werror for maintainer mode
|
||||
if test "x$enable_maintainer_mode" = "xyes"
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue