gdb/: Require a C++ compiler

This removes all support for building gdb & gdbserver with a C
compiler from gdb & gdbserver's build machinery.

gdb/ChangeLog:
2016-09-05  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention that a C++ compiler is now required.
	* Makefile.in (COMPILER, COMPILER_CFLAGS): Remove.
	(COMPILE.pre, CC_LD): Use CXX directly.
	(INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly.
	* acinclude.m4: Don't include build-with-cxx.m4.
	* build-with-cxx.m4: Delete file.
	* configure.ac: Remove GDB_AC_BUILD_WITH_CXX call.
	* warning.m4: Assume $enable_build_with_cxx is yes.
	* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2016-09-05  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER, COMPILER_CFLAGS): Remove.
	(COMPILE.pre, CC_LD): Use CXX directly.
	(INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly.
	* acinclude.m4: Don't include build-with-cxx.m4.
	* configure.ac: Remove GDB_AC_BUILD_WITH_CXX call.
	* configure: Regenerate.
This commit is contained in:
Pedro Alves 2016-09-05 19:10:44 +01:00
parent f245535cf5
commit cf6de44d75
13 changed files with 51 additions and 190 deletions

View File

@ -1,3 +1,15 @@
2016-09-05 Pedro Alves <palves@redhat.com>
* NEWS: Mention that a C++ compiler is now required.
* Makefile.in (COMPILER, COMPILER_CFLAGS): Remove.
(COMPILE.pre, CC_LD): Use CXX directly.
(INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly.
* acinclude.m4: Don't include build-with-cxx.m4.
* build-with-cxx.m4: Delete file.
* configure.ac: Remove GDB_AC_BUILD_WITH_CXX call.
* warning.m4: Assume $enable_build_with_cxx is yes.
* configure: Regenerate.
2016-09-05 Pedro Alves <palves@redhat.com>
PR backtrace/19927

View File

@ -79,11 +79,6 @@ MSGMERGE = msgmerge
PACKAGE = @PACKAGE@
CATALOGS = @CATALOGS@
# The name of the compiler to use.
COMPILER = @COMPILER@
# Set to CFLAGS or CXXFLAGS, depending on compiler/language.
COMPILER_CFLAGS = @COMPILER_CFLAGS@
# If you are compiling with GCC, make sure that either 1) You have the
# fixed include files where GCC can reach them, or 2) You use the
# -traditional flag. Otherwise the ioctl calls in inflow.c
@ -99,7 +94,7 @@ depcomp = $(SHELL) $(srcdir)/../depcomp
# Note that these are overridden by GNU make-specific code below if
# GNU make is used. The overrides implement dependency tracking.
COMPILE.pre = $(COMPILER)
COMPILE.pre = $(CXX)
COMPILE.post = -c -o $@
COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
POSTCOMPILE = @true
@ -129,8 +124,8 @@ MAKEHTMLFLAGS =
# Set this up with gcc if you have gnu ld and the loader will print out
# line numbers for undefined references.
#CC_LD=gcc -static
CC_LD=$(COMPILER)
#CC_LD=g++ -static
CC_LD=$(CXX)
# Where is our "include" directory? Typically $(srcdir)/../include.
# This is essentially the header file directory for the library
@ -568,7 +563,7 @@ INTERNAL_CPPFLAGS = @CPPFLAGS@ @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
INTERNAL_CFLAGS_BASE = \
$(COMPILER_CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
$(CXXFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
$(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS)
@ -584,7 +579,7 @@ LDFLAGS = @LDFLAGS@
# and have it work; that's why CFLAGS is here.
# PROFILE_CFLAGS is _not_ included, however, because we use monstartup.
INTERNAL_LDFLAGS = \
$(COMPILER_CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) \
$(CXXFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) \
$(LDFLAGS) $(CONFIG_LDFLAGS)
# If your system is missing alloca(), or, more likely, it's there but

View File

@ -3,6 +3,12 @@
*** Changes since GDB 7.12
* GDB and GDBserver now require building with a C++ compiler.
It is no longer possible to build GDB or GDBserver with a C
compiler. The --disable-build-with-cxx configure option has been
removed.
* Support for thread names on MS-Windows.
GDB now catches and handles the special exception that programs

View File

@ -65,9 +65,6 @@ m4_include([common/common.m4])
dnl For libiberty_INIT.
m4_include(libiberty.m4)
dnl For --enable-build-with-cxx and COMPILER.
m4_include(build-with-cxx.m4)
dnl For GDB_AC_PTRACE.
m4_include(ptrace.m4)

View File

@ -1,43 +0,0 @@
dnl Copyright (C) 2014-2016 Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl GDB_AC_BUILD_WITH_CXX()
dnl Provide an --enable-build-with-cxx/--disable-build-with-cxx set of options
dnl allowing a user to build with a C++ compiler.
AC_DEFUN([GDB_AC_BUILD_WITH_CXX],
[
AC_ARG_ENABLE(build-with-cxx,
AS_HELP_STRING([--disable-build-with-cxx], [build with C compiler instead of C++ compiler]),
[case $enableval in
yes | no)
;;
*)
AC_MSG_ERROR([bad value $enableval for --enable-build-with-cxx]) ;;
esac],
[enable_build_with_cxx=yes])
if test "$enable_build_with_cxx" = "yes"; then
COMPILER='$(CXX)'
COMPILER_CFLAGS='$(CXXFLAGS)'
else
COMPILER='$(CC)'
COMPILER_CFLAGS='$(CFLAGS)'
fi
AC_SUBST(COMPILER)
AC_SUBST(COMPILER_CFLAGS)
])

54
gdb/configure vendored
View File

@ -732,8 +732,6 @@ MAKE
CCDEPMODE
DEPDIR
am__leading_dot
COMPILER_CFLAGS
COMPILER
INSTALL_STRIP_PROGRAM
STRIP
install_sh
@ -809,7 +807,6 @@ enable_option_checking
enable_maintainer_mode
enable_plugins
enable_largefile
enable_build_with_cxx
with_separate_debug_dir
with_gdb_datadir
with_relocated_sources
@ -1503,8 +1500,6 @@ Optional Features:
(and sometimes confusing) to the casual installer
--enable-plugins Enable support for plugins
--disable-largefile omit support for large files
--disable-build-with-cxx
build with C compiler instead of C++ compiler
--enable-targets=TARGETS
alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
@ -4956,32 +4951,6 @@ ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# See if we are building with C++, and substitute COMPILER.
# Check whether --enable-build-with-cxx was given.
if test "${enable_build_with_cxx+set}" = set; then :
enableval=$enable_build_with_cxx; case $enableval in
yes | no)
;;
*)
as_fn_error "bad value $enableval for --enable-build-with-cxx" "$LINENO" 5 ;;
esac
else
enable_build_with_cxx=yes
fi
if test "$enable_build_with_cxx" = "yes"; then
COMPILER='$(CXX)'
COMPILER_CFLAGS='$(CXXFLAGS)'
else
COMPILER='$(CC)'
COMPILER_CFLAGS='$(CFLAGS)'
fi
# Dependency checking.
rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
@ -14254,21 +14223,12 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
# These options work in either C or C++ modes.
# The options we'll try to enable.
build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
# Now add in C and C++ specific options, depending on mode.
if test "$enable_build_with_cxx" = "yes"; then
build_warnings="$build_warnings -Wno-sign-compare -Wno-write-strings \
-Wno-narrowing"
else
build_warnings="$build_warnings -Wpointer-sign -Wmissing-prototypes \
-Wdeclaration-after-statement -Wmissing-parameter-type \
-Wold-style-declaration -Wold-style-definition"
fi
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
-Wno-sign-compare -Wno-write-strings -Wno-narrowing"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
@ -14310,14 +14270,12 @@ fi
# The set of warnings supported by a C++ compiler is not the same as
# of the C compiler.
if test "$enable_build_with_cxx" = "yes"; then
ac_ext=cpp
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
fi
WARN_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
@ -14369,14 +14327,12 @@ fi
if test "$enable_build_with_cxx" = "yes"; then
ac_ext=c
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
fi
# In the Cygwin environment, we need some additional flags.

