gdb/: Require a C++ compiler
authorPedro Alves <palves@redhat.com>
Mon, 5 Sep 2016 18:10:44 +0000 (19:10 +0100)
committerPedro Alves <palves@redhat.com>
Mon, 5 Sep 2016 18:10:44 +0000 (19:10 +0100)
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.

13 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/NEWS
gdb/acinclude.m4
gdb/build-with-cxx.m4 [deleted file]
gdb/configure
gdb/configure.ac
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/acinclude.m4
gdb/gdbserver/configure
gdb/gdbserver/configure.ac
gdb/warning.m4

index 1fb363d..9d46948 100644 (file)
@@ -1,5 +1,17 @@
 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
        * frame.c (get_frame_id): Compute the frame id if not computed
        yet.
index 7b2df86..354705e 100644 (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
index 6f5feb1..99e1013 100644 (file)
--- 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
index 4f83585..4b3f7fc 100644 (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)
 
diff --git a/gdb/build-with-cxx.m4 b/gdb/build-with-cxx.m4
deleted file mode 100644 (file)
index 58caa8a..0000000
+++ /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 <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)
-])
index 7577ba4..e2d853d 100755 (executable)
@@ -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.
 
 # 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
 
 
 
-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.
index f774db7..e451e60 100644 (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])
index 629254f..5e9e4cb 100644 (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
index f844ab8..309b496 100644 (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
index a052c2b..8ec9188 100644 (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)
 
index 6b14b52..f112517 100755 (executable)
@@ -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 "*)
index 01ec634..6d5907b 100644 (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
 
index 8d7ce68..849fa2d 100644 (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++])
 ])