gdbsupport: use AM_GDB_WARNINGS
Since gdbsupport has been given its own build system, it is no longer compiled with the warning flags specified in gdb/warning.m4. This patch makes it use AM_GDB_WARNINGS. gdbsupport/ChangeLog: * acinclude.m4: Include ../gdb/warning.m4. * configure.ac: Use AM_GDB_WARNINGS. * Makefile.am: Set AM_CFLAGS to WARN_CFLAGS and WERROR_CFLAGS. * Makefile.in: Re-generate. * configure: Re-generate.
This commit is contained in:
parent
da5bd37ebc
commit
629c296280
6 changed files with 215 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2020-02-11 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* acinclude.m4: Include ../gdb/warning.m4.
|
||||
* configure.ac: Use AM_GDB_WARNINGS.
|
||||
* Makefile.am: Set AM_CFLAGS to WARN_CFLAGS and WERROR_CFLAGS.
|
||||
* Makefile.in: Re-generate.
|
||||
* configure: Re-generate.
|
||||
|
||||
2020-02-10 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* environ.c (gdb_environ::set): Cast concat NULL sentinel to char *.
|
||||
|
|
|
@ -29,6 +29,8 @@ override CXX += $(CXX_DIALECT)
|
|||
override CC := $(CXX)
|
||||
override CFLAGS := $(CXXFLAGS)
|
||||
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = libgdbsupport.a
|
||||
|
||||
if SELFTEST
|
||||
|
|
|
@ -124,7 +124,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/codeset.m4 \
|
|||
$(top_srcdir)/../gdb/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/../gdb/libiberty.m4 \
|
||||
$(top_srcdir)/../gdb/selftest.m4 \
|
||||
$(top_srcdir)/../gdb/ptrace.m4 $(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/../gdb/ptrace.m4 $(top_srcdir)/../gdb/warning.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
|
@ -287,6 +288,8 @@ SHELL = @SHELL@
|
|||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
WERROR_CFLAGS = @WERROR_CFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
|
@ -350,6 +353,7 @@ AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
|
|||
-I../gnulib/import -I$(srcdir)/../gnulib/import \
|
||||
-I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd
|
||||
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
noinst_LIBRARIES = libgdbsupport.a
|
||||
@SELFTEST_TRUE@selftest = selftest.c
|
||||
libgdbsupport_a_SOURCES = \
|
||||
|
|
|
@ -5,3 +5,6 @@ m4_include([../gdb/ax_cxx_compile_stdcxx.m4])
|
|||
m4_include([../gdb/libiberty.m4])
|
||||
m4_include([../gdb/selftest.m4])
|
||||
m4_include([../gdb/ptrace.m4])
|
||||
|
||||
dnl This gets AM_GDB_WARNINGS.
|
||||
m4_include(../gdb/warning.m4)
|
||||
|
|
194
gdbsupport/configure
vendored
194
gdbsupport/configure
vendored
|
@ -624,6 +624,8 @@ ac_subst_vars='am__EXEEXT_FALSE
|
|||
am__EXEEXT_TRUE
|
||||
LTLIBOBJS
|
||||
LIBOBJS
|
||||
WERROR_CFLAGS
|
||||
WARN_CFLAGS
|
||||
SELFTEST_FALSE
|
||||
SELFTEST_TRUE
|
||||
LTLIBIPT
|
||||
|
@ -769,6 +771,9 @@ with_gnu_ld
|
|||
enable_rpath
|
||||
with_libipt_prefix
|
||||
enable_unit_tests
|
||||
enable_werror
|
||||
enable_build_warnings
|
||||
enable_gdb_build_warnings
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
|
@ -1415,6 +1420,11 @@ Optional Features:
|
|||
--disable-rpath do not hardcode runtime library paths
|
||||
--enable-unit-tests Enable the inclusion of unit tests when compiling
|
||||
GDB
|
||||
--enable-werror treat compile warnings as errors
|
||||
--enable-build-warnings enable build-time compiler warnings if gcc is used
|
||||
--enable-gdb-build-warnings
|
||||
enable GDB specific build-time compiler warnings if
|
||||
gcc is used
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
|
@ -10806,6 +10816,190 @@ _ACEOF
|
|||
fi
|
||||
|
||||
|
||||
# Detect support warning flags.
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
enableval=$enable_werror; case "${enableval}" in
|
||||
yes | y) ERROR_ON_WARNING="yes" ;;
|
||||
no | n) ERROR_ON_WARNING="no" ;;
|
||||
*) as_fn_error $? "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
# Enable -Werror by default when using gcc. Turn it off for releases.
|
||||
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
|
||||
ERROR_ON_WARNING=yes
|
||||
fi
|
||||
|
||||
WERROR_CFLAGS=""
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
WERROR_CFLAGS="-Werror"
|
||||
fi
|
||||
|
||||
# The options we'll try to enable.
|
||||
build_warnings="-Wall -Wpointer-arith \
|
||||
-Wno-unused -Wunused-value -Wunused-variable -Wunused-function \
|
||||
-Wno-switch -Wno-char-subscripts \
|
||||
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
|
||||
-Wno-sign-compare -Wno-error=maybe-uninitialized \
|
||||
-Wno-mismatched-tags \
|
||||
-Wno-error=deprecated-register \
|
||||
-Wsuggest-override \
|
||||
-Wimplicit-fallthrough=3 \
|
||||
-Wduplicated-cond \
|
||||
-Wshadow=local \
|
||||
-Wdeprecated-copy \
|
||||
-Wdeprecated-copy-dtor \
|
||||
-Wredundant-move \
|
||||
-Wmissing-declarations"
|
||||
|
||||
case "${host}" in
|
||||
*-*-mingw32*)
|
||||
# Enable -Wno-format by default when using gcc on mingw since many
|
||||
# GCC versions complain about %I64.
|
||||
build_warnings="$build_warnings -Wno-format" ;;
|
||||
*-*-solaris*)
|
||||
# Solaris 11.4 <python2.7/ceval.h> uses #pragma no_inline that GCC
|
||||
# doesn't understand.
|
||||
build_warnings="$build_warnings -Wno-unknown-pragmas"
|
||||
# Solaris 11 <unistd.h> marks vfork deprecated.
|
||||
build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
|
||||
*)
|
||||
# Note that gcc requires -Wformat for -Wformat-nonliteral to work,
|
||||
# but there's a special case for this below.
|
||||
build_warnings="$build_warnings -Wformat-nonliteral" ;;
|
||||
esac
|
||||
|
||||
# Check whether --enable-build-warnings was given.
|
||||
if test "${enable_build_warnings+set}" = set; then :
|
||||
enableval=$enable_build_warnings; case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting compiler warning flags = $build_warnings" 6>&1
|
||||
fi
|
||||
fi
|
||||
# Check whether --enable-gdb-build-warnings was given.
|
||||
if test "${enable_gdb_build_warnings+set}" = set; then :
|
||||
enableval=$enable_gdb_build_warnings; case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# The set of warnings supported by a C++ compiler is not the same as
|
||||
# of the C compiler.
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
|
||||
WARN_CFLAGS=""
|
||||
if test "x${build_warnings}" != x -a "x$GCC" = xyes
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5
|
||||
$as_echo_n "checking compiler warning flags... " >&6; }
|
||||
# Separate out the -Werror flag as some files just cannot be
|
||||
# compiled with it enabled.
|
||||
for w in ${build_warnings}; do
|
||||
# GCC does not complain about -Wno-unknown-warning. Invert
|
||||
# and test -Wunknown-warning instead.
|
||||
case $w in
|
||||
-Wno-*)
|
||||
wtest=`echo $w | sed 's/-Wno-/-W/g'` ;;
|
||||
-Wformat-nonliteral)
|
||||
# gcc requires -Wformat before -Wformat-nonliteral
|
||||
# will work, so stick them together.
|
||||
w="-Wformat $w"
|
||||
wtest="$w"
|
||||
;;
|
||||
*)
|
||||
wtest=$w ;;
|
||||
esac
|
||||
|
||||
case $w in
|
||||
-Werr*) WERROR_CFLAGS=-Werror ;;
|
||||
*)
|
||||
# Check whether GCC accepts it.
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror $wtest"
|
||||
saved_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror $wtest"
|
||||
if test "x$w" = "x-Wunused-variable"; then
|
||||
# Check for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38958,
|
||||
# fixed in GCC 4.9. This test is derived from the gdb
|
||||
# source code that triggered this bug in GCC.
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
struct scoped_restore_base {};
|
||||
struct scoped_restore_tmpl : public scoped_restore_base {
|
||||
~scoped_restore_tmpl() {}
|
||||
};
|
||||
int
|
||||
main ()
|
||||
{
|
||||
const scoped_restore_base &b = scoped_restore_tmpl();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
WARN_CFLAGS="${WARN_CFLAGS} $w"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
WARN_CFLAGS="${WARN_CFLAGS} $w"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
CXXFLAGS="$saved_CXXFLAGS"
|
||||
esac
|
||||
done
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
|
||||
$as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
TARGET_WORD_SIZE=`sed -n 's,#define BFD_ARCH_SIZE \(.*\)$,\1,p' ../bfd/bfd-in3.h`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
|
|
|
@ -48,6 +48,9 @@ AM_CONDITIONAL(SELFTEST, $enable_unittests)
|
|||
# Check the return and argument types of ptrace.
|
||||
GDB_AC_PTRACE
|
||||
|
||||
# Detect support warning flags.
|
||||
AM_GDB_WARNINGS
|
||||
|
||||
TARGET_WORD_SIZE=`sed -n 's,#define BFD_ARCH_SIZE \(.*\)$,\1,p' ../bfd/bfd-in3.h`
|
||||
AC_DEFINE_UNQUOTED(TARGET_WORD_SIZE, $TARGET_WORD_SIZE,
|
||||
[Define to the word size for the target.])
|
||||
|
|
Loading…
Add table
Reference in a new issue