View File

@ -38,9 +38,6 @@ AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
# See if we are building with C++, and substitute COMPILER.
GDB_AC_BUILD_WITH_CXX
# Dependency checking.
ZW_CREATE_DEPDIR
ZW_PROG_COMPILER_DEPENDENCIES([CC])

View File

@ -1,3 +1,12 @@
2016-09-05 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER, COMPILER_CFLAGS): Remove.
(COMPILE.pre, CC_LD): Use CXX directly.
(INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly.
* acinclude.m4: Don't include build-with-cxx.m4.
* configure.ac: Remove GDB_AC_BUILD_WITH_CXX call.
* configure: Regenerate.
2016-09-02 Akash Trehan <akash.trehan123@gmail.com>
PR gdb/19495

View File

@ -49,11 +49,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
RANLIB = @RANLIB@
# The name of the compiler to use.
COMPILER = @COMPILER@
# Set to CFLAGS or CXXFLAGS, depending on compiler/language.
COMPILER_CFLAGS = @COMPILER_CFLAGS@
CC = @CC@
CXX = @CXX@
AR = @AR@
@ -66,7 +61,7 @@ depcomp = $(SHELL) $(srcdir)/../depcomp
# Note that these are overridden by GNU make-specific code below if
# GNU make is used. The overrides implement dependency tracking.
COMPILE.pre = $(COMPILER)
COMPILE.pre = $(CXX)
COMPILE.post = -c -o $@
COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
POSTCOMPILE = @true
@ -84,8 +79,8 @@ VPATH = @srcdir@
# Set this up with gcc if you have gnu ld and the loader will print out
# line numbers for undefinded refs.
#CC_LD=gcc -static
CC_LD=$(COMPILER)
#CC_LD=g++ -static
CC_LD=$(CXX)
# Where is the "include" directory? Traditionally ../include or ./include
INCLUDE_DIR = ${srcdir}/../../include
@ -138,7 +133,7 @@ CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
INTERNAL_CFLAGS_BASE = ${COMPILER_CFLAGS} ${GLOBAL_CFLAGS} \
INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS}
INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER

