提交 0675ad72 编写于 作者: H Heikki Linnakangas

Remove -Werror, replace with more specific -Wno-* options.

It's important to pay attention to compiler warnings, but -Werror isn't
buying us much at the moment. Firstly, there are a lot of warnings on modern
versions of gcc. I have to pass: "-Wno-error=unused-but-set-variable
-Wno-error=enum-compare -Wno-error=address -Wno-error=maybe-uninitialized"
to make it compile. More important than erroring out on warnings is to make
sure there are no warnings to begin with. Once we get to that state, any
warnings will stick out like sore thumb anyway, and you won't need -Werror
to make them more annoying.

We have a long way until we are 100% warning free, but most of the warnings
come from upstream code. They have been fixed in later versions of
PostgreSQL, so they will go away as we merge with upstream.
上级 7f9467c8
......@@ -4233,9 +4233,9 @@ fi
# but has its own. Also check other compiler-specific flags here.
if test "$GCC" = yes -a "$ICC" = no; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith "
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith"
# These work in some but not all gcc versions
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wendif-labels" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wendif-labels" >&5
$as_echo_n "checking if $CC supports -Wendif-labels... " >&6; }
pgac_save_CFLAGS=$CFLAGS
CFLAGS="$pgac_save_CFLAGS -Wendif-labels"
......@@ -4260,7 +4260,7 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
#PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
# This was included in -Wall/-Wformat in older GCC versions
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wformat-security" >&5
$as_echo_n "checking if $CC supports -Wformat-security... " >&6; }
......@@ -4392,6 +4392,64 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Silence compiler warnings that you get with modern versions of GCC.
# All of these warnings have been fixed in later versions of PostgreSQL,
# but GPDB is based on 8.2, so you get these. TODO: Remove when we catch up
# with later PostgreSQL releases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wno-unused-but-set-variable" >&5
$as_echo_n "checking if $CC supports -Wno-unused-but-set-variable... " >&6; }
pgac_save_CFLAGS=$CFLAGS
CFLAGS="$pgac_save_CFLAGS -Wno-unused-but-set-variable"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
CFLAGS="$pgac_save_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wno-address" >&5
$as_echo_n "checking if $CC supports -Wno-address... " >&6; }
pgac_save_CFLAGS=$CFLAGS
CFLAGS="$pgac_save_CFLAGS -Wno-address"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
CFLAGS="$pgac_save_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#-Wno-error=enum-compare -Wno-error=address -Wno-error=maybe-uninitialized
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
......
......@@ -331,10 +331,10 @@ fi
# but has its own. Also check other compiler-specific flags here.
if test "$GCC" = yes -a "$ICC" = no; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith "
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith"
# These work in some but not all gcc versions
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
#PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
#PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
# This was included in -Wall/-Wformat in older GCC versions
PGAC_PROG_CC_CFLAGS_OPT([-Wformat-security])
# Disable strict-aliasing rules; needed for gcc 3.3+
......@@ -346,6 +346,16 @@ if test "$GCC" = yes -a "$ICC" = no; then
# Disable loop optimizations that get confused by variable-length struct
# declarations in gcc 4.8+
PGAC_PROG_CC_CFLAGS_OPT([-fno-aggressive-loop-optimizations])
# Silence compiler warnings that you get with modern versions of GCC.
# All of these warnings have been fixed in later versions of PostgreSQL,
# but GPDB is based on 8.2, so you get these. TODO: Remove when we catch up
# with later PostgreSQL releases.
PGAC_PROG_CC_CFLAGS_OPT([-Wno-unused-but-set-variable])
PGAC_PROG_CC_CFLAGS_OPT([-Wno-address])
#-Wno-error=enum-compare -Wno-error=address -Wno-error=maybe-uninitialized
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
......
......@@ -234,12 +234,6 @@ GCC = @GCC@
SUN_STUDIO_CC = @SUN_STUDIO_CC@
CFLAGS = @CFLAGS@
ifneq ($(findstring mingw32,$(CC)),mingw32)
ifeq ($(GCC), yes)
CFLAGS += -Werror
endif # GCC
endif
# Kind-of compilers
BISON = @BISON@
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册