From cf6de44d75082116865a85cbf94db2632b679361 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 5 Sep 2016 19:10:44 +0100 Subject: [PATCH] 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 * 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 * 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. --- gdb/ChangeLog | 12 +++++++++ gdb/Makefile.in | 15 ++++------- gdb/NEWS | 6 +++++ gdb/acinclude.m4 | 3 --- gdb/build-with-cxx.m4 | 43 ------------------------------ gdb/configure | 54 ++++---------------------------------- gdb/configure.ac | 3 --- gdb/gdbserver/ChangeLog | 9 +++++++ gdb/gdbserver/Makefile.in | 13 +++------ gdb/gdbserver/acinclude.m4 | 3 --- gdb/gdbserver/configure | 54 ++++---------------------------------- gdb/gdbserver/configure.ac | 3 --- gdb/warning.m4 | 23 ++++------------ 13 files changed, 51 insertions(+), 190 deletions(-) delete mode 100644 gdb/build-with-cxx.m4 diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1fb363d3cf9..9d46948c5c6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2016-09-05 Pedro Alves + + * 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 PR backtrace/19927 diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 7b2df86878f..354705e5222 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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 diff --git a/gdb/NEWS b/gdb/NEWS index 6f5feb1e724..99e10134b7c 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -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 diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 4f835853869..4b3f7fcf95e 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -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) diff --git a/gdb/build-with-cxx.m4 b/gdb/build-with-cxx.m4 deleted file mode 100644 index 58caa8a402f..00000000000 --- a/gdb/build-with-cxx.m4 +++ /dev/null @@ -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 . - -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) -]) diff --git a/gdb/configure b/gdb/configure index 7577ba4c798..e2d853d05eb 100755 --- a/gdb/configure +++ b/gdb/configure @@ -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. diff --git a/gdb/configure.ac b/gdb/configure.ac index f774db7ea6e..e451e60031c 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -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]) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 629254fa2a2..5e9e4cb43a5 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,12 @@ +2016-09-05 Pedro Alves + + * 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 PR gdb/19495 diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index f844ab8853e..309b4967f5c 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -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 diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4 index a052c2b975f..8ec91887cf1 100644 --- a/gdb/gdbserver/acinclude.m4 +++ b/gdb/gdbserver/acinclude.m4 @@ -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) diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 6b14b52fc62..f1125173740 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -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 "*) diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 01ec634771d..6d5907bfaae 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -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 diff --git a/gdb/warning.m4 b/gdb/warning.m4 index 8d7ce68ce3f..849fa2d7190 100644 --- a/gdb/warning.m4 +++ b/gdb/warning.m4 @@ -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++]) ]) -- 2.30.2