View File

@ -26,9 +26,6 @@ m4_include(../common/common.m4)
dnl For libiberty_INIT.
m4_include(../libiberty.m4)
dnl For --enable-build-with-cxx and COMPILER.
m4_include(../build-with-cxx.m4)
dnl For GDB_AC_PTRACE.
m4_include(../ptrace.m4)

View File

@ -615,8 +615,6 @@ DEPDIR
am__leading_dot
host_noncanonical
target_noncanonical
COMPILER_CFLAGS
COMPILER
RANLIB
AR
INSTALL_DATA
@ -693,7 +691,6 @@ ac_user_opts='
enable_option_checking
enable_maintainer_mode
enable_largefile
enable_build_with_cxx
enable_libmcheck
with_ust
with_ust_include
@ -1339,8 +1336,6 @@ Optional Features:
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--disable-largefile omit support for large files
--disable-build-with-cxx
build with C compiler instead of C++ compiler
--enable-libmcheck Try linking with -lmcheck if available
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings if gcc is used
@ -4774,32 +4769,6 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# See if we are building with C++, and substitute COMPILER.
# Check whether --enable-build-with-cxx was given.
if test "${enable_build_with_cxx+set}" = set; then :
enableval=$enable_build_with_cxx; case $enableval in
yes | no)
;;
*)
as_fn_error "bad value $enableval for --enable-build-with-cxx" "$LINENO" 5 ;;
esac
else
enable_build_with_cxx=yes
fi
if test "$enable_build_with_cxx" = "yes"; then
COMPILER='$(CXX)'
COMPILER_CFLAGS='$(CXXFLAGS)'
else
COMPILER='$(CC)'
COMPILER_CFLAGS='$(CFLAGS)'
fi
# Set the 'development' global.
. $srcdir/../../bfd/development.sh
@ -6288,21 +6257,12 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
# These options work in either C or C++ modes.
# The options we'll try to enable.
build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
# Now add in C and C++ specific options, depending on mode.
if test "$enable_build_with_cxx" = "yes"; then
build_warnings="$build_warnings -Wno-sign-compare -Wno-write-strings \
-Wno-narrowing"
else
build_warnings="$build_warnings -Wpointer-sign -Wmissing-prototypes \
-Wdeclaration-after-statement -Wmissing-parameter-type \
-Wold-style-declaration -Wold-style-definition"
fi
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
-Wno-sign-compare -Wno-write-strings -Wno-narrowing"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
@ -6344,14 +6304,12 @@ fi
# The set of warnings supported by a C++ compiler is not the same as
# of the C compiler.
if test "$enable_build_with_cxx" = "yes"; then
ac_ext=cpp
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
fi
WARN_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
@ -6403,14 +6361,12 @@ fi
if test "$enable_build_with_cxx" = "yes"; then
ac_ext=c
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
fi
case " $WARN_CFLAGS " in
*" -Wmissing-prototypes "*)

View File

@ -40,9 +40,6 @@ AC_ARG_PROGRAM
AC_HEADER_STDC
# See if we are building with C++, and substitute COMPILER.
GDB_AC_BUILD_WITH_CXX
# Set the 'development' global.
. $srcdir/../../bfd/development.sh

View File

@ -35,21 +35,12 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
# These options work in either C or C++ modes.
# The options we'll try to enable.
build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
# Now add in C and C++ specific options, depending on mode.
if test "$enable_build_with_cxx" = "yes"; then
build_warnings="$build_warnings -Wno-sign-compare -Wno-write-strings \
-Wno-narrowing"
else
build_warnings="$build_warnings -Wpointer-sign -Wmissing-prototypes \
-Wdeclaration-after-statement -Wmissing-parameter-type \
-Wold-style-declaration -Wold-style-definition"
fi
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
-Wno-sign-compare -Wno-write-strings -Wno-narrowing"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
@ -89,9 +80,7 @@ fi])dnl
# The set of warnings supported by a C++ compiler is not the same as
# of the C compiler.
if test "$enable_build_with_cxx" = "yes"; then
AC_LANG_PUSH([C++])
fi
AC_LANG_PUSH([C++])
WARN_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
@ -127,7 +116,5 @@ fi
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WERROR_CFLAGS)
if test "$enable_build_with_cxx" = "yes"; then
AC_LANG_POP([C++])
fi
AC_LANG_POP([C++])
])