public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 02/36] Add --enable-build-with-cxx configure switch
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
@ 2015-02-09 23:20 ` Pedro Alves
  2015-02-10 22:11   ` Yao Qi
  2015-02-09 23:21 ` [PATCH 16/36] x86 Linux/ptrace: fix offsetof usage in C++ mode Pedro Alves
                   ` (39 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:20 UTC (permalink / raw)
  To: gdb-patches

This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ (98/03)
compiler.

The name of the switch should be familiar to those who following GCC's
own C++ conversion process.

. Adding -fpermissive to build_warnings makes errors like these be
warnings instead:

  gdb/infrun.c:6597:1: error:   initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive]
   sig_print_info (enum gdb_signal oursig)
   ^
  gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’:
  gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive]
     restore_infcall_suspend_state (state);
				 ^

so that the compiler carries on compiling the file.  -Werror still
catches the warnings, so nothing is lost, only our lifes are made
easier by concentrating on getting other other more important things
out of the way first.

There's no way to quiet those warnings.  Until they're all fixed, when
building in C++ mode, -Werror is disabled by default.

. Adding -Wno-narrowing suppresses thousands of instances of this warning:

  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]

We can defer handling those until we target C++11.


. Adding -Wno-sign-compare suppresses thousands of instances of this warning:

  gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
	 if (tmpulongest == tdep->fcntl_F_GETLK64)
				  ^


. Adding -Wno-write-strings suppresses thousands of instances of this warning:

  gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’:
  gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "editable";
	      ^
  gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "noneditable";
	      ^

For now, it's best to hide these warnings from view until we're
'-fpermissive'-clean, and can thus starging building with -Werror.
The C compiler has always managed to build working GDBs with these
issues in the code, so a C++ compiler should too.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER): New, get it from autoconf.
	(COMPILE.pre, CC_LD): Use COMPILER.
	(CXX): Get from autoconf instead.
	(CXX_FOR_TARGET): Default to g++ instead of gcc.
	* acinclude.m4: Include build-with-cxx.m4.
	* build-with-cxx.m4: New file.
	* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
	Disable -Werror by default if building in C++ mode.
	(build_warnings): Add -fpermissive, -Wno-sign-compare,
	-Wno-write-strings, -Wno-narrowing.
	Run supported-warning-flags tests with the C++ compiler.  Append
	-Werror to CFLAGS.
	* configure: Regenerate.

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

	* Makefile.in (COMPILER): New, get it from autoconf.
	(CXX): Get from autoconf instead.
	(COMPILE.pre): Use COMPILER.
	(CC-LD): Rename to ...
	(CC_LD): ... this.  Use COMPILER.
	(gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust.
	(CXX_FOR_TARGET): Default to g++ instead of gcc.
	* acinclude.m4: Include build-with-cxx.m4.
	* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
	Disable -Werror by default if building in C++ mode.
	(build_warnings): Add -fpermissive, -Wno-sign-compare,
	-Wno-write-strings, -Wno-narrowing.
	Run supported-warning-flags tests with the C++ compiler.  Append
	-Werror to CFLAGS.
	* configure: Regenerate.
---
 gdb/Makefile.in            |  17 +-
 gdb/acinclude.m4           |   3 +
 gdb/build-with-cxx.m4      |  40 +++++
 gdb/configure              | 374 +++++++++++++++++++++++++++++++++++++++++++-
 gdb/configure.ac           |  34 +++-
 gdb/gdbserver/Makefile.in  |  16 +-
 gdb/gdbserver/acinclude.m4 |   3 +
 gdb/gdbserver/configure    | 376 +++++++++++++++++++++++++++++++++++++++++++--
 gdb/gdbserver/configure.ac |  32 +++-
 9 files changed, 859 insertions(+), 36 deletions(-)
 create mode 100644 gdb/build-with-cxx.m4

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 00fb2cd..5b8e262 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -79,12 +79,16 @@ MSGMERGE = msgmerge
 PACKAGE = @PACKAGE@
 CATALOGS = @CATALOGS@
 
+# The name of the compiler to use.
+COMPILER = @COMPILER@
+
 # 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
 # will be incorrectly compiled.  The "fixincludes" script in the gcc
 # distribution will fix your include files up.
 CC=@CC@
+CXX=@CXX@
 
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
@@ -93,7 +97,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 = $(CC)
+COMPILE.pre = $(COMPILER)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
@@ -123,7 +127,7 @@ 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=$(CC)
+CC_LD=$(COMPILER)
 
 # Where is our "include" directory?  Typically $(srcdir)/../include.
 # This is essentially the header file directory for the library
@@ -762,19 +766,18 @@ CC_FOR_TARGET = ` \
     fi; \
   fi`
 
-CXX = gcc
 CXX_FOR_TARGET = ` \
-  if [ -f $${rootme}/../gcc/xgcc ] ; then \
+  if [ -f $${rootme}/../gcc/xg++ ] ; then \
     if [ -f $${rootme}/../$(target_subdir)newlib/Makefile ] ; then \
-      echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/$(target_subdir)newlib/targ-include -idirafter $${rootsrc}/../$(target_subdir)newlib/libc/include -nostdinc -B$${rootme}/../$(target_subdir)newlib/; \
+      echo $${rootme}/../gcc/xg++ -B$${rootme}/../gcc/ -idirafter $${rootme}/$(target_subdir)newlib/targ-include -idirafter $${rootsrc}/../$(target_subdir)newlib/libc/include -nostdinc -B$${rootme}/../$(target_subdir)newlib/; \
     else \
-      echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/; \
+      echo $${rootme}/../gcc/xg++ -B$${rootme}/../gcc/; \
     fi; \
   else \
     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
       echo $(CXX); \
     else \
-      t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
+      t='$(program_transform_name)'; echo g++ | sed -e '' $$t; \
     fi; \
   fi`
 
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index ff4aff0..c551dd9 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -57,6 +57,9 @@ m4_include([common/common.m4])
 dnl For libiberty_INIT.
 m4_include(../libiberty/libiberty.m4)
 
+dnl For --enable-build-with-cxx and COMPILER.
+m4_include(build-with-cxx.m4)
+
 ## ----------------------------------------- ##
 ## ANSIfy the C compiler whenever possible.  ##
 ## From Franc,ois Pinard                     ##
diff --git a/gdb/build-with-cxx.m4 b/gdb/build-with-cxx.m4
new file mode 100644
index 0000000..b6284fd
--- /dev/null
+++ b/gdb/build-with-cxx.m4
@@ -0,0 +1,40 @@
+dnl Copyright (C) 2014-2015 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([--enable-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=no])
+
+  if test "$enable_build_with_cxx" = "yes"; then
+    COMPILER='$(CXX)'
+   else
+    COMPILER='$(CC)'
+  fi
+  AC_SUBST(COMPILER)
+])
diff --git a/gdb/configure b/gdb/configure
index 05e355c..1a0c41f 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -724,6 +724,7 @@ MAKE
 CCDEPMODE
 DEPDIR
 am__leading_dot
+COMPILER
 INSTALL_STRIP_PROGRAM
 STRIP
 install_sh
@@ -742,6 +743,9 @@ build
 EGREP
 GREP
 CPP
+ac_ct_CXX
+CXXFLAGS
+CXX
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -796,6 +800,7 @@ enable_option_checking
 enable_maintainer_mode
 enable_plugins
 enable_largefile
+enable_build_with_cxx
 with_separate_debug_dir
 with_gdb_datadir
 with_relocated_sources
@@ -849,6 +854,9 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+CXX
+CXXFLAGS
+CCC
 CPP
 MAKEINFO
 MAKEINFOFLAGS
@@ -1484,6 +1492,7 @@ Optional Features:
 			  (and sometimes confusing) to the casual installer
   --enable-plugins        Enable support for plugins
   --disable-largefile     omit support for large files
+  --enable-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)
@@ -1567,6 +1576,8 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   MAKEINFO    Parent configure detects if it is of sufficient version.
   MAKEINFOFLAGS
@@ -1696,6 +1707,44 @@ fi
 
 } # ac_fn_c_try_compile
 
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_cxx_try_compile
+
 # ac_fn_c_try_cpp LINENO
 # ----------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -3487,6 +3536,264 @@ 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
 
+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
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+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
+
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4634,6 +4941,29 @@ 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=no
+fi
+
+
+  if test "$enable_build_with_cxx" = "yes"; then
+    COMPILER='$(CXX)'
+   else
+    COMPILER='$(CC)'
+  fi
+
+
+
 # Dependency checking.
 rm -rf .tst 2>/dev/null
 mkdir .tst 2>/dev/null
@@ -13035,8 +13365,11 @@ if test "${enable_werror+set}" = set; then :
 fi
 
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -13046,6 +13379,7 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-fpermissive -Wno-sign-compare -Wno-write-strings -Wno-narrowing \
 -Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
@@ -13089,6 +13423,18 @@ 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.
+if test "$enable_build_with_cxx" = "yes"; then
+    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
 then
@@ -13099,10 +13445,16 @@ $as_echo_n "checking compiler warning flags... " >&6; }
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.  Append -Werror to CFLAGS
+	    # so that configure can catch warnings like:
+	    #  cc1plus: warning: command line option '-Wpointer-sign' is valid for C/ObjC but not for C++ [enabled by default]
 	    saved_CFLAGS="$CFLAGS"
-	    CFLAGS="$CFLAGS $w"
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	    CFLAGS="$CFLAGS -Werror $w"
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS -Werror $w"
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -13113,11 +13465,12 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+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
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
@@ -13126,6 +13479,15 @@ fi
 
 
 
+if test "$enable_build_with_cxx" = "yes"; then
+   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.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cygwin" >&5
 $as_echo_n "checking for cygwin... " >&6; }
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 920e580..6192062 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -27,6 +27,8 @@ AM_MAINTAINER_MODE
 . $srcdir/../bfd/development.sh
 
 AC_PROG_CC
+AC_PROG_CXX
+
 AC_USE_SYSTEM_EXTENSIONS
 ACX_LARGEFILE
 AM_PROG_CC_STDC
@@ -36,6 +38,9 @@ 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])
@@ -1959,8 +1964,11 @@ AC_ARG_ENABLE(werror,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
    esac])
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -1970,6 +1978,7 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-fpermissive -Wno-sign-compare -Wno-write-strings -Wno-narrowing \
 -Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
@@ -2011,6 +2020,13 @@ 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])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
+
 WARN_CFLAGS=""
 if test "x${build_warnings}" != x -a "x$GCC" = xyes
 then
@@ -2020,11 +2036,17 @@ then
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.  Append -Werror to CFLAGS
+	    # so that configure can catch warnings like:
+	    #  cc1plus: warning: command line option '-Wpointer-sign' is valid for C/ObjC but not for C++ [enabled by default]
 	    saved_CFLAGS="$CFLAGS"
-	    CFLAGS="$CFLAGS $w"
+	    CFLAGS="$CFLAGS -Werror $w"
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS -Werror $w"
 	    AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
@@ -2032,6 +2054,10 @@ fi
 AC_SUBST(WARN_CFLAGS)
 AC_SUBST(WERROR_CFLAGS)
 
+if test "$enable_build_with_cxx" = "yes"; then
+   AC_LANG_POP([C++])
+fi
+
 # In the Cygwin environment, we need some additional flags.
 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
 [AC_EGREP_CPP(^lose$, [
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e479c7c..cb35470 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -49,7 +49,11 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 RANLIB = @RANLIB@
 
+# The name of the compiler to use.
+COMPILER = @COMPILER@
+
 CC = @CC@
+CXX = @CXX@
 AR = @AR@
 AR_FLAGS = rc
 
@@ -60,7 +64,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 = $(CC)
+COMPILE.pre = $(COMPILER)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
@@ -78,8 +82,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=${CC}
+#CC_LD=gcc -static
+CC_LD=$(COMPILER)
 
 # Where is the "include" directory?  Traditionally ../include or ./include
 INCLUDE_DIR =  ${srcdir}/../../include
@@ -294,7 +298,7 @@ clean-info: force
 
 gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBGNU) $(LIBIBERTY)
 	rm -f gdbserver$(EXEEXT)
-	${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
+	$(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
 	$(LIBGNU) $(LIBIBERTY) $(GDBSERVER_LIBS) $(XM_CLIBS)
 
 $(LIBGNU) $(LIBIBERTY) $(GNULIB_H): all-lib
@@ -304,7 +308,7 @@ all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile
 
 gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY)
 	rm -f gdbreplay$(EXEEXT)
-	${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \
+	$(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \
 	  $(XM_CLIBS) $(LIBGNU) $(LIBIBERTY)
 
 IPA_OBJS=ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o \
@@ -316,7 +320,7 @@ IPA_LIB=libinproctrace.so
 
 $(IPA_LIB): $(IPA_OBJS) ${ADD_DEPS} ${CDEPS}
 	rm -f $(IPA_LIB)
-	${CC-LD} -shared -fPIC -Wl,--no-undefined $(INTERNAL_CFLAGS) \
+	$(CC_LD) -shared -fPIC -Wl,--no-undefined $(INTERNAL_CFLAGS) \
 	$(INTERNAL_LDFLAGS) -o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread
 
 # Put the proper machine-specific files first, so M-. on a machine
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index ba4a21f..cbed321 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -23,6 +23,9 @@ m4_include(../common/common.m4)
 dnl For libiberty_INIT.
 m4_include(../../libiberty/libiberty.m4)
 
+dnl For --enable-build-with-cxx and COMPILER.
+m4_include(../build-with-cxx.m4)
+
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 5623746..f8e93d2 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -615,6 +615,7 @@ DEPDIR
 am__leading_dot
 host_noncanonical
 target_noncanonical
+COMPILER
 RANLIB
 AR
 INSTALL_DATA
@@ -635,6 +636,9 @@ build
 EGREP
 GREP
 CPP
+ac_ct_CXX
+CXXFLAGS
+CXX
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -688,6 +692,7 @@ ac_user_opts='
 enable_option_checking
 enable_maintainer_mode
 enable_largefile
+enable_build_with_cxx
 enable_libmcheck
 with_ust
 with_ust_include
@@ -706,6 +711,9 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+CXX
+CXXFLAGS
+CCC
 CPP'
 
 
@@ -1328,6 +1336,7 @@ 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
+  --enable-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-inprocess-agent
@@ -1354,6 +1363,8 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
 
 Use these variables to override the choices made by `configure' or to help
@@ -1474,6 +1485,44 @@ fi
 
 } # ac_fn_c_try_compile
 
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_cxx_try_compile
+
 # ac_fn_c_try_cpp LINENO
 # ----------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -3206,6 +3255,263 @@ 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
 
+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
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+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
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4403,6 +4709,29 @@ $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=no
+fi
+
+
+  if test "$enable_build_with_cxx" = "yes"; then
+    COMPILER='$(CXX)'
+   else
+    COMPILER='$(CC)'
+  fi
+
+
+
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
@@ -5451,8 +5780,11 @@ if test "${enable_werror+set}" = set; then :
 fi
 
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -5462,8 +5794,20 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-fpermissive -Wno-sign-compare -Wno-write-strings -Wno-narrowing \
 -Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
+# 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_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$GCC" = xyes
 then
@@ -5474,10 +5818,16 @@ $as_echo_n "checking compiler warning flags... " >&6; }
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.  Append -Werror to CFLAGS
+	    # so that configure can catch warnings like:
+	    #  cc1plus: warning: command line option '-Wpointer-sign' is valid for C/ObjC but not for C++ [enabled by default]
 	    saved_CFLAGS="$CFLAGS"
-	    CFLAGS="$CFLAGS $w"
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	    CFLAGS="$CFLAGS -Werror $w"
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS -Werror $w"
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -5488,11 +5838,12 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+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
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
@@ -5501,6 +5852,15 @@ fi
 
 
 
+if test "$enable_build_with_cxx" = "yes"; then
+   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
+
 old_LIBS="$LIBS"
 LIBS="$LIBS -ldl"
 for ac_func in dladdr
@@ -5517,8 +5877,7 @@ done
 LIBS="$old_LIBS"
 
 
-
-  # Check for presense of long long
+  # Check for presence of long long.
   ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
 if test "x$ac_cv_type_long_long" = x""yes; then :
 
@@ -5675,7 +6034,6 @@ _ACEOF
 
 
 
-
 ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strerror" = x""yes; then :
   ac_have_decl=1
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 60636f7..6fd0086 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -26,6 +26,7 @@ AC_CONFIG_HEADER(config.h:config.in)
 AM_MAINTAINER_MODE
 
 AC_PROG_CC
+AC_PROG_CXX
 AC_GNU_SOURCE
 AC_SYS_LARGEFILE
 
@@ -39,6 +40,9 @@ 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
 
@@ -150,8 +154,11 @@ AC_ARG_ENABLE(werror,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
    esac])
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -161,8 +168,15 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-fpermissive -Wno-sign-compare -Wno-write-strings -Wno-narrowing \
 -Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
+# 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
+
 WARN_CFLAGS=""
 if test "x$GCC" = xyes
 then
@@ -172,11 +186,17 @@ then
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.  Append -Werror to CFLAGS
+	    # so that configure can catch warnings like:
+	    #  cc1plus: warning: command line option '-Wpointer-sign' is valid for C/ObjC but not for C++ [enabled by default]
 	    saved_CFLAGS="$CFLAGS"
-	    CFLAGS="$CFLAGS $w"
+	    CFLAGS="$CFLAGS -Werror $w"
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS -Werror $w"
 	    AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
@@ -184,6 +204,10 @@ fi
 AC_SUBST(WARN_CFLAGS)
 AC_SUBST(WERROR_CFLAGS)
 
+if test "$enable_build_with_cxx" = "yes"; then
+   AC_LANG_POP([C++])
+fi
+
 dnl dladdr is glibc-specific.  It is used by thread-db.c but only for
 dnl debugging messages.  It lives in -ldl which is handled below so we don't
 dnl use AC_CHECK_LIB (or AC_SEARCH_LIBS) here.  Instead we just temporarily
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 00/36] Support building GDB as a C++ program
@ 2015-02-09 23:20 Pedro Alves
  2015-02-09 23:20 ` [PATCH 02/36] Add --enable-build-with-cxx configure switch Pedro Alves
                   ` (40 more replies)
  0 siblings, 41 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:20 UTC (permalink / raw)
  To: gdb-patches

I'm glad to announce that the global maintainers have reached
consensus on converting GDB to use C++ as implementation language.

See the project page here: https://sourceware.org/gdb/wiki/cxx-conversion

This series implements the first parts of the transition plan
described in that page.  Namely:

  - Add a --enable-build-with-cxx option (default: no) to compile GDB
    and GDBserver with a C++ compiler, keeping the support for
    building with a C compiler.

  - Modify GDB and GDBserver so they can be compiled in C++ mode,
    using G++'s '-fpermissive' option as shortcut.

  - Split the TRY_CATCH macro into TRY/CATCH macros to better map to
    C++'s 'throw'/'try...catch' in C++ mode, and eliminate all the
    volatile gdb_exception objects.

Some of the patches in the series are generated with scripts.

You'll find those here:
  git@github.com:palves/gdb-refactoring-scripts.git master
Web browsable here:
  https://github.com/palves/gdb-refactoring-scripts

I have regtested/built this on x86_64 Fedora 20 (only).

Known problems:

. Other hosts/native targets will naturally stumble on more
  host-specific code that needs converting, which I can't easily test.
  Help very much welcome!

. '--enable-targets=all' doesn't link yet in C++ mode.  This just more
  extern "C" problems.

These are the kinds of things that we can fix incrementally in
mainline.

Tested on x86_64 Fedora 20, native and gdbserver, both C and C++
modes.

For convenience, you can also find this series here:
  git@github.com:palves/gdb.git palves/cxx-conversion-attempt
Web version:
  https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt
  
I wrote a second series a few months ago that built on an older
version of this one and fixes all the '-fpermissive' errors/warnings,
until GDB and GDBserver build cleanly with -Werror, on x86_64 Fedora.
It's naturally rotten in a few places by now, and in need of some
further cleaning up but it shouldn't be that far off.  You can find it
here:

  https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt-part-2-no-fpermissive
  git@github.com:palves/gdb.git palves/cxx-conversion-attempt-part-2-no-fpermissive

Pedro Alves (31):
  Create libiberty/libiberty.m4
  Add --enable-build-with-cxx configure switch
  C++ keyword cleanliness, mostly auto-generated
  record-btrace.c: Remove redefinitions
  Make array object extern
  elf-bfd.h: Wrap in extern "C".
  floatformat.h: Wrap in extern "C".
  Add extern "C" to declarations of C symbols
  Make functions and variables exported by the IPA be extern "C"
  proc-service, extern "C"
  target.h: Include infrun.h
  Don't forward declare enum target_hw_bp_type
  x86 Linux/ptrace: fix offsetof usage in C++ mode
  mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args
  Exported const objects
  gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast
  opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
  Remove duplicate const
  gdbarch.h: include regcache.h
  breakpoint.h: move enum ‘print_stop_action’
  python/python-internal.h: enum ‘ext_lang_rc’ not defined
  Adjust self tests to cope with GDB built as a C++ program
  catch_command_errors: Remove 'mask' parameter
  Move exception_none to common code, and use it
  Normalize TRY_CATCH exception handling block
  Split TRY_CATCH into TRY + CATCH
  TRY_CATCH -> TRY+CATCH+END_CATCH everywhere
  TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions
  more making TRY/CATCH callers look more like real C++ try/catch blocks
  kill volatile struct gdb_exception
  Make TRY/CATCH use real C++ try/catch in C++ mode

Tom Tromey (5):
  Fix struct, union, and enum nesting in C++
  Fix redefinition errors in C++ mode
  Do not do arithmetic on enum types
  Rename struct lzma_stream to avoid clash with system header
  quit_force: Replace TRY_CATCH wrapper macros

 bfd/elf-bfd.h                               |   7 +
 gdb/Makefile.in                             |  17 +-
 gdb/acinclude.m4                            |   6 +
 gdb/ada-lang.c                              |  94 ++--
 gdb/ada-lang.h                              |   2 +-
 gdb/ada-typeprint.c                         |  11 +-
 gdb/ada-valprint.c                          |   7 +-
 gdb/addrmap.c                               |  56 +--
 gdb/aix-thread.c                            |  32 +-
 gdb/amd64-tdep.c                            | 109 +++--
 gdb/arm-tdep.c                              |   8 +-
 gdb/bcache.c                                |  14 +-
 gdb/block.c                                 |  10 +-
 gdb/block.h                                 |   6 +-
 gdb/break-catch-throw.c                     |  51 +-
 gdb/breakpoint.c                            | 123 ++---
 gdb/breakpoint.h                            |  40 +-
 gdb/btrace.c                                |  18 +-
 gdb/build-with-cxx.m4                       |  40 ++
 gdb/buildsym.c                              |  18 +-
 gdb/c-exp.y                                 |  42 +-
 gdb/c-varobj.c                              |  38 +-
 gdb/cli-out.c                               |   4 +-
 gdb/cli/cli-decode.c                        | 110 ++---
 gdb/cli/cli-decode.h                        |   2 +-
 gdb/cli/cli-interp.c                        |   9 +-
 gdb/cli/cli-script.c                        |  27 +-
 gdb/cli/cli-setshow.c                       |  20 +-
 gdb/coffread.c                              |  38 +-
 gdb/command.h                               |  24 +-
 gdb/common/agent.h                          |   3 +-
 gdb/common/cleanups.c                       |  12 +-
 gdb/common/common-defs.h                    |  10 +
 gdb/common/common-exceptions.c              | 143 ++++--
 gdb/common/common-exceptions.h              | 102 +++-
 gdb/common/filestuff.c                      |  10 +-
 gdb/common/filestuff.h                      |   4 +-
 gdb/compile/compile-c-symbols.c             |  47 +-
 gdb/compile/compile-object-run.c            |  19 +-
 gdb/completer.c                             |  25 +-
 gdb/config.in                               |  45 ++
 gdb/configure                               | 640 ++++++++++++++++++++++---
 gdb/configure.ac                            |  36 +-
 gdb/continuations.c                         |  12 +-
 gdb/corelow.c                               |  19 +-
 gdb/cp-abi.c                                |  33 +-
 gdb/cp-name-parser.y                        |  20 +-
 gdb/cp-namespace.c                          |  63 +--
 gdb/cp-support.c                            |  82 ++--
 gdb/cp-support.h                            |   2 +-
 gdb/cp-valprint.c                           |  43 +-
 gdb/d-exp.y                                 |   8 +-
 gdb/darwin-nat-info.c                       |  22 +-
 gdb/darwin-nat.c                            | 124 ++---
 gdb/dbxread.c                               |  41 +-
 gdb/defs.h                                  |   2 +-
 gdb/dwarf2-frame-tailcall.c                 |   6 +-
 gdb/dwarf2-frame.c                          |  56 ++-
 gdb/dwarf2loc.c                             |  17 +-
 gdb/dwarf2read.c                            | 162 ++++---
 gdb/elfread.c                               |   8 +-
 gdb/environ.c                               |   6 +-
 gdb/eval.c                                  |  33 +-
 gdb/event-loop.c                            |   7 +-
 gdb/event-top.c                             |  12 +-
 gdb/exceptions.c                            |  20 +-
 gdb/exceptions.h                            |   3 -
 gdb/f-exp.y                                 |  16 +-
 gdb/f-valprint.c                            |  11 +-
 gdb/features/feature_to_c.sh                |   8 +-
 gdb/frame-unwind.c                          |  27 +-
 gdb/frame.c                                 |  47 +-
 gdb/gcore.c                                 |  13 +-
 gdb/gdb_proc_service.h                      |  11 +
 gdb/gdbarch.c                               |  22 +-
 gdb/gdbarch.h                               |   2 +
 gdb/gdbarch.sh                              |  24 +-
 gdb/gdbserver/Makefile.in                   |  16 +-
 gdb/gdbserver/acinclude.m4                  |   6 +
 gdb/gdbserver/config.in                     |  41 ++
 gdb/gdbserver/configure                     | 708 +++++++++++++++++++++++++++-
 gdb/gdbserver/configure.ac                  |  34 +-
 gdb/gdbserver/gdb_proc_service.h            |  79 ++++
 gdb/gdbserver/inferiors.h                   |   2 +-
 gdb/gdbserver/linux-aarch64-low.c           |   4 +-
 gdb/gdbserver/linux-amd64-ipa.c             |   2 +-
 gdb/gdbserver/linux-arm-low.c               |  10 +-
 gdb/gdbserver/linux-i386-ipa.c              |   2 +-
 gdb/gdbserver/linux-low.c                   |  20 +-
 gdb/gdbserver/linux-mips-low.c              |  58 +--
 gdb/gdbserver/linux-x86-low.c               |  28 +-
 gdb/gdbserver/lynx-low.c                    |  12 +-
 gdb/gdbserver/proc-service.c                |   4 +-
 gdb/gdbserver/server.c                      |  38 +-
 gdb/gdbserver/thread-db.c                   |  42 +-
 gdb/gdbserver/tracepoint.c                  | 188 ++++----
 gdb/gdbserver/tracepoint.h                  |  50 +-
 gdb/gdbthread.h                             |   2 +-
 gdb/gdbtypes.c                              |  62 +--
 gdb/gdbtypes.h                              | 573 +++++++++++-----------
 gdb/gnu-v3-abi.c                            |  44 +-
 gdb/go-exp.y                                |   8 +-
 gdb/guile/guile-internal.h                  |   6 +-
 gdb/guile/guile.c                           |  20 +-
 gdb/guile/scm-block.c                       |   9 +-
 gdb/guile/scm-breakpoint.c                  |  79 +++-
 gdb/guile/scm-cmd.c                         |   9 +-
 gdb/guile/scm-disasm.c                      |   9 +-
 gdb/guile/scm-frame.c                       | 169 ++++---
 gdb/guile/scm-lazy-string.c                 |  15 +-
 gdb/guile/scm-math.c                        |  38 +-
 gdb/guile/scm-param.c                       |  19 +-
 gdb/guile/scm-ports.c                       |   9 +-
 gdb/guile/scm-pretty-print.c                |   7 +-
 gdb/guile/scm-symbol.c                      |  68 ++-
 gdb/guile/scm-symtab.c                      |   9 +-
 gdb/guile/scm-type.c                        | 105 +++--
 gdb/guile/scm-utils.c                       |  12 +-
 gdb/guile/scm-value.c                       | 244 +++++++---
 gdb/hppa-linux-tdep.c                       |  14 +-
 gdb/i386-tdep.c                             |  36 +-
 gdb/ia64-tdep.c                             |  30 +-
 gdb/inf-loop.c                              |  15 +-
 gdb/inf-ttrace.c                            |  32 +-
 gdb/infcall.c                               |  13 +-
 gdb/infcmd.c                                |  21 +-
 gdb/inferior.c                              |   2 +-
 gdb/inferior.h                              |   2 +-
 gdb/infrun.c                                |  23 +-
 gdb/jit.c                                   |  32 +-
 gdb/jv-exp.y                                |  24 +-
 gdb/linespec.c                              |  21 +-
 gdb/linux-nat.c                             |   6 +-
 gdb/linux-tdep.c                            |  12 +-
 gdb/linux-thread-db.c                       |  73 +--
 gdb/m32c-tdep.c                             |  35 +-
 gdb/macrotab.c                              |  14 +-
 gdb/main.c                                  | 101 ++--
 gdb/maint.c                                 |  10 +-
 gdb/mdebugread.c                            |  54 +--
 gdb/memattr.c                               |  24 +-
 gdb/mi/mi-cmd-stack.c                       |  48 +-
 gdb/mi/mi-cmd-var.c                         |  14 +-
 gdb/mi/mi-interp.c                          |  24 +-
 gdb/mi/mi-main.c                            |  15 +-
 gdb/minidebug.c                             |  22 +-
 gdb/minsyms.c                               |  20 +-
 gdb/nat/linux-ptrace.c                      |   2 +-
 gdb/nat/x86-dregs.c                         |   4 +-
 gdb/nat/x86-dregs.h                         |   3 +-
 gdb/nto-procfs.c                            |  16 +-
 gdb/nto-tdep.c                              |   6 +-
 gdb/objc-lang.c                             |  68 +--
 gdb/p-exp.y                                 |  10 +-
 gdb/p-valprint.c                            |  24 +-
 gdb/parse.c                                 |  27 +-
 gdb/parser-defs.h                           |   2 +-
 gdb/ppc-linux-tdep.c                        |  10 +-
 gdb/ppcnbsd-tdep.c                          |   4 +-
 gdb/printcmd.c                              |  64 +--
 gdb/prologue-value.h                        |  41 +-
 gdb/psymtab.c                               |  22 +-
 gdb/python/py-arch.c                        |  10 +-
 gdb/python/py-block.c                       |  13 +-
 gdb/python/py-bpevent.c                     |   5 +-
 gdb/python/py-breakpoint.c                  |  60 ++-
 gdb/python/py-cmd.c                         |  11 +-
 gdb/python/py-continueevent.c               |   5 +-
 gdb/python/py-event.h                       |   5 +-
 gdb/python/py-evtregistry.c                 |   4 +-
 gdb/python/py-exitedevent.c                 |   5 +-
 gdb/python/py-finishbreakpoint.c            |  51 +-
 gdb/python/py-frame.c                       | 162 ++++---
 gdb/python/py-framefilter.c                 | 134 +++---
 gdb/python/py-function.c                    |   4 +-
 gdb/python/py-gdb-readline.c                |  19 +-
 gdb/python/py-inferior.c                    |  47 +-
 gdb/python/py-infevents.c                   |  20 +-
 gdb/python/py-infthread.c                   |  13 +-
 gdb/python/py-lazy-string.c                 |  13 +-
 gdb/python/py-linetable.c                   |  21 +-
 gdb/python/py-newobjfileevent.c             |  10 +-
 gdb/python/py-objfile.c                     |  22 +-
 gdb/python/py-param.c                       |  11 +-
 gdb/python/py-prettyprint.c                 |  16 +-
 gdb/python/py-progspace.c                   |   4 +-
 gdb/python/py-signalevent.c                 |   5 +-
 gdb/python/py-stopevent.c                   |   3 +-
 gdb/python/py-symbol.c                      |  67 ++-
 gdb/python/py-symtab.c                      |   8 +-
 gdb/python/py-threadevent.c                 |   3 +-
 gdb/python/py-type.c                        | 164 ++++---
 gdb/python/py-utils.c                       |   9 +-
 gdb/python/py-value.c                       | 228 ++++++---
 gdb/python/python-internal.h                |   1 +
 gdb/python/python.c                         |  89 ++--
 gdb/record-btrace.c                         | 100 ++--
 gdb/remote-mips.c                           |   4 +-
 gdb/remote.c                                |  97 ++--
 gdb/rs6000-aix-tdep.c                       |   7 +-
 gdb/rs6000-tdep.c                           |  13 +-
 gdb/s390-linux-tdep.c                       |  19 +-
 gdb/solib-darwin.c                          |  20 +-
 gdb/solib-dsbt.c                            |   8 +-
 gdb/solib-frv.c                             |   8 +-
 gdb/solib-ia64-hpux.c                       |  26 +-
 gdb/solib-pa64.c                            |  28 +-
 gdb/solib-som.c                             |  58 +--
 gdb/solib-spu.c                             |  30 +-
 gdb/solib-svr4.c                            | 104 ++--
 gdb/solib.c                                 |  58 ++-
 gdb/sparc-sol2-tdep.c                       |   2 +-
 gdb/stabsread.c                             | 100 ++--
 gdb/stack.c                                 | 135 +++---
 gdb/stap-probe.c                            |   4 +-
 gdb/symfile-debug.c                         |   6 +-
 gdb/symfile.h                               |  20 +-
 gdb/symtab.c                                | 118 ++---
 gdb/target-descriptions.c                   |  54 ++-
 gdb/target.c                                |   6 +-
 gdb/target.h                                |   2 +
 gdb/testsuite/gdb.gdb/complaints.exp        |   6 +-
 gdb/testsuite/gdb.gdb/python-interrupts.exp |   2 +-
 gdb/testsuite/gdb.gdb/python-selftest.exp   |   2 +-
 gdb/testsuite/gdb.gdb/selftest.exp          |   6 +-
 gdb/thread.c                                |  10 +-
 gdb/top.c                                   |  43 +-
 gdb/tracefile-tfile.c                       |   6 +-
 gdb/tui/tui-data.c                          |   4 +-
 gdb/tui/tui-data.h                          |   8 +-
 gdb/tui/tui-layout.c                        |   8 +-
 gdb/tui/tui-win.c                           |   8 +-
 gdb/tui/tui-windata.c                       |   2 +-
 gdb/tui/tui-wingeneral.c                    |   2 +-
 gdb/tui/tui.c                               |   6 +-
 gdb/typeprint.c                             |  24 +-
 gdb/ui-file.h                               |   2 +-
 gdb/valarith.c                              |   6 +-
 gdb/valops.c                                |  13 +-
 gdb/valprint.c                              |  10 +-
 gdb/value.c                                 | 140 +++---
 gdb/varobj.c                                |  99 ++--
 gdb/varobj.h                                |   4 +-
 gdb/x86-linux-nat.c                         |  17 +-
 gdb/xcoffread.c                             |  30 +-
 gdb/xml-support.c                           |  12 +-
 gdb/xtensa-tdep.h                           |  14 +-
 include/floatformat.h                       |   8 +
 libiberty/libiberty.m4                      |  33 ++
 opcodes/microblaze-opc.h                    |   6 +-
 opcodes/microblaze-opcm.h                   |   4 +-
 251 files changed, 6281 insertions(+), 3484 deletions(-)
 create mode 100644 gdb/build-with-cxx.m4
 mode change 100644 => 100755 gdb/features/feature_to_c.sh
 create mode 100644 libiberty/libiberty.m4

-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 05/36] Fix redefinition errors in C++ mode
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (17 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 17/36] mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-11 10:09   ` Yao Qi
  2015-02-09 23:21 ` [PATCH 28/36] Move exception_none to common code, and use it Pedro Alves
                   ` (21 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

From: Tom Tromey <tromey@redhat.com>

In C, we can forward declare static structure instances.  That doesn't
work in C++ though.  C++ treats these as definitions.  So then the
compiler complains about symbol redefinition, like:

 src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’
 src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here

The intent of static here is naturally to avoid making these objects
visible outside the compilation unit.  The equivalent in C++ would be
to instead define the objects in the anonymous namespace.  But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.

gdb/ChangeLog:
2015-02-09  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves <palves@redhat.com>

	* breakpoint.c (base_breakpoint_ops): Make extern.
	* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
	* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
	* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
	* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
	* python/py-arch.c (arch_object_type): Make extern.
	* python/py-block.c (block_syms_iterator_object_type): Make extern.
	* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
	* python/py-cmd.c (cmdpy_object_type): Make extern.
	* python/py-continueevent.c (continue_event_object_type)
	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
	parameter.  Update all callers.
	* python/py-evtregistry.c (eventregistry_object_type): Make extern.
	* python/py-exitedevent.c (exited_event_object_type): Make extern.
	* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
	* python/py-function.c (fnpy_object_type): Make extern.
	* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
	* python/py-infevents.c (call_pre_event_object_type)
	(inferior_call_post_event_object_type).
	(memory_changed_event_object_type): Make extern.
	* python/py-infthread.c (thread_object_type): Make extern.
	* python/py-lazy-string.c (lazy_string_object_type): Make extern.
	* python/py-linetable.c (linetable_entry_object_type)
	(linetable_object_type, ltpy_iterator_object_type): Make extern.
	* python/py-newobjfileevent.c (new_objfile_event_object_type)
	(clear_objfiles_event_object_type): Make extern.
	* python/py-objfile.c (objfile_object_type): Make extern.
	* python/py-param.c (parmpy_object_type): Make extern.
	* python/py-progspace.c (pspace_object_type): Make extern.
	* python/py-signalevent.c (signal_event_object_type): Make extern.
	* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
	* python/py-type.c (type_object_type, field_object_type)
	(type_iterator_object_type): Make extern.
	* python/python.c (python_extension_script_ops)
	(python_extension_ops): Make extern.
	* stap-probe.c (stap_probe_ops): Make extern.
---
 gdb/breakpoint.c                 |  2 +-
 gdb/dwarf2loc.c                  |  4 ++--
 gdb/elfread.c                    |  8 ++++----
 gdb/guile/guile.c                |  8 ++++----
 gdb/ppcnbsd-tdep.c               |  4 ++--
 gdb/python/py-arch.c             |  4 ++--
 gdb/python/py-block.c            |  4 ++--
 gdb/python/py-bpevent.c          |  5 ++---
 gdb/python/py-cmd.c              |  4 ++--
 gdb/python/py-continueevent.c    |  5 ++---
 gdb/python/py-event.h            |  5 ++---
 gdb/python/py-evtregistry.c      |  4 ++--
 gdb/python/py-exitedevent.c      |  5 ++---
 gdb/python/py-finishbreakpoint.c |  4 ++--
 gdb/python/py-function.c         |  4 ++--
 gdb/python/py-inferior.c         |  8 ++++----
 gdb/python/py-infevents.c        | 20 ++++++++------------
 gdb/python/py-infthread.c        |  4 ++--
 gdb/python/py-lazy-string.c      |  4 ++--
 gdb/python/py-linetable.c        | 12 ++++++------
 gdb/python/py-newobjfileevent.c  | 10 ++++------
 gdb/python/py-objfile.c          |  4 ++--
 gdb/python/py-param.c            |  4 ++--
 gdb/python/py-progspace.c        |  4 ++--
 gdb/python/py-signalevent.c      |  5 ++---
 gdb/python/py-stopevent.c        |  3 +--
 gdb/python/py-symtab.c           |  8 ++++----
 gdb/python/py-threadevent.c      |  3 +--
 gdb/python/py-type.c             | 12 ++++++------
 gdb/python/python.c              |  8 ++++----
 gdb/stap-probe.c                 |  4 ++--
 31 files changed, 85 insertions(+), 98 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 2804453..006acef 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -299,7 +299,7 @@ static int strace_marker_p (struct breakpoint *b);
 
 /* The abstract base class all breakpoint_ops structures inherit
    from.  */
-struct breakpoint_ops base_breakpoint_ops;
+extern struct breakpoint_ops base_breakpoint_ops;
 
 /* The breakpoint_ops structure to be inherited by all breakpoint_ops
    that are implemented on top of software or hardware breakpoints
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index fc0f112..aa569ee 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -41,7 +41,7 @@
 
 extern int dwarf2_always_disassemble;
 
-static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
+extern const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
 
 static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
 						    struct frame_info *frame,
@@ -2151,7 +2151,7 @@ static const struct lval_funcs pieced_value_funcs = {
 
 /* Virtual method table for dwarf2_evaluate_loc_desc_full below.  */
 
-static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
+const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
 {
   dwarf_expr_read_addr_from_reg,
   dwarf_expr_get_reg_value,
diff --git a/gdb/elfread.c b/gdb/elfread.c
index fbe3917..65c63f0 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -49,8 +49,8 @@
 extern void _initialize_elfread (void);
 
 /* Forward declarations.  */
-static const struct sym_fns elf_sym_fns_gdb_index;
-static const struct sym_fns elf_sym_fns_lazy_psyms;
+extern const struct sym_fns elf_sym_fns_gdb_index;
+extern const struct sym_fns elf_sym_fns_lazy_psyms;
 
 /* The struct elfinfo is available only during ELF symbol table and
    psymtab reading.  It is destroyed at the completion of psymtab-reading.
@@ -1566,7 +1566,7 @@ static const struct sym_fns elf_sym_fns =
 /* The same as elf_sym_fns, but not registered and lazily reads
    psymbols.  */
 
-static const struct sym_fns elf_sym_fns_lazy_psyms =
+const struct sym_fns elf_sym_fns_lazy_psyms =
 {
   elf_new_init,			/* init anything gbl to entire symtab */
   elf_symfile_init,		/* read initial info, setup for sym_read() */
@@ -1583,7 +1583,7 @@ static const struct sym_fns elf_sym_fns_lazy_psyms =
 
 /* The same as elf_sym_fns, but not registered and uses the
    DWARF-specific GNU index rather than psymtab.  */
-static const struct sym_fns elf_sym_fns_gdb_index =
+const struct sym_fns elf_sym_fns_gdb_index =
 {
   elf_new_init,			/* init anything gbl to entire symab */
   elf_symfile_init,		/* read initial info, setup for sym_red() */
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 319b583..3e0d11a 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -71,8 +71,8 @@ const char *gdbscm_print_excp = gdbscm_print_excp_message;
 
 #ifdef HAVE_GUILE
 /* Forward decls, these are defined later.  */
-static const struct extension_language_script_ops guile_extension_script_ops;
-static const struct extension_language_ops guile_extension_ops;
+extern const struct extension_language_script_ops guile_extension_script_ops;
+extern const struct extension_language_ops guile_extension_ops;
 #endif
 
 /* The main struct describing GDB's interface to the Guile
@@ -124,7 +124,7 @@ static const char boot_scm_filename[] = "boot.scm";
 
 /* The interface between gdb proper and loading of python scripts.  */
 
-static const struct extension_language_script_ops guile_extension_script_ops =
+const struct extension_language_script_ops guile_extension_script_ops =
 {
   gdbscm_source_script,
   gdbscm_source_objfile_script,
@@ -134,7 +134,7 @@ static const struct extension_language_script_ops guile_extension_script_ops =
 
 /* The interface between gdb proper and guile scripting.  */
 
-static const struct extension_language_ops guile_extension_ops =
+const struct extension_language_ops guile_extension_ops =
 {
   gdbscm_finish_initialization,
   gdbscm_initialized,
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 158cc95..76b6ea7 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -92,7 +92,7 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function,
 
 /* Signal trampolines.  */
 
-static const struct tramp_frame ppcnbsd2_sigtramp;
+extern const struct tramp_frame ppcnbsd2_sigtramp;
 
 static void
 ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
@@ -151,7 +151,7 @@ static const struct tramp_frame ppcnbsd_sigtramp =
 
 /* NetBSD 2.0 introduced a slightly different signal trampoline.  */
 
-static const struct tramp_frame ppcnbsd2_sigtramp =
+const struct tramp_frame ppcnbsd2_sigtramp =
 {
   SIGTRAMP_FRAME,
   4,
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index da6801e..49c654b 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -42,7 +42,7 @@ static struct gdbarch_data *arch_object_data = NULL;
       }								\
   } while (0)
 
-static PyTypeObject arch_object_type
+extern PyTypeObject arch_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
 
 /* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch
@@ -281,7 +281,7 @@ END_PC." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject arch_object_type = {
+PyTypeObject arch_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Architecture",                 /* tp_name */
   sizeof (arch_object),               /* tp_basicsize */
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 140c521..fb6a6b6 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -78,7 +78,7 @@ typedef struct {
       }									\
   } while (0)
 
-static PyTypeObject block_syms_iterator_object_type
+extern PyTypeObject block_syms_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
 static const struct objfile_data *blpy_objfile_data_key;
 
@@ -515,7 +515,7 @@ Return true if this block iterator is valid, false if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject block_syms_iterator_object_type = {
+PyTypeObject block_syms_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.BlockIterator",		  /*tp_name*/
   sizeof (block_syms_iterator_object),	      /*tp_basicsize*/
diff --git a/gdb/python/py-bpevent.c b/gdb/python/py-bpevent.c
index b1df64e..abc9dba 100644
--- a/gdb/python/py-bpevent.c
+++ b/gdb/python/py-bpevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-stopevent.h"
 
-static PyTypeObject breakpoint_event_object_type
+extern PyTypeObject breakpoint_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 /* Create and initialize a BreakpointEvent object.  This acquires new
@@ -55,5 +55,4 @@ GDBPY_NEW_EVENT_TYPE (breakpoint,
                       "gdb.BreakpointEvent",
                       "BreakpointEvent",
                       "GDB breakpoint stop event object",
-                      stop_event_object_type,
-                      static);
+                      stop_event_object_type);
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index c0b6464..a5e96d6 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -70,7 +70,7 @@ struct cmdpy_object
 
 typedef struct cmdpy_object cmdpy_object;
 
-static PyTypeObject cmdpy_object_type
+extern PyTypeObject cmdpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
 
 /* Constants used by this module.  */
@@ -746,7 +746,7 @@ static PyMethodDef cmdpy_object_methods[] =
   { 0 }
 };
 
-static PyTypeObject cmdpy_object_type =
+PyTypeObject cmdpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Command",		  /*tp_name*/
diff --git a/gdb/python/py-continueevent.c b/gdb/python/py-continueevent.c
index e5a384b..3ae5568 100644
--- a/gdb/python/py-continueevent.c
+++ b/gdb/python/py-continueevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject continue_event_object_type
+extern PyTypeObject continue_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -51,5 +51,4 @@ GDBPY_NEW_EVENT_TYPE (continue,
                       "gdb.ContinueEvent",
                       "ContinueEvent",
                       "GDB continue event object",
-                      thread_event_object_type,
-                      static);
+                      thread_event_object_type);
diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index a0b2f74..fcb555d 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -41,12 +41,11 @@
     python.
   DOC Python documentation for the new event type
   BASE the base event for this event usually just event_object_type.
-  QUAL qualification for the create event usually 'static'
 */
 
-#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base, qual) \
+#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base) \
 \
-    qual PyTypeObject name##_event_object_type \
+  PyTypeObject name##_event_object_type		    \
         CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
     = { \
       PyVarObject_HEAD_INIT (NULL, 0)				\
diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c
index 229a557..3a31441 100644
--- a/gdb/python/py-evtregistry.c
+++ b/gdb/python/py-evtregistry.c
@@ -23,7 +23,7 @@
 
 events_object gdb_py_events;
 
-static PyTypeObject eventregistry_object_type
+extern PyTypeObject eventregistry_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
 
 /* Implementation of EventRegistry.connect () -> NULL.
@@ -132,7 +132,7 @@ static PyMethodDef eventregistry_object_methods[] =
   { NULL } /* Sentinel.  */
 };
 
-static PyTypeObject eventregistry_object_type =
+PyTypeObject eventregistry_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.EventRegistry",                        /* tp_name */
diff --git a/gdb/python/py-exitedevent.c b/gdb/python/py-exitedevent.c
index 3d61443..d6ece3c 100644
--- a/gdb/python/py-exitedevent.c
+++ b/gdb/python/py-exitedevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject exited_event_object_type
+extern PyTypeObject exited_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -88,5 +88,4 @@ GDBPY_NEW_EVENT_TYPE (exited,
                       "gdb.ExitedEvent",
                       "ExitedEvent",
                       "GDB exited event object",
-                      event_object_type,
-                      static);
+                      event_object_type);
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 94f19e0..9b5e3c7 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -52,7 +52,7 @@ struct finish_breakpoint_object
   PyObject *return_value;
 };
 
-static PyTypeObject finish_breakpoint_object_type
+extern PyTypeObject finish_breakpoint_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
 
 /* Python function to get the 'return_value' attribute of
@@ -429,7 +429,7 @@ None otherwise.", NULL },
     { NULL }  /* Sentinel.  */
 };
 
-static PyTypeObject finish_breakpoint_object_type =
+PyTypeObject finish_breakpoint_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.FinishBreakpoint",         /*tp_name*/
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index 1513d8d..244bc61 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -28,7 +28,7 @@
 #include "expression.h"
 #include "language.h"
 
-static PyTypeObject fnpy_object_type
+extern PyTypeObject fnpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
 
 \f
@@ -212,7 +212,7 @@ gdbpy_initialize_functions (void)
 
 \f
 
-static PyTypeObject fnpy_object_type =
+PyTypeObject fnpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Function",		  /*tp_name*/
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index ae73040..5d13e07 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -50,7 +50,7 @@ typedef struct
   int nthreads;
 } inferior_object;
 
-static PyTypeObject inferior_object_type
+extern PyTypeObject inferior_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
 
 static const struct inferior_data *infpy_inf_data_key;
@@ -64,7 +64,7 @@ typedef struct {
   CORE_ADDR length;
 } membuf_object;
 
-static PyTypeObject membuf_object_type
+extern PyTypeObject membuf_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
 
 /* Require that INFERIOR be a valid inferior ID.  */
@@ -915,7 +915,7 @@ Return a long with the address of a match, or None." },
   { NULL }
 };
 
-static PyTypeObject inferior_object_type =
+PyTypeObject inferior_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Inferior",		  /* tp_name */
@@ -982,7 +982,7 @@ static PyBufferProcs buffer_procs = {
 };
 #endif	/* IS_PY3K */
 
-static PyTypeObject membuf_object_type = {
+PyTypeObject membuf_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Membuf",			  /*tp_name*/
   sizeof (membuf_object),	  /*tp_basicsize*/
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c
index 0715b15..3ded1b8 100644
--- a/gdb/python/py-infevents.c
+++ b/gdb/python/py-infevents.c
@@ -20,13 +20,13 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject inferior_call_pre_event_object_type
+extern PyTypeObject inferior_call_pre_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject inferior_call_post_event_object_type
+extern PyTypeObject inferior_call_post_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject register_changed_event_object_type
+extern PyTypeObject register_changed_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject memory_changed_event_object_type
+extern PyTypeObject memory_changed_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 /* Construct either a gdb.InferiorCallPreEvent or a
@@ -238,26 +238,22 @@ GDBPY_NEW_EVENT_TYPE (inferior_call_pre,
 		      "gdb.InferiorCallPreEvent",
 		      "InferiorCallPreEvent",
 		      "GDB inferior function pre-call event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (inferior_call_post,
 		      "gdb.InferiorCallPostEvent",
 		      "InferiorCallPostEvent",
 		      "GDB inferior function post-call event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (register_changed,
 		      "gdb.RegisterChangedEvent",
 		      "RegisterChangedEvent",
 		      "GDB register change event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (memory_changed,
 		      "gdb.MemoryChangedEvent",
 		      "MemoryChangedEvent",
 		      "GDB memory change event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index fa4cc25..9a9a2e6 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -22,7 +22,7 @@
 #include "inferior.h"
 #include "python-internal.h"
 
-static PyTypeObject thread_object_type
+extern PyTypeObject thread_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
 
 /* Require that INFERIOR be a valid inferior ID.  */
@@ -307,7 +307,7 @@ Return whether the thread is exited." },
   { NULL }
 };
 
-static PyTypeObject thread_object_type =
+PyTypeObject thread_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.InferiorThread",		  /*tp_name*/
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 7df6a9e..9c0f7a4 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -45,7 +45,7 @@ typedef struct {
   struct type *type;
 } lazy_string_object;
 
-static PyTypeObject lazy_string_object_type
+extern PyTypeObject lazy_string_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
 
 static PyObject *
@@ -215,7 +215,7 @@ static PyGetSetDef lazy_string_object_getset[] = {
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject lazy_string_object_type = {
+PyTypeObject lazy_string_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LazyString",	          /*tp_name*/
   sizeof (lazy_string_object),	  /*tp_basicsize*/
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index 49007ce..ff1716b 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -28,7 +28,7 @@ typedef struct {
   CORE_ADDR pc;
 } linetable_entry_object;
 
-static PyTypeObject linetable_entry_object_type
+extern PyTypeObject linetable_entry_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
 
 typedef struct {
@@ -39,7 +39,7 @@ typedef struct {
   PyObject *symtab;
 } linetable_object;
 
-static PyTypeObject linetable_object_type
+extern PyTypeObject linetable_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
 
 typedef struct {
@@ -52,7 +52,7 @@ typedef struct {
   PyObject *source;
 } ltpy_iterator_object;
 
-static PyTypeObject ltpy_iterator_object_type
+extern PyTypeObject ltpy_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
 
 /* Internal helper function to extract gdb.Symtab from a gdb.Linetable
@@ -493,7 +493,7 @@ Return True if this Linetable is valid, False if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject linetable_object_type = {
+PyTypeObject linetable_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTable",	          /*tp_name*/
   sizeof (linetable_object),	  /*tp_basicsize*/
@@ -540,7 +540,7 @@ Return True if this Linetable iterator is valid, False if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject ltpy_iterator_object_type = {
+PyTypeObject ltpy_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTableIterator",		  /*tp_name*/
   sizeof (ltpy_iterator_object),  /*tp_basicsize*/
@@ -580,7 +580,7 @@ static PyGetSetDef linetable_entry_object_getset[] = {
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject linetable_entry_object_type = {
+PyTypeObject linetable_entry_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTableEntry",	          /*tp_name*/
   sizeof (linetable_entry_object), /*tp_basicsize*/
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 2999b76..95c10e1 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -20,9 +20,9 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject new_objfile_event_object_type
+extern PyTypeObject new_objfile_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject clear_objfiles_event_object_type
+extern PyTypeObject clear_objfiles_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -72,8 +72,7 @@ GDBPY_NEW_EVENT_TYPE (new_objfile,
                       "gdb.NewObjFileEvent",
                       "NewObjFileEvent",
                       "GDB new object file event object",
-                      event_object_type,
-                      static);
+                      event_object_type);
 \f
 /* Subroutine of emit_clear_objfiles_event to simplify it.  */
 
@@ -125,5 +124,4 @@ GDBPY_NEW_EVENT_TYPE (clear_objfiles,
 		      "gdb.ClearObjFilesEvent",
 		      "ClearObjFilesEvent",
 		      "GDB clear object files event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 0aecaf6..0a10623 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -49,7 +49,7 @@ typedef struct
   PyObject *xmethods;
 } objfile_object;
 
-static PyTypeObject objfile_object_type
+extern PyTypeObject objfile_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
 
 static const struct objfile_data *objfpy_objfile_data_key;
@@ -652,7 +652,7 @@ static PyGetSetDef objfile_getset[] =
   { NULL }
 };
 
-static PyTypeObject objfile_object_type =
+PyTypeObject objfile_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Objfile",		  /*tp_name*/
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 48173c8..2fe5be6 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -88,7 +88,7 @@ struct parmpy_object
 
 typedef struct parmpy_object parmpy_object;
 
-static PyTypeObject parmpy_object_type
+extern PyTypeObject parmpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
 
 /* Some handy string constants.  */
@@ -779,7 +779,7 @@ gdbpy_initialize_parameters (void)
 
 \f
 
-static PyTypeObject parmpy_object_type =
+PyTypeObject parmpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Parameter",		  /*tp_name*/
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 29b9f96..93fbc14 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -48,7 +48,7 @@ typedef struct
   PyObject *xmethods;
 } pspace_object;
 
-static PyTypeObject pspace_object_type
+extern PyTypeObject pspace_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
 
 static const struct program_space_data *pspy_pspace_data_key;
@@ -352,7 +352,7 @@ static PyGetSetDef pspace_getset[] =
   { NULL }
 };
 
-static PyTypeObject pspace_object_type =
+PyTypeObject pspace_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Progspace",		  /*tp_name*/
diff --git a/gdb/python/py-signalevent.c b/gdb/python/py-signalevent.c
index 98a47f1..d5b1f27 100644
--- a/gdb/python/py-signalevent.c
+++ b/gdb/python/py-signalevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-stopevent.h"
 
-static PyTypeObject signal_event_object_type
+extern PyTypeObject signal_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 PyObject *
@@ -57,5 +57,4 @@ GDBPY_NEW_EVENT_TYPE (signal,
                       "gdb.SignalEvent",
                       "SignalEvent",
                       "GDB signal event object",
-                      stop_event_object_type,
-                      static);
+                      stop_event_object_type);
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c
index 0ec39ca..684edff 100644
--- a/gdb/python/py-stopevent.c
+++ b/gdb/python/py-stopevent.c
@@ -115,5 +115,4 @@ GDBPY_NEW_EVENT_TYPE (stop,
                       "gdb.StopEvent",
                       "StopEvent",
                       "GDB stop event object",
-                      thread_event_object_type,
-                      /*no qual*/);
+                      thread_event_object_type);
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 487dc87..796a7fc 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -37,7 +37,7 @@ typedef struct stpy_symtab_object {
   struct stpy_symtab_object *next;
 } symtab_object;
 
-static PyTypeObject symtab_object_type
+extern PyTypeObject symtab_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
 static const struct objfile_data *stpy_objfile_data_key;
 
@@ -68,7 +68,7 @@ typedef struct salpy_sal_object {
   struct salpy_sal_object *next;
 } sal_object;
 
-static PyTypeObject sal_object_type
+extern PyTypeObject sal_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
 static const struct objfile_data *salpy_objfile_data_key;
 
@@ -576,7 +576,7 @@ Return the Linetable associated with this symbol table" },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject symtab_object_type = {
+PyTypeObject symtab_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Symtab",			  /*tp_name*/
   sizeof (symtab_object),	  /*tp_basicsize*/
@@ -626,7 +626,7 @@ Return true if this symbol table and line is valid, false if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject sal_object_type = {
+PyTypeObject sal_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Symtab_and_line",	  /*tp_name*/
   sizeof (sal_object),		  /*tp_basicsize*/
diff --git a/gdb/python/py-threadevent.c b/gdb/python/py-threadevent.c
index 6932cd3..f78dc64 100644
--- a/gdb/python/py-threadevent.c
+++ b/gdb/python/py-threadevent.c
@@ -77,5 +77,4 @@ GDBPY_NEW_EVENT_TYPE (thread,
                       "gdb.ThreadEvent",
                       "ThreadEvent",
                       "GDB thread event object",
-                      event_object_type,
-                      /*no qual*/);
+                      event_object_type);
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index bf92363..a3da678 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -41,7 +41,7 @@ typedef struct pyty_type_object
   struct pyty_type_object *next;
 } type_object;
 
-static PyTypeObject type_object_type
+extern PyTypeObject type_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
 
 /* A Field object.  */
@@ -53,7 +53,7 @@ typedef struct pyty_field_object
   PyObject *dict;
 } field_object;
 
-static PyTypeObject field_object_type
+extern PyTypeObject field_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
 
 /* A type iterator object.  */
@@ -67,7 +67,7 @@ typedef struct {
   struct pyty_type_object *source;
 } typy_iterator_object;
 
-static PyTypeObject type_iterator_object_type
+extern PyTypeObject type_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
 
 /* This is used to initialize various gdb.TYPE_ constants.  */
@@ -1539,7 +1539,7 @@ static PyMappingMethods typy_mapping = {
   NULL				  /* no "set" method */
 };
 
-static PyTypeObject type_object_type =
+PyTypeObject type_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Type",			  /*tp_name*/
@@ -1588,7 +1588,7 @@ static PyGetSetDef field_object_getset[] =
   { NULL }
 };
 
-static PyTypeObject field_object_type =
+PyTypeObject field_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Field",			  /*tp_name*/
@@ -1630,7 +1630,7 @@ static PyTypeObject field_object_type =
   0,				  /* tp_new */
 };
 
-static PyTypeObject type_iterator_object_type = {
+PyTypeObject type_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.TypeIterator",		  /*tp_name*/
   sizeof (typy_iterator_object),  /*tp_basicsize*/
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 344d8d2..9854c79 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -57,8 +57,8 @@ static const char *gdbpy_should_print_stack = python_excp_message;
 
 #ifdef HAVE_PYTHON
 /* Forward decls, these are defined later.  */
-static const struct extension_language_script_ops python_extension_script_ops;
-static const struct extension_language_ops python_extension_ops;
+extern const struct extension_language_script_ops python_extension_script_ops;
+extern const struct extension_language_ops python_extension_ops;
 #endif
 
 /* The main struct describing GDB's interface to the Python
@@ -152,7 +152,7 @@ static enum ext_lang_rc gdbpy_before_prompt_hook
 
 /* The interface between gdb proper and loading of python scripts.  */
 
-static const struct extension_language_script_ops python_extension_script_ops =
+const struct extension_language_script_ops python_extension_script_ops =
 {
   gdbpy_source_script,
   gdbpy_source_objfile_script,
@@ -162,7 +162,7 @@ static const struct extension_language_script_ops python_extension_script_ops =
 
 /* The interface between gdb proper and python extensions.  */
 
-static const struct extension_language_ops python_extension_ops =
+const struct extension_language_ops python_extension_ops =
 {
   gdbpy_finish_initialization,
   gdbpy_initialized,
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index d7d9cf1..ffe4dd1 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -47,7 +47,7 @@
 
 /* Forward declaration. */
 
-static const struct probe_ops stap_probe_ops;
+extern const struct probe_ops stap_probe_ops;
 
 /* Should we display debug information for the probe's argument expression
    parsing?  */
@@ -1742,7 +1742,7 @@ stap_gen_info_probes_table_values (struct probe *probe_generic,
 
 /* SystemTap probe_ops.  */
 
-static const struct probe_ops stap_probe_ops =
+const struct probe_ops stap_probe_ops =
 {
   stap_probe_is_linespec,
   stap_get_probes,
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 11/36] Make functions and variables exported by the IPA be extern "C"
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
  2015-02-09 23:20 ` [PATCH 02/36] Add --enable-build-with-cxx configure switch Pedro Alves
  2015-02-09 23:21 ` [PATCH 16/36] x86 Linux/ptrace: fix offsetof usage in C++ mode Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 04/36] Fix struct, union, and enum nesting in C++ Pedro Alves
                   ` (37 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Functions and variables that are exported by the IPA DSO (that
GDBserver needs to look up) should have "C" mangling, thus be declared
with extern "C".

Function and variable declarations need the extern "C" marker, but
variable definitions can't be marked extern, so the patch splits
IP_AGENT_EXPORT into three.

Building in C++ mode revealed that a few variables were missing
IP_AGENT_EXPORT, thus the IPA has been broken when stripped, even in C
mode...  So this ends being a bug fix as well.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* common/agent.h (IPA_SYM_EXPORTED_NAME): New.
	(IPA_SYM): Use it.
	* common/common-defs.h (EXTERN_C_PUSH, EXTERN_C_POP): New macros.

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

	* linux-amd64-ipa.c (gdb_agent_get_raw_reg): Use
	IP_AGENT_EXPORT_FUNC.
	* linux-i386-ipa.c (gdb_agent_get_raw_reg): Use
	IP_AGENT_EXPORT_FUNC.
	* tracepoint.c (ATTR_USED, ATTR_NOINLINE, ATTR_CONSTRUCTOR)
	(IP_AGENT_EXPORT): Delete.
	(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
	(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
	(gdb_trampoline_buffer_error, collecting, gdb_collect)
	(stop_tracing, flush_trace_buffer, about_to_request_buffer_space)
	(trace_buffer_is_full, stopping_tracepoint, expr_eval_result)
	(error_tracepoint, tracepoints, tracing, trace_buffer_ctrl)
	(trace_buffer_ctrl_curr, trace_buffer_lo, trace_buffer_hi)
	(traceframe_read_count, traceframe_write_count)
	(traceframes_created, trace_state_variables, get_raw_reg)
	(get_trace_state_variable_value, set_trace_state_variable_value)
	(ust_loaded, helper_thread_id, cmd_buf): Use
	IPA_SYM_EXPORTED_NAME.
	(stop_tracing, flush_trace_buffer): Use IP_AGENT_EXPORT_FUNC.
	(tracepoints) Use IP_AGENT_EXPORT_VAR.
	(stopping_tracepoint, trace_buffer_is_full, expr_eval_result): Use
	IP_AGENT_EXPORT_VAR and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(last_tracepoint): Move into !IN_PROCESS_AGENT block.
	(error_tracepoint): Use IP_AGENT_EXPORT_VAR and wrap in
	EXTERN_C_PUSH/EXTERN_C_POP.
	(trace_state_variables): Use IP_AGENT_EXPORT_VAR.
	(trace_buffer_lo, trace_buffer_hi): Use IP_AGENT_EXPORT_VAR and
	wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(trace_buffer_ctrl, trace_buffer_ctrl_curr)
	(traceframe_write_count, traceframe_read_count)
	(traceframes_created, tracing): Use IP_AGENT_EXPORT_VAR.
	(about_to_request_buffer_space, get_trace_state_variable_value)
	(set_trace_state_variable_value): Use IP_AGENT_EXPORT_FUNC.
	(collecting): Use IP_AGENT_EXPORT_VAR and wrap in
	EXTERN_C_PUSH/EXTERN_C_POP.
	(gdb_collect): Use IP_AGENT_EXPORT_FUNC.
	(ust_loaded, cmd_buf): Use IP_AGENT_EXPORT_VAR.
	(helper_thread_id, gdb_agent_capability): Use IP_AGENT_EXPORT_VAR
	and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
	(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
	(gdb_trampoline_buffer_error): Use IP_AGENT_EXPORT_VAR.
	* tracepoint.h (ATTR_USED, ATTR_NOINLINE, EXPORTED_SYMBOL):
	Define.
	(IP_AGENT_EXPORT_FUNC, IP_AGENT_EXPORT_VAR)
	(IP_AGENT_EXPORT_VAR_DECL): Define.
	(tracing): Declare.
	(gdb_agent_get_raw_reg): Declare.
---
 gdb/common/agent.h              |   3 +-
 gdb/common/common-defs.h        |   4 +
 gdb/gdbserver/linux-amd64-ipa.c |   2 +-
 gdb/gdbserver/linux-i386-ipa.c  |   2 +-
 gdb/gdbserver/tracepoint.c      | 186 +++++++++++++++++++---------------------
 gdb/gdbserver/tracepoint.h      |  50 ++++++++++-
 6 files changed, 144 insertions(+), 103 deletions(-)

diff --git a/gdb/common/agent.h b/gdb/common/agent.h
index e01b0ad..a004c2e 100644
--- a/gdb/common/agent.h
+++ b/gdb/common/agent.h
@@ -23,9 +23,10 @@ int agent_look_up_symbols (void *);
 
 #define STRINGIZE_1(STR) #STR
 #define STRINGIZE(STR) STRINGIZE_1(STR)
+#define IPA_SYM_EXPORTED_NAME(SYM) gdb_agent_ ## SYM
 #define IPA_SYM(SYM)                                   \
   {                                                    \
-    STRINGIZE (gdb_agent_ ## SYM),			\
+    STRINGIZE (IPA_SYM_EXPORTED_NAME (SYM)),		\
     offsetof (struct ipa_sym_addresses, addr_ ## SYM)	\
   }
 
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 3020bd8..62d9de5 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -52,8 +52,12 @@
 
 #ifdef __cplusplus
 # define EXTERN_C extern "C"
+# define EXTERN_C_PUSH extern "C" {
+# define EXTERN_C_POP }
 #else
 # define EXTERN_C extern
+# define EXTERN_C_PUSH
+# define EXTERN_C_POP
 #endif
 
 #endif /* COMMON_DEFS_H */
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdb/gdbserver/linux-amd64-ipa.c
index c27ef21..a6dfb03 100644
--- a/gdb/gdbserver/linux-amd64-ipa.c
+++ b/gdb/gdbserver/linux-amd64-ipa.c
@@ -68,7 +68,7 @@ supply_fast_tracepoint_registers (struct regcache *regcache,
 		     ((char *) buf) + x86_64_ft_collect_regmap[i]);
 }
 
-ULONGEST __attribute__ ((visibility("default"), used))
+IP_AGENT_EXPORT_FUNC ULONGEST
 gdb_agent_get_raw_reg (const unsigned char *raw_regs, int regnum)
 {
   if (regnum >= X86_64_NUM_FT_COLLECT_GREGS)
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdb/gdbserver/linux-i386-ipa.c
index 6381a55..c00d01b 100644
--- a/gdb/gdbserver/linux-i386-ipa.c
+++ b/gdb/gdbserver/linux-i386-ipa.c
@@ -99,7 +99,7 @@ supply_fast_tracepoint_registers (struct regcache *regcache,
     }
 }
 
-ULONGEST __attribute__ ((visibility("default"), used))
+IP_AGENT_EXPORT_FUNC ULONGEST
 gdb_agent_get_raw_reg (unsigned char *raw_regs, int regnum)
 {
   /* This should maybe be allowed to return an error code, or perhaps
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 82d6ce5..9f87257 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -99,70 +99,43 @@ trace_vdebug (const char *fmt, ...)
 #define trace_debug(FMT, args...)		\
   trace_debug_1 (1, FMT, ##args)
 
-#if defined(__GNUC__)
-#  define ATTR_USED __attribute__((used))
-#  define ATTR_NOINLINE __attribute__((noinline))
-#  define ATTR_CONSTRUCTOR __attribute__ ((constructor))
-#else
-#  define ATTR_USED
-#  define ATTR_NOINLINE
-#  define ATTR_CONSTRUCTOR
-#endif
-
-/* Make sure the functions the IPA needs to export (symbols GDBserver
-   needs to query GDB about) are exported.  */
-
-#ifdef IN_PROCESS_AGENT
-# if defined _WIN32 || defined __CYGWIN__
-#   define IP_AGENT_EXPORT __declspec(dllexport) ATTR_USED
-# else
-#   if __GNUC__ >= 4
-#     define IP_AGENT_EXPORT \
-  __attribute__ ((visibility("default"))) ATTR_USED
-#   else
-#     define IP_AGENT_EXPORT ATTR_USED
-#   endif
-# endif
-#else
-#  define IP_AGENT_EXPORT
-#endif
-
 /* Prefix exported symbols, for good citizenship.  All the symbols
-   that need exporting are defined in this module.  */
+   that need exporting are defined in this module.  Note that all
+   these symbols must be tagged with IP_AGENT_EXPORT_*.  */
 #ifdef IN_PROCESS_AGENT
-# define gdb_tp_heap_buffer gdb_agent_gdb_tp_heap_buffer
-# define gdb_jump_pad_buffer gdb_agent_gdb_jump_pad_buffer
-# define gdb_jump_pad_buffer_end gdb_agent_gdb_jump_pad_buffer_end
-# define gdb_trampoline_buffer gdb_agent_gdb_trampoline_buffer
-# define gdb_trampoline_buffer_end gdb_agent_gdb_trampoline_buffer_end
-# define gdb_trampoline_buffer_error gdb_agent_gdb_trampoline_buffer_error
-# define collecting gdb_agent_collecting
-# define gdb_collect gdb_agent_gdb_collect
-# define stop_tracing gdb_agent_stop_tracing
-# define flush_trace_buffer gdb_agent_flush_trace_buffer
-# define about_to_request_buffer_space gdb_agent_about_to_request_buffer_space
-# define trace_buffer_is_full gdb_agent_trace_buffer_is_full
-# define stopping_tracepoint gdb_agent_stopping_tracepoint
-# define expr_eval_result gdb_agent_expr_eval_result
-# define error_tracepoint gdb_agent_error_tracepoint
-# define tracepoints gdb_agent_tracepoints
-# define tracing gdb_agent_tracing
-# define trace_buffer_ctrl gdb_agent_trace_buffer_ctrl
-# define trace_buffer_ctrl_curr gdb_agent_trace_buffer_ctrl_curr
-# define trace_buffer_lo gdb_agent_trace_buffer_lo
-# define trace_buffer_hi gdb_agent_trace_buffer_hi
-# define traceframe_read_count gdb_agent_traceframe_read_count
-# define traceframe_write_count gdb_agent_traceframe_write_count
-# define traceframes_created gdb_agent_traceframes_created
-# define trace_state_variables gdb_agent_trace_state_variables
-# define get_raw_reg gdb_agent_get_raw_reg
+# define gdb_tp_heap_buffer IPA_SYM_EXPORTED_NAME (gdb_tp_heap_buffer)
+# define gdb_jump_pad_buffer IPA_SYM_EXPORTED_NAME (gdb_jump_pad_buffer)
+# define gdb_jump_pad_buffer_end IPA_SYM_EXPORTED_NAME (gdb_jump_pad_buffer_end)
+# define gdb_trampoline_buffer IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer)
+# define gdb_trampoline_buffer_end IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer_end)
+# define gdb_trampoline_buffer_error IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer_error)
+# define collecting IPA_SYM_EXPORTED_NAME (collecting)
+# define gdb_collect IPA_SYM_EXPORTED_NAME (gdb_collect)
+# define stop_tracing IPA_SYM_EXPORTED_NAME (stop_tracing)
+# define flush_trace_buffer IPA_SYM_EXPORTED_NAME (flush_trace_buffer)
+# define about_to_request_buffer_space IPA_SYM_EXPORTED_NAME (about_to_request_buffer_space)
+# define trace_buffer_is_full IPA_SYM_EXPORTED_NAME (trace_buffer_is_full)
+# define stopping_tracepoint IPA_SYM_EXPORTED_NAME (stopping_tracepoint)
+# define expr_eval_result IPA_SYM_EXPORTED_NAME (expr_eval_result)
+# define error_tracepoint IPA_SYM_EXPORTED_NAME (error_tracepoint)
+# define tracepoints IPA_SYM_EXPORTED_NAME (tracepoints)
+# define tracing IPA_SYM_EXPORTED_NAME (tracing)
+# define trace_buffer_ctrl IPA_SYM_EXPORTED_NAME (trace_buffer_ctrl)
+# define trace_buffer_ctrl_curr IPA_SYM_EXPORTED_NAME (trace_buffer_ctrl_curr)
+# define trace_buffer_lo IPA_SYM_EXPORTED_NAME (trace_buffer_lo)
+# define trace_buffer_hi IPA_SYM_EXPORTED_NAME (trace_buffer_hi)
+# define traceframe_read_count IPA_SYM_EXPORTED_NAME (traceframe_read_count)
+# define traceframe_write_count IPA_SYM_EXPORTED_NAME (traceframe_write_count)
+# define traceframes_created IPA_SYM_EXPORTED_NAME (traceframes_created)
+# define trace_state_variables IPA_SYM_EXPORTED_NAME (trace_state_variables)
+# define get_raw_reg IPA_SYM_EXPORTED_NAME (get_raw_reg)
 # define get_trace_state_variable_value \
-  gdb_agent_get_trace_state_variable_value
+  IPA_SYM_EXPORTED_NAME (get_trace_state_variable_value)
 # define set_trace_state_variable_value \
-  gdb_agent_set_trace_state_variable_value
-# define ust_loaded gdb_agent_ust_loaded
-# define helper_thread_id gdb_agent_helper_thread_id
-# define cmd_buf gdb_agent_cmd_buf
+  IPA_SYM_EXPORTED_NAME (set_trace_state_variable_value)
+# define ust_loaded IPA_SYM_EXPORTED_NAME (ust_loaded)
+# define helper_thread_id IPA_SYM_EXPORTED_NAME (helper_thread_id)
+# define cmd_buf IPA_SYM_EXPORTED_NAME (cmd_buf)
 #endif
 
 #ifndef IN_PROCESS_AGENT
@@ -395,14 +368,14 @@ read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 #  define UNKNOWN_SIDE_EFFECTS() do {} while (0)
 #endif
 
-IP_AGENT_EXPORT void ATTR_USED ATTR_NOINLINE
+IP_AGENT_EXPORT_FUNC void
 stop_tracing (void)
 {
   /* GDBserver places breakpoint here.  */
   UNKNOWN_SIDE_EFFECTS();
 }
 
-IP_AGENT_EXPORT void ATTR_USED ATTR_NOINLINE
+IP_AGENT_EXPORT_FUNC void
 flush_trace_buffer (void)
 {
   /* GDBserver places breakpoint here.  */
@@ -861,31 +834,34 @@ struct wstep_state
 
 #endif
 
+EXTERN_C_PUSH
+
 /* The linked list of all tracepoints.  Marked explicitly as used as
    the in-process library doesn't use it for the fast tracepoints
    support.  */
-IP_AGENT_EXPORT struct tracepoint *tracepoints ATTR_USED;
-
-#ifndef IN_PROCESS_AGENT
-
-/* Pointer to the last tracepoint in the list, new tracepoints are
-   linked in at the end.  */
-
-static struct tracepoint *last_tracepoint;
-#endif
+IP_AGENT_EXPORT_VAR struct tracepoint *tracepoints;
 
 /* The first tracepoint to exceed its pass count.  */
 
-IP_AGENT_EXPORT struct tracepoint *stopping_tracepoint;
+IP_AGENT_EXPORT_VAR struct tracepoint *stopping_tracepoint;
 
 /* True if the trace buffer is full or otherwise no longer usable.  */
 
-IP_AGENT_EXPORT int trace_buffer_is_full;
+IP_AGENT_EXPORT_VAR int trace_buffer_is_full;
 
-static enum eval_result_type expr_eval_result = expr_eval_no_error;
+/* The first error that occurred during expression evaluation.  */
+
+IP_AGENT_EXPORT_VAR enum eval_result_type expr_eval_result = expr_eval_no_error;
+
+EXTERN_C_POP
 
 #ifndef IN_PROCESS_AGENT
 
+/* Pointer to the last tracepoint in the list, new tracepoints are
+   linked in at the end.  */
+
+static struct tracepoint *last_tracepoint;
+
 static const char *eval_result_names[] =
   {
     "terror:in the attic",  /* this should never be reported */
@@ -902,7 +878,9 @@ static const char *eval_result_names[] =
 
 /* The tracepoint in which the error occurred.  */
 
-static struct tracepoint *error_tracepoint;
+EXTERN_C_PUSH
+IP_AGENT_EXPORT_VAR struct tracepoint *error_tracepoint;
+EXTERN_C_POP
 
 struct trace_state_variable
 {
@@ -936,7 +914,7 @@ struct trace_state_variable
 struct trace_state_variable *alloced_trace_state_variables;
 #endif
 
-IP_AGENT_EXPORT struct trace_state_variable *trace_state_variables;
+IP_AGENT_EXPORT_VAR struct trace_state_variable *trace_state_variables;
 
 /* The results of tracing go into a fixed-size space known as the
    "trace buffer".  Because usage follows a limited number of
@@ -1019,14 +997,18 @@ static int circular_trace_buffer;
 
 static LONGEST trace_buffer_size;
 
+EXTERN_C_PUSH
+
 /* Pointer to the block of memory that traceframes all go into.  */
 
-static unsigned char *trace_buffer_lo;
+IP_AGENT_EXPORT_VAR unsigned char *trace_buffer_lo;
 
 /* Pointer to the end of the trace buffer, more precisely to the byte
    after the end of the buffer.  */
 
-static unsigned char *trace_buffer_hi;
+IP_AGENT_EXPORT_VAR unsigned char *trace_buffer_hi;
+
+EXTERN_C_POP
 
 /* Control structure holding the read/write/etc. pointers into the
    trace buffer.  We need more than one of these to implement a
@@ -1180,8 +1162,8 @@ A GDBserver update of `trace_buffer_ctrl_curr' does:
 #define GDBSERVER_UPDATED_FLUSH_COUNT_BIT 0x80000000
 
 #ifdef IN_PROCESS_AGENT
-IP_AGENT_EXPORT struct trace_buffer_control trace_buffer_ctrl[3];
-IP_AGENT_EXPORT unsigned int trace_buffer_ctrl_curr;
+IP_AGENT_EXPORT_VAR struct trace_buffer_control trace_buffer_ctrl[3];
+IP_AGENT_EXPORT_VAR unsigned int trace_buffer_ctrl_curr;
 
 # define TRACE_BUFFER_CTRL_CURR \
   (trace_buffer_ctrl_curr & ~GDBSERVER_FLUSH_COUNT_MASK)
@@ -1226,8 +1208,8 @@ struct trace_buffer_control trace_buffer_ctrl[1];
    of complete traceframes present in the trace buffer.  The IP agent
    writes to the write count, GDBserver writes to read count.  */
 
-IP_AGENT_EXPORT unsigned int traceframe_write_count;
-IP_AGENT_EXPORT unsigned int traceframe_read_count;
+IP_AGENT_EXPORT_VAR unsigned int traceframe_write_count;
+IP_AGENT_EXPORT_VAR unsigned int traceframe_read_count;
 
 /* Convenience macro.  */
 
@@ -1237,7 +1219,7 @@ IP_AGENT_EXPORT unsigned int traceframe_read_count;
 /* The count of all traceframes created in the current run, including
    ones that were discarded to make room.  */
 
-IP_AGENT_EXPORT int traceframes_created;
+IP_AGENT_EXPORT_VAR int traceframes_created;
 
 #ifndef IN_PROCESS_AGENT
 
@@ -1267,7 +1249,7 @@ static struct readonly_region *readonly_regions;
 
 /* The global that controls tracing overall.  */
 
-IP_AGENT_EXPORT int tracing;
+IP_AGENT_EXPORT_VAR int tracing;
 
 #ifndef IN_PROCESS_AGENT
 
@@ -1524,7 +1506,7 @@ init_trace_buffer (LONGEST bufsize)
 
 #ifdef IN_PROCESS_AGENT
 
-IP_AGENT_EXPORT void ATTR_USED ATTR_NOINLINE
+IP_AGENT_EXPORT_FUNC void
 about_to_request_buffer_space (void)
 {
   /* GDBserver places breakpoint here while it goes about to flush
@@ -2127,7 +2109,7 @@ create_trace_state_variable (int num, int gdb)
   return tsv;
 }
 
-IP_AGENT_EXPORT LONGEST
+IP_AGENT_EXPORT_FUNC LONGEST
 get_trace_state_variable_value (int num)
 {
   struct trace_state_variable *tsv;
@@ -2153,7 +2135,7 @@ get_trace_state_variable_value (int num)
   return tsv->value;
 }
 
-IP_AGENT_EXPORT void
+IP_AGENT_EXPORT_FUNC void
 set_trace_state_variable_value (int num, LONGEST val)
 {
   struct trace_state_variable *tsv;
@@ -5790,13 +5772,15 @@ fast_tracepoint_collecting, returning continue-until-break at %s",
    NULL if it isn't locked.  Note that this lock *must* be set while
    executing any *function other than the jump pad.  See
    fast_tracepoint_collecting.  */
-static collecting_t * ATTR_USED collecting;
+EXTERN_C_PUSH
+IP_AGENT_EXPORT_VAR collecting_t *collecting;
+EXTERN_C_POP
 
 /* This routine, called from the jump pad (in asm) is designed to be
    called from the jump pads of fast tracepoints, thus it is on the
    critical path.  */
 
-IP_AGENT_EXPORT void ATTR_USED
+IP_AGENT_EXPORT_FUNC void
 gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
 {
   struct fast_tracepoint_ctx ctx;
@@ -6547,8 +6531,8 @@ upload_fast_traceframes (void)
 
 #ifdef IN_PROCESS_AGENT
 
-IP_AGENT_EXPORT int ust_loaded;
-IP_AGENT_EXPORT char cmd_buf[IPA_CMD_BUF_SIZE];
+IP_AGENT_EXPORT_VAR int ust_loaded;
+IP_AGENT_EXPORT_VAR char cmd_buf[IPA_CMD_BUF_SIZE];
 
 #ifdef HAVE_UST
 
@@ -6839,7 +6823,9 @@ run_inferior_command (char *cmd, int len)
 
 /* Thread ID of the helper thread.  GDBserver reads this to know which
    is the help thread.  This is an LWP id on Linux.  */
-int helper_thread_id;
+EXTERN_C_PUSH
+IP_AGENT_EXPORT_VAR int helper_thread_id;
+EXTERN_C_POP
 
 static int
 init_named_socket (const char *name)
@@ -7269,7 +7255,9 @@ gdb_agent_helper_thread (void *arg)
 #include <signal.h>
 #include <pthread.h>
 
-IP_AGENT_EXPORT int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE;
+EXTERN_C_PUSH
+IP_AGENT_EXPORT_VAR int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE;
+EXTERN_C_POP
 
 static void
 gdb_agent_init (void)
@@ -7307,12 +7295,12 @@ gdb_agent_init (void)
 #include <sys/mman.h>
 #include <fcntl.h>
 
-IP_AGENT_EXPORT char *gdb_tp_heap_buffer;
-IP_AGENT_EXPORT char *gdb_jump_pad_buffer;
-IP_AGENT_EXPORT char *gdb_jump_pad_buffer_end;
-IP_AGENT_EXPORT char *gdb_trampoline_buffer;
-IP_AGENT_EXPORT char *gdb_trampoline_buffer_end;
-IP_AGENT_EXPORT char *gdb_trampoline_buffer_error;
+IP_AGENT_EXPORT_VAR char *gdb_tp_heap_buffer;
+IP_AGENT_EXPORT_VAR char *gdb_jump_pad_buffer;
+IP_AGENT_EXPORT_VAR char *gdb_jump_pad_buffer_end;
+IP_AGENT_EXPORT_VAR char *gdb_trampoline_buffer;
+IP_AGENT_EXPORT_VAR char *gdb_trampoline_buffer_end;
+IP_AGENT_EXPORT_VAR char *gdb_trampoline_buffer_error;
 
 /* Record the result of getting buffer space for fast tracepoint
    trampolines.  Any error message is copied, since caller may not be
diff --git a/gdb/gdbserver/tracepoint.h b/gdb/gdbserver/tracepoint.h
index 2adcd56..30d0b58 100644
--- a/gdb/gdbserver/tracepoint.h
+++ b/gdb/gdbserver/tracepoint.h
@@ -25,7 +25,50 @@
 
 void initialize_tracepoint (void);
 
-extern int tracing;
+#if defined(__GNUC__)
+# define ATTR_USED __attribute__((used))
+# define ATTR_NOINLINE __attribute__((noinline))
+#else
+# define ATTR_USED
+# define ATTR_NOINLINE
+#endif
+
+/* How to make symbol public/exported.  */
+
+#if defined _WIN32 || defined __CYGWIN__
+# define EXPORTED_SYMBOL __declspec (dllexport)
+#else
+# if __GNUC__ >= 4
+#  define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
+# else
+#  define EXPORTED_SYMBOL
+# endif
+#endif
+
+/* Use these to make sure the functions and variables the IPA needs to
+   export (symbols GDBserver needs to query GDB about) are visible and
+   have C linkage.
+
+   Tag exported functions with IP_AGENT_EXPORT_FUNC, tag the
+   definitions of exported variables with IP_AGENT_EXPORT_VAR, and
+   variable declarations with IP_AGENT_EXPORT_VAR_DECL.  Variables
+   must also be exported with C linkage.  As we can't both use extern
+   "C" and initialize a variable in the same statement, variables that
+   don't have a separate declaration must use
+   EXTERN_C_PUSH/EXTERN_C_POP around their definition.  */
+
+#ifdef IN_PROCESS_AGENT
+# define IP_AGENT_EXPORT_FUNC EXTERN_C EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED
+# define IP_AGENT_EXPORT_VAR EXPORTED_SYMBOL ATTR_USED
+# define IP_AGENT_EXPORT_VAR_DECL EXTERN_C EXPORTED_SYMBOL
+#else
+# define IP_AGENT_EXPORT_FUNC
+# define IP_AGENT_EXPORT_VAR
+# define IP_AGENT_EXPORT_VAR_DECL extern
+#endif
+
+IP_AGENT_EXPORT_VAR_DECL int tracing;
+
 extern int disconnected_tracing;
 
 void tracepoint_look_up_symbols (void);
@@ -120,6 +163,11 @@ int agent_mem_read_string (struct eval_agent_expr_context *ctx,
 			   CORE_ADDR from,
 			   ULONGEST len);
 
+/* The prototype the get_raw_reg function in the IPA.  Each arch's
+   bytecode compiler emits calls to this function.  */
+IP_AGENT_EXPORT_FUNC ULONGEST gdb_agent_get_raw_reg
+  (const unsigned char *raw_regs, int regnum);
+
 /* Returns the address of the get_raw_reg function in the IPA.  */
 CORE_ADDR get_raw_reg_func_addr (void);
 /* Returns the address of the get_trace_state_variable_value
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 08/36] elf-bfd.h: Wrap in extern "C".
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (9 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 23/36] gdbarch.h: include regcache.h Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:33   ` Andrew Pinski
  2015-02-09 23:21 ` [PATCH 31/36] Split TRY_CATCH into TRY + CATCH Pedro Alves
                   ` (29 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Binutils Development

Just like bfd-in2.h.  So that C++ programs, such as when GDB is built
as a C++ program, can use it.

bfd/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* elf-bfd.h [__cplusplus]: Wrap in extern "C".
---
 bfd/elf-bfd.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 49ffe79..0587cc2 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -22,6 +22,10 @@
 #ifndef _LIBELF_H_
 #define _LIBELF_H_ 1
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "elf/common.h"
 #include "elf/external.h"
 #include "elf/internal.h"
@@ -2540,4 +2544,7 @@ extern asection _bfd_elf_large_com_section;
     (!(H)->unique_global \
      && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)))
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _LIBELF_H_ */
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 28/36] Move exception_none to common code, and use it
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (18 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 05/36] Fix redefinition errors in C++ mode Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast Pedro Alves
                   ` (20 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.h (exception_none): Declare.
	* common/common-exceptions.c (exception_none): Moved from
	exceptions.c.
	(exceptions_state_mc_init): Use exception_none.
	* exceptions.c (exception_none): Move to
	common/common-exceptions.c.
	* exceptions.h (exception_none): Move to
	common/common-exceptions.h.
---
 gdb/common/common-exceptions.c | 6 +++---
 gdb/common/common-exceptions.h | 3 +++
 gdb/exceptions.c               | 2 --
 gdb/exceptions.h               | 3 ---
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c
index 4308b91..b65f259 100644
--- a/gdb/common/common-exceptions.c
+++ b/gdb/common/common-exceptions.c
@@ -20,6 +20,8 @@
 #include "common-defs.h"
 #include "common-exceptions.h"
 
+const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
+
 /* Possible catcher states.  */
 enum catcher_state {
   /* Initial state, a new catcher has just been created.  */
@@ -78,9 +80,7 @@ exceptions_state_mc_init (volatile struct gdb_exception *exception,
   struct catcher *new_catcher = XCNEW (struct catcher);
 
   /* Start with no exception, save it's address.  */
-  exception->reason = 0;
-  exception->error = GDB_NO_ERROR;
-  exception->message = NULL;
+  *exception = exception_none;
   new_catcher->exception = exception;
 
   new_catcher->mask = mask;
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index e349ed0..a32e6f9 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -188,4 +188,7 @@ extern void throw_error (enum errors error, const char *fmt, ...)
 extern void throw_quit (const char *fmt, ...)
      ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
 
+/* A pre-defined non-exception.  */
+extern const struct gdb_exception exception_none;
+
 #endif /* COMMON_EXCEPTIONS_H */
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 91ca7d5..0ca4c56 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -27,8 +27,6 @@
 #include "serial.h"
 #include "gdbthread.h"
 
-const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
-
 void
 prepare_to_throw_exception (void)
 {
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index 9718573..3b0dbac 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -22,9 +22,6 @@
 
 #include "ui-out.h"
 
-/* A pre-defined non-exception.  */
-extern const struct gdb_exception exception_none;
-
 /* If E is an exception, print it's error message on the specified
    stream.  For _fprintf, prefix the message with PREFIX...  */
 extern void exception_print (struct ui_file *file, struct gdb_exception e);
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (14 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 29/36] Normalize TRY_CATCH exception handling block Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-11  7:57   ` Joel Brobecker
  2015-02-09 23:21 ` [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict Pedro Alves
                   ` (24 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-09  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-09  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.
---
 gdb/ada-lang.c                    |  52 ++++++++--------
 gdb/ada-lang.h                    |   2 +-
 gdb/addrmap.c                     |  56 ++++++++---------
 gdb/aix-thread.c                  |  32 +++++-----
 gdb/amd64-tdep.c                  |  76 +++++++++++------------
 gdb/bcache.c                      |  14 ++---
 gdb/block.c                       |  10 +--
 gdb/block.h                       |   6 +-
 gdb/break-catch-throw.c           |  14 ++---
 gdb/buildsym.c                    |  18 +++---
 gdb/c-exp.y                       |  42 ++++++-------
 gdb/cli/cli-decode.c              | 110 ++++++++++++++++-----------------
 gdb/cli/cli-decode.h              |   2 +-
 gdb/cli/cli-script.c              |  10 +--
 gdb/cli/cli-setshow.c             |  20 +++---
 gdb/coffread.c                    |  38 ++++++------
 gdb/command.h                     |  24 ++++----
 gdb/common/cleanups.c             |  12 ++--
 gdb/common/filestuff.c            |  10 +--
 gdb/common/filestuff.h            |   4 +-
 gdb/continuations.c               |  12 ++--
 gdb/cp-name-parser.y              |  20 +++---
 gdb/cp-namespace.c                |  63 +++++++++----------
 gdb/cp-support.c                  |  48 +++++++--------
 gdb/cp-support.h                  |   2 +-
 gdb/cp-valprint.c                 |   4 +-
 gdb/d-exp.y                       |   8 +--
 gdb/darwin-nat-info.c             |  22 +++----
 gdb/darwin-nat.c                  | 124 +++++++++++++++++++-------------------
 gdb/dbxread.c                     |  41 +++++++------
 gdb/dwarf2read.c                  |  42 ++++++-------
 gdb/environ.c                     |   6 +-
 gdb/f-exp.y                       |  16 ++---
 gdb/frame.c                       |   6 +-
 gdb/gdbarch.c                     |  22 +++----
 gdb/gdbarch.sh                    |  22 +++----
 gdb/gdbserver/inferiors.h         |   2 +-
 gdb/gdbserver/linux-aarch64-low.c |   4 +-
 gdb/gdbserver/linux-arm-low.c     |  10 +--
 gdb/gdbserver/linux-low.c         |  20 +++---
 gdb/gdbserver/linux-mips-low.c    |  58 +++++++++---------
 gdb/gdbserver/linux-x86-low.c     |  10 +--
 gdb/gdbserver/lynx-low.c          |  12 ++--
 gdb/gdbserver/thread-db.c         |  42 ++++++-------
 gdb/gdbthread.h                   |   2 +-
 gdb/gdbtypes.c                    |  32 +++++-----
 gdb/gnu-v3-abi.c                  |  26 ++++----
 gdb/go-exp.y                      |   8 +--
 gdb/guile/guile-internal.h        |   6 +-
 gdb/guile/scm-symbol.c            |  22 +++----
 gdb/guile/scm-utils.c             |  12 ++--
 gdb/hppa-linux-tdep.c             |  14 ++---
 gdb/ia64-tdep.c                   |  30 ++++-----
 gdb/inf-ttrace.c                  |  32 +++++-----
 gdb/inferior.c                    |   2 +-
 gdb/inferior.h                    |   2 +-
 gdb/jit.c                         |  16 ++---
 gdb/jv-exp.y                      |  24 ++++----
 gdb/linux-thread-db.c             |  50 +++++++--------
 gdb/macrotab.c                    |  14 ++---
 gdb/mdebugread.c                  |  54 ++++++++---------
 gdb/memattr.c                     |  24 ++++----
 gdb/mi/mi-cmd-var.c               |  14 ++---
 gdb/minsyms.c                     |  20 +++---
 gdb/nat/x86-dregs.c               |   4 +-
 gdb/nto-procfs.c                  |  16 ++---
 gdb/nto-tdep.c                    |   6 +-
 gdb/objc-lang.c                   |  68 ++++++++++-----------
 gdb/p-exp.y                       |  10 +--
 gdb/p-valprint.c                  |   6 +-
 gdb/parse.c                       |  10 +--
 gdb/parser-defs.h                 |   2 +-
 gdb/printcmd.c                    |  24 ++++----
 gdb/psymtab.c                     |  22 +++----
 gdb/python/py-symbol.c            |  22 +++----
 gdb/remote-mips.c                 |   4 +-
 gdb/remote.c                      |  18 +++---
 gdb/solib-darwin.c                |  20 +++---
 gdb/solib-ia64-hpux.c             |   6 +-
 gdb/solib-pa64.c                  |  28 ++++-----
 gdb/solib-som.c                   |  58 +++++++++---------
 gdb/solib-spu.c                   |  24 ++++----
 gdb/solib-svr4.c                  |  86 +++++++++++++-------------
 gdb/stabsread.c                   |  62 +++++++++----------
 gdb/symfile-debug.c               |   6 +-
 gdb/symfile.h                     |   2 +-
 gdb/symtab.c                      |  46 +++++++-------
 gdb/thread.c                      |  10 +--
 gdb/top.c                         |   2 +-
 gdb/tui/tui-windata.c             |   2 +-
 gdb/typeprint.c                   |  14 ++---
 gdb/ui-file.h                     |   2 +-
 gdb/valarith.c                    |   6 +-
 gdb/value.c                       |   8 +--
 gdb/varobj.c                      |  44 +++++++-------
 gdb/varobj.h                      |   4 +-
 gdb/xcoffread.c                   |  30 ++++-----
 97 files changed, 1124 insertions(+), 1120 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 562627a..04cff1e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -274,7 +274,7 @@ struct cache_entry
   /* The name used to perform the lookup.  */
   const char *name;
   /* The namespace used during the lookup.  */
-  domain_enum namespace;
+  domain_enum the_namespace;
   /* The symbol returned by the lookup, or NULL if no matching symbol
      was found.  */
   struct symbol *sym;
@@ -4430,7 +4430,7 @@ ada_clear_symbol_cache (void)
    Return it if found, or NULL otherwise.  */
 
 static struct cache_entry **
-find_entry (const char *name, domain_enum namespace)
+find_entry (const char *name, domain_enum the_namespace)
 {
   struct ada_symbol_cache *sym_cache
     = ada_get_symbol_cache (current_program_space);
@@ -4439,7 +4439,7 @@ find_entry (const char *name, domain_enum namespace)
 
   for (e = &sym_cache->root[h]; *e != NULL; e = &(*e)->next)
     {
-      if (namespace == (*e)->namespace && strcmp (name, (*e)->name) == 0)
+      if (the_namespace == (*e)->the_namespace && strcmp (name, (*e)->name) == 0)
         return e;
     }
   return NULL;
@@ -4452,10 +4452,10 @@ find_entry (const char *name, domain_enum namespace)
    SYM.  Same principle for BLOCK if not NULL.  */
 
 static int
-lookup_cached_symbol (const char *name, domain_enum namespace,
+lookup_cached_symbol (const char *name, domain_enum the_namespace,
                       struct symbol **sym, const struct block **block)
 {
-  struct cache_entry **e = find_entry (name, namespace);
+  struct cache_entry **e = find_entry (name, the_namespace);
 
   if (e == NULL)
     return 0;
@@ -4470,7 +4470,7 @@ lookup_cached_symbol (const char *name, domain_enum namespace,
    in domain NAMESPACE, save this result in our symbol cache.  */
 
 static void
-cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+cache_symbol (const char *name, domain_enum the_namespace, struct symbol *sym,
               const struct block *block)
 {
   struct ada_symbol_cache *sym_cache
@@ -4503,7 +4503,7 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
   e->name = copy = obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
   strcpy (copy, name);
   e->sym = sym;
-  e->namespace = namespace;
+  e->the_namespace = the_namespace;
   e->block = block;
 }
 \f
@@ -4725,7 +4725,7 @@ ada_lookup_simple_minsym (const char *name)
 
 static void
 add_symbols_from_enclosing_procs (struct obstack *obstackp,
-                                  const char *name, domain_enum namespace,
+                                  const char *name, domain_enum the_namespace,
                                   int wild_match_p)
 {
 }
@@ -5404,7 +5404,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
 
 static int
 ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
-			       domain_enum namespace,
+			       domain_enum the_namespace,
 			       struct ada_symbol_info **results,
 			       int full_search)
 {
@@ -5443,7 +5443,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
       if (full_search)
 	{
 	  ada_add_local_symbols (&symbol_list_obstack, name, block,
-				 namespace, wild_match_p);
+				 the_namespace, wild_match_p);
 	}
       else
 	{
@@ -5451,7 +5451,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 	     ada_iterate_over_symbols, and we don't want to search
 	     superblocks.  */
 	  ada_add_block_symbols (&symbol_list_obstack, block, name,
-				 namespace, NULL, wild_match_p);
+				 the_namespace, NULL, wild_match_p);
 	}
       if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search)
 	goto done;
@@ -5461,7 +5461,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
      already performed this search before.  If we have, then return
      the same result.  */
 
-  if (lookup_cached_symbol (name0, namespace, &sym, &block))
+  if (lookup_cached_symbol (name0, the_namespace, &sym, &block))
     {
       if (sym != NULL)
         add_defn_to_vec (&symbol_list_obstack, sym, block);
@@ -5472,14 +5472,14 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 
   /* Search symbols from all global blocks.  */
  
-  add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1,
+  add_nonlocal_symbols (&symbol_list_obstack, name, the_namespace, 1,
 			wild_match_p);
 
   /* Now add symbols from all per-file blocks if we've gotten no hits
      (not strictly correct, but perhaps better than an error).  */
 
   if (num_defns_collected (&symbol_list_obstack) == 0)
-    add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 0,
+    add_nonlocal_symbols (&symbol_list_obstack, name, the_namespace, 0,
 			  wild_match_p);
 
 done:
@@ -5489,10 +5489,10 @@ done:
   ndefns = remove_extra_symbols (*results, ndefns);
 
   if (ndefns == 0 && full_search && syms_from_global_search)
-    cache_symbol (name0, namespace, NULL, NULL);
+    cache_symbol (name0, the_namespace, NULL, NULL);
 
   if (ndefns == 1 && full_search && syms_from_global_search)
-    cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);
+    cache_symbol (name0, the_namespace, (*results)[0].sym, (*results)[0].block);
 
   ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
 
@@ -5564,7 +5564,7 @@ ada_name_for_lookup (const char *name)
 
 void
 ada_lookup_encoded_symbol (const char *name, const struct block *block,
-			   domain_enum namespace,
+			   domain_enum the_namespace,
 			   struct ada_symbol_info *info)
 {
   struct ada_symbol_info *candidates;
@@ -5573,7 +5573,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
   gdb_assert (info != NULL);
   memset (info, 0, sizeof (struct ada_symbol_info));
 
-  n_candidates = ada_lookup_symbol_list (name, block, namespace, &candidates);
+  n_candidates = ada_lookup_symbol_list (name, block, the_namespace, &candidates);
   if (n_candidates == 0)
     return;
 
@@ -5589,7 +5589,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
 
 struct symbol *
 ada_lookup_symbol (const char *name, const struct block *block0,
-                   domain_enum namespace, int *is_a_field_of_this)
+                   domain_enum the_namespace, int *is_a_field_of_this)
 {
   struct ada_symbol_info info;
 
@@ -5597,7 +5597,7 @@ ada_lookup_symbol (const char *name, const struct block *block0,
     *is_a_field_of_this = 0;
 
   ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
-			     block0, namespace, &info);
+			     block0, the_namespace, &info);
   return info.sym;
 }
 
@@ -7790,17 +7790,17 @@ struct type *
 ada_find_parallel_type (struct type *type, const char *suffix)
 {
   char *name;
-  const char *typename = ada_type_name (type);
+  const char *type_name = ada_type_name (type);
   int len;
 
-  if (typename == NULL)
+  if (type_name == NULL)
     return NULL;
 
-  len = strlen (typename);
+  len = strlen (type_name);
 
   name = (char *) alloca (len + strlen (suffix) + 1);
 
-  strcpy (name, typename);
+  strcpy (name, type_name);
   strcpy (name + len, suffix);
 
   return ada_find_parallel_type_with_name (type, name);
@@ -7863,9 +7863,9 @@ variant_field_index (struct type *type)
 /* A record type with no fields.  */
 
 static struct type *
-empty_record (struct type *template)
+empty_record (struct type *templ)
 {
-  struct type *type = alloc_type_copy (template);
+  struct type *type = alloc_type_copy (templ);
 
   TYPE_CODE (type) = TYPE_CODE_STRUCT;
   TYPE_NFIELDS (type) = 0;
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 29409e6..d2fed3f 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -244,7 +244,7 @@ extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
                                          domain_enum, int *);
 
 extern void ada_lookup_encoded_symbol
-  (const char *name, const struct block *block, domain_enum namespace,
+  (const char *name, const struct block *block, domain_enum the_namespace,
    struct ada_symbol_info *symbol_info);
 
 extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 9bfcc96..4eb08cd 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -29,14 +29,14 @@
    implementation.  */
 struct addrmap_funcs
 {
-  void (*set_empty) (struct addrmap *this,
+  void (*set_empty) (struct addrmap *self,
                      CORE_ADDR start, CORE_ADDR end_inclusive,
                      void *obj);
-  void *(*find) (struct addrmap *this, CORE_ADDR addr);
-  struct addrmap *(*create_fixed) (struct addrmap *this,
+  void *(*find) (struct addrmap *self, CORE_ADDR addr);
+  struct addrmap *(*create_fixed) (struct addrmap *self,
                                    struct obstack *obstack);
-  void (*relocate) (struct addrmap *this, CORE_ADDR offset);
-  int (*foreach) (struct addrmap *this, addrmap_foreach_fn fn, void *data);
+  void (*relocate) (struct addrmap *self, CORE_ADDR offset);
+  int (*foreach) (struct addrmap *self, addrmap_foreach_fn fn, void *data);
 };
 
 
@@ -113,7 +113,7 @@ struct addrmap_fixed
 
 
 static void
-addrmap_fixed_set_empty (struct addrmap *this,
+addrmap_fixed_set_empty (struct addrmap *self,
                    CORE_ADDR start, CORE_ADDR end_inclusive,
                    void *obj)
 {
@@ -124,9 +124,9 @@ addrmap_fixed_set_empty (struct addrmap *this,
 
 
 static void *
-addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_fixed_find (struct addrmap *self, CORE_ADDR addr)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   struct addrmap_transition *bottom = &map->transitions[0];
   struct addrmap_transition *top = &map->transitions[map->num_transitions - 1];
 
@@ -157,7 +157,7 @@ addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
 
 
 static struct addrmap *
-addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_fixed_create_fixed (struct addrmap *self, struct obstack *obstack)
 {
   internal_error (__FILE__, __LINE__,
                   _("addrmap_create_fixed is not implemented yet "
@@ -166,9 +166,9 @@ addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
 
 
 static void
-addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_fixed_relocate (struct addrmap *self, CORE_ADDR offset)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   size_t i;
 
   for (i = 0; i < map->num_transitions; i++)
@@ -177,10 +177,10 @@ addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
 
 
 static int
-addrmap_fixed_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_fixed_foreach (struct addrmap *self, addrmap_foreach_fn fn,
 		       void *data)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   size_t i;
 
   for (i = 0; i < map->num_transitions; i++)
@@ -315,26 +315,26 @@ addrmap_splay_tree_insert (struct addrmap_mutable *map,
    tree node at ADDR, even if it would represent a "transition" from
    one value to the same value.  */
 static void
-force_transition (struct addrmap_mutable *this, CORE_ADDR addr)
+force_transition (struct addrmap_mutable *self, CORE_ADDR addr)
 {
   splay_tree_node n
-    = addrmap_splay_tree_lookup (this, addr);
+    = addrmap_splay_tree_lookup (self, addr);
 
   if (! n)
     {
-      n = addrmap_splay_tree_predecessor (this, addr);
-      addrmap_splay_tree_insert (this, addr,
+      n = addrmap_splay_tree_predecessor (self, addr);
+      addrmap_splay_tree_insert (self, addr,
                                  n ? addrmap_node_value (n) : NULL);
     }
 }
 
 
 static void
-addrmap_mutable_set_empty (struct addrmap *this,
+addrmap_mutable_set_empty (struct addrmap *self,
                            CORE_ADDR start, CORE_ADDR end_inclusive,
                            void *obj)
 {
-  struct addrmap_mutable *map = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *map = (struct addrmap_mutable *) self;
   splay_tree_node n, next;
   void *prior_value;
 
@@ -384,7 +384,7 @@ addrmap_mutable_set_empty (struct addrmap *this,
 
 
 static void *
-addrmap_mutable_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_mutable_find (struct addrmap *self, CORE_ADDR addr)
 {
   /* Not needed yet.  */
   internal_error (__FILE__, __LINE__,
@@ -422,15 +422,15 @@ splay_foreach_copy (splay_tree_node n, void *closure)
 
 
 static struct addrmap *
-addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
 {
-  struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
   struct addrmap_fixed *fixed;
   size_t num_transitions;
 
   /* Count the number of transitions in the tree.  */
   num_transitions = 0;
-  splay_tree_foreach (mutable->tree, splay_foreach_count, &num_transitions);
+  splay_tree_foreach (mutable_obj->tree, splay_foreach_count, &num_transitions);
 
   /* Include an extra entry for the transition at zero (which fixed
      maps have, but mutable maps do not.)  */
@@ -447,7 +447,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
 
   /* Copy all entries from the splay tree to the array, in order 
      of increasing address.  */
-  splay_tree_foreach (mutable->tree, splay_foreach_copy, fixed);
+  splay_tree_foreach (mutable_obj->tree, splay_foreach_copy, fixed);
 
   /* We should have filled the array.  */
   gdb_assert (fixed->num_transitions == num_transitions);
@@ -457,7 +457,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
 
 
 static void
-addrmap_mutable_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_mutable_relocate (struct addrmap *self, CORE_ADDR offset)
 {
   /* Not needed yet.  */
   internal_error (__FILE__, __LINE__,
@@ -488,15 +488,15 @@ addrmap_mutable_foreach_worker (splay_tree_node node, void *data)
 
 
 static int
-addrmap_mutable_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_mutable_foreach (struct addrmap *self, addrmap_foreach_fn fn,
 			 void *data)
 {
-  struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
   struct mutable_foreach_data foreach_data;
 
   foreach_data.fn = fn;
   foreach_data.data = data;
-  return splay_tree_foreach (mutable->tree, addrmap_mutable_foreach_worker,
+  return splay_tree_foreach (mutable_obj->tree, addrmap_mutable_foreach_worker,
 			     &foreach_data);
 }
 
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c187ea0..b03716b 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -757,9 +757,9 @@ sync_threadlists (void)
       else if (gi == gcount)
 	{
 	  thread = add_thread (ptid_build (infpid, 0, pbuf[pi].pthid));
-	  thread->private = xmalloc (sizeof (struct private_thread_info));
-	  thread->private->pdtid = pbuf[pi].pdtid;
-	  thread->private->tid = pbuf[pi].tid;
+	  thread->priv = xmalloc (sizeof (struct private_thread_info));
+	  thread->priv->pdtid = pbuf[pi].pdtid;
+	  thread->priv->tid = pbuf[pi].tid;
 	  pi++;
 	}
       else
@@ -776,8 +776,8 @@ sync_threadlists (void)
 
 	  if (cmp_result == 0)
 	    {
-	      gbuf[gi]->private->pdtid = pdtid;
-	      gbuf[gi]->private->tid = tid;
+	      gbuf[gi]->priv->pdtid = pdtid;
+	      gbuf[gi]->priv->tid = tid;
 	      pi++;
 	      gi++;
 	    }
@@ -789,9 +789,9 @@ sync_threadlists (void)
 	  else
 	    {
 	      thread = add_thread (pptid);
-	      thread->private = xmalloc (sizeof (struct private_thread_info));
-	      thread->private->pdtid = pdtid;
-	      thread->private->tid = tid;
+	      thread->priv = xmalloc (sizeof (struct private_thread_info));
+	      thread->priv->pdtid = pdtid;
+	      thread->priv->tid = tid;
 	      pi++;
 	    }
 	}
@@ -809,7 +809,7 @@ iter_tid (struct thread_info *thread, void *tidp)
 {
   const pthdb_tid_t tid = *(pthdb_tid_t *)tidp;
 
-  return (thread->private->tid == tid);
+  return (thread->priv->tid == tid);
 }
 
 /* Synchronize libpthdebug's state with the inferior and with GDB,
@@ -999,7 +999,7 @@ aix_thread_resume (struct target_ops *ops,
 	error (_("aix-thread resume: unknown pthread %ld"),
 	       ptid_get_lwp (ptid));
 
-      tid[0] = thread->private->tid;
+      tid[0] = thread->priv->tid;
       if (tid[0] == PTHDB_INVALID_TID)
 	error (_("aix-thread resume: no tid for pthread %ld"),
 	       ptid_get_lwp (ptid));
@@ -1313,10 +1313,10 @@ aix_thread_fetch_registers (struct target_ops *ops,
   else
     {
       thread = find_thread_ptid (inferior_ptid);
-      tid = thread->private->tid;
+      tid = thread->priv->tid;
 
       if (tid == PTHDB_INVALID_TID)
-	fetch_regs_user_thread (regcache, thread->private->pdtid);
+	fetch_regs_user_thread (regcache, thread->priv->pdtid);
       else
 	fetch_regs_kernel_thread (regcache, regno, tid);
     }
@@ -1667,10 +1667,10 @@ aix_thread_store_registers (struct target_ops *ops,
   else
     {
       thread = find_thread_ptid (inferior_ptid);
-      tid = thread->private->tid;
+      tid = thread->priv->tid;
 
       if (tid == PTHDB_INVALID_TID)
-	store_regs_user_thread (regcache, thread->private->pdtid);
+	store_regs_user_thread (regcache, thread->priv->pdtid);
       else
 	store_regs_kernel_thread (regcache, regno, tid);
     }
@@ -1764,8 +1764,8 @@ aix_thread_extra_thread_info (struct target_ops *self,
 
   buf = mem_fileopen ();
 
-  pdtid = thread->private->pdtid;
-  tid = thread->private->tid;
+  pdtid = thread->priv->pdtid;
+  tid = thread->priv->tid;
 
   if (tid != PTHDB_INVALID_TID)
     /* i18n: Like "thread-identifier %d, [state] running, suspended" */
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index a661b88..e9de0f6 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -508,7 +508,7 @@ amd64_merge_classes (enum amd64_reg_class class1, enum amd64_reg_class class2)
   return AMD64_SSE;
 }
 
-static void amd64_classify (struct type *type, enum amd64_reg_class class[2]);
+static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]);
 
 /* Return non-zero if TYPE is a non-POD structure or union type.  */
 
@@ -527,19 +527,19 @@ amd64_non_pod_p (struct type *type)
    arrays) and union types, and store the result in CLASS.  */
 
 static void
-amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
+amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
 {
   /* 1. If the size of an object is larger than two eightbytes, or in
         C++, is a non-POD structure or union type, or contains
         unaligned fields, it has class memory.  */
   if (TYPE_LENGTH (type) > 16 || amd64_non_pod_p (type))
     {
-      class[0] = class[1] = AMD64_MEMORY;
+      theclass[0] = theclass[1] = AMD64_MEMORY;
       return;
     }
 
   /* 2. Both eightbytes get initialized to class NO_CLASS.  */
-  class[0] = class[1] = AMD64_NO_CLASS;
+  theclass[0] = theclass[1] = AMD64_NO_CLASS;
 
   /* 3. Each field of an object is classified recursively so that
         always two fields are considered. The resulting class is
@@ -551,9 +551,9 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
       struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type));
 
       /* All fields in an array have the same type.  */
-      amd64_classify (subtype, class);
-      if (TYPE_LENGTH (type) > 8 && class[1] == AMD64_NO_CLASS)
-	class[1] = class[0];
+      amd64_classify (subtype, theclass);
+      if (TYPE_LENGTH (type) > 8 && theclass[1] == AMD64_NO_CLASS)
+	theclass[1] = theclass[0];
     }
   else
     {
@@ -582,7 +582,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 	  gdb_assert (pos == 0 || pos == 1);
 
 	  amd64_classify (subtype, subclass);
-	  class[pos] = amd64_merge_classes (class[pos], subclass[0]);
+	  theclass[pos] = amd64_merge_classes (theclass[pos], subclass[0]);
 	  if (bitsize <= 64 && pos == 0 && endpos == 1)
 	    /* This is a bit of an odd case:  We have a field that would
 	       normally fit in one of the two eightbytes, except that
@@ -606,9 +606,9 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 	       use up all 16 bytes of the aggregate, and are already
 	       handled just fine (because each portion sits on its own
 	       8-byte).  */
-	    class[1] = amd64_merge_classes (class[1], subclass[0]);
+	    theclass[1] = amd64_merge_classes (theclass[1], subclass[0]);
 	  if (pos == 0)
-	    class[1] = amd64_merge_classes (class[1], subclass[1]);
+	    theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
 	}
     }
 
@@ -616,26 +616,26 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 
   /* Rule (a): If one of the classes is MEMORY, the whole argument is
      passed in memory.  */
-  if (class[0] == AMD64_MEMORY || class[1] == AMD64_MEMORY)
-    class[0] = class[1] = AMD64_MEMORY;
+  if (theclass[0] == AMD64_MEMORY || theclass[1] == AMD64_MEMORY)
+    theclass[0] = theclass[1] = AMD64_MEMORY;
 
   /* Rule (b): If SSEUP is not preceded by SSE, it is converted to
      SSE.  */
-  if (class[0] == AMD64_SSEUP)
-    class[0] = AMD64_SSE;
-  if (class[1] == AMD64_SSEUP && class[0] != AMD64_SSE)
-    class[1] = AMD64_SSE;
+  if (theclass[0] == AMD64_SSEUP)
+    theclass[0] = AMD64_SSE;
+  if (theclass[1] == AMD64_SSEUP && theclass[0] != AMD64_SSE)
+    theclass[1] = AMD64_SSE;
 }
 
 /* Classify TYPE, and store the result in CLASS.  */
 
 static void
-amd64_classify (struct type *type, enum amd64_reg_class class[2])
+amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
 {
   enum type_code code = TYPE_CODE (type);
   int len = TYPE_LENGTH (type);
 
-  class[0] = class[1] = AMD64_NO_CLASS;
+  theclass[0] = theclass[1] = AMD64_NO_CLASS;
 
   /* Arguments of types (signed and unsigned) _Bool, char, short, int,
      long, long long, and pointers are in the INTEGER class.  Similarly,
@@ -646,28 +646,28 @@ amd64_classify (struct type *type, enum amd64_reg_class class[2])
        || code == TYPE_CODE_CHAR
        || code == TYPE_CODE_PTR || code == TYPE_CODE_REF)
       && (len == 1 || len == 2 || len == 4 || len == 8))
-    class[0] = AMD64_INTEGER;
+    theclass[0] = AMD64_INTEGER;
 
   /* Arguments of types float, double, _Decimal32, _Decimal64 and __m64
      are in class SSE.  */
   else if ((code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
 	   && (len == 4 || len == 8))
     /* FIXME: __m64 .  */
-    class[0] = AMD64_SSE;
+    theclass[0] = AMD64_SSE;
 
   /* Arguments of types __float128, _Decimal128 and __m128 are split into
      two halves.  The least significant ones belong to class SSE, the most
      significant one to class SSEUP.  */
   else if (code == TYPE_CODE_DECFLOAT && len == 16)
     /* FIXME: __float128, __m128.  */
-    class[0] = AMD64_SSE, class[1] = AMD64_SSEUP;
+    theclass[0] = AMD64_SSE, theclass[1] = AMD64_SSEUP;
 
   /* The 64-bit mantissa of arguments of type long double belongs to
      class X87, the 16-bit exponent plus 6 bytes of padding belongs to
      class X87UP.  */
   else if (code == TYPE_CODE_FLT && len == 16)
     /* Class X87 and X87UP.  */
-    class[0] = AMD64_X87, class[1] = AMD64_X87UP;
+    theclass[0] = AMD64_X87, theclass[1] = AMD64_X87UP;
 
   /* Arguments of complex T where T is one of the types float or
      double get treated as if they are implemented as:
@@ -679,19 +679,19 @@ amd64_classify (struct type *type, enum amd64_reg_class class[2])
 
   */
   else if (code == TYPE_CODE_COMPLEX && len == 8)
-    class[0] = AMD64_SSE;
+    theclass[0] = AMD64_SSE;
   else if (code == TYPE_CODE_COMPLEX && len == 16)
-    class[0] = class[1] = AMD64_SSE;
+    theclass[0] = theclass[1] = AMD64_SSE;
 
   /* A variable of type complex long double is classified as type
      COMPLEX_X87.  */
   else if (code == TYPE_CODE_COMPLEX && len == 32)
-    class[0] = AMD64_COMPLEX_X87;
+    theclass[0] = AMD64_COMPLEX_X87;
 
   /* Aggregates.  */
   else if (code == TYPE_CODE_ARRAY || code == TYPE_CODE_STRUCT
 	   || code == TYPE_CODE_UNION)
-    amd64_classify_aggregate (type, class);
+    amd64_classify_aggregate (type, theclass);
 }
 
 static enum return_value_convention
@@ -699,7 +699,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 		    struct type *type, struct regcache *regcache,
 		    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
-  enum amd64_reg_class class[2];
+  enum amd64_reg_class theclass[2];
   int len = TYPE_LENGTH (type);
   static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM };
   static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM };
@@ -710,7 +710,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
   gdb_assert (!(readbuf && writebuf));
 
   /* 1. Classify the return type with the classification algorithm.  */
-  amd64_classify (type, class);
+  amd64_classify (type, theclass);
 
   /* 2. If the type has class MEMORY, then the caller provides space
      for the return value and passes the address of this storage in
@@ -719,7 +719,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 
      On return %rax will contain the address that has been passed in
      by the caller in %rdi.  */
-  if (class[0] == AMD64_MEMORY)
+  if (theclass[0] == AMD64_MEMORY)
     {
       /* As indicated by the comment above, the ABI guarantees that we
          can always find the return value just after the function has
@@ -738,7 +738,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 
   /* 8. If the class is COMPLEX_X87, the real part of the value is
         returned in %st0 and the imaginary part in %st1.  */
-  if (class[0] == AMD64_COMPLEX_X87)
+  if (theclass[0] == AMD64_COMPLEX_X87)
     {
       if (readbuf)
 	{
@@ -760,7 +760,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
 
-  gdb_assert (class[1] != AMD64_MEMORY);
+  gdb_assert (theclass[1] != AMD64_MEMORY);
   gdb_assert (len <= 16);
 
   for (i = 0; len > 0; i++, len -= 8)
@@ -768,7 +768,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
       int regnum = -1;
       int offset = 0;
 
-      switch (class[i])
+      switch (theclass[i])
 	{
 	case AMD64_INTEGER:
 	  /* 3. If the class is INTEGER, the next available register
@@ -801,7 +801,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 	case AMD64_X87UP:
 	  /* 7. If the class is X87UP, the value is returned together
              with the previous X87 value in %st0.  */
-	  gdb_assert (i > 0 && class[0] == AMD64_X87);
+	  gdb_assert (i > 0 && theclass[0] == AMD64_X87);
 	  regnum = AMD64_ST0_REGNUM;
 	  offset = 8;
 	  len = 2;
@@ -865,21 +865,21 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
     {
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
-      enum amd64_reg_class class[2];
+      enum amd64_reg_class theclass[2];
       int needed_integer_regs = 0;
       int needed_sse_regs = 0;
       int j;
 
       /* Classify argument.  */
-      amd64_classify (type, class);
+      amd64_classify (type, theclass);
 
       /* Calculate the number of integer and SSE registers needed for
          this argument.  */
       for (j = 0; j < 2; j++)
 	{
-	  if (class[j] == AMD64_INTEGER)
+	  if (theclass[j] == AMD64_INTEGER)
 	    needed_integer_regs++;
-	  else if (class[j] == AMD64_SSE)
+	  else if (theclass[j] == AMD64_SSE)
 	    needed_sse_regs++;
 	}
 
@@ -906,7 +906,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
 	      int regnum = -1;
 	      int offset = 0;
 
-	      switch (class[j])
+	      switch (theclass[j])
 		{
 		case AMD64_INTEGER:
 		  regnum = integer_regnum[integer_reg++];
diff --git a/gdb/bcache.c b/gdb/bcache.c
index 78c6d5d..f3abc12 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -264,14 +264,14 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
 
   /* The user's string isn't in the list.  Insert it after *ps.  */
   {
-    struct bstring *new
+    struct bstring *newobj
       = obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
 
-    memcpy (&new->d.data, addr, length);
-    new->length = length;
-    new->next = bcache->bucket[hash_index];
-    new->half_hash = half_hash;
-    bcache->bucket[hash_index] = new;
+    memcpy (&newobj->d.data, addr, length);
+    newobj->length = length;
+    newobj->next = bcache->bucket[hash_index];
+    newobj->half_hash = half_hash;
+    bcache->bucket[hash_index] = newobj;
 
     bcache->unique_count++;
     bcache->unique_size += length;
@@ -280,7 +280,7 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
     if (added)
       *added = 1;
 
-    return &new->d.data;
+    return &newobj->d.data;
   }
 }
 \f
diff --git a/gdb/block.c b/gdb/block.c
index 4175672..00a7012 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -34,7 +34,7 @@
 struct block_namespace_info
 {
   const char *scope;
-  struct using_direct *using;
+  struct using_direct *using_decl;
 };
 
 static void block_initialize_namespace (struct block *block,
@@ -326,7 +326,7 @@ block_using (const struct block *block)
   if (block == NULL || BLOCK_NAMESPACE (block) == NULL)
     return NULL;
   else
-    return BLOCK_NAMESPACE (block)->using;
+    return BLOCK_NAMESPACE (block)->using_decl;
 }
 
 /* Set BLOCK's using member to USING; if needed, allocate memory via
@@ -335,12 +335,12 @@ block_using (const struct block *block)
 
 void
 block_set_using (struct block *block,
-		 struct using_direct *using,
+		 struct using_direct *using_decl,
 		 struct obstack *obstack)
 {
   block_initialize_namespace (block, obstack);
 
-  BLOCK_NAMESPACE (block)->using = using;
+  BLOCK_NAMESPACE (block)->using_decl = using_decl;
 }
 
 /* If BLOCK_NAMESPACE (block) is NULL, allocate it via OBSTACK and
@@ -354,7 +354,7 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
       BLOCK_NAMESPACE (block)
 	= obstack_alloc (obstack, sizeof (struct block_namespace_info));
       BLOCK_NAMESPACE (block)->scope = NULL;
-      BLOCK_NAMESPACE (block)->using = NULL;
+      BLOCK_NAMESPACE (block)->using_decl = NULL;
     }
 }
 
diff --git a/gdb/block.h b/gdb/block.h
index e45f445..bdc5888 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -92,7 +92,7 @@ struct block
 	 this block: using directives and the current namespace
 	 scope.  */
       
-      struct block_namespace_info *namespace;
+      struct block_namespace_info *the_namespace;
     }
     cplus_specific;
   }
@@ -118,7 +118,7 @@ struct global_block
 #define BLOCK_FUNCTION(bl)	(bl)->function
 #define BLOCK_SUPERBLOCK(bl)	(bl)->superblock
 #define BLOCK_DICT(bl)		(bl)->dict
-#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.namespace
+#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.the_namespace
 
 struct blockvector
 {
@@ -176,7 +176,7 @@ extern void block_set_scope (struct block *block, const char *scope,
 extern struct using_direct *block_using (const struct block *block);
 
 extern void block_set_using (struct block *block,
-			     struct using_direct *using,
+			     struct using_direct *using_decl,
 			     struct obstack *obstack);
 
 extern const struct block *block_static_block (const struct block *block);
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index fb04932..2baf506 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -162,7 +162,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
 {
   struct exception_catchpoint *self
     = (struct exception_catchpoint *) bs->breakpoint_at;
-  char *typename = NULL;
+  char *type_name = NULL;
   volatile struct gdb_exception e;
 
   bkpt_breakpoint_ops.check_status (bs);
@@ -178,22 +178,22 @@ check_status_exception_catchpoint (struct bpstats *bs)
       char *canon;
 
       fetch_probe_arguments (NULL, &typeinfo_arg);
-      typename = cplus_typename_from_type_info (typeinfo_arg);
+      type_name = cplus_typename_from_type_info (typeinfo_arg);
 
-      canon = cp_canonicalize_string (typename);
+      canon = cp_canonicalize_string (type_name);
       if (canon != NULL)
 	{
-	  xfree (typename);
-	  typename = canon;
+	  xfree (type_name);
+	  type_name = canon;
 	}
     }
 
   if (e.reason < 0)
     exception_print (gdb_stderr, e);
-  else if (regexec (self->pattern, typename, 0, NULL, 0) != 0)
+  else if (regexec (self->pattern, type_name, 0, NULL, 0) != 0)
     bs->stop = 0;
 
-  xfree (typename);
+  xfree (type_name);
 }
 
 /* Implement the 're_set' method.  */
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index bb3ee26..2a24a25 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1622,7 +1622,7 @@ augment_type_symtab (void)
 struct context_stack *
 push_context (int desc, CORE_ADDR valu)
 {
-  struct context_stack *new;
+  struct context_stack *newobj;
 
   if (context_stack_depth == context_stack_size)
     {
@@ -1632,18 +1632,18 @@ push_context (int desc, CORE_ADDR valu)
 		  (context_stack_size * sizeof (struct context_stack)));
     }
 
-  new = &context_stack[context_stack_depth++];
-  new->depth = desc;
-  new->locals = local_symbols;
-  new->old_blocks = pending_blocks;
-  new->start_addr = valu;
-  new->using_directives = using_directives;
-  new->name = NULL;
+  newobj = &context_stack[context_stack_depth++];
+  newobj->depth = desc;
+  newobj->locals = local_symbols;
+  newobj->old_blocks = pending_blocks;
+  newobj->start_addr = valu;
+  newobj->using_directives = using_directives;
+  newobj->name = NULL;
 
   local_symbols = NULL;
   using_directives = NULL;
 
-  return new;
+  return newobj;
 }
 
 /* Pop a context block.  Returns the address of the context block just
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index e6de803..84f3a33 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -164,7 +164,7 @@ static int type_aggregate_p (struct type *);
 
     struct type_stack *type_stack;
 
-    struct objc_class_str class;
+    struct objc_class_str theclass;
   }
 
 %{
@@ -215,11 +215,11 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token <ssym> UNKNOWN_CPP_NAME
 %token <voidval> COMPLETE
 %token <tsym> TYPENAME
-%token <class> CLASSNAME	/* ObjC Class name */
+%token <theclass> CLASSNAME	/* ObjC Class name */
 %type <sval> name
 %type <svec> string_exp
 %type <ssym> name_not_typename
-%type <tsym> typename
+%type <tsym> type_name
 
  /* This is like a '[' token, but is only generated when parsing
     Objective C.  This lets us reuse the same parser without
@@ -238,7 +238,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token TEMPLATE
 %token ERROR
 %token NEW DELETE
-%type <sval> operator
+%type <sval> oper
 %token REINTERPRET_CAST DYNAMIC_CAST STATIC_CAST CONST_CAST
 %token ENTRY
 %token TYPEOF
@@ -479,17 +479,17 @@ exp	:	exp OBJC_LBRAC exp1 ']'
 
 exp	: 	OBJC_LBRAC TYPENAME
 			{
-			  CORE_ADDR class;
+			  CORE_ADDR theclass;
 
-			  class = lookup_objc_class (parse_gdbarch (pstate),
+			  theclass = lookup_objc_class (parse_gdbarch (pstate),
 						     copy_name ($2.stoken));
-			  if (class == 0)
+			  if (theclass == 0)
 			    error (_("%s is not an ObjC Class"),
 				   copy_name ($2.stoken));
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate,
 					    parse_type (pstate)->builtin_int);
-			  write_exp_elt_longcst (pstate, (LONGEST) class);
+			  write_exp_elt_longcst (pstate, (LONGEST) theclass);
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  start_msglist();
 			}
@@ -505,7 +505,7 @@ exp	:	OBJC_LBRAC CLASSNAME
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate,
 					    parse_type (pstate)->builtin_int);
-			  write_exp_elt_longcst (pstate, (LONGEST) $2.class);
+			  write_exp_elt_longcst (pstate, (LONGEST) $2.theclass);
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  start_msglist();
 			}
@@ -1390,7 +1390,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 					       $2.length);
 			  $$ = NULL;
 			}
-	|	UNSIGNED typename
+	|	UNSIGNED type_name
 			{ $$ = lookup_unsigned_typename (parse_language (pstate),
 							 parse_gdbarch (pstate),
 							 TYPE_NAME($2.type)); }
@@ -1398,7 +1398,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 			{ $$ = lookup_unsigned_typename (parse_language (pstate),
 							 parse_gdbarch (pstate),
 							 "int"); }
-	|	SIGNED_KEYWORD typename
+	|	SIGNED_KEYWORD type_name
 			{ $$ = lookup_signed_typename (parse_language (pstate),
 						       parse_gdbarch (pstate),
 						       TYPE_NAME($2.type)); }
@@ -1419,7 +1419,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 			{ $$ = follow_types ($1); }
 	;
 
-typename:	TYPENAME
+type_name:	TYPENAME
 	|	INT_KEYWORD
 		{
 		  $$.stoken.ptr = "int";
@@ -1501,7 +1501,7 @@ const_or_volatile_noopt:  	const_and_volatile
 			{ insert_type (tp_volatile); }
 	;
 
-operator:	OPERATOR NEW
+oper:	OPERATOR NEW
 			{ $$ = operator_stoken (" new"); }
 	|	OPERATOR DELETE
 			{ $$ = operator_stoken (" delete"); }
@@ -1632,7 +1632,7 @@ name	:	NAME { $$ = $1.stoken; }
 	|	TYPENAME { $$ = $1.stoken; }
 	|	NAME_OR_INT  { $$ = $1.stoken; }
 	|	UNKNOWN_CPP_NAME  { $$ = $1.stoken; }
-	|	operator { $$ = $1; }
+	|	oper { $$ = $1; }
 	;
 
 name_not_typename :	NAME
@@ -1644,7 +1644,7 @@ name_not_typename :	NAME
    context where only a name could occur, this might be useful.
   	|	NAME_OR_INT
  */
-	|	operator
+	|	oper
 			{
 			  struct field_of_this_result is_a_field_of_this;
 
@@ -2274,7 +2274,7 @@ enum token_flags
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
   enum token_flags flags;
@@ -2493,7 +2493,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	if ((tokentab3[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2506,7 +2506,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	if ((tokentab2[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2803,7 +2803,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	if ((ident_tokens[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2946,10 +2946,10 @@ classify_name (struct parser_state *par_state, const struct block *block,
       CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy);
       if (Class)
 	{
-	  yylval.class.class = Class;
+	  yylval.theclass.theclass = Class;
 	  sym = lookup_struct_typedef (copy, expression_context_block, 1);
 	  if (sym)
-	    yylval.class.type = SYMBOL_TYPE (sym);
+	    yylval.theclass.type = SYMBOL_TYPE (sym);
 	  return CLASSNAME;
 	}
     }
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4ec6ec0..2ee2ae0 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -189,7 +189,7 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
    of *LIST).  */
 
 struct cmd_list_element *
-add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
+add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 	 const char *doc, struct cmd_list_element **list)
 {
   struct cmd_list_element *c
@@ -228,7 +228,7 @@ add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
     }
 
   c->name = name;
-  c->class = class;
+  c->theclass = theclass;
   set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
@@ -283,7 +283,7 @@ deprecate_cmd (struct cmd_list_element *cmd, const char *replacement)
 }
 
 struct cmd_list_element *
-add_alias_cmd (const char *name, const char *oldname, enum command_class class,
+add_alias_cmd (const char *name, const char *oldname, enum command_class theclass,
 	       int abbrev_flag, struct cmd_list_element **list)
 {
   const char *tmp;
@@ -306,7 +306,7 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
       return 0;
     }
 
-  c = add_cmd (name, class, NULL, old->doc, list);
+  c = add_cmd (name, theclass, NULL, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
   if (old->doc_allocated)
@@ -335,13 +335,13 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
    containing that list.  */
 
 struct cmd_list_element *
-add_prefix_cmd (const char *name, enum command_class class,
+add_prefix_cmd (const char *name, enum command_class theclass,
 		cmd_cfunc_ftype *fun,
 		const char *doc, struct cmd_list_element **prefixlist,
 		const char *prefixname, int allow_unknown,
 		struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
   struct cmd_list_element *p;
 
   c->prefixlist = prefixlist;
@@ -363,13 +363,13 @@ add_prefix_cmd (const char *name, enum command_class class,
 /* Like add_prefix_cmd but sets the abbrev_flag on the new command.  */
 
 struct cmd_list_element *
-add_abbrev_prefix_cmd (const char *name, enum command_class class,
+add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
 		       cmd_cfunc_ftype *fun, const char *doc,
 		       struct cmd_list_element **prefixlist,
 		       const char *prefixname,
 		       int allow_unknown, struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
 
   c->prefixlist = prefixlist;
   c->prefixname = prefixname;
@@ -403,13 +403,13 @@ empty_sfunc (char *args, int from_tty, struct cmd_list_element *c)
 static struct cmd_list_element *
 add_set_or_show_cmd (const char *name,
 		     enum cmd_types type,
-		     enum command_class class,
+		     enum command_class theclass,
 		     var_types var_type,
 		     void *var,
 		     const char *doc,
 		     struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, NULL, doc, list);
 
   gdb_assert (type == set_cmd || type == show_cmd);
   c->type = type;
@@ -432,7 +432,7 @@ add_set_or_show_cmd (const char *name,
 
 static void
 add_setshow_cmd_full (const char *name,
-		      enum command_class class,
+		      enum command_class theclass,
 		      var_types var_type, void *var,
 		      const char *set_doc, const char *show_doc,
 		      const char *help_doc,
@@ -458,7 +458,7 @@ add_setshow_cmd_full (const char *name,
       full_set_doc = xstrdup (set_doc);
       full_show_doc = xstrdup (show_doc);
     }
-  set = add_set_or_show_cmd (name, set_cmd, class, var_type, var,
+  set = add_set_or_show_cmd (name, set_cmd, theclass, var_type, var,
 			     full_set_doc, set_list);
   set->doc_allocated = 1;
 
@@ -467,7 +467,7 @@ add_setshow_cmd_full (const char *name,
 
   set_cmd_prefix (set, set_list);
 
-  show = add_set_or_show_cmd (name, show_cmd, class, var_type, var,
+  show = add_set_or_show_cmd (name, show_cmd, theclass, var_type, var,
 			      full_show_doc, show_list);
   show->doc_allocated = 1;
   show->show_value_func = show_func;
@@ -485,7 +485,7 @@ add_setshow_cmd_full (const char *name,
 
 void
 add_setshow_enum_cmd (const char *name,
-		      enum command_class class,
+		      enum command_class theclass,
 		      const char *const *enumlist,
 		      const char **var,
 		      const char *set_doc,
@@ -498,7 +498,7 @@ add_setshow_enum_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_enum, var,
+  add_setshow_cmd_full (name, theclass, var_enum, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -514,7 +514,7 @@ const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
    string.  FUNC is the corresponding callback.  */
 void
 add_setshow_auto_boolean_cmd (const char *name,
-			      enum command_class class,
+			      enum command_class theclass,
 			      enum auto_boolean *var,
 			      const char *set_doc, const char *show_doc,
 			      const char *help_doc,
@@ -525,7 +525,7 @@ add_setshow_auto_boolean_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_auto_boolean, var,
+  add_setshow_cmd_full (name, theclass, var_auto_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -538,7 +538,7 @@ add_setshow_auto_boolean_cmd (const char *name,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
+add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var,
 			 const char *set_doc, const char *show_doc,
 			 const char *help_doc,
 			 cmd_sfunc_ftype *set_func,
@@ -549,7 +549,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
   static const char *boolean_enums[] = { "on", "off", NULL };
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_boolean, var,
+  add_setshow_cmd_full (name, theclass, var_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -560,7 +560,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_filename_cmd (const char *name, enum command_class class,
+add_setshow_filename_cmd (const char *name, enum command_class theclass,
 			  char **var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -571,7 +571,7 @@ add_setshow_filename_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_result;
 
-  add_setshow_cmd_full (name, class, var_filename, var,
+  add_setshow_cmd_full (name, theclass, var_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -582,7 +582,7 @@ add_setshow_filename_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_string_cmd (const char *name, enum command_class class,
+add_setshow_string_cmd (const char *name, enum command_class theclass,
 			char **var,
 			const char *set_doc, const char *show_doc,
 			const char *help_doc,
@@ -591,7 +591,7 @@ add_setshow_string_cmd (const char *name, enum command_class class,
 			struct cmd_list_element **set_list,
 			struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_string, var,
+  add_setshow_cmd_full (name, theclass, var_string, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -601,7 +601,7 @@ add_setshow_string_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 struct cmd_list_element *
-add_setshow_string_noescape_cmd (const char *name, enum command_class class,
+add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
 				 char **var,
 				 const char *set_doc, const char *show_doc,
 				 const char *help_doc,
@@ -612,7 +612,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_cmd;
 
-  add_setshow_cmd_full (name, class, var_string_noescape, var,
+  add_setshow_cmd_full (name, theclass, var_string_noescape, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -623,7 +623,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_optional_filename_cmd (const char *name, enum command_class class,
+add_setshow_optional_filename_cmd (const char *name, enum command_class theclass,
 				   char **var,
 				   const char *set_doc, const char *show_doc,
 				   const char *help_doc,
@@ -634,7 +634,7 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_result;
  
-  add_setshow_cmd_full (name, class, var_optional_filename, var,
+  add_setshow_cmd_full (name, theclass, var_optional_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -666,7 +666,7 @@ integer_unlimited_completer (struct cmd_list_element *ignore,
    value.  SET_DOC and SHOW_DOC are the documentation strings.  This
    function is only used in Python API.  Please don't use it elsewhere.  */
 void
-add_setshow_integer_cmd (const char *name, enum command_class class,
+add_setshow_integer_cmd (const char *name, enum command_class theclass,
 			 int *var,
 			 const char *set_doc, const char *show_doc,
 			 const char *help_doc,
@@ -677,7 +677,7 @@ add_setshow_integer_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_integer, var,
+  add_setshow_cmd_full (name, theclass, var_integer, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -691,7 +691,7 @@ add_setshow_integer_cmd (const char *name, enum command_class class,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_uinteger_cmd (const char *name, enum command_class class,
+add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
 			  unsigned int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -702,7 +702,7 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_uinteger, var,
+  add_setshow_cmd_full (name, theclass, var_uinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -716,7 +716,7 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_zinteger_cmd (const char *name, enum command_class class,
+add_setshow_zinteger_cmd (const char *name, enum command_class theclass,
 			  int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -725,7 +725,7 @@ add_setshow_zinteger_cmd (const char *name, enum command_class class,
 			  struct cmd_list_element **set_list,
 			  struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_zinteger, var,
+  add_setshow_cmd_full (name, theclass, var_zinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -734,7 +734,7 @@ add_setshow_zinteger_cmd (const char *name, enum command_class class,
 
 void
 add_setshow_zuinteger_unlimited_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
@@ -746,7 +746,7 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_zuinteger_unlimited, var,
+  add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -760,7 +760,7 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_zuinteger_cmd (const char *name, enum command_class class,
+add_setshow_zuinteger_cmd (const char *name, enum command_class theclass,
 			   unsigned int *var,
 			   const char *set_doc, const char *show_doc,
 			   const char *help_doc,
@@ -769,7 +769,7 @@ add_setshow_zuinteger_cmd (const char *name, enum command_class class,
 			   struct cmd_list_element **set_list,
 			   struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_zuinteger, var,
+  add_setshow_cmd_full (name, theclass, var_zuinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -870,19 +870,19 @@ add_info_alias (const char *name, const char *oldname, int abbrev_flag)
 /* Add an element to the list of commands.  */
 
 struct cmd_list_element *
-add_com (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
+add_com (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 	 const char *doc)
 {
-  return add_cmd (name, class, fun, doc, &cmdlist);
+  return add_cmd (name, theclass, fun, doc, &cmdlist);
 }
 
 /* Add an alias or abbreviation command to the list of commands.  */
 
 struct cmd_list_element *
-add_com_alias (const char *name, const char *oldname, enum command_class class,
+add_com_alias (const char *name, const char *oldname, enum command_class theclass,
 	       int abbrev_flag)
 {
-  return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
+  return add_alias_cmd (name, oldname, theclass, abbrev_flag, &cmdlist);
 }
 \f
 /* Recursively walk the commandlist structures, and print out the
@@ -991,7 +991,7 @@ help_cmd (const char *command, struct ui_file *stream)
 
   /* If this is a class name, print all of the commands in the class.  */
   if (c->func == NULL)
-    help_list (cmdlist, "", c->class, stream);
+    help_list (cmdlist, "", c->theclass, stream);
 
   if (c->hook_pre || c->hook_post)
     fprintf_filtered (stream,
@@ -1021,7 +1021,7 @@ help_cmd (const char *command, struct ui_file *stream)
  */
 void
 help_list (struct cmd_list_element *list, const char *cmdtype,
-	   enum command_class class, struct ui_file *stream)
+	   enum command_class theclass, struct ui_file *stream)
 {
   int len;
   char *cmdtype1, *cmdtype2;
@@ -1042,14 +1042,14 @@ help_list (struct cmd_list_element *list, const char *cmdtype,
       strcpy (cmdtype2 + len - 1, " sub");
     }
 
-  if (class == all_classes)
+  if (theclass == all_classes)
     fprintf_filtered (stream, "List of classes of %scommands:\n\n", cmdtype2);
   else
     fprintf_filtered (stream, "List of %scommands:\n\n", cmdtype2);
 
-  help_cmd_list (list, class, cmdtype, (int) class >= 0, stream);
+  help_cmd_list (list, theclass, cmdtype, (int) theclass >= 0, stream);
 
-  if (class == all_classes)
+  if (theclass == all_classes)
     {
       fprintf_filtered (stream, "\n\
 Type \"help%s\" followed by a class name for a list of commands in ",
@@ -1091,7 +1091,7 @@ help_all (struct ui_file *stream)
       if (c->func == NULL)
 	{
 	  fprintf_filtered (stream, "\nCommand class: %s\n\n", c->name);
-	  help_cmd_list (cmdlist, c->class, "", 1, stream);
+	  help_cmd_list (cmdlist, c->theclass, "", 1, stream);
 	}
     }
 
@@ -1104,7 +1104,7 @@ help_all (struct ui_file *stream)
       if (c->abbrev_flag)
         continue;
 
-      if (c->class == no_class)
+      if (c->theclass == no_class)
 	{
 	  if (!seen_unclassified)
 	    {
@@ -1187,7 +1187,7 @@ print_help_for_command (struct cmd_list_element *c, const char *prefix,
  * is at the low level, not the high-level).
  */
 void
-help_cmd_list (struct cmd_list_element *list, enum command_class class,
+help_cmd_list (struct cmd_list_element *list, enum command_class theclass,
 	       const char *prefix, int recurse, struct ui_file *stream)
 {
   struct cmd_list_element *c;
@@ -1195,16 +1195,16 @@ help_cmd_list (struct cmd_list_element *list, enum command_class class,
   for (c = list; c; c = c->next)
     {      
       if (c->abbrev_flag == 0
-	  && (class == all_commands
-	      || (class == all_classes && c->func == NULL)
-	      || (class == c->class && c->func != NULL)))
+	  && (theclass == all_commands
+	      || (theclass == all_classes && c->func == NULL)
+	      || (theclass == c->theclass && c->func != NULL)))
 	{
 	  print_help_for_command (c, prefix, recurse, stream);
 	}
       else if (c->abbrev_flag == 0 && recurse
-	       && class == class_user && c->prefixlist != NULL)
+	       && theclass == class_user && c->prefixlist != NULL)
 	/* User-defined commands may be subcommands.  */
-	help_cmd_list (*c->prefixlist, class, c->prefixname, 
+	help_cmd_list (*c->prefixlist, theclass, c->prefixname,
 		       recurse, stream);
     }
 }
@@ -1898,6 +1898,6 @@ cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
 int
 cli_user_command_p (struct cmd_list_element *cmd)
 {
-  return (cmd->class == class_user
+  return (cmd->theclass == class_user
 	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
 }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index ec89325..a669ba6 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -53,7 +53,7 @@ struct cmd_list_element
     const char *name;
 
     /* Command class; class values are chosen by application program.  */
-    enum command_class class;
+    enum command_class theclass;
 
     /* When 1 indicated that this command is deprecated.  It may be
        removed from gdb's command set in the future.  */
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 2989b05..65232da 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1532,7 +1532,7 @@ define_command (char *comname, int from_tty)
     {
       int q;
 
-      if (c->class == class_user || c->class == class_alias)
+      if (c->theclass == class_user || c->theclass == class_alias)
 	q = query (_("Redefine command \"%s\"? "), c->name);
       else
 	q = query (_("Really redefine built-in command \"%s\"? "), c->name);
@@ -1584,11 +1584,11 @@ define_command (char *comname, int from_tty)
 	     "Type commands for definition of \"%s\".", comfull);
   cmds = read_command_lines (tmpbuf, from_tty, 1, 0, 0);
 
-  if (c && c->class == class_user)
+  if (c && c->theclass == class_user)
     free_command_lines (&c->user_commands);
 
   newc = add_cmd (comname, class_user, user_defined_command,
-		  (c && c->class == class_user)
+		  (c && c->theclass == class_user)
 		  ? c->doc : xstrdup ("User-defined."), list);
   newc->user_commands = cmds;
 
@@ -1629,7 +1629,7 @@ document_command (char *comname, int from_tty)
   tem = comname;
   c = lookup_cmd (&tem, *list, "", 0, 1);
 
-  if (c->class != class_user)
+  if (c->theclass != class_user)
     error (_("Command \"%s\" is built-in."), comfull);
 
   xsnprintf (tmpbuf, sizeof (tmpbuf), "Type documentation for \"%s\".",
@@ -1739,7 +1739,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
       const char *prefixname = c->prefixname;
 
       for (c = *c->prefixlist; c != NULL; c = c->next)
-	if (c->class == class_user || c->prefixlist != NULL)
+	if (c->theclass == class_user || c->prefixlist != NULL)
 	  show_user_1 (c, prefixname, c->name, gdb_stdout);
       return;
     }
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 09bf28d..8d01b52 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -37,8 +37,8 @@ notify_command_param_changed_p (int param_changed, struct cmd_list_element *c)
   if (param_changed == 0)
     return 0;
 
-  if (c->class == class_maintenance || c->class == class_deprecated
-      || c->class == class_obscure)
+  if (c->theclass == class_maintenance || c->theclass == class_deprecated
+      || c->theclass == class_obscure)
     return 0;
 
   return 1;
@@ -158,16 +158,16 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
     {
     case var_string:
       {
-	char *new;
+	char *newobj;
 	const char *p;
 	char *q;
 	int ch;
 
 	if (arg == NULL)
 	  arg = "";
-	new = (char *) xmalloc (strlen (arg) + 2);
+	newobj = (char *) xmalloc (strlen (arg) + 2);
 	p = arg;
-	q = new;
+	q = newobj;
 	while ((ch = *p++) != '\000')
 	  {
 	    if (ch == '\\')
@@ -195,18 +195,18 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  *q++ = ' ';
 #endif
 	*q++ = '\0';
-	new = (char *) xrealloc (new, q - new);
+	newobj = (char *) xrealloc (newobj, q - newobj);
 
 	if (*(char **) c->var == NULL
-	    || strcmp (*(char **) c->var, new) != 0)
+	    || strcmp (*(char **) c->var, newobj) != 0)
 	  {
 	    xfree (*(char **) c->var);
-	    *(char **) c->var = new;
+	    *(char **) c->var = newobj;
 
 	    option_changed = 1;
 	  }
 	else
-	  xfree (new);
+	  xfree (newobj);
       }
       break;
     case var_string_noescape:
@@ -693,7 +693,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix)
 	}
       else
 	{
-	  if (list->class != no_set_class)
+	  if (list->theclass != no_set_class)
 	    {
 	      struct cleanup *option_chain
 		= make_cleanup_ui_out_tuple_begin_end (uiout, "option");
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 20c8c5e..366d828 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -773,7 +773,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   struct coff_symbol coff_symbol;
   struct coff_symbol *cs = &coff_symbol;
   static struct internal_syment main_sym;
@@ -1067,9 +1067,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 	         context_stack_depth is zero, and complain if not.  */
 
 	      depth = 0;
-	      new = push_context (depth, fcn_start_addr);
+	      newobj = push_context (depth, fcn_start_addr);
 	      fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
-	      new->name =
+	      newobj->name =
 		process_coff_symbol (&fcn_cs_saved, 
 				     &fcn_aux_saved, objfile);
 	    }
@@ -1092,9 +1092,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  break;
 		}
 
-	      new = pop_context ();
+	      newobj = pop_context ();
 	      /* Stack must be empty now.  */
-	      if (context_stack_depth > 0 || new == NULL)
+	      if (context_stack_depth > 0 || newobj == NULL)
 		{
 		  complaint (&symfile_complaints,
 			     _("Unmatched .ef symbol(s) ignored "
@@ -1129,8 +1129,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		enter_linenos (fcn_line_ptr, fcn_first_line,
 			       fcn_last_line, objfile);
 
-	      finish_block (new->name, &local_symbols,
-			    new->old_blocks, new->start_addr,
+	      finish_block (newobj->name, &local_symbols,
+			    newobj->old_blocks, newobj->start_addr,
 			    fcn_cs_saved.c_value
 			    + fcn_aux_saved.x_sym.x_misc.x_fsize
 			    + ANOFFSET (objfile->section_offsets,
@@ -1158,8 +1158,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  break;
 		}
 
-	      new = pop_context ();
-	      if (depth-- != new->depth)
+	      newobj = pop_context ();
+	      if (depth-- != newobj->depth)
 		{
 		  complaint (&symfile_complaints,
 			     _("Mismatched .eb symbol ignored "
@@ -1173,11 +1173,11 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		    cs->c_value + ANOFFSET (objfile->section_offsets,
 					    SECT_OFF_TEXT (objfile));
 		  /* Make a block for the local symbols within.  */
-		  finish_block (0, &local_symbols, new->old_blocks,
-				new->start_addr, tmpaddr);
+		  finish_block (0, &local_symbols, newobj->old_blocks,
+				newobj->start_addr, tmpaddr);
 		}
 	      /* Now pop locals of block just finished.  */
-	      local_symbols = new->locals;
+	      local_symbols = newobj->locals;
 	    }
 	  break;
 
@@ -2060,7 +2060,7 @@ coff_read_struct_type (int index, int length, int lastsym,
 
   struct type *type;
   struct nextfield *list = 0;
-  struct nextfield *new;
+  struct nextfield *newobj;
   int nfields = 0;
   int n;
   char *name;
@@ -2087,9 +2087,9 @@ coff_read_struct_type (int index, int length, int lastsym,
 	case C_MOU:
 
 	  /* Get space to record the next field's data.  */
-	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
-	  new->next = list;
-	  list = new;
+	  newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+	  newobj->next = list;
+	  list = newobj;
 
 	  /* Save the data.  */
 	  list->field.name = obstack_copy0 (&objfile->objfile_obstack,
@@ -2104,9 +2104,9 @@ coff_read_struct_type (int index, int length, int lastsym,
 	case C_FIELD:
 
 	  /* Get space to record the next field's data.  */
-	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
-	  new->next = list;
-	  list = new;
+	  newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+	  newobj->next = list;
+	  list = newobj;
 
 	  /* Save the data.  */
 	  list->field.name = obstack_copy0 (&objfile->objfile_obstack,
diff --git a/gdb/command.h b/gdb/command.h
index 956eeaa..bdf625b 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -248,7 +248,7 @@ typedef void (show_value_ftype) (struct ui_file *file,
 extern show_value_ftype deprecated_show_value_hack;
 
 extern void add_setshow_enum_cmd (const char *name,
-				  enum command_class class,
+				  enum command_class theclass,
 				  const char *const *enumlist,
 				  const char **var,
 				  const char *set_doc,
@@ -260,7 +260,7 @@ extern void add_setshow_enum_cmd (const char *name,
 				  struct cmd_list_element **show_list);
 
 extern void add_setshow_auto_boolean_cmd (const char *name,
-					  enum command_class class,
+					  enum command_class theclass,
 					  enum auto_boolean *var,
 					  const char *set_doc,
 					  const char *show_doc,
@@ -271,7 +271,7 @@ extern void add_setshow_auto_boolean_cmd (const char *name,
 					  struct cmd_list_element **show_list);
 
 extern void add_setshow_boolean_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc, const char *show_doc,
 				     const char *help_doc,
@@ -281,7 +281,7 @@ extern void add_setshow_boolean_cmd (const char *name,
 				     struct cmd_list_element **show_list);
 
 extern void add_setshow_filename_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      char **var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -292,7 +292,7 @@ extern void add_setshow_filename_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_string_cmd (const char *name,
-				    enum command_class class,
+				    enum command_class theclass,
 				    char **var,
 				    const char *set_doc,
 				    const char *show_doc,
@@ -304,7 +304,7 @@ extern void add_setshow_string_cmd (const char *name,
 
 extern struct cmd_list_element *add_setshow_string_noescape_cmd
 		      (const char *name,
-		       enum command_class class,
+		       enum command_class theclass,
 		       char **var,
 		       const char *set_doc,
 		       const char *show_doc,
@@ -315,7 +315,7 @@ extern struct cmd_list_element *add_setshow_string_noescape_cmd
 		       struct cmd_list_element **show_list);
 
 extern void add_setshow_optional_filename_cmd (const char *name,
-					       enum command_class class,
+					       enum command_class theclass,
 					       char **var,
 					       const char *set_doc,
 					       const char *show_doc,
@@ -326,7 +326,7 @@ extern void add_setshow_optional_filename_cmd (const char *name,
 					       struct cmd_list_element **show_list);
 
 extern void add_setshow_integer_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
@@ -337,7 +337,7 @@ extern void add_setshow_integer_cmd (const char *name,
 				     struct cmd_list_element **show_list);
 
 extern void add_setshow_uinteger_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      unsigned int *var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -348,7 +348,7 @@ extern void add_setshow_uinteger_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_zinteger_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      int *var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -359,7 +359,7 @@ extern void add_setshow_zinteger_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_zuinteger_cmd (const char *name,
-				       enum command_class class,
+				       enum command_class theclass,
 				       unsigned int *var,
 				       const char *set_doc,
 				       const char *show_doc,
@@ -371,7 +371,7 @@ extern void add_setshow_zuinteger_cmd (const char *name,
 
 extern void
   add_setshow_zuinteger_unlimited_cmd (const char *name,
-				       enum command_class class,
+				       enum command_class theclass,
 				       int *var,
 				       const char *set_doc,
 				       const char *show_doc,
diff --git a/gdb/common/cleanups.c b/gdb/common/cleanups.c
index 964df7a..e57e4cc 100644
--- a/gdb/common/cleanups.c
+++ b/gdb/common/cleanups.c
@@ -79,15 +79,15 @@ static struct cleanup *
 make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
 		  void *arg,  void (*free_arg) (void *))
 {
-  struct cleanup *new
+  struct cleanup *newobj
     = (struct cleanup *) xmalloc (sizeof (struct cleanup));
   struct cleanup *old_chain = *pmy_chain;
 
-  new->next = *pmy_chain;
-  new->function = function;
-  new->free_arg = free_arg;
-  new->arg = arg;
-  *pmy_chain = new;
+  newobj->next = *pmy_chain;
+  newobj->function = function;
+  newobj->free_arg = free_arg;
+  newobj->arg = arg;
+  *pmy_chain = newobj;
 
   gdb_assert (old_chain != NULL);
   return old_chain;
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index ef12821..bfdcd8b 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -343,10 +343,12 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
 /* See filestuff.h.  */
 
 int
-gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
+gdb_socketpair_cloexec (int the_namespace, int style, int protocol,
+			int filedes[2])
 {
 #ifdef HAVE_SOCKETPAIR
-  int result = socketpair (namespace, style | SOCK_CLOEXEC, protocol, filedes);
+  int result = socketpair (the_namespace, style | SOCK_CLOEXEC,
+			   protocol, filedes);
 
   if (result != -1)
     {
@@ -363,9 +365,9 @@ gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
 /* See filestuff.h.  */
 
 int
-gdb_socket_cloexec (int namespace, int style, int protocol)
+gdb_socket_cloexec (int the_namespace, int style, int protocol)
 {
-  int result = socket (namespace, style | SOCK_CLOEXEC, protocol);
+  int result = socket (the_namespace, style | SOCK_CLOEXEC, protocol);
 
   if (result != -1)
     socket_mark_cloexec (result);
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index f44f3b1..9be6376 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -54,13 +54,13 @@ extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
 /* Like 'socketpair', but ensures that the returned file descriptors
    have the close-on-exec flag set.  */
 
-extern int gdb_socketpair_cloexec (int namespace, int style, int protocol,
+extern int gdb_socketpair_cloexec (int the_namespace, int style, int protocol,
 				   int filedes[2]);
 
 /* Like 'socket', but ensures that the returned file descriptor has
    the close-on-exec flag set.  */
 
-extern int gdb_socket_cloexec (int namespace, int style, int protocol);
+extern int gdb_socket_cloexec (int the_namespace, int style, int protocol);
 
 /* Like 'pipe', but ensures that the returned file descriptors have
    the close-on-exec flag set.  */
diff --git a/gdb/continuations.c b/gdb/continuations.c
index 412a085..e753dc1 100644
--- a/gdb/continuations.c
+++ b/gdb/continuations.c
@@ -39,13 +39,13 @@ make_continuation (struct continuation **pmy_chain,
 		   continuation_ftype *function,
 		   void *arg,  void (*free_arg) (void *))
 {
-  struct continuation *new = XNEW (struct continuation);
+  struct continuation *newobj = XNEW (struct continuation);
 
-  new->next = *pmy_chain;
-  new->function = function;
-  new->free_arg = free_arg;
-  new->arg = arg;
-  *pmy_chain = new;
+  newobj->next = *pmy_chain;
+  newobj->function = function;
+  newobj->free_arg = free_arg;
+  newobj->arg = arg;
+  *pmy_chain = newobj;
 }
 
 static void
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index c1e7951..b4690ea 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -277,9 +277,9 @@ make_name (const char *name, int len)
     const char *opname;
   }
 
-%type <comp> exp exp1 type start start_opt operator colon_name
+%type <comp> exp exp1 type start start_opt oper colon_name
 %type <comp> unqualified_name colon_ext_name
-%type <comp> template template_arg
+%type <comp> templ template_arg
 %type <comp> builtin_type
 %type <comp> typespec_2 array_indicator
 %type <comp> colon_ext_only ext_only_name
@@ -439,7 +439,7 @@ demangler_special
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, $2, $4); }
 		;
 
-operator	:	OPERATOR NEW
+oper	:	OPERATOR NEW
 			{
 			  /* Match the whitespacing of cplus_demangle_operators.
 			     It would abort on unrecognized string otherwise.  */
@@ -554,8 +554,8 @@ conversion_op_name
 
 /* DEMANGLE_COMPONENT_NAME */
 /* This accepts certain invalid placements of '~'.  */
-unqualified_name:	operator
-		|	operator '<' template_params '>'
+unqualified_name:	oper
+		|	oper '<' template_params '>'
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
 		|	'~' NAME
 			{ $$ = make_dtor (gnu_v3_complete_object_dtor, $2); }
@@ -579,9 +579,9 @@ colon_name	:	name
 name		:	nested_name NAME %prec NAME
 			{ $$ = $1.comp; d_right ($1.last) = $2; }
 		|	NAME %prec NAME
-		|	nested_name template %prec NAME
+		|	nested_name templ %prec NAME
 			{ $$ = $1.comp; d_right ($1.last) = $2; }
-		|	template %prec NAME
+		|	templ %prec NAME
 		;
 
 colon_ext_name	:	colon_name
@@ -611,13 +611,13 @@ nested_name	:	NAME COLONCOLON
 			  d_left ($$.last) = $2;
 			  d_right ($$.last) = NULL;
 			}
-		|	template COLONCOLON
+		|	templ COLONCOLON
 			{ $$.comp = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
 			  d_left ($$.comp) = $1;
 			  d_right ($$.comp) = NULL;
 			  $$.last = $$.comp;
 			}
-		|	nested_name template COLONCOLON
+		|	nested_name templ COLONCOLON
 			{ $$.comp = $1.comp;
 			  d_right ($1.last) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
 			  $$.last = d_right ($1.last);
@@ -628,7 +628,7 @@ nested_name	:	NAME COLONCOLON
 
 /* DEMANGLE_COMPONENT_TEMPLATE */
 /* DEMANGLE_COMPONENT_TEMPLATE_ARGLIST */
-template	:	NAME '<' template_params '>'
+templ	:	NAME '<' template_params '>'
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
 		;
 
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 4bec821..34d9d05 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -126,7 +126,7 @@ cp_add_using_directive (const char *dest,
                         struct obstack *obstack)
 {
   struct using_direct *current;
-  struct using_direct *new;
+  struct using_direct *newobj;
 
   /* Has it already been added?  */
 
@@ -163,39 +163,39 @@ cp_add_using_directive (const char *dest,
       return;
     }
 
-  new = obstack_alloc (obstack, (sizeof (*new)
+  newobj = obstack_alloc (obstack, (sizeof (*newobj)
 				 + (VEC_length (const_char_ptr, excludes)
-				    * sizeof (*new->excludes))));
-  memset (new, 0, sizeof (*new));
+				    * sizeof (*newobj->excludes))));
+  memset (newobj, 0, sizeof (*newobj));
 
   if (copy_names)
     {
-      new->import_src = obstack_copy0 (obstack, src, strlen (src));
-      new->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
+      newobj->import_src = obstack_copy0 (obstack, src, strlen (src));
+      newobj->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
     }
   else
     {
-      new->import_src = src;
-      new->import_dest = dest;
+      newobj->import_src = src;
+      newobj->import_dest = dest;
     }
 
   if (alias != NULL && copy_names)
-    new->alias = obstack_copy0 (obstack, alias, strlen (alias));
+    newobj->alias = obstack_copy0 (obstack, alias, strlen (alias));
   else
-    new->alias = alias;
+    newobj->alias = alias;
 
   if (declaration != NULL && copy_names)
-    new->declaration = obstack_copy0 (obstack,
+    newobj->declaration = obstack_copy0 (obstack,
 				      declaration, strlen (declaration));
   else
-    new->declaration = declaration;
+    newobj->declaration = declaration;
 
-  memcpy (new->excludes, VEC_address (const_char_ptr, excludes),
-	  VEC_length (const_char_ptr, excludes) * sizeof (*new->excludes));
-  new->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
+  memcpy (newobj->excludes, VEC_address (const_char_ptr, excludes),
+	  VEC_length (const_char_ptr, excludes) * sizeof (*newobj->excludes));
+  newobj->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
 
-  new->next = using_directives;
-  using_directives = new;
+  newobj->next = using_directives;
+  using_directives = newobj;
 }
 
 /* Test whether or not NAMESPACE looks like it mentions an anonymous
@@ -293,14 +293,14 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
 
   if (search)
     {
-      struct symbol *this;
+      struct symbol *lang_this;
       struct type *type;
 
-      this = lookup_language_this (language_def (language_cplus), block);
-      if (this == NULL)
+      lang_this = lookup_language_this (language_def (language_cplus), block);
+      if (lang_this == NULL)
 	return NULL;
 
-      type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
+      type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this)));
       /* If TYPE_NAME is NULL, abandon trying to find this symbol.
 	 This can happen for lambda functions compiled with clang++,
 	 which outputs no name for the container class.  */
@@ -382,7 +382,7 @@ cp_search_static_and_baseclasses (const char *name,
    "this" if we can compute it.  */
 
 static struct symbol *
-cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
+cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
 			       const struct block *block,
 			       const domain_enum domain, int search)
 {
@@ -391,11 +391,11 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
   unsigned int prefix_len;
   struct symbol *sym;
 
-  if (namespace[0] != '\0')
+  if (the_namespace[0] != '\0')
     {
-      concatenated_name = alloca (strlen (namespace) + 2
+      concatenated_name = alloca (strlen (the_namespace) + 2
 				  + strlen (name) + 1);
-      strcpy (concatenated_name, namespace);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, name);
       name = concatenated_name;
@@ -410,7 +410,8 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
      class/namespace.  Since we're only searching static and global blocks
      there's often no need to first do that lookup.  */
 
-  is_in_anonymous = namespace[0] != '\0' && cp_is_in_anonymous (namespace);
+  is_in_anonymous
+    = the_namespace[0] != '\0' && cp_is_in_anonymous (the_namespace);
   sym = cp_basic_lookup_symbol (name, block, domain, is_in_anonymous);
   if (sym != NULL)
     return sym;
@@ -785,7 +786,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
 			const char *scope,
 			int scope_len)
 {
-  char *namespace;
+  char *the_namespace;
 
   if (scope[scope_len] != '\0')
     {
@@ -821,10 +822,10 @@ lookup_namespace_scope (const struct language_defn *langdef,
   if (scope_len == 0 && strchr (name, ':') == NULL)
     return cp_lookup_bare_symbol (langdef, name, block, domain, 1);
 
-  namespace = alloca (scope_len + 1);
-  strncpy (namespace, scope, scope_len);
-  namespace[scope_len] = '\0';
-  return cp_lookup_symbol_in_namespace (namespace, name,
+  the_namespace = alloca (scope_len + 1);
+  strncpy (the_namespace, scope, scope_len);
+  the_namespace[scope_len] = '\0';
+  return cp_lookup_symbol_in_namespace (the_namespace, name,
 					block, domain, 1);
 }
 
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 59463e3..260601f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -56,7 +56,7 @@ static void overload_list_add_symbol (struct symbol *sym,
 				      const char *oload_name);
 
 static void make_symbol_overload_list_using (const char *func_name,
-					     const char *namespace);
+					     const char *the_namespace);
 
 static void make_symbol_overload_list_qualified (const char *func_name);
 
@@ -326,15 +326,15 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
     {
       if (d_left (comp)->type == DEMANGLE_COMPONENT_NAME)
 	{
-	  struct demangle_component new;
+	  struct demangle_component newobj;
 
 	  ui_file_write (buf, d_left (comp)->u.s_name.s,
 			 d_left (comp)->u.s_name.len);
 	  name = ui_file_obsavestring (buf, &info->obstack, &len);
-	  new.type = DEMANGLE_COMPONENT_NAME;
-	  new.u.s_name.s = name;
-	  new.u.s_name.len = len;
-	  if (inspect_type (info, &new, finder, data))
+	  newobj.type = DEMANGLE_COMPONENT_NAME;
+	  newobj.u.s_name.s = name;
+	  newobj.u.s_name.len = len;
+	  if (inspect_type (info, &newobj, finder, data))
 	    {
 	      char *n, *s;
 	      long slen;
@@ -344,7 +344,7 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
 		 node.  */
 
 	      ui_file_rewind (buf);
-	      n = cp_comp_to_string (&new, 100);
+	      n = cp_comp_to_string (&newobj, 100);
 	      if (n == NULL)
 		{
 		  /* If something went astray, abort typedef substitutions.  */
@@ -1174,7 +1174,7 @@ overload_list_add_symbol (struct symbol *sym,
 
 struct symbol **
 make_symbol_overload_list (const char *func_name,
-			   const char *namespace)
+			   const char *the_namespace)
 {
   struct cleanup *old_cleanups;
   const char *name;
@@ -1187,15 +1187,15 @@ make_symbol_overload_list (const char *func_name,
 
   old_cleanups = make_cleanup (xfree, sym_return_val);
 
-  make_symbol_overload_list_using (func_name, namespace);
+  make_symbol_overload_list_using (func_name, the_namespace);
 
-  if (namespace[0] == '\0')
+  if (the_namespace[0] == '\0')
     name = func_name;
   else
     {
       char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
-      strcpy (concatenated_name, namespace);
+	= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, func_name);
       name = concatenated_name;
@@ -1226,19 +1226,19 @@ make_symbol_overload_list_block (const char *name,
 
 static void
 make_symbol_overload_list_namespace (const char *func_name,
-                                     const char *namespace)
+                                     const char *the_namespace)
 {
   const char *name;
   const struct block *block = NULL;
 
-  if (namespace[0] == '\0')
+  if (the_namespace[0] == '\0')
     name = func_name;
   else
     {
       char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+	= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
 
-      strcpy (concatenated_name, namespace);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, func_name);
       name = concatenated_name;
@@ -1263,7 +1263,7 @@ static void
 make_symbol_overload_list_adl_namespace (struct type *type,
                                          const char *func_name)
 {
-  char *namespace;
+  char *the_namespace;
   const char *type_name;
   int i, prefix_len;
 
@@ -1287,11 +1287,11 @@ make_symbol_overload_list_adl_namespace (struct type *type,
 
   if (prefix_len != 0)
     {
-      namespace = alloca (prefix_len + 1);
-      strncpy (namespace, type_name, prefix_len);
-      namespace[prefix_len] = '\0';
+      the_namespace = alloca (prefix_len + 1);
+      strncpy (the_namespace, type_name, prefix_len);
+      the_namespace[prefix_len] = '\0';
 
-      make_symbol_overload_list_namespace (func_name, namespace);
+      make_symbol_overload_list_namespace (func_name, the_namespace);
     }
 
   /* Check public base type */
@@ -1340,7 +1340,7 @@ reset_directive_searched (void *data)
 
 static void
 make_symbol_overload_list_using (const char *func_name,
-				 const char *namespace)
+				 const char *the_namespace)
 {
   struct using_direct *current;
   const struct block *block;
@@ -1365,7 +1365,7 @@ make_symbol_overload_list_using (const char *func_name,
         if (current->alias != NULL || current->declaration != NULL)
           continue;
 
-        if (strcmp (namespace, current->import_dest) == 0)
+        if (strcmp (the_namespace, current->import_dest) == 0)
 	  {
 	    /* Mark this import as searched so that the recursive call
 	       does not search it again.  */
@@ -1383,7 +1383,7 @@ make_symbol_overload_list_using (const char *func_name,
       }
 
   /* Now, add names for this namespace.  */
-  make_symbol_overload_list_namespace (func_name, namespace);
+  make_symbol_overload_list_namespace (func_name, the_namespace);
 }
 
 /* This does the bulk of the work of finding overloaded symbols.
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 407da62..cbff610 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -198,7 +198,7 @@ extern struct symbol *cp_lookup_symbol_nonlocal
       const struct block *block,
       const domain_enum domain);
 
-extern struct symbol *cp_lookup_symbol_namespace (const char *namespace,
+extern struct symbol *cp_lookup_symbol_namespace (const char *the_namespace,
 						  const char *name,
 						  const struct block *block,
 						  const domain_enum domain);
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 624976b..93f4c1b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -96,9 +96,9 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
 int
 cp_is_vtbl_ptr_type (struct type *type)
 {
-  const char *typename = type_name_no_tag (type);
+  const char *type_name = type_name_no_tag (type);
 
-  return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
+  return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
 }
 
 /* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index c6543ca..9936b6b 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -946,7 +946,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1330,7 +1330,7 @@ yylex (void)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -1339,7 +1339,7 @@ yylex (void)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1565,7 +1565,7 @@ yylex (void)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	/* It is ok to always set this, even though we don't always
 	   strictly need to.  */
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 53ca1ea..90e61da 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -118,7 +118,7 @@ get_task_from_args (char *args)
     {
       if (ptid_equal (inferior_ptid, null_ptid))
 	printf_unfiltered (_("No inferior running\n"));
-      return current_inferior ()->private->task;
+      return current_inferior ()->priv->task;
     }
   if (strcmp (args, "gdb") == 0)
     return mach_task_self ();
@@ -258,32 +258,32 @@ info_mach_ports_command (char *args, int from_tty)
 	    {
 	      struct inferior *inf = current_inferior ();
 
-	      if (port == inf->private->task)
+	      if (port == inf->priv->task)
 		printf_unfiltered (_(" inferior-task"));
-	      else if (port == inf->private->notify_port)
+	      else if (port == inf->priv->notify_port)
 		printf_unfiltered (_(" inferior-notify"));
 	      else
 		{
 		  int k;
 		  darwin_thread_t *t;
 
-		  for (k = 0; k < inf->private->exception_info.count; k++)
-		    if (port == inf->private->exception_info.ports[k])
+		  for (k = 0; k < inf->priv->exception_info.count; k++)
+		    if (port == inf->priv->exception_info.ports[k])
 		      {
 			printf_unfiltered (_(" inferior-excp-port"));
 			break;
 		      }
 
-		  if (inf->private->threads)
+		  if (inf->priv->threads)
 		    {
 		      for (k = 0;
 			   VEC_iterate(darwin_thread_t,
-				       inf->private->threads, k, t);
+				       inf->priv->threads, k, t);
 			   k++)
 			if (port == t->gdb_port)
 			  {
 			    printf_unfiltered (_(" inferior-thread for 0x%x"),
-					       inf->private->task);
+					       inf->priv->task);
 			    break;
 			  }
 		    }
@@ -742,7 +742,7 @@ info_mach_region_command (char *exp, int from_tty)
     error (_("Inferior not available"));
 
   inf = current_inferior ();
-  darwin_debug_region (inf->private->task, address);
+  darwin_debug_region (inf->priv->task, address);
 }
 
 static void
@@ -811,7 +811,7 @@ info_mach_exceptions_command (char *args, int from_tty)
 	{
 	  if (ptid_equal (inferior_ptid, null_ptid))
 	    printf_unfiltered (_("No inferior running\n"));
-	  disp_exception (&current_inferior ()->private->exception_info);
+	  disp_exception (&current_inferior ()->priv->exception_info);
 	  return;
 	}
       else if (strcmp (args, "host") == 0)
@@ -835,7 +835,7 @@ info_mach_exceptions_command (char *args, int from_tty)
       inf = current_inferior ();
       
       kret = task_get_exception_ports
-	(inf->private->task, EXC_MASK_ALL, info.masks,
+	(inf->priv->task, EXC_MASK_ALL, info.masks,
 	 &info.count, info.ports, info.behaviors, info.flavors);
       MACH_CHECK_ERROR (kret);
       disp_exception (&info);
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index f9481c7..630748a 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -274,7 +274,7 @@ darwin_check_new_threads (struct inferior *inf)
   unsigned int new_nbr;
   unsigned int old_nbr;
   unsigned int new_ix, old_ix;
-  darwin_inferior *darwin_inf = inf->private;
+  darwin_inferior *darwin_inf = inf->priv;
   VEC (darwin_thread_t) *thread_vec;
 
   /* Get list of threads.  */
@@ -369,7 +369,7 @@ darwin_check_new_threads (struct inferior *inf)
 	    {
 	      tp = find_thread_ptid (ptid_build (inf->pid, 0, 0));
 	      gdb_assert (tp);
-	      tp->private = pti;
+	      tp->priv = pti;
 	    }
 	  VEC_safe_push (darwin_thread_t, thread_vec, pti);
 	  new_ix++;
@@ -400,13 +400,13 @@ darwin_check_new_threads (struct inferior *inf)
 static int
 find_inferior_task_it (struct inferior *inf, void *port_ptr)
 {
-  return inf->private->task == *(task_t*)port_ptr;
+  return inf->priv->task == *(task_t*)port_ptr;
 }
 
 static int
 find_inferior_notify_it (struct inferior *inf, void *port_ptr)
 {
-  return inf->private->notify_port == *(task_t*)port_ptr;
+  return inf->priv->notify_port == *(task_t*)port_ptr;
 }
 
 /* Return an inferior by task port.  */
@@ -431,7 +431,7 @@ darwin_find_thread (struct inferior *inf, thread_t thread)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     if (t->gdb_port == thread)
       return t;
@@ -443,14 +443,14 @@ darwin_find_thread (struct inferior *inf, thread_t thread)
 static void
 darwin_suspend_inferior (struct inferior *inf)
 {
-  if (!inf->private->suspended)
+  if (!inf->priv->suspended)
     {
       kern_return_t kret;
 
-      kret = task_suspend (inf->private->task);
+      kret = task_suspend (inf->priv->task);
       MACH_CHECK_ERROR (kret);
 
-      inf->private->suspended = 1;
+      inf->priv->suspended = 1;
     }
 }
 
@@ -459,14 +459,14 @@ darwin_suspend_inferior (struct inferior *inf)
 static void
 darwin_resume_inferior (struct inferior *inf)
 {
-  if (inf->private->suspended)
+  if (inf->priv->suspended)
     {
       kern_return_t kret;
 
-      kret = task_resume (inf->private->task);
+      kret = task_resume (inf->priv->task);
       MACH_CHECK_ERROR (kret);
 
-      inf->private->suspended = 0;
+      inf->priv->suspended = 0;
     }
 }
 
@@ -703,7 +703,7 @@ darwin_send_reply (struct inferior *inf, darwin_thread_t *thread)
 		   MACH_PORT_NULL);
   MACH_CHECK_ERROR (kret);
 
-  inf->private->pending_messages--;
+  inf->priv->pending_messages--;
 }
 
 static void
@@ -773,7 +773,7 @@ darwin_resume_inferior_threads (struct inferior *inf, int step, int nsignal)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, thread);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, thread);
        k++)
     darwin_resume_thread (inf, thread, step, nsignal);
 }
@@ -805,7 +805,7 @@ darwin_suspend_inferior_threads (struct inferior *inf)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, thread);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, thread);
        k++)
     switch (thread->msg_state)
       {
@@ -925,7 +925,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
 	}
       *pinf = inf;
       *pthread = thread;
-      inf->private->pending_messages++;
+      inf->priv->pending_messages++;
 
       status->kind = TARGET_WAITKIND_STOPPED;
       thread->msg_state = DARWIN_MESSAGE;
@@ -992,7 +992,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
       inf = darwin_find_inferior_by_notify (hdr->msgh_local_port);
       if (inf != NULL)
 	{
-	  if (!inf->private->no_ptrace)
+	  if (!inf->priv->no_ptrace)
 	    {
 	      pid_t res;
 	      int wstatus;
@@ -1096,7 +1096,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 
       status->kind = TARGET_WAITKIND_STOPPED;
       status->value.sig = GDB_SIGNAL_TRAP;
-      thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+      thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
       thread->msg_state = DARWIN_STOPPED;
       return ptid_build (inf->pid, 0, thread->gdb_port);
     }
@@ -1200,7 +1200,7 @@ darwin_stop (struct target_ops *self, ptid_t t)
   struct inferior *inf = current_inferior ();
 
   /* FIXME: handle in no_ptrace mode.  */
-  gdb_assert (!inf->private->no_ptrace);
+  gdb_assert (!inf->priv->no_ptrace);
   kill (inf->pid, SIGINT);
 }
 
@@ -1213,33 +1213,33 @@ darwin_mourn_inferior (struct target_ops *ops)
   int i;
 
   /* Deallocate threads.  */
-  if (inf->private->threads)
+  if (inf->priv->threads)
     {
       int k;
       darwin_thread_t *t;
       for (k = 0;
-	   VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+	   VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
 	   k++)
 	{
 	  kret = mach_port_deallocate (gdb_task, t->gdb_port);
 	  MACH_CHECK_ERROR (kret);
 	}
-      VEC_free (darwin_thread_t, inf->private->threads);
-      inf->private->threads = NULL;
+      VEC_free (darwin_thread_t, inf->priv->threads);
+      inf->priv->threads = NULL;
     }
 
   kret = mach_port_move_member (gdb_task,
-				inf->private->notify_port, MACH_PORT_NULL);
+				inf->priv->notify_port, MACH_PORT_NULL);
   MACH_CHECK_ERROR (kret);
 
-  kret = mach_port_request_notification (gdb_task, inf->private->task,
+  kret = mach_port_request_notification (gdb_task, inf->priv->task,
 					 MACH_NOTIFY_DEAD_NAME, 0,
 					 MACH_PORT_NULL,
 					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
 					 &prev);
   /* This can fail if the task is dead.  */
   inferior_debug (4, "task=0x%x, prev=0x%x, notify_port=0x%x\n",
-		  inf->private->task, prev, inf->private->notify_port);
+		  inf->priv->task, prev, inf->priv->notify_port);
 
   if (kret == KERN_SUCCESS)
     {
@@ -1247,24 +1247,24 @@ darwin_mourn_inferior (struct target_ops *ops)
       MACH_CHECK_ERROR (kret);
     }
 
-  kret = mach_port_destroy (gdb_task, inf->private->notify_port);
+  kret = mach_port_destroy (gdb_task, inf->priv->notify_port);
   MACH_CHECK_ERROR (kret);
 
 
   /* Deallocate saved exception ports.  */
-  for (i = 0; i < inf->private->exception_info.count; i++)
+  for (i = 0; i < inf->priv->exception_info.count; i++)
     {
       kret = mach_port_deallocate
-	(gdb_task, inf->private->exception_info.ports[i]);
+	(gdb_task, inf->priv->exception_info.ports[i]);
       MACH_CHECK_ERROR (kret);
     }
-  inf->private->exception_info.count = 0;
+  inf->priv->exception_info.count = 0;
 
-  kret = mach_port_deallocate (gdb_task, inf->private->task);
+  kret = mach_port_deallocate (gdb_task, inf->priv->task);
   MACH_CHECK_ERROR (kret);
 
-  xfree (inf->private);
-  inf->private = NULL;
+  xfree (inf->priv);
+  inf->priv = NULL;
 
   inf_child_mourn_inferior (ops);
 }
@@ -1276,7 +1276,7 @@ darwin_reply_to_all_pending_messages (struct inferior *inf)
   darwin_thread_t *t;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     {
       if (t->msg_state == DARWIN_MESSAGE)
@@ -1299,7 +1299,7 @@ darwin_stop_inferior (struct inferior *inf)
 
   darwin_reply_to_all_pending_messages (inf);
 
-  if (inf->private->no_ptrace)
+  if (inf->priv->no_ptrace)
     return;
 
   res = kill (inf->pid, SIGSTOP);
@@ -1364,7 +1364,7 @@ darwin_kill_inferior (struct target_ops *ops)
 
   gdb_assert (inf != NULL);
 
-  kret = darwin_restore_exception_ports (inf->private);
+  kret = darwin_restore_exception_ports (inf->priv);
   MACH_CHECK_ERROR (kret);
 
   darwin_reply_to_all_pending_messages (inf);
@@ -1393,9 +1393,9 @@ darwin_attach_pid (struct inferior *inf)
   mach_port_t prev_not;
   exception_mask_t mask;
 
-  inf->private = XCNEW (darwin_inferior);
+  inf->priv = XCNEW (darwin_inferior);
 
-  kret = task_for_pid (gdb_task, inf->pid, &inf->private->task);
+  kret = task_for_pid (gdb_task, inf->pid, &inf->priv->task);
   if (kret != KERN_SUCCESS)
     {
       int status;
@@ -1412,7 +1412,7 @@ darwin_attach_pid (struct inferior *inf)
     }
 
   inferior_debug (2, _("inferior task: 0x%x, pid: %d\n"),
-		  inf->private->task, inf->pid);
+		  inf->priv->task, inf->pid);
 
   if (darwin_ex_port == MACH_PORT_NULL)
     {
@@ -1449,23 +1449,23 @@ darwin_attach_pid (struct inferior *inf)
 
   /* Create a port to be notified when the child task terminates.  */
   kret = mach_port_allocate (gdb_task, MACH_PORT_RIGHT_RECEIVE,
-			     &inf->private->notify_port);
+			     &inf->priv->notify_port);
   if (kret != KERN_SUCCESS)
     error (_("Unable to create notification port, mach_port_allocate "
 	     "returned: %d"),
 	   kret);
 
   kret = mach_port_move_member (gdb_task,
-				inf->private->notify_port, darwin_port_set);
+				inf->priv->notify_port, darwin_port_set);
   if (kret != KERN_SUCCESS)
     error (_("Unable to move notification port into new port set, "
 	     "mach_port_move_member\n"
 	     "returned: %d"),
 	   kret);
 
-  kret = mach_port_request_notification (gdb_task, inf->private->task,
+  kret = mach_port_request_notification (gdb_task, inf->priv->task,
 					 MACH_NOTIFY_DEAD_NAME, 0,
-					 inf->private->notify_port,
+					 inf->priv->notify_port,
 					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
 					 &prev_not);
   if (kret != KERN_SUCCESS)
@@ -1484,7 +1484,7 @@ its own.  This is unexpected, but should otherwise not have any actual\n\
 impact on the debugging session."));
     }
 
-  kret = darwin_save_exception_ports (inf->private);
+  kret = darwin_save_exception_ports (inf->priv);
   if (kret != KERN_SUCCESS)
     error (_("Unable to save exception ports, task_get_exception_ports"
 	     "returned: %d"),
@@ -1495,7 +1495,7 @@ impact on the debugging session."));
     mask = EXC_MASK_ALL;
   else
     mask = EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT;
-  kret = task_set_exception_ports (inf->private->task, mask, darwin_ex_port,
+  kret = task_set_exception_ports (inf->priv->task, mask, darwin_ex_port,
 				   EXCEPTION_DEFAULT, THREAD_STATE_NONE);
   if (kret != KERN_SUCCESS)
     error (_("Unable to set exception ports, task_set_exception_ports"
@@ -1514,9 +1514,9 @@ darwin_init_thread_list (struct inferior *inf)
 
   darwin_check_new_threads (inf);
 
-  gdb_assert (inf->private->threads
-	      && VEC_length (darwin_thread_t, inf->private->threads) > 0);
-  thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+  gdb_assert (inf->priv->threads
+	      && VEC_length (darwin_thread_t, inf->priv->threads) > 0);
+  thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
 
   /* Note: fork_inferior automatically add a thead but it uses a wrong ptid.
      Fix up.  */
@@ -1662,7 +1662,7 @@ darwin_setup_fake_stop_event (struct inferior *inf)
      as well.  Otherwise, we'll try resuming it when resuming the
      inferior, and get a warning because the thread's suspend count
      is already zero, making the resume request useless.  */
-  thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+  thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
   kret = thread_suspend (thread->gdb_port);
   MACH_CHECK_ERROR (kret);
 }
@@ -1716,11 +1716,11 @@ darwin_attach (struct target_ops *ops, const char *args, int from_tty)
 
   darwin_init_thread_list (inf);
 
-  darwin_check_osabi (inf->private, ptid_get_tid (inferior_ptid));
+  darwin_check_osabi (inf->priv, ptid_get_tid (inferior_ptid));
 
   darwin_setup_fake_stop_event (inf);
 
-  inf->private->no_ptrace = 1;
+  inf->priv->no_ptrace = 1;
 }
 
 /* Take a program previously attached to and detaches it.
@@ -1750,13 +1750,13 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
     }
 
   /* If ptrace() is in use, stop the process.  */
-  if (!inf->private->no_ptrace)
+  if (!inf->priv->no_ptrace)
     darwin_stop_inferior (inf);
 
-  kret = darwin_restore_exception_ports (inf->private);
+  kret = darwin_restore_exception_ports (inf->priv);
   MACH_CHECK_ERROR (kret);
 
-  if (!inf->private->no_ptrace)
+  if (!inf->priv->no_ptrace)
     {
       res = PTRACE (PT_DETACH, inf->pid, 0, 0);
       if (res != 0)
@@ -1769,7 +1769,7 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
   /* When using ptrace, we have just performed a PT_DETACH, which
      resumes the inferior.  On the other hand, when we are not using
      ptrace, we need to resume its execution ourselves.  */
-  if (inf->private->no_ptrace)
+  if (inf->priv->no_ptrace)
     darwin_resume_inferior (inf);
 
   darwin_mourn_inferior (ops);
@@ -1987,7 +1987,7 @@ darwin_xfer_partial (struct target_ops *ops,
     {
     case TARGET_OBJECT_MEMORY:
       {
-	int l = darwin_read_write_inferior (inf->private->task, offset,
+	int l = darwin_read_write_inferior (inf->priv->task, offset,
 					    readbuf, writebuf, len);
 
 	if (l == 0)
@@ -2006,7 +2006,7 @@ darwin_xfer_partial (struct target_ops *ops,
           /* Support only read.  */
           return TARGET_XFER_E_IO;
         }
-      return darwin_read_dyld_info (inf->private->task, offset, readbuf, len,
+      return darwin_read_dyld_info (inf->priv->task, offset, readbuf, len,
 				    xfered_len);
 #endif
     default:
@@ -2029,10 +2029,10 @@ set_enable_mach_exceptions (char *args, int from_tty,
 	mask = EXC_MASK_ALL;
       else
 	{
-	  darwin_restore_exception_ports (inf->private);
+	  darwin_restore_exception_ports (inf->priv);
 	  mask = EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT;
 	}
-      kret = task_set_exception_ports (inf->private->task, mask, darwin_ex_port,
+      kret = task_set_exception_ports (inf->priv->task, mask, darwin_ex_port,
 				       EXCEPTION_DEFAULT, THREAD_STATE_NONE);
       MACH_CHECK_ERROR (kret);
     }
@@ -2067,7 +2067,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
 
   /* First linear search.  */
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     if (t->inf_port == lwp)
       return ptid_build (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
@@ -2075,7 +2075,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
   /* Maybe the port was never extract.  Do it now.  */
 
   /* First get inferior port names.  */
-  kret = mach_port_names (inf->private->task, &names, &names_count, &types,
+  kret = mach_port_names (inf->priv->task, &names, &names_count, &types,
 			  &types_count);
   MACH_CHECK_ERROR (kret);
   if (kret != KERN_SUCCESS)
@@ -2091,7 +2091,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
 
       /* We just need to know the corresponding name in gdb name space.
 	 So extract and deallocate the right.  */
-      kret = mach_port_extract_right (inf->private->task, names[i],
+      kret = mach_port_extract_right (inf->priv->task, names[i],
 				      MACH_MSG_TYPE_COPY_SEND,
 				      &local_name, &local_type);
       if (kret != KERN_SUCCESS)
@@ -2099,7 +2099,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
       mach_port_deallocate (gdb_task, local_name);
 
       for (k = 0;
-	   VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+	   VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
 	   k++)
 	if (t->gdb_port == local_name)
 	  {
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 6d9bacc..4f60e10 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2702,7 +2702,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		    struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   /* This remembers the address of the start of a function.  It is
      used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries
      are relative to the current function's start address.  On systems
@@ -2779,15 +2779,16 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	    }
 
 	  within_function = 0;
-	  new = pop_context ();
+	  newobj = pop_context ();
 
 	  /* Make a block for the local symbols within.  */
-	  block = finish_block (new->name, &local_symbols, new->old_blocks,
-				new->start_addr, new->start_addr + valu);
+	  block = finish_block (newobj->name, &local_symbols,
+				newobj->old_blocks,
+				newobj->start_addr, newobj->start_addr + valu);
 
 	  /* For C++, set the block's scope.  */
-	  if (SYMBOL_LANGUAGE (new->name) == language_cplus)
-	    cp_set_block_scope (new->name, block, &objfile->objfile_obstack);
+	  if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
+	    cp_set_block_scope (newobj->name, block, &objfile->objfile_obstack);
 
 	  /* May be switching to an assembler file which may not be using
 	     block relative stabs, so reset the offset.  */
@@ -2847,8 +2848,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	  break;
 	}
 
-      new = pop_context ();
-      if (desc != new->depth)
+      newobj = pop_context ();
+      if (desc != newobj->depth)
 	lbrac_mismatch_complaint (symnum);
 
       if (local_symbols != NULL)
@@ -2861,7 +2862,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		     _("misplaced N_LBRAC entry; discarding local "
 		       "symbols which have no enclosing block"));
 	}
-      local_symbols = new->locals;
+      local_symbols = newobj->locals;
 
       if (context_stack_depth > 1)
 	{
@@ -2876,15 +2877,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	      /* Muzzle a compiler bug that makes end < start.
 
 		 ??? Which compilers?  Is this ever harmful?.  */
-	      if (new->start_addr > valu)
+	      if (newobj->start_addr > valu)
 		{
 		  complaint (&symfile_complaints,
 			     _("block start larger than block end"));
-		  new->start_addr = valu;
+		  newobj->start_addr = valu;
 		}
 	      /* Make a block for the local symbols within.  */
-	      finish_block (0, &local_symbols, new->old_blocks,
-			    new->start_addr, valu);
+	      finish_block (0, &local_symbols, newobj->old_blocks,
+			    newobj->start_addr, valu);
 	    }
 	}
       else
@@ -3183,20 +3184,20 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		{
 		  struct block *block;
 
-		  new = pop_context ();
+		  newobj = pop_context ();
 		  /* Make a block for the local symbols within.  */
-		  block = finish_block (new->name, &local_symbols,
-					new->old_blocks, new->start_addr,
+		  block = finish_block (newobj->name, &local_symbols,
+					newobj->old_blocks, newobj->start_addr,
 					valu);
 
 		  /* For C++, set the block's scope.  */
-		  if (SYMBOL_LANGUAGE (new->name) == language_cplus)
-		    cp_set_block_scope (new->name, block,
+		  if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
+		    cp_set_block_scope (newobj->name, block,
 					&objfile->objfile_obstack);
 		}
 
-	      new = push_context (0, valu);
-	      new->name = define_symbol (valu, name, desc, type, objfile);
+	      newobj = push_context (0, valu);
+	      newobj->name = define_symbol (valu, name, desc, type, objfile);
 	      break;
 
 	    default:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f7b9b90..9d12112 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3808,7 +3808,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 dw2_map_matching_symbols (struct objfile *objfile,
-			  const char * name, domain_enum namespace,
+			  const char * name, domain_enum the_namespace,
 			  int global,
 			  int (*callback) (struct block *,
 					   struct symbol *, void *),
@@ -11275,7 +11275,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   CORE_ADDR lowpc;
   CORE_ADDR highpc;
   struct die_info *child_die;
@@ -11343,15 +11343,15 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
 
-  new = push_context (0, lowpc);
-  new->name = new_symbol_full (die, read_type_die (die, cu), cu,
+  newobj = push_context (0, lowpc);
+  newobj->name = new_symbol_full (die, read_type_die (die, cu), cu,
 			       (struct symbol *) templ_func);
 
   /* If there is a location expression for DW_AT_frame_base, record
      it.  */
   attr = dwarf2_attr (die, DW_AT_frame_base, cu);
   if (attr)
-    dwarf2_symbol_mark_computed (attr, new->name, cu, 1);
+    dwarf2_symbol_mark_computed (attr, newobj->name, cu, 1);
 
   cu->list_in_scope = &local_symbols;
 
@@ -11401,9 +11401,9 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
 
-  new = pop_context ();
+  newobj = pop_context ();
   /* Make a block for the local symbols within.  */
-  block = finish_block (new->name, &local_symbols, new->old_blocks,
+  block = finish_block (newobj->name, &local_symbols, newobj->old_blocks,
                         lowpc, highpc);
 
   /* For C++, set the block's scope.  */
@@ -11415,7 +11415,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
   /* If we have address ranges, record them.  */
   dwarf2_record_block_ranges (die, block, baseaddr, cu);
 
-  gdbarch_make_symbol_special (gdbarch, new->name, objfile);
+  gdbarch_make_symbol_special (gdbarch, newobj->name, objfile);
 
   /* Attach template arguments to function.  */
   if (! VEC_empty (symbolp, template_args))
@@ -11437,8 +11437,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
      a function declares a class that has methods).  This means that
      when we finish processing a function scope, we may need to go
      back to building a containing block's symbol lists.  */
-  local_symbols = new->locals;
-  using_directives = new->using_directives;
+  local_symbols = newobj->locals;
+  using_directives = newobj->using_directives;
 
   /* If we've finished processing a top-level function, subsequent
      symbols go in the file symbol list.  */
@@ -11454,7 +11454,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   CORE_ADDR lowpc, highpc;
   struct die_info *child_die;
   CORE_ADDR baseaddr;
@@ -11481,13 +11481,13 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  child_die = sibling_die (child_die);
 	}
     }
-  new = pop_context ();
+  newobj = pop_context ();
 
   if (local_symbols != NULL || using_directives != NULL)
     {
       struct block *block
-        = finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
-                        highpc);
+        = finish_block (0, &local_symbols, newobj->old_blocks,
+			newobj->start_addr, highpc);
 
       /* Note that recording ranges after traversing children, as we
          do here, means that recording a parent's ranges entails
@@ -11501,8 +11501,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
          to do.  */
       dwarf2_record_block_ranges (die, block, baseaddr, cu);
     }
-  local_symbols = new->locals;
-  using_directives = new->using_directives;
+  local_symbols = newobj->locals;
+  using_directives = newobj->using_directives;
 }
 
 /* Read in DW_TAG_GNU_call_site and insert it to CU->call_site_htab.  */
@@ -12715,7 +12715,7 @@ static int
 dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
 {
   const char *fieldname;
-  const char *typename;
+  const char *type_name;
   int len;
 
   if (die->parent == NULL)
@@ -12727,13 +12727,13 @@ dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
     return 0;
 
   fieldname = dwarf2_name (die, cu);
-  typename = dwarf2_name (die->parent, cu);
-  if (fieldname == NULL || typename == NULL)
+  type_name = dwarf2_name (die->parent, cu);
+  if (fieldname == NULL || type_name == NULL)
     return 0;
 
   len = strlen (fieldname);
-  return (strncmp (fieldname, typename, len) == 0
-	  && (typename[len] == '\0' || typename[len] == '<'));
+  return (strncmp (fieldname, type_name, len) == 0
+	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
 /* Add a member function to the proper fieldlist.  */
diff --git a/gdb/environ.c b/gdb/environ.c
index 88dd834..824a6f5 100644
--- a/gdb/environ.c
+++ b/gdb/environ.c
@@ -78,10 +78,10 @@ init_environ (struct gdb_environ *e)
   while (--i >= 0)
     {
       int len = strlen (e->vector[i]);
-      char *new = (char *) xmalloc (len + 1);
+      char *newobj = (char *) xmalloc (len + 1);
 
-      memcpy (new, e->vector[i], len + 1);
-      e->vector[i] = new;
+      memcpy (newobj, e->vector[i], len + 1);
+      e->vector[i] = newobj;
     }
 }
 
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 896296d..144e17f 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -830,7 +830,7 @@ parse_number (struct parser_state *par_state,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1006,11 +1006,11 @@ yylex (void)
   
   /* See if it is a special .foo. operator.  */
   
-  for (i = 0; dot_ops[i].operator != NULL; i++)
-    if (strncmp (tokstart, dot_ops[i].operator,
-		 strlen (dot_ops[i].operator)) == 0)
+  for (i = 0; dot_ops[i].oper != NULL; i++)
+    if (strncmp (tokstart, dot_ops[i].oper,
+		 strlen (dot_ops[i].oper)) == 0)
       {
-	lexptr += strlen (dot_ops[i].operator);
+	lexptr += strlen (dot_ops[i].oper);
 	yylval.opcode = dot_ops[i].opcode;
 	return dot_ops[i].token;
       }
@@ -1175,9 +1175,9 @@ yylex (void)
   
   /* Catch specific keywords.  */
   
-  for (i = 0; f77_keywords[i].operator != NULL; i++)
-    if (strlen (f77_keywords[i].operator) == namelen
-	&& strncmp (tokstart, f77_keywords[i].operator, namelen) == 0)
+  for (i = 0; f77_keywords[i].oper != NULL; i++)
+    if (strlen (f77_keywords[i].oper) == namelen
+	&& strncmp (tokstart, f77_keywords[i].oper, namelen) == 0)
       {
 	/* 	lexptr += strlen(f77_keywords[i].operator); */ 
 	yylval.opcode = f77_keywords[i].opcode;
diff --git a/gdb/frame.c b/gdb/frame.c
index 5b1a8d9..6b1be94 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -753,9 +753,9 @@ frame_find_by_id (struct frame_id id)
 
   for (frame = get_current_frame (); ; frame = prev_frame)
     {
-      struct frame_id this = get_frame_id (frame);
+      struct frame_id self = get_frame_id (frame);
 
-      if (frame_id_eq (id, this))
+      if (frame_id_eq (id, self))
 	/* An exact match.  */
 	return frame;
 
@@ -769,7 +769,7 @@ frame_find_by_id (struct frame_id id)
 	 frame in the current frame chain can have this ID.  See the
 	 comment at frame_id_inner for details.   */
       if (get_frame_type (frame) == NORMAL_FRAME
-	  && !frame_id_inner (get_frame_arch (frame), id, this)
+	  && !frame_id_inner (get_frame_arch (frame), id, self)
 	  && frame_id_inner (get_frame_arch (prev_frame), id,
 			     get_frame_id (prev_frame)))
 	return NULL;
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index b35da35..637ee1f 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4901,7 +4901,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
   if (new_gdbarch->initialized_p)
     {
       struct gdbarch_list **list;
-      struct gdbarch_list *this;
+      struct gdbarch_list *self;
       if (gdbarch_debug)
 	fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
 			    "Previous architecture %s (%s) selected\n",
@@ -4913,12 +4913,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
-      /* Unlink THIS.  */
-      this = (*list);
-      (*list) = this->next;
-      /* Insert THIS at the front.  */
-      this->next = rego->arches;
-      rego->arches = this;
+      /* Unlink SELF.  */
+      self = (*list);
+      (*list) = self->next;
+      /* Insert SELF at the front.  */
+      self->next = rego->arches;
+      rego->arches = self;
       /* Return it.  */
       return new_gdbarch;
     }
@@ -4933,10 +4933,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
   /* Insert the new architecture into the front of the architecture
      list (keep the list sorted Most Recently Used).  */
   {
-    struct gdbarch_list *this = XNEW (struct gdbarch_list);
-    this->next = rego->arches;
-    this->gdbarch = new_gdbarch;
-    rego->arches = this;
+    struct gdbarch_list *self = XNEW (struct gdbarch_list);
+    self->next = rego->arches;
+    self->gdbarch = new_gdbarch;
+    rego->arches = self;
   }    
 
   /* Check that the newly installed architecture is valid.  Plug in
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index cffefc5..dde976a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -2350,7 +2350,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
   if (new_gdbarch->initialized_p)
     {
       struct gdbarch_list **list;
-      struct gdbarch_list *this;
+      struct gdbarch_list *self;
       if (gdbarch_debug)
 	fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
 			    "Previous architecture %s (%s) selected\n",
@@ -2362,12 +2362,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
-      /* Unlink THIS.  */
-      this = (*list);
-      (*list) = this->next;
-      /* Insert THIS at the front.  */
-      this->next = rego->arches;
-      rego->arches = this;
+      /* Unlink SELF.  */
+      self = (*list);
+      (*list) = self->next;
+      /* Insert SELF at the front.  */
+      self->next = rego->arches;
+      rego->arches = self;
       /* Return it.  */
       return new_gdbarch;
     }
@@ -2382,10 +2382,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
   /* Insert the new architecture into the front of the architecture
      list (keep the list sorted Most Recently Used).  */
   {
-    struct gdbarch_list *this = XNEW (struct gdbarch_list);
-    this->next = rego->arches;
-    this->gdbarch = new_gdbarch;
-    rego->arches = this;
+    struct gdbarch_list *self = XNEW (struct gdbarch_list);
+    self->next = rego->arches;
+    self->gdbarch = new_gdbarch;
+    rego->arches = self;
   }    
 
   /* Check that the newly installed architecture is valid.  Plug in
diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h
index c75499d..0569586 100644
--- a/gdb/gdbserver/inferiors.h
+++ b/gdb/gdbserver/inferiors.h
@@ -69,7 +69,7 @@ struct process_info
   const struct target_desc *tdesc;
 
   /* Private target data.  */
-  struct process_info_private *private;
+  struct process_info_private *priv;
 };
 
 #define ptid_of(inf) ((inf)->entry.id)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 6b84042..a34fe5d 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -721,7 +721,7 @@ aarch64_get_debug_reg_state ()
   struct process_info *proc;
 
   proc = current_process ();
-  return &proc->private->arch_private->debug_reg_state;
+  return &proc->priv->arch_private->debug_reg_state;
 }
 
 /* Record the insertion of one breakpoint/watchpoint, as represented
@@ -1151,7 +1151,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       int tid = ptid_get_lwp (ptid);
       struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
       struct aarch64_debug_reg_state *state
-	= &proc->private->arch_private->debug_reg_state;
+	= &proc->priv->arch_private->debug_reg_state;
 
       if (show_debug_regs)
 	fprintf (stderr, "prepare_to_resume thread %ld\n", lwpid_of (thread));
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 303d9c8..2cd1668 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -590,12 +590,12 @@ arm_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   if (watch)
     {
       count = arm_linux_get_hw_watchpoint_count ();
-      pts = proc->private->arch_private->wpts;
+      pts = proc->priv->arch_private->wpts;
     }
   else
     {
       count = arm_linux_get_hw_breakpoint_count ();
-      pts = proc->private->arch_private->bpts;
+      pts = proc->priv->arch_private->bpts;
     }
 
   for (i = 0; i < count; i++)
@@ -630,12 +630,12 @@ arm_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   if (watch)
     {
       count = arm_linux_get_hw_watchpoint_count ();
-      pts = proc->private->arch_private->wpts;
+      pts = proc->priv->arch_private->wpts;
     }
   else
     {
       count = arm_linux_get_hw_breakpoint_count ();
-      pts = proc->private->arch_private->bpts;
+      pts = proc->priv->arch_private->bpts;
     }
 
   for (i = 0; i < count; i++)
@@ -725,7 +725,7 @@ arm_prepare_to_resume (struct lwp_info *lwp)
   struct thread_info *thread = get_lwp_thread (lwp);
   int pid = lwpid_of (thread);
   struct process_info *proc = find_process_pid (pid_of (thread));
-  struct arch_process_info *proc_info = proc->private->arch_private;
+  struct arch_process_info *proc_info = proc->priv->arch_private;
   struct arch_lwp_info *lwp_info = lwp->arch_private;
   int i;
 
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index eff940d..083f49f 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -357,13 +357,13 @@ linux_add_process (int pid, int attached)
   struct process_info *proc;
 
   proc = add_process (pid, attached);
-  proc->private = xcalloc (1, sizeof (*proc->private));
+  proc->priv = xcalloc (1, sizeof (*proc->priv));
 
   /* Set the arch when the first LWP stops.  */
-  proc->private->new_inferior = 1;
+  proc->priv->new_inferior = 1;
 
   if (the_low_target.new_process != NULL)
-    proc->private->arch_private = the_low_target.new_process ();
+    proc->priv->arch_private = the_low_target.new_process ();
 
   return proc;
 }
@@ -1173,10 +1173,10 @@ linux_mourn (struct process_info *process)
   find_inferior (&all_threads, delete_lwp_callback, process);
 
   /* Freeing all private data.  */
-  priv = process->private;
+  priv = process->priv;
   free (priv->arch_private);
   free (priv);
-  process->private = NULL;
+  process->priv = NULL;
 
   remove_process (process);
 }
@@ -1862,7 +1862,7 @@ linux_low_filter_event (int lwpid, int wstat)
 	 is stopped for the first time, but before we access any
 	 inferior registers.  */
       proc = find_process_pid (pid_of (thread));
-      if (proc->private->new_inferior)
+      if (proc->priv->new_inferior)
 	{
 	  struct thread_info *saved_thread;
 
@@ -1873,7 +1873,7 @@ linux_low_filter_event (int lwpid, int wstat)
 
 	  current_thread = saved_thread;
 
-	  proc->private->new_inferior = 0;
+	  proc->priv->new_inferior = 0;
 	}
     }
 
@@ -2746,7 +2746,7 @@ linux_wait_1 (ptid_t ptid,
       && current_thread->last_resume_kind != resume_step
       && (
 #if defined (USE_THREAD_DB) && !defined (__ANDROID__)
-	  (current_process ()->private->thread_db != NULL
+	  (current_process ()->priv->thread_db != NULL
 	   && (WSTOPSIG (w) == __SIGRTMIN
 	       || WSTOPSIG (w) == __SIGRTMIN + 1))
 	  ||
@@ -4809,7 +4809,7 @@ linux_look_up_symbols (void)
 #ifdef USE_THREAD_DB
   struct process_info *proc = current_process ();
 
-  if (proc->private->thread_db != NULL)
+  if (proc->priv->thread_db != NULL)
     return;
 
   /* If the kernel supports tracing clones, then we don't need to
@@ -5729,7 +5729,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
 {
   char *document;
   unsigned document_len;
-  struct process_info_private *const priv = current_process ()->private;
+  struct process_info_private *const priv = current_process ()->priv;
   char filename[PATH_MAX];
   int pid, is_elf64;
 
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 478bb6e..f081dda 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -353,19 +353,19 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
 {
   ptid_t ptid = ptid_of (get_lwp_thread (lwp));
   struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
 
   if (lwp->arch_private->watch_registers_changed)
     {
       /* Only update the watch registers if we have set or unset a
 	 watchpoint already.  */
-      if (mips_linux_watch_get_num_valid (&private->watch_mirror) > 0)
+      if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
 	{
 	  /* Write the mirrored watch register values.  */
 	  int tid = ptid_get_lwp (ptid);
 
 	  if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
-			    &private->watch_mirror))
+			    &priv->watch_mirror))
 	    perror_with_name ("Couldn't write watch register");
 	}
 
@@ -395,7 +395,7 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 		   int len, struct raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   struct pt_watch_regs regs;
   struct mips_watchpoint *new_watch;
   struct mips_watchpoint **pw;
@@ -406,17 +406,17 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 
   lwpid = lwpid_of (current_thread);
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					0))
     return -1;
 
   if (len <= 0)
     return -1;
 
-  regs = private->watch_readback;
+  regs = priv->watch_readback;
   /* Add the current watches.  */
-  mips_linux_watch_populate_regs (private->current_watches, &regs);
+  mips_linux_watch_populate_regs (priv->current_watches, &regs);
 
   /* Now try to add the new watch.  */
   watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
@@ -431,12 +431,12 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   new_watch->type = watch_type;
   new_watch->next = NULL;
 
-  pw = &private->current_watches;
+  pw = &priv->current_watches;
   while (*pw != NULL)
     pw = &(*pw)->next;
   *pw = new_watch;
 
-  private->watch_mirror = regs;
+  priv->watch_mirror = regs;
 
   /* Only update the threads of this process.  */
   pid = pid_of (proc);
@@ -453,7 +453,7 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 		   int len, struct raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
 
   int deleted_one;
   int pid;
@@ -465,7 +465,7 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   /* Search for a known watch that matches.  Then unlink and free it.  */
   watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
   deleted_one = 0;
-  pw = &private->current_watches;
+  pw = &priv->current_watches;
   while ((w = *pw))
     {
       if (w->addr == addr && w->len == len && w->type == watch_type)
@@ -483,11 +483,11 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 
   /* At this point watch_readback is known to be valid because we
      could not have added the watch without reading it.  */
-  gdb_assert (private->watch_readback_valid == 1);
+  gdb_assert (priv->watch_readback_valid == 1);
 
-  private->watch_mirror = private->watch_readback;
-  mips_linux_watch_populate_regs (private->current_watches,
-				  &private->watch_mirror);
+  priv->watch_mirror = priv->watch_readback;
+  mips_linux_watch_populate_regs (priv->current_watches,
+				  &priv->watch_mirror);
 
   /* Only update the threads of this process.  */
   pid = pid_of (proc);
@@ -503,21 +503,21 @@ static int
 mips_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   int n;
   int num_valid;
   long lwpid = lwpid_of (current_thread);
 
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					1))
     return 0;
 
-  num_valid = mips_linux_watch_get_num_valid (&private->watch_readback);
+  num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
 
   for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
-    if (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+    if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 	& (R_MASK | W_MASK))
       return 1;
 
@@ -531,7 +531,7 @@ static CORE_ADDR
 mips_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   int n;
   int num_valid;
   long lwpid = lwpid_of (current_thread);
@@ -543,28 +543,28 @@ mips_stopped_data_address (void)
      triggered.  */
 
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					0))
     return 0;
 
-  num_valid = mips_linux_watch_get_num_valid (&private->watch_readback);
+  num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
 
   for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
-    if (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+    if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 	& (R_MASK | W_MASK))
       {
 	CORE_ADDR t_low, t_hi;
 	int t_irw;
 	struct mips_watchpoint *watch;
 
-	t_low = mips_linux_watch_get_watchlo (&private->watch_readback, n);
+	t_low = mips_linux_watch_get_watchlo (&priv->watch_readback, n);
 	t_irw = t_low & IRW_MASK;
-	t_hi = (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+	t_hi = (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 		| IRW_MASK);
 	t_low &= ~(CORE_ADDR)t_hi;
 
-	for (watch = private->current_watches;
+	for (watch = priv->current_watches;
 	     watch != NULL;
 	     watch = watch->next)
 	  {
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 2c3fccc..eff2847 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -687,7 +687,7 @@ x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 	struct x86_debug_reg_state *state
-	  = &proc->private->arch_private->debug_reg_state;
+	  = &proc->priv->arch_private->debug_reg_state;
 
 	return x86_dr_insert_watchpoint (state, hw_type, addr, size);
       }
@@ -716,7 +716,7 @@ x86_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 	struct x86_debug_reg_state *state
-	  = &proc->private->arch_private->debug_reg_state;
+	  = &proc->priv->arch_private->debug_reg_state;
 
 	return x86_dr_remove_watchpoint (state, hw_type, addr, size);
       }
@@ -730,7 +730,7 @@ static int
 x86_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  return x86_dr_stopped_by_watchpoint (&proc->private->arch_private->debug_reg_state);
+  return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state);
 }
 
 static CORE_ADDR
@@ -738,7 +738,7 @@ x86_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
   CORE_ADDR addr;
-  if (x86_dr_stopped_data_address (&proc->private->arch_private->debug_reg_state,
+  if (x86_dr_stopped_data_address (&proc->priv->arch_private->debug_reg_state,
 				   &addr))
     return addr;
   return 0;
@@ -783,7 +783,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
       int pid = ptid_get_pid (ptid);
       struct process_info *proc = find_process_pid (pid);
       struct x86_debug_reg_state *state
-	= &proc->private->arch_private->debug_reg_state;
+	= &proc->priv->arch_private->debug_reg_state;
 
       x86_linux_dr_set (ptid, DR_CONTROL, 0);
 
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 98797ba..460346c 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -218,8 +218,8 @@ lynx_add_process (int pid, int attached)
 
   proc = add_process (pid, attached);
   proc->tdesc = lynx_tdesc;
-  proc->private = xcalloc (1, sizeof (*proc->private));
-  proc->private->last_wait_event_ptid = null_ptid;
+  proc->priv = xcalloc (1, sizeof (*proc->priv));
+  proc->priv->last_wait_event_ptid = null_ptid;
 
   return proc;
 }
@@ -334,7 +334,7 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
      unexpected signals (Eg SIG61) when we resume the inferior
      using a different thread.  */
   if (ptid_equal (ptid, minus_one_ptid))
-    ptid = current_process()->private->last_wait_event_ptid;
+    ptid = current_process()->priv->last_wait_event_ptid;
 
   /* The ptid might still be minus_one_ptid; this can happen between
      the moment we create the inferior or attach to a process, and
@@ -422,7 +422,7 @@ retry:
 
   ret = lynx_waitpid (pid, &wstat);
   new_ptid = lynx_ptid_build (ret, ((union wait *) &wstat)->w_tid);
-  find_process_pid (ret)->private->last_wait_event_ptid = new_ptid;
+  find_process_pid (ret)->priv->last_wait_event_ptid = new_ptid;
 
   /* If this is a new thread, then add it now.  The reason why we do
      this here instead of when handling new-thread events is because
@@ -552,8 +552,8 @@ static void
 lynx_mourn (struct process_info *proc)
 {
   /* Free our private data.  */
-  free (proc->private);
-  proc->private = NULL;
+  free (proc->priv);
+  proc->priv = NULL;
 
   clear_inferiors ();
 }
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 2185245..72b9e65 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -191,7 +191,7 @@ thread_db_create_event (CORE_ADDR where)
   td_event_msg_t msg;
   td_err_e err;
   struct lwp_info *lwp;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   gdb_assert (thread_db->td_ta_event_getmsg_p != NULL);
 
@@ -227,7 +227,7 @@ thread_db_enable_reporting (void)
   td_thr_events_t events;
   td_notify_t notify;
   td_err_e err;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   if (thread_db->td_ta_set_event_p == NULL
       || thread_db->td_ta_event_addr_p == NULL
@@ -271,7 +271,7 @@ find_one_thread (ptid_t ptid)
   td_err_e err;
   struct thread_info *inferior;
   struct lwp_info *lwp;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int lwpid = ptid_get_lwp (ptid);
 
   inferior = (struct thread_info *) find_inferior_id (&all_threads, ptid);
@@ -351,7 +351,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
   if (thread_db_use_events)
     {
       td_err_e err;
-      struct thread_db *thread_db = proc->private->thread_db;
+      struct thread_db *thread_db = proc->priv->thread_db;
 
       err = thread_db->td_thr_event_enable_p (th_p, 1);
       if (err != TD_OK)
@@ -390,7 +390,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 {
   td_thrinfo_t ti;
   td_err_e err;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   err = thread_db->td_thr_get_info_p (th_p, &ti);
   if (err != TD_OK)
@@ -429,7 +429,7 @@ thread_db_find_new_threads (void)
 {
   td_err_e err;
   ptid_t ptid = current_ptid;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int loop, iteration;
 
   /* This function is only called when we first initialize thread_db.
@@ -475,7 +475,7 @@ thread_db_find_new_threads (void)
 static void
 thread_db_look_up_symbols (void)
 {
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   const char **sym_list;
   CORE_ADDR unused;
 
@@ -490,7 +490,7 @@ thread_db_look_up_symbols (void)
 int
 thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp)
 {
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int may_ask_gdb = !thread_db->all_symbols_looked_up;
 
   /* If we've passed the call to thread_db_look_up_symbols, then
@@ -513,7 +513,7 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
   struct thread_db *thread_db;
 
   proc = get_thread_process (thread);
-  thread_db = proc->private->thread_db;
+  thread_db = proc->priv->thread_db;
 
   /* If the thread layer is not (yet) initialized, fail.  */
   if (thread_db == NULL || !thread_db->all_symbols_looked_up)
@@ -574,10 +574,10 @@ thread_db_load_search (void)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  gdb_assert (proc->private->thread_db == NULL);
+  gdb_assert (proc->priv->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
-  proc->private->thread_db = tdb;
+  proc->priv->thread_db = tdb;
 
   tdb->td_ta_new_p = &td_ta_new;
 
@@ -588,7 +588,7 @@ thread_db_load_search (void)
       if (debug_threads)
 	debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
       free (tdb);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
       return 0;
     }
 
@@ -619,10 +619,10 @@ try_thread_db_load_1 (void *handle)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  gdb_assert (proc->private->thread_db == NULL);
+  gdb_assert (proc->priv->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
-  proc->private->thread_db = tdb;
+  proc->priv->thread_db = tdb;
 
   tdb->handle = handle;
 
@@ -639,7 +639,7 @@ try_thread_db_load_1 (void *handle)
 	  if (required)						\
 	    {							\
 	      free (tdb);					\
-	      proc->private->thread_db = NULL;			\
+	      proc->priv->thread_db = NULL;			\
 	      return 0;						\
 	    }							\
 	}							\
@@ -655,7 +655,7 @@ try_thread_db_load_1 (void *handle)
       if (debug_threads)
 	debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
       free (tdb);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
       return 0;
     }
 
@@ -893,7 +893,7 @@ switch_to_process (struct process_info *proc)
 static void
 disable_thread_event_reporting (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
   if (thread_db)
     {
       td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
@@ -925,7 +925,7 @@ disable_thread_event_reporting (struct process_info *proc)
 static void
 remove_thread_event_breakpoints (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
 
   if (thread_db->td_create_bp != NULL)
     {
@@ -943,7 +943,7 @@ remove_thread_event_breakpoints (struct process_info *proc)
 void
 thread_db_detach (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
 
   if (thread_db)
     {
@@ -957,7 +957,7 @@ thread_db_detach (struct process_info *proc)
 void
 thread_db_mourn (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
   if (thread_db)
     {
       td_err_e (*td_ta_delete_p) (td_thragent_t *);
@@ -976,7 +976,7 @@ thread_db_mourn (struct process_info *proc)
 #endif  /* USE_LIBTHREAD_DB_DIRECTLY  */
 
       free (thread_db);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
     }
 }
 
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index a2f378a..e9ae47d 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -261,7 +261,7 @@ struct thread_info
   struct frame_id initiating_frame;
 
   /* Private data used by the target vector implementation.  */
-  struct private_thread_info *private;
+  struct private_thread_info *priv;
 
   /* Function that is called to free PRIVATE.  If this is NULL, then
      xfree will be called on PRIVATE.  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2abaffe..46be7a5 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1515,7 +1515,7 @@ struct type *
 lookup_struct_elt_type (struct type *type, const char *name, int noerr)
 {
   int i;
-  char *typename;
+  char *type_name;
 
   for (;;)
     {
@@ -1529,9 +1529,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT 
       && TYPE_CODE (type) != TYPE_CODE_UNION)
     {
-      typename = type_to_string (type);
-      make_cleanup (xfree, typename);
-      error (_("Type %s is not a structure or union type."), typename);
+      type_name = type_to_string (type);
+      make_cleanup (xfree, type_name);
+      error (_("Type %s is not a structure or union type."), type_name);
     }
 
 #if 0
@@ -1540,10 +1540,10 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
      I.e. when doing "ptype bell->bar" for "struct foo { int bar; int
      foo; } bell;" Disabled by fnf.  */
   {
-    char *typename;
+    char *type_name;
 
-    typename = type_name_no_tag (type);
-    if (typename != NULL && strcmp (typename, name) == 0)
+    type_name = type_name_no_tag (type);
+    if (type_name != NULL && strcmp (type_name, name) == 0)
       return type;
   }
 #endif
@@ -1583,9 +1583,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
       return NULL;
     }
 
-  typename = type_to_string (type);
-  make_cleanup (xfree, typename);
-  error (_("Type %s has no component named %s."), typename, name);
+  type_name = type_to_string (type);
+  make_cleanup (xfree, type_name);
+  error (_("Type %s has no component named %s."), type_name, name);
 }
 
 /* Store in *MAX the largest number representable by unsigned integer type
@@ -2711,7 +2711,7 @@ class_types_same_p (const struct type *a, const struct type *b)
    distance_to_ancestor (A, D, 1) = -1.  */
 
 static int
-distance_to_ancestor (struct type *base, struct type *dclass, int public)
+distance_to_ancestor (struct type *base, struct type *dclass, int is_public)
 {
   int i;
   int d;
@@ -2724,10 +2724,10 @@ distance_to_ancestor (struct type *base, struct type *dclass, int public)
 
   for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
     {
-      if (public && ! BASETYPE_VIA_PUBLIC (dclass, i))
+      if (is_public && ! BASETYPE_VIA_PUBLIC (dclass, i))
 	continue;
 
-      d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), public);
+      d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), is_public);
       if (d >= 0)
 	return 1 + d;
     }
@@ -4182,7 +4182,7 @@ recursive_dump_type (struct type *type, int spaces)
 
 struct type_pair
 {
-  struct type *old, *new;
+  struct type *old, *newobj;
 };
 
 static hashval_t
@@ -4238,7 +4238,7 @@ copy_type_recursive (struct objfile *objfile,
   pair.old = type;
   slot = htab_find_slot (copied_types, &pair, INSERT);
   if (*slot != NULL)
-    return ((struct type_pair *) *slot)->new;
+    return ((struct type_pair *) *slot)->newobj;
 
   new_type = alloc_type_arch (get_type_arch (type));
 
@@ -4247,7 +4247,7 @@ copy_type_recursive (struct objfile *objfile,
   stored
     = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair));
   stored->old = type;
-  stored->new = new_type;
+  stored->newobj = new_type;
   *slot = stored;
 
   /* Copy the common fields of types.  For the main type, we simply
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index cdcb354..f65b4ec 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1076,7 +1076,7 @@ gnuv3_get_typeid (struct value *value)
   struct gdbarch *gdbarch;
   struct cleanup *cleanup;
   struct value *result;
-  char *typename, *canonical;
+  char *type_name, *canonical;
 
   /* We have to handle values a bit trickily here, to allow this code
      to work properly with non_lvalue values that are really just
@@ -1095,20 +1095,20 @@ gnuv3_get_typeid (struct value *value)
   type = make_cv_type (0, 0, type, NULL);
   gdbarch = get_type_arch (type);
 
-  typename = type_to_string (type);
-  if (typename == NULL)
+  type_name = type_to_string (type);
+  if (type_name == NULL)
     error (_("cannot find typeinfo for unnamed type"));
-  cleanup = make_cleanup (xfree, typename);
+  cleanup = make_cleanup (xfree, type_name);
 
   /* We need to canonicalize the type name here, because we do lookups
      using the demangled name, and so we must match the format it
      uses.  E.g., GDB tends to use "const char *" as a type name, but
      the demangler uses "char const *".  */
-  canonical = cp_canonicalize_string (typename);
+  canonical = cp_canonicalize_string (type_name);
   if (canonical != NULL)
     {
       make_cleanup (xfree, canonical);
-      typename = canonical;
+      type_name = canonical;
     }
 
   typeinfo_type = gnuv3_get_typeid_type (gdbarch);
@@ -1124,7 +1124,7 @@ gnuv3_get_typeid (struct value *value)
 
       vtable = gnuv3_get_vtable (gdbarch, type, address);
       if (vtable == NULL)
-	error (_("cannot find typeinfo for object of type '%s'"), typename);
+	error (_("cannot find typeinfo for object of type '%s'"), type_name);
       typeinfo_value = value_field (vtable, vtable_field_type_info);
       result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
 				      typeinfo_value));
@@ -1134,12 +1134,12 @@ gnuv3_get_typeid (struct value *value)
       char *sym_name;
       struct bound_minimal_symbol minsym;
 
-      sym_name = concat ("typeinfo for ", typename, (char *) NULL);
+      sym_name = concat ("typeinfo for ", type_name, (char *) NULL);
       make_cleanup (xfree, sym_name);
       minsym = lookup_minimal_symbol (sym_name, NULL, NULL);
 
       if (minsym.minsym == NULL)
-	error (_("could not find typeinfo symbol for '%s'"), typename);
+	error (_("could not find typeinfo symbol for '%s'"), type_name);
 
       result = value_at_lazy (typeinfo_type, BMSYMBOL_VALUE_ADDRESS (minsym));
     }
@@ -1187,21 +1187,21 @@ gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
 static struct type *
 gnuv3_get_type_from_type_info (struct value *type_info_ptr)
 {
-  char *typename;
+  char *type_name;
   struct cleanup *cleanup;
   struct value *type_val;
   struct expression *expr;
   struct type *result;
 
-  typename = gnuv3_get_typename_from_type_info (type_info_ptr);
-  cleanup = make_cleanup (xfree, typename);
+  type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
+  cleanup = make_cleanup (xfree, type_name);
 
   /* We have to parse the type name, since in general there is not a
      symbol for a type.  This is somewhat bogus since there may be a
      mis-parse.  Another approach might be to re-use the demangler's
      internal form to reconstruct the type somehow.  */
 
-  expr = parse_expression (typename);
+  expr = parse_expression (type_name);
   make_cleanup (xfree, expr);
 
   type_val = evaluate_type (expr);
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 2443983..bada4cf 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -988,7 +988,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1075,7 +1075,7 @@ lex_one_token (struct parser_state *par_state)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -1084,7 +1084,7 @@ lex_one_token (struct parser_state *par_state)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1315,7 +1315,7 @@ lex_one_token (struct parser_state *par_state)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	/* It is ok to always set this, even though we don't always
 	   strictly need to.  */
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 9a8ef68..5c0f2d7 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -139,12 +139,12 @@ extern SCM gdbscm_string_string;
 \f
 /* scm-utils.c */
 
-extern void gdbscm_define_variables (const scheme_variable *, int public);
+extern void gdbscm_define_variables (const scheme_variable *, int is_public);
 
-extern void gdbscm_define_functions (const scheme_function *, int public);
+extern void gdbscm_define_functions (const scheme_function *, int is_public);
 
 extern void gdbscm_define_integer_constants (const scheme_integer_constant *,
-					     int public);
+					     int is_public);
 
 extern void gdbscm_printf (SCM port, const char *format, ...);
 
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 829143e..1891237 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -434,11 +434,11 @@ gdbscm_symbol_constant_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return scm_from_bool (class == LOC_CONST || class == LOC_CONST_BYTES);
+  return scm_from_bool (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
 }
 
 /* (symbol-function? <gdb:symbol>) -> boolean */
@@ -449,11 +449,11 @@ gdbscm_symbol_function_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return scm_from_bool (class == LOC_BLOCK);
+  return scm_from_bool (theclass == LOC_BLOCK);
 }
 
 /* (symbol-variable? <gdb:symbol>) -> boolean */
@@ -464,14 +464,14 @@ gdbscm_symbol_variable_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
   return scm_from_bool (!SYMBOL_IS_ARGUMENT (symbol)
-			&& (class == LOC_LOCAL || class == LOC_REGISTER
-			    || class == LOC_STATIC || class == LOC_COMPUTED
-			    || class == LOC_OPTIMIZED_OUT));
+			&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
+			    || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+			    || theclass == LOC_OPTIMIZED_OUT));
 }
 
 /* (symbol-needs-frame? <gdb:symbol>) -> boolean
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index 023097f..59d8b52 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -27,14 +27,14 @@
 /* Define VARIABLES in the gdb module.  */
 
 void
-gdbscm_define_variables (const scheme_variable *variables, int public)
+gdbscm_define_variables (const scheme_variable *variables, int is_public)
 {
   const scheme_variable *sv;
 
   for (sv = variables; sv->name != NULL; ++sv)
     {
       scm_c_define (sv->name, sv->value);
-      if (public)
+      if (is_public)
 	scm_c_export (sv->name, NULL);
     }
 }
@@ -42,7 +42,7 @@ gdbscm_define_variables (const scheme_variable *variables, int public)
 /* Define FUNCTIONS in the gdb module.  */
 
 void
-gdbscm_define_functions (const scheme_function *functions, int public)
+gdbscm_define_functions (const scheme_function *functions, int is_public)
 {
   const scheme_function *sf;
 
@@ -53,7 +53,7 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
       scm_set_procedure_property_x (proc, gdbscm_documentation_symbol,
 				    gdbscm_scm_from_c_string (sf->doc_string));
-      if (public)
+      if (is_public)
 	scm_c_export (sf->name, NULL);
     }
 }
@@ -62,14 +62,14 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
 void
 gdbscm_define_integer_constants (const scheme_integer_constant *constants,
-				 int public)
+				 int is_public)
 {
   const scheme_integer_constant *sc;
 
   for (sc = constants; sc->name != NULL; ++sc)
     {
       scm_c_define (sc->name, scm_from_int (sc->value));
-      if (public)
+      if (is_public)
 	scm_c_export (sc->name, NULL);
     }
 }
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 55fcd23..6dc2e84 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -136,7 +136,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   unsigned int dummy[HPPA_MAX_INSN_PATTERN_LEN];
   int offs = 0;
-  int try;
+  int attempt;
   /* offsets to try to find the trampoline */
   static int pcoffs[] = { 0, 4*4, 5*4 };
   /* offsets to the rt_sigframe structure */
@@ -154,12 +154,12 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
      e4008200 be,l 0x100(%sr2, %r0), %sr0, %r31
      08000240 nop  */
 
-  for (try = 0; try < ARRAY_SIZE (pcoffs); try++)
+  for (attempt = 0; attempt < ARRAY_SIZE (pcoffs); attempt++)
     {
-      if (insns_match_pattern (gdbarch, sp + pcoffs[try],
+      if (insns_match_pattern (gdbarch, sp + pcoffs[attempt],
 			       hppa_sigtramp, dummy))
 	{
-          offs = sfoffs[try];
+          offs = sfoffs[attempt];
 	  break;
 	}
     }
@@ -171,8 +171,8 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
 	  /* sigaltstack case: we have no way of knowing which offset to 
 	     use in this case; default to new kernel handling.  If this is
 	     wrong the unwinding will fail.  */
-	  try = 2;
-	  sp = pc - pcoffs[try];
+	  attempt = 2;
+	  sp = pc - pcoffs[attempt];
 	}
       else
       {
@@ -186,7 +186,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
      bad we cannot include system specific headers :-(.
      sizeof(struct siginfo) == 128
      offsetof(struct ucontext, uc_mcontext) == 24.  */
-  return sp + sfoffs[try] + 128 + 24;
+  return sp + sfoffs[attempt] + 128 + 24;
 }
 
 struct hppa_linux_sigtramp_unwind_cache
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 89f7ae3..c237aaa 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -512,7 +512,7 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
 {
   gdb_byte bundle[BUNDLE_LEN];
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
-  long long template;
+  long long templ;
   int val;
 
   /* Warn about slot numbers greater than 2.  We used to generate
@@ -543,8 +543,8 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
     return 0;
 
   *instr = slotN_contents (bundle, slotnum);
-  template = extract_bit_field (bundle, 0, 5);
-  *it = template_encoding_table[(int)template][slotnum];
+  templ = extract_bit_field (bundle, 0, 5);
+  *it = template_encoding_table[(int)templ][slotnum];
 
   if (slotnum == 2 || (slotnum == 1 && *it == L))
     addr += 16;
@@ -642,7 +642,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_breakpoint;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   if (slotnum > 2)
@@ -671,8 +671,8 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
      a breakpoint on an L-X instruction.  */
   bp_tgt->shadow_len = BUNDLE_LEN - shadow_slotnum;
 
-  template = extract_bit_field (bundle, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       /* X unit types can only be used in slot 2, and are actually
 	 part of a 2-slot L-X instruction.  We cannot break at this
@@ -681,7 +681,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
       gdb_assert (slotnum == 2);
       error (_("Can't insert breakpoint for non-existing slot X"));
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       /* L unit types can only be used in slot 1.  But the associated
 	 opcode for that instruction is in slot 2, so bump the slot number
@@ -739,7 +739,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
   int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_breakpoint, instr_saved;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   addr &= ~0x0f;
@@ -761,8 +761,8 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
      for addressing the SHADOW_CONTENTS placement.  */
   shadow_slotnum = slotnum;
 
-  template = extract_bit_field (bundle_mem, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle_mem, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       /* X unit types can only be used in slot 2, and are actually
 	 part of a 2-slot L-X instruction.  We refuse to insert
@@ -776,7 +776,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
       do_cleanups (cleanup);
       return -1;
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       /* L unit types can only be used in slot 1.  But the breakpoint
 	 was actually saved using slot 2, so update the slot number
@@ -829,7 +829,7 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
   int slotnum = (int) (*pcptr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_fetched;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   if (slotnum > 2)
@@ -857,13 +857,13 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
 
   /* Check for L type instruction in slot 1, if present then bump up the slot
      number to the slot 2.  */
-  template = extract_bit_field (bundle, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       gdb_assert (slotnum == 2);
       error (_("Can't insert breakpoint for non-existing slot X"));
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       gdb_assert (slotnum == 1);
       slotnum = 2;
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 080e167..8957ca2 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -424,9 +424,9 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child,
       inf_ttrace_num_lwps_in_syscall = 0;
 
       ti = inferior_thread ();
-      ti->private =
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
     }
   else
@@ -610,7 +610,7 @@ inf_ttrace_create_threads_after_attach (int pid)
   /* Add the stopped thread.  */
   ptid = ptid_build (pid, tts.tts_lwpid, 0);
   ti = add_thread (ptid);
-  ti->private = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
+  ti->priv = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
   inf_ttrace_num_lwps++;
 
   /* We use the "first stopped thread" as the currently active thread.  */
@@ -631,7 +631,7 @@ inf_ttrace_create_threads_after_attach (int pid)
 
       ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
       ti = add_thread (ptid);
-      ti->private = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
+      ti->priv = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
       inf_ttrace_num_lwps++;
     }
 }
@@ -750,7 +750,7 @@ inf_ttrace_delete_dead_threads_callback (struct thread_info *info, void *arg)
     return 0;
 
   lwpid = ptid_get_lwp (info->ptid);
-  p = (struct inf_ttrace_private_thread_info *) info->private;
+  p = (struct inf_ttrace_private_thread_info *) info->priv;
 
   /* Check if an lwp that was dying is still there or not.  */
   if (p->dying && (kill (lwpid, 0) == -1))
@@ -772,7 +772,7 @@ inf_ttrace_resume_lwp (struct thread_info *info, ttreq_t request, int sig)
   if (ttrace (request, pid, lwpid, TT_NOPC, sig, 0) == -1)
     {
       struct inf_ttrace_private_thread_info *p
-	= (struct inf_ttrace_private_thread_info *) info->private;
+	= (struct inf_ttrace_private_thread_info *) info->priv;
       if (p->dying && errno == EPROTO)
 	/* This is expected, it means the dying lwp is really gone
 	   by now.  If ttrace had an event to inform the debugger
@@ -872,10 +872,10 @@ inf_ttrace_wait (struct target_ops *ops,
       /* We haven't set the private member on the main thread yet.  Do
 	 it now.  */
       ti = find_thread_ptid (inferior_ptid);
-      gdb_assert (ti != NULL && ti->private == NULL);
-      ti->private =
+      gdb_assert (ti != NULL && ti->priv == NULL);
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
 
       /* Notify the core that this ptid changed.  This changes
@@ -955,9 +955,9 @@ inf_ttrace_wait (struct target_ops *ops,
       lwpid = tts.tts_u.tts_thread.tts_target_lwpid;
       ptid = ptid_build (tts.tts_pid, lwpid, 0);
       ti = add_thread (ptid);
-      ti->private =
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
       inf_ttrace_num_lwps++;
       ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
@@ -973,7 +973,7 @@ inf_ttrace_wait (struct target_ops *ops,
 	printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (ptid));
       ti = find_thread_ptid (ptid);
       gdb_assert (ti != NULL);
-      ((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
+      ((struct inf_ttrace_private_thread_info *)ti->priv)->dying = 1;
       inf_ttrace_num_lwps--;
       /* Let the thread really exit.  */
       ttrace (TT_LWP_CONTINUE, ptid_get_pid (ptid),
@@ -990,7 +990,7 @@ inf_ttrace_wait (struct target_ops *ops,
 			  target_pid_to_str (ptid));
       ti = find_thread_ptid (ptid);
       gdb_assert (ti != NULL);
-      ((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
+      ((struct inf_ttrace_private_thread_info *)ti->priv)->dying = 1;
       inf_ttrace_num_lwps--;
 
       /* Resume the lwp_terminate-caller thread.  */
@@ -1146,10 +1146,10 @@ static char *
 inf_ttrace_extra_thread_info (struct target_ops *self,
 			      struct thread_info *info)
 {
-  struct inf_ttrace_private_thread_info* private =
-    (struct inf_ttrace_private_thread_info *) info->private;
+  struct inf_ttrace_private_thread_info* priv =
+    (struct inf_ttrace_private_thread_info *) info->priv;
 
-  if (private != NULL && private->dying)
+  if (priv != NULL && priv->dying)
     return "Exiting";
 
   return NULL;
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 6b4f65f..ba320b5 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -101,7 +101,7 @@ free_inferior (struct inferior *inf)
   xfree (inf->terminal);
   free_environ (inf->environment);
   target_desc_info_free (inf->tdesc_info);
-  xfree (inf->private);
+  xfree (inf->priv);
   xfree (inf);
 }
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 4463de6..2530777 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -381,7 +381,7 @@ struct inferior
   struct continuation *continuations;
 
   /* Private data used by the target vector implementation.  */
-  struct private_inferior *private;
+  struct private_inferior *priv;
 
   /* HAS_EXIT_CODE is true if the inferior exited with an exit code.
      In this case, the EXIT_CODE field is also valid.  */
diff --git a/gdb/jit.c b/gdb/jit.c
index 712d1e2..32a3fc7 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -532,15 +532,15 @@ jit_symtab_open_impl (struct gdb_symbol_callbacks *cb,
 
 static int
 compare_block (const struct gdb_block *const old,
-               const struct gdb_block *const new)
+               const struct gdb_block *const newobj)
 {
   if (old == NULL)
     return 1;
-  if (old->begin < new->begin)
+  if (old->begin < newobj->begin)
     return 1;
-  else if (old->begin == new->begin)
+  else if (old->begin == newobj->begin)
     {
-      if (old->end > new->end)
+      if (old->end > newobj->end)
         return 1;
       else
         return 0;
@@ -1220,20 +1220,20 @@ static void
 jit_frame_this_id (struct frame_info *this_frame, void **cache,
                    struct frame_id *this_id)
 {
-  struct jit_unwind_private private;
+  struct jit_unwind_private priv;
   struct gdb_frame_id frame_id;
   struct gdb_reader_funcs *funcs;
   struct gdb_unwind_callbacks callbacks;
 
-  private.registers = NULL;
-  private.this_frame = this_frame;
+  priv.registers = NULL;
+  priv.this_frame = this_frame;
 
   /* We don't expect the frame_id function to set any registers, so we
      set reg_set to NULL.  */
   callbacks.reg_get = jit_unwind_reg_get_impl;
   callbacks.reg_set = NULL;
   callbacks.target_read = jit_target_read_impl;
-  callbacks.priv_data = &private;
+  callbacks.priv_data = &priv;
 
   gdb_assert (loaded_jit_reader);
   funcs = loaded_jit_reader->functions;
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 653eb81..2ed1c17 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -842,7 +842,7 @@ parse_number (struct parser_state *par_state,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -896,7 +896,7 @@ yylex (void)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -905,7 +905,7 @@ yylex (void)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1461,21 +1461,21 @@ static struct expression *
 copy_exp (struct expression *expr, int endpos)
 {
   int len = length_of_subexp (expr, endpos);
-  struct expression *new
-    = (struct expression *) malloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
+  struct expression *newobj
+    = (struct expression *) malloc (sizeof (*newobj) + EXP_ELEM_TO_BYTES (len));
 
-  new->nelts = len;
-  memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
-  new->language_defn = 0;
+  newobj->nelts = len;
+  memcpy (newobj->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
+  newobj->language_defn = 0;
 
-  return new;
+  return newobj;
 }
 
 /* Insert the expression NEW into the current expression (expout) at POS.  */
 static void
-insert_exp (struct parser_state *par_state, int pos, struct expression *new)
+insert_exp (struct parser_state *par_state, int pos, struct expression *newobj)
 {
-  int newlen = new->nelts;
+  int newlen = newobj->nelts;
   int i;
 
   /* Grow expout if necessary.  In this function's only use at present,
@@ -1485,7 +1485,7 @@ insert_exp (struct parser_state *par_state, int pos, struct expression *new)
   for (i = par_state->expout_ptr - 1; i >= pos; i--)
     par_state->expout->elts[i + newlen] = par_state->expout->elts[i];
   
-  memcpy (par_state->expout->elts + pos, new->elts,
+  memcpy (par_state->expout->elts + pos, newobj->elts,
 	  EXP_ELEM_TO_BYTES (newlen));
   par_state->expout_ptr += newlen;
 }
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 6b525a0..7ce4991 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -387,7 +387,7 @@ have_threads_callback (struct thread_info *thread, void *args)
   if (ptid_get_pid (thread->ptid) != pid)
     return 0;
 
-  return thread->private != NULL;
+  return thread->priv != NULL;
 }
 
 static int
@@ -1279,10 +1279,10 @@ thread_db_inferior_created (struct target_ops *target, int from_tty)
    from libthread_db thread state information.  */
 
 static void
-update_thread_state (struct private_thread_info *private,
+update_thread_state (struct private_thread_info *priv,
 		     const td_thrinfo_t *ti_p)
 {
-  private->dying = (ti_p->ti_state == TD_THR_UNKNOWN
+  priv->dying = (ti_p->ti_state == TD_THR_UNKNOWN
 		    || ti_p->ti_state == TD_THR_ZOMBIE);
 }
 
@@ -1294,7 +1294,7 @@ static int
 attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
 	       const td_thrinfo_t *ti_p)
 {
-  struct private_thread_info *private;
+  struct private_thread_info *priv;
   struct thread_info *tp;
   td_err_e err;
   struct thread_db_info *info;
@@ -1319,9 +1319,9 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
 	 PTRACE_EVENT_CLONE); assume the same mechanism notices thread
 	 exit, so this can not be a stale thread recreated with the
 	 same ID.  */
-      if (tp->private != NULL)
+      if (tp->priv != NULL)
 	{
-	  if (!tp->private->dying)
+	  if (!tp->priv->dying)
 	    return 0;
 
 	  delete_thread (ptid);
@@ -1356,8 +1356,8 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
     }
 
   /* Construct the thread's private data.  */
-  private = xmalloc (sizeof (struct private_thread_info));
-  memset (private, 0, sizeof (struct private_thread_info));
+  priv = xmalloc (sizeof (struct private_thread_info));
+  memset (priv, 0, sizeof (struct private_thread_info));
 
   /* A thread ID of zero may mean the thread library has not initialized
      yet.  But we shouldn't even get here if that's the case.  FIXME:
@@ -1365,15 +1365,15 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
      list this will have to go somewhere else; maybe private == NULL
      until the thread_db target claims it.  */
   gdb_assert (ti_p->ti_tid != 0);
-  private->th = *th_p;
-  private->tid = ti_p->ti_tid;
-  update_thread_state (private, ti_p);
+  priv->th = *th_p;
+  priv->tid = ti_p->ti_tid;
+  update_thread_state (priv, ti_p);
 
   /* Add the thread to GDB's thread list.  */
   if (tp == NULL)
-    add_thread_with_info (ptid, private);
+    add_thread_with_info (ptid, priv);
   else
-    tp->private = private;
+    tp->priv = priv;
 
   info = get_thread_db_info (ptid_get_pid (ptid));
 
@@ -1404,8 +1404,8 @@ detach_thread (ptid_t ptid)
      something re-uses its thread ID.  We'll report the thread exit
      when the underlying LWP dies.  */
   thread_info = find_thread_ptid (ptid);
-  gdb_assert (thread_info != NULL && thread_info->private != NULL);
-  thread_info->private->dying = 1;
+  gdb_assert (thread_info != NULL && thread_info->priv != NULL);
+  thread_info->priv->dying = 1;
 }
 
 static void
@@ -1682,7 +1682,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 
   ptid = ptid_build (info->pid, ti.ti_lid, 0);
   tp = find_thread_ptid (ptid);
-  if (tp == NULL || tp->private == NULL)
+  if (tp == NULL || tp->priv == NULL)
     {
       if (attach_thread (ptid, th_p, &ti))
 	cb_data->new_threads += 1;
@@ -1699,7 +1699,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
     {
       /* Need to update this if not using the libthread_db events
 	 (particularly, the TD_DEATH event).  */
-      update_thread_state (tp->private, &ti);
+      update_thread_state (tp->priv, &ti);
     }
 
   return 0;
@@ -1834,12 +1834,12 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
   struct thread_info *thread_info = find_thread_ptid (ptid);
   struct target_ops *beneath;
 
-  if (thread_info != NULL && thread_info->private != NULL)
+  if (thread_info != NULL && thread_info->priv != NULL)
     {
       static char buf[64];
       thread_t tid;
 
-      tid = thread_info->private->tid;
+      tid = thread_info->priv->tid;
       snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
 		tid, ptid_get_lwp (ptid));
 
@@ -1857,10 +1857,10 @@ static char *
 thread_db_extra_thread_info (struct target_ops *self,
 			     struct thread_info *info)
 {
-  if (info->private == NULL)
+  if (info->priv == NULL)
     return NULL;
 
-  if (info->private->dying)
+  if (info->priv->dying)
     return "Exiting";
 
   return NULL;
@@ -1885,7 +1885,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
   /* Find the matching thread.  */
   thread_info = find_thread_ptid (ptid);
 
-  if (thread_info != NULL && thread_info->private != NULL)
+  if (thread_info != NULL && thread_info->priv != NULL)
     {
       td_err_e err;
       psaddr_t address;
@@ -1904,7 +1904,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 	  /* Note the cast through uintptr_t: this interface only works if
 	     a target address fits in a psaddr_t, which is a host pointer.
 	     So a 32-bit debugger can not access 64-bit TLS through this.  */
-	  err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
+	  err = info->td_thr_tls_get_addr_p (&thread_info->priv->th,
 					     (psaddr_t)(uintptr_t) lm,
 					     offset, &address);
 	}
@@ -1922,7 +1922,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 	     PR libc/16831 due to GDB PR threads/16954 LOAD_MODULE is also NULL.
 	     The constant number 1 depends on GNU __libc_setup_tls
 	     initialization of l_tls_modid to 1.  */
-	  err = info->td_thr_tlsbase_p (&thread_info->private->th,
+	  err = info->td_thr_tlsbase_p (&thread_info->priv->th,
 					1, &address);
 	  address = (char *) address + offset;
 	}
@@ -1962,7 +1962,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
 {
   long *tid = (long *) data;
 
-  if (thread->private->tid == *tid)
+  if (thread->priv->tid == *tid)
     return 1;
 
   return 0;
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 4c50e66..4c5341e 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -450,7 +450,7 @@ macro_include (struct macro_source_file *source,
                int line,
                const char *included)
 {
-  struct macro_source_file *new;
+  struct macro_source_file *newobj;
   struct macro_source_file **link;
 
   /* Find the right position in SOURCE's `includes' list for the new
@@ -496,13 +496,13 @@ macro_include (struct macro_source_file *source,
   /* At this point, we know that LINE is an unused line number, and
      *LINK points to the entry an #inclusion at that line should
      precede.  */
-  new = new_source_file (source->table, included);
-  new->included_by = source;
-  new->included_at_line = line;
-  new->next_included = *link;
-  *link = new;
+  newobj = new_source_file (source->table, included);
+  newobj->included_by = source;
+  newobj->included_at_line = line;
+  newobj->next_included = *link;
+  *link = newobj;
 
-  return new;
+  return newobj;
 }
 
 
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 5965761..058bb7c 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -430,24 +430,24 @@ static struct parse_stack
 static void
 push_parse_stack (void)
 {
-  struct parse_stack *new;
+  struct parse_stack *newobj;
 
   /* Reuse frames if possible.  */
   if (top_stack && top_stack->prev)
-    new = top_stack->prev;
+    newobj = top_stack->prev;
   else
-    new = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
+    newobj = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
   /* Initialize new frame with previous content.  */
   if (top_stack)
     {
-      struct parse_stack *prev = new->prev;
+      struct parse_stack *prev = newobj->prev;
 
-      *new = *top_stack;
-      top_stack->prev = new;
-      new->prev = prev;
-      new->next = top_stack;
+      *newobj = *top_stack;
+      top_stack->prev = newobj;
+      newobj->prev = prev;
+      newobj->next = top_stack;
     }
-  top_stack = new;
+  top_stack = newobj;
 }
 
 /* Exit a lexical context.  */
@@ -559,7 +559,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
   struct type *t;
   struct field *f;
   int count = 1;
-  enum address_class class;
+  enum address_class theclass;
   TIR tir;
   long svalue = sh->value;
   int bitsize;
@@ -600,7 +600,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       break;
 
     case stGlobal:		/* External symbol, goes into global block.  */
-      class = LOC_STATIC;
+      theclass = LOC_STATIC;
       b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
 			     GLOBAL_BLOCK);
       s = new_symbol (name);
@@ -608,7 +608,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       goto data;
 
     case stStatic:		/* Static data, goes into current block.  */
-      class = LOC_STATIC;
+      theclass = LOC_STATIC;
       b = top_stack->cur_block;
       s = new_symbol (name);
       if (SC_IS_COMMON (sh->sc))
@@ -629,13 +629,13 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       s = new_symbol (name);
       SYMBOL_VALUE (s) = svalue;
       if (sh->sc == scRegister)
-	class = mdebug_register_index;
+	theclass = mdebug_register_index;
       else
-	class = LOC_LOCAL;
+	theclass = LOC_LOCAL;
 
     data:			/* Common code for symbols describing data.  */
       SYMBOL_DOMAIN (s) = VAR_DOMAIN;
-      SYMBOL_ACLASS_INDEX (s) = class;
+      SYMBOL_ACLASS_INDEX (s) = theclass;
       add_symbol (s, top_stack->cur_st, b);
 
       /* Type could be missing if file is compiled without debugging info.  */
@@ -3416,7 +3416,7 @@ parse_partial_symbols (struct objfile *objfile)
 	  for (cur_sdx = 0; cur_sdx < fh->csym;)
 	    {
 	      char *name;
-	      enum address_class class;
+	      enum address_class theclass;
 	      CORE_ADDR minsym_value;
 
 	      (*swap_sym_in) (cur_bfd,
@@ -3572,7 +3572,7 @@ parse_partial_symbols (struct objfile *objfile)
 							 mst_file_bss,
 							 SECT_OFF_BSS (objfile),
 							 objfile);
-		  class = LOC_STATIC;
+		  theclass = LOC_STATIC;
 		  break;
 
 		case stIndirect:	/* Irix5 forward declaration */
@@ -3584,11 +3584,11 @@ parse_partial_symbols (struct objfile *objfile)
 		     structs from alpha and mips cc.  */
 		  if (sh.iss == 0 || has_opaque_xref (fh, &sh))
 		    goto skip;
-		  class = LOC_TYPEDEF;
+		  theclass = LOC_TYPEDEF;
 		  break;
 
 		case stConstant:	/* Constant decl */
-		  class = LOC_CONST;
+		  theclass = LOC_CONST;
 		  break;
 
 		case stUnion:
@@ -3644,7 +3644,7 @@ parse_partial_symbols (struct objfile *objfile)
 		}
 	      /* Use this gdb symbol.  */
 	      add_psymbol_to_list (name, strlen (name), 1,
-				   VAR_DOMAIN, class,
+				   VAR_DOMAIN, theclass,
 				   &objfile->static_psymbols,
 				   0, sh.value, psymtab_language, objfile);
 	    skip:
@@ -3658,7 +3658,7 @@ parse_partial_symbols (struct objfile *objfile)
 	  PST_PRIVATE (save_pst)->extern_tab = ext_ptr;
 	  for (; --cur_sdx >= 0; ext_ptr++)
 	    {
-	      enum address_class class;
+	      enum address_class theclass;
 	      SYMR *psh;
 	      char *name;
 	      CORE_ADDR svalue;
@@ -3708,7 +3708,7 @@ parse_partial_symbols (struct objfile *objfile)
 		     Ignore them, as parse_external will ignore them too.  */
 		  continue;
 		case stLabel:
-		  class = LOC_LABEL;
+		  theclass = LOC_LABEL;
 		  break;
 		default:
 		  unknown_ext_complaint (debug_info->ssext + psh->iss);
@@ -3719,12 +3719,12 @@ parse_partial_symbols (struct objfile *objfile)
 		  if (SC_IS_COMMON (psh->sc))
 		    continue;
 
-		  class = LOC_STATIC;
+		  theclass = LOC_STATIC;
 		  break;
 		}
 	      name = debug_info->ssext + psh->iss;
 	      add_psymbol_to_list (name, strlen (name), 1,
-				   VAR_DOMAIN, class,
+				   VAR_DOMAIN, theclass,
 				   &objfile->global_psymbols,
 				   0, svalue,
 				   psymtab_language, objfile);
@@ -4568,7 +4568,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 
 static struct symbol *
 mylookup_symbol (char *name, const struct block *block,
-		 domain_enum domain, enum address_class class)
+		 domain_enum domain, enum address_class theclass)
 {
   struct block_iterator iter;
   int inc;
@@ -4579,14 +4579,14 @@ mylookup_symbol (char *name, const struct block *block,
     {
       if (SYMBOL_LINKAGE_NAME (sym)[0] == inc
 	  && SYMBOL_DOMAIN (sym) == domain
-	  && SYMBOL_CLASS (sym) == class
+	  && SYMBOL_CLASS (sym) == theclass
 	  && strcmp (SYMBOL_LINKAGE_NAME (sym), name) == 0)
 	return sym;
     }
 
   block = BLOCK_SUPERBLOCK (block);
   if (block)
-    return mylookup_symbol (name, block, domain, class);
+    return mylookup_symbol (name, block, domain, theclass);
   return 0;
 }
 
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e6a98f6..a2aac07 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -112,11 +112,11 @@ mem_region_cmp (const void *untyped_lhs, const void *untyped_rhs)
 /* Allocate a new memory region, with default settings.  */
 
 void
-mem_region_init (struct mem_region *new)
+mem_region_init (struct mem_region *newobj)
 {
-  memset (new, 0, sizeof (struct mem_region));
-  new->enabled_p = 1;
-  new->attrib = default_mem_attrib;
+  memset (newobj, 0, sizeof (struct mem_region));
+  newobj->enabled_p = 1;
+  newobj->attrib = default_mem_attrib;
 }
 
 /* This function should be called before any command which would
@@ -174,7 +174,7 @@ static void
 create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 		   const struct mem_attrib *attrib)
 {
-  struct mem_region new;
+  struct mem_region newobj;
   int i, ix;
 
   /* lo == hi is a useless empty region.  */
@@ -184,11 +184,11 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
       return;
     }
 
-  mem_region_init (&new);
-  new.lo = lo;
-  new.hi = hi;
+  mem_region_init (&newobj);
+  newobj.lo = lo;
+  newobj.hi = hi;
 
-  ix = VEC_lower_bound (mem_region_s, mem_region_list, &new,
+  ix = VEC_lower_bound (mem_region_s, mem_region_list, &newobj,
 			mem_region_lessthan);
 
   /* Check for an overlapping memory region.  We only need to check
@@ -214,9 +214,9 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 	}
     }
 
-  new.number = ++mem_number;
-  new.attrib = *attrib;
-  VEC_safe_insert (mem_region_s, mem_region_list, ix, &new);
+  newobj.number = ++mem_number;
+  newobj.attrib = *attrib;
+  VEC_safe_insert (mem_region_s, mem_region_list, ix, &newobj);
 }
 
 /*
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index d9b37f8..ee0bbc6 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -35,7 +35,7 @@ extern unsigned int varobjdebug;		/* defined in varobj.c.  */
 
 static void varobj_update_one (struct varobj *var,
 			       enum print_values print_values,
-			       int explicit);
+			       int is_explicit);
 
 static int mi_print_value_p (struct varobj *var,
 			     enum print_values print_values);
@@ -730,14 +730,14 @@ mi_cmd_var_update (char *command, char **argv, int argc)
 
 static void
 varobj_update_one (struct varobj *var, enum print_values print_values,
-		   int explicit)
+		   int is_explicit)
 {
   struct ui_out *uiout = current_uiout;
   VEC (varobj_update_result) *changes;
   varobj_update_result *r;
   int i;
   
-  changes = varobj_update (&var, explicit);
+  changes = varobj_update (&var, is_explicit);
   
   for (i = 0; VEC_iterate (varobj_update_result, changes, i, r); ++i)
     {
@@ -803,14 +803,14 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
       ui_out_field_int (uiout, "has_more",
 			varobj_has_more (r->varobj, to));
 
-      if (r->new)
+      if (r->newobj)
 	{
 	  int j;
 	  varobj_p child;
 	  struct cleanup *cleanup;
 
 	  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children");
-	  for (j = 0; VEC_iterate (varobj_p, r->new, j, child); ++j)
+	  for (j = 0; VEC_iterate (varobj_p, r->newobj, j, child); ++j)
 	    {
 	      struct cleanup *cleanup_child;
 
@@ -821,8 +821,8 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
 	    }
 
 	  do_cleanups (cleanup);
-	  VEC_free (varobj_p, r->new);
-	  r->new = NULL;	/* Paranoia.  */
+	  VEC_free (varobj_p, r->newobj);
+	  r->newobj = NULL;	/* Paranoia.  */
 	}
 
       do_cleanups (cleanup);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 83b2070..f8985e8 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -550,7 +550,7 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc_in,
 {
   int lo;
   int hi;
-  int new;
+  int newobj;
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
   struct minimal_symbol *best_symbol = NULL;
@@ -617,15 +617,15 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc_in,
 		{
 		  /* pc is still strictly less than highest address.  */
 		  /* Note "new" will always be >= lo.  */
-		  new = (lo + hi) / 2;
-		  if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[new]) >= pc)
-		      || (lo == new))
+		  newobj = (lo + hi) / 2;
+		  if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[newobj]) >= pc)
+		      || (lo == newobj))
 		    {
-		      hi = new;
+		      hi = newobj;
 		    }
 		  else
 		    {
-		      lo = new;
+		      lo = newobj;
 		    }
 		}
 
@@ -975,7 +975,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
 				 struct objfile *objfile)
 {
   struct obj_section *obj_section;
-  struct msym_bunch *new;
+  struct msym_bunch *newobj;
   struct minimal_symbol *msymbol;
 
   /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
@@ -1001,10 +1001,10 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
 
   if (msym_bunch_index == BUNCH_SIZE)
     {
-      new = XCNEW (struct msym_bunch);
+      newobj = XCNEW (struct msym_bunch);
       msym_bunch_index = 0;
-      new->next = msym_bunch;
-      msym_bunch = new;
+      newobj->next = msym_bunch;
+      msym_bunch = newobj;
     }
   msymbol = &msym_bunch->contents[msym_bunch_index];
   MSYMBOL_SET_LANGUAGE (msymbol, language_auto,
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 37d1ff1..b1fae73 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -407,8 +407,8 @@ x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state,
       int align = addr % max_wp_len;
       /* Four (eight on AMD64) is the maximum length a debug register
 	 can watch.  */
-      int try = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
-      int size = size_try_array[try][align];
+      int attempt = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
+      int size = size_try_array[attempt][align];
 
       if (what == WP_COUNT)
 	{
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 323d614..7312060 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -247,24 +247,24 @@ update_thread_private_data_name (struct thread_info *new_thread,
   gdb_assert (newname != NULL);
   gdb_assert (new_thread != NULL);
   newnamelen = strlen (newname);
-  if (!new_thread->private)
+  if (!new_thread->priv)
     {
-      new_thread->private = xmalloc (offsetof (struct private_thread_info,
+      new_thread->priv = xmalloc (offsetof (struct private_thread_info,
 					       name)
 				     + newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
-  else if (strcmp (newname, new_thread->private->name) != 0)
+  else if (strcmp (newname, new_thread->priv->name) != 0)
     {
       /* Reallocate if neccessary.  */
-      int oldnamelen = strlen (new_thread->private->name);
+      int oldnamelen = strlen (new_thread->priv->name);
 
       if (oldnamelen < newnamelen)
-	new_thread->private = xrealloc (new_thread->private,
+	new_thread->priv = xrealloc (new_thread->priv,
 					offsetof (struct private_thread_info,
 						  name)
 					+ newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
 }
 
@@ -299,7 +299,7 @@ update_thread_private_data (struct thread_info *new_thread,
 
   update_thread_private_data_name (new_thread, tn->name_buf);
 
-  pti = (struct private_thread_info *) new_thread->private;
+  pti = (struct private_thread_info *) new_thread->priv;
   pti->tid = tid;
   pti->state = state;
   pti->flags = flags;
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index b6e8600..93c230c 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -364,9 +364,9 @@ static const char *nto_thread_state_str[] =
 char *
 nto_extra_thread_info (struct target_ops *self, struct thread_info *ti)
 {
-  if (ti && ti->private
-      && ti->private->state < ARRAY_SIZE (nto_thread_state_str))
-    return (char *)nto_thread_state_str [ti->private->state];
+  if (ti && ti->priv
+      && ti->priv->state < ARRAY_SIZE (nto_thread_state_str))
+    return (char *)nto_thread_state_str [ti->priv->state];
   return "";
 }
 
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 979ba01..0d1d96b 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -65,7 +65,7 @@ struct objc_class {
 
 struct objc_super {
   CORE_ADDR receiver;
-  CORE_ADDR class;
+  CORE_ADDR theclass;
 };
 
 struct objc_method {
@@ -413,16 +413,16 @@ static char *msglist_sel;
 void
 start_msglist(void)
 {
-  struct selname *new = 
+  struct selname *newobj =
     (struct selname *) xmalloc (sizeof (struct selname));
 
-  new->next = selname_chain;
-  new->msglist_len = msglist_len;
-  new->msglist_sel = msglist_sel;
+  newobj->next = selname_chain;
+  newobj->msglist_len = msglist_len;
+  newobj->msglist_sel = msglist_sel;
   msglist_len = 0;
   msglist_sel = (char *)xmalloc(1);
   *msglist_sel = 0;
-  selname_chain = new;
+  selname_chain = newobj;
 }
 
 void
@@ -856,7 +856,7 @@ parse_selector (char *method, char **selector)
 }
 
 static char * 
-parse_method (char *method, char *type, char **class, 
+parse_method (char *method, char *type, char **theclass,
 	      char **category, char **selector)
 {
   char *s1 = NULL;
@@ -869,7 +869,7 @@ parse_method (char *method, char *type, char **class,
   char *nselector = NULL;
 
   gdb_assert (type != NULL);
-  gdb_assert (class != NULL);
+  gdb_assert (theclass != NULL);
   gdb_assert (category != NULL);
   gdb_assert (selector != NULL);
   
@@ -941,8 +941,8 @@ parse_method (char *method, char *type, char **class,
 
   if (type != NULL)
     *type = ntype;
-  if (class != NULL)
-    *class = nclass;
+  if (theclass != NULL)
+    *theclass = nclass;
   if (category != NULL)
     *category = ncategory;
   if (selector != NULL)
@@ -952,7 +952,7 @@ parse_method (char *method, char *type, char **class,
 }
 
 static void
-find_methods (char type, const char *class, const char *category, 
+find_methods (char type, const char *theclass, const char *category, 
 	      const char *selector,
 	      VEC (const_char_ptr) **symbol_names)
 {
@@ -1018,8 +1018,8 @@ find_methods (char type, const char *class, const char *category,
 	  if ((type != '\0') && (ntype != type))
 	    continue;
 
-	  if ((class != NULL) 
-	      && ((nclass == NULL) || (strcmp (class, nclass) != 0)))
+	  if ((theclass != NULL)
+	      && ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
 	    continue;
 
 	  if ((category != NULL) && 
@@ -1112,7 +1112,7 @@ const char *
 find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
 {
   char type = '\0';
-  char *class = NULL;
+  char *theclass = NULL;
   char *category = NULL;
   char *selector = NULL;
 
@@ -1125,7 +1125,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
 
   buf = (char *) alloca (strlen (method) + 1);
   strcpy (buf, method);
-  tmp = parse_method (buf, &type, &class, &category, &selector);
+  tmp = parse_method (buf, &type, &theclass, &category, &selector);
 
   if (tmp == NULL)
     {
@@ -1138,7 +1138,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
       selector_case = 1;
     }
 
-  find_methods (type, class, category, selector, symbol_names);
+  find_methods (type, theclass, category, selector, symbol_names);
 
   /* If we hit the "selector" case, and we found some methods, then
      add the selector itself as a symbol, if it exists.  */
@@ -1417,34 +1417,34 @@ read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   super->receiver = read_memory_unsigned_integer (addr, 4, byte_order);
-  super->class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+  super->theclass = read_memory_unsigned_integer (addr + 4, 4, byte_order);
 };
 
 static void 
 read_objc_class (struct gdbarch *gdbarch, CORE_ADDR addr,
-		 struct objc_class *class)
+		 struct objc_class *theclass)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
-  class->isa = read_memory_unsigned_integer (addr, 4, byte_order);
-  class->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
-  class->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
-  class->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
-  class->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
-  class->instance_size = read_memory_unsigned_integer (addr + 18, 4,
+  theclass->isa = read_memory_unsigned_integer (addr, 4, byte_order);
+  theclass->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+  theclass->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
+  theclass->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
+  theclass->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
+  theclass->instance_size = read_memory_unsigned_integer (addr + 18, 4,
 						       byte_order);
-  class->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
-  class->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
-  class->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
-  class->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
+  theclass->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
+  theclass->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
+  theclass->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
+  theclass->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
 }
 
 static CORE_ADDR
 find_implementation_from_class (struct gdbarch *gdbarch,
-				CORE_ADDR class, CORE_ADDR sel)
+				CORE_ADDR theclass, CORE_ADDR sel)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  CORE_ADDR subclass = class;
+  CORE_ADDR subclass = theclass;
 
   while (subclass != 0) 
     {
@@ -1563,10 +1563,10 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
   sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
 
   read_objc_super (gdbarch, super, &sstr);
-  if (sstr.class == 0)
+  if (sstr.theclass == 0)
     return 0;
   
-  res = find_implementation_from_class (gdbarch, sstr.class, sel);
+  res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
   if (new_pc != 0)
     *new_pc = res;
   if (res == 0)
@@ -1591,10 +1591,10 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
   sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
 
   read_objc_super (gdbarch, super, &sstr);
-  if (sstr.class == 0)
+  if (sstr.theclass == 0)
     return 0;
   
-  res = find_implementation_from_class (gdbarch, sstr.class, sel);
+  res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
   if (new_pc != 0)
     *new_pc = res;
   if (res == 0)
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..c214cf1 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1103,7 +1103,7 @@ pop_current_type (void)
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1173,8 +1173,8 @@ yylex (void)
   /* See if it is a special token of length 3.  */
   if (explen > 2)
     for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-      if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
-          && (!isalpha (tokentab3[i].operator[0]) || explen == 3
+      if (strncasecmp (tokstart, tokentab3[i].oper, 3) == 0
+          && (!isalpha (tokentab3[i].oper[0]) || explen == 3
               || (!isalpha (tokstart[3])
 		  && !isdigit (tokstart[3]) && tokstart[3] != '_')))
         {
@@ -1186,8 +1186,8 @@ yylex (void)
   /* See if it is a special token of length 2.  */
   if (explen > 1)
   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-      if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
-          && (!isalpha (tokentab2[i].operator[0]) || explen == 2
+      if (strncasecmp (tokstart, tokentab2[i].oper, 2) == 0
+          && (!isalpha (tokentab2[i].oper[0]) || explen == 2
               || (!isalpha (tokstart[2])
 		  && !isdigit (tokstart[2]) && tokstart[2] != '_')))
         {
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index ead0ac2..f7e2aae 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -483,10 +483,10 @@ const char pascal_vtbl_ptr_name[] =
 int
 pascal_object_is_vtbl_ptr_type (struct type *type)
 {
-  const char *typename = type_name_no_tag (type);
+  const char *type_name = type_name_no_tag (type);
 
-  return (typename != NULL
-	  && strcmp (typename, pascal_vtbl_ptr_name) == 0);
+  return (type_name != NULL
+	  && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
 }
 
 /* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/parse.c b/gdb/parse.c
index ce60d69..af01947 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -140,13 +140,13 @@ static struct funcall *funcall_chain;
 void
 start_arglist (void)
 {
-  struct funcall *new;
+  struct funcall *newobj;
 
-  new = (struct funcall *) xmalloc (sizeof (struct funcall));
-  new->next = funcall_chain;
-  new->arglist_len = arglist_len;
+  newobj = (struct funcall *) xmalloc (sizeof (struct funcall));
+  newobj->next = funcall_chain;
+  newobj->arglist_len = arglist_len;
   arglist_len = 0;
-  funcall_chain = new;
+  funcall_chain = newobj;
 }
 
 /* Return the number of arguments in a function call just terminated,
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index abf5a2c..a377ec3 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -114,7 +114,7 @@ struct objc_class_str
   {
     struct stoken stoken;
     struct type *type;
-    int class;
+    int theclass;
   };
 
 typedef struct type *type_ptr;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 88a07d1..cdbed30 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1496,7 +1496,7 @@ display_command (char *arg, int from_tty)
 {
   struct format_data fmt;
   struct expression *expr;
-  struct display *new;
+  struct display *newobj;
   int display_it = 1;
   const char *exp = arg;
 
@@ -1535,20 +1535,20 @@ display_command (char *arg, int from_tty)
       innermost_block = NULL;
       expr = parse_expression (exp);
 
-      new = (struct display *) xmalloc (sizeof (struct display));
+      newobj = (struct display *) xmalloc (sizeof (struct display));
 
-      new->exp_string = xstrdup (exp);
-      new->exp = expr;
-      new->block = innermost_block;
-      new->pspace = current_program_space;
-      new->next = display_chain;
-      new->number = ++display_number;
-      new->format = fmt;
-      new->enabled_p = 1;
-      display_chain = new;
+      newobj->exp_string = xstrdup (exp);
+      newobj->exp = expr;
+      newobj->block = innermost_block;
+      newobj->pspace = current_program_space;
+      newobj->next = display_chain;
+      newobj->number = ++display_number;
+      newobj->format = fmt;
+      newobj->enabled_p = 1;
+      display_chain = newobj;
 
       if (from_tty)
-	do_one_display (new);
+	do_one_display (newobj);
 
       dont_repeat ();
     }
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 4ee9dc1..53740e8 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1253,7 +1253,7 @@ psymtab_to_fullname (struct partial_symtab *ps)
     ever returns non-zero, and otherwise returns 0.  */
 
 static int
-map_block (const char *name, domain_enum namespace, struct objfile *objfile,
+map_block (const char *name, domain_enum the_namespace, struct objfile *objfile,
 	   struct block *block,
 	   int (*callback) (struct block *, struct symbol *, void *),
 	   void *data, symbol_compare_ftype *match)
@@ -1265,7 +1265,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
        sym != NULL; sym = block_iter_match_next (name, match, &iter))
     {
       if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), 
-				 SYMBOL_DOMAIN (sym), namespace))
+				 SYMBOL_DOMAIN (sym), the_namespace))
 	{
 	  if (callback (block, sym, data))
 	    return 1;
@@ -1280,7 +1280,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
 
 static void
 psym_map_matching_symbols (struct objfile *objfile,
-			   const char *name, domain_enum namespace,
+			   const char *name, domain_enum the_namespace,
 			   int global,
 			   int (*callback) (struct block *,
 					    struct symbol *, void *),
@@ -1295,7 +1295,7 @@ psym_map_matching_symbols (struct objfile *objfile,
     {
       QUIT;
       if (ps->readin
-	  || match_partial_symbol (objfile, ps, global, name, namespace, match,
+	  || match_partial_symbol (objfile, ps, global, name, the_namespace, match,
 				   ordered_compare))
 	{
 	  struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
@@ -1304,7 +1304,7 @@ psym_map_matching_symbols (struct objfile *objfile,
 	  if (cust == NULL)
 	    continue;
 	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
-	  if (map_block (name, namespace, objfile, block,
+	  if (map_block (name, the_namespace, objfile, block,
 			 callback, data, match))
 	    return;
 	  if (callback (block, NULL, data))
@@ -1550,12 +1550,12 @@ psymbol_hash (const void *addr, int length)
   struct partial_symbol *psymbol = (struct partial_symbol *) addr;
   unsigned int lang = psymbol->ginfo.language;
   unsigned int domain = PSYMBOL_DOMAIN (psymbol);
-  unsigned int class = PSYMBOL_CLASS (psymbol);
+  unsigned int theclass = PSYMBOL_CLASS (psymbol);
 
   h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
   h = hash_continue (&lang, sizeof (unsigned int), h);
   h = hash_continue (&domain, sizeof (unsigned int), h);
-  h = hash_continue (&class, sizeof (unsigned int), h);
+  h = hash_continue (&theclass, sizeof (unsigned int), h);
   h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h);
 
   return h;
@@ -1633,7 +1633,7 @@ psymbol_bcache_full (struct partial_symbol *sym,
 static const struct partial_symbol *
 add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
 		       domain_enum domain,
-		       enum address_class class,
+		       enum address_class theclass,
 		       long val,	/* Value as a long */
 		       CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
 		       enum language language, struct objfile *objfile,
@@ -1658,7 +1658,7 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
   SYMBOL_SECTION (&psymbol) = -1;
   SYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
   PSYMBOL_DOMAIN (&psymbol) = domain;
-  PSYMBOL_CLASS (&psymbol) = class;
+  PSYMBOL_CLASS (&psymbol) = theclass;
 
   SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
 
@@ -1718,7 +1718,7 @@ append_psymbol_to_list (struct psymbol_allocation_list *list,
 void
 add_psymbol_to_list (const char *name, int namelength, int copy_name,
 		     domain_enum domain,
-		     enum address_class class,
+		     enum address_class theclass,
 		     struct psymbol_allocation_list *list, 
 		     long val,	/* Value as a long */
 		     CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
@@ -1729,7 +1729,7 @@ add_psymbol_to_list (const char *name, int namelength, int copy_name,
   int added;
 
   /* Stash the partial symbol away in the cache.  */
-  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
+  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, theclass,
 				val, coreaddr, language, objfile, &added);
 
   /* Do not duplicate global partial symbols.  */
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 696935b..729bc64 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -147,42 +147,42 @@ static PyObject *
 sympy_is_constant (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return PyBool_FromLong (class == LOC_CONST || class == LOC_CONST_BYTES);
+  return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
 }
 
 static PyObject *
 sympy_is_function (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return PyBool_FromLong (class == LOC_BLOCK);
+  return PyBool_FromLong (theclass == LOC_BLOCK);
 }
 
 static PyObject *
 sympy_is_variable (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
   return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (symbol)
-			  && (class == LOC_LOCAL || class == LOC_REGISTER
-			      || class == LOC_STATIC || class == LOC_COMPUTED
-			      || class == LOC_OPTIMIZED_OUT));
+			  && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
+			      || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+			      || theclass == LOC_OPTIMIZED_OUT));
 }
 
 /* Implementation of gdb.Symbol.needs_frame -> Boolean.
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 7a2fd1a..143e5fd 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -846,7 +846,7 @@ mips_send_packet (const char *s, int get_ack)
   /* unsigned */ int len;
   unsigned char *packet;
   int cksum;
-  int try;
+  int attempt;
 
   len = strlen (s);
   if (len > DATA_MAXLEN)
@@ -873,7 +873,7 @@ mips_send_packet (const char *s, int get_ack)
   /* We can only have one outstanding data packet, so we just wait for
      the acknowledgement here.  Keep retransmitting the packet until
      we get one, or until we've tried too many times.  */
-  for (try = 0; try < mips_send_retries; try++)
+  for (attempt = 0; attempt < mips_send_retries; attempt++)
     {
       int garbage;
       int ch;
diff --git a/gdb/remote.c b/gdb/remote.c
index 3980aad..48dfc5b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1659,15 +1659,15 @@ demand_private_info (ptid_t ptid)
 
   gdb_assert (info);
 
-  if (!info->private)
+  if (!info->priv)
     {
-      info->private = xmalloc (sizeof (*(info->private)));
+      info->priv = xmalloc (sizeof (*(info->priv)));
       info->private_dtor = free_private_thread_info;
-      info->private->core = -1;
-      info->private->extra = 0;
+      info->priv->core = -1;
+      info->priv->extra = 0;
     }
 
-  return info->private;
+  return info->priv;
 }
 
 /* Call this function as a result of
@@ -2910,8 +2910,8 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
     {
       struct thread_info *info = find_thread_ptid (tp->ptid);
 
-      if (info && info->private)
-	return info->private->extra;
+      if (info && info->priv)
+	return info->priv->extra;
       else
 	return NULL;
     }
@@ -11157,8 +11157,8 @@ remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
 {
   struct thread_info *info = find_thread_ptid (ptid);
 
-  if (info && info->private)
-    return info->private->core;
+  if (info && info->priv)
+    return info->priv->core;
   return -1;
 }
 
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index d742f82..f96841f 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -271,7 +271,7 @@ darwin_current_sos (void)
       char *file_path;
       int errcode;
       struct darwin_so_list *dnew;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
 
       /* Read image info from inferior.  */
@@ -302,22 +302,22 @@ darwin_current_sos (void)
 
       /* Create and fill the new so_list element.  */
       dnew = XCNEW (struct darwin_so_list);
-      new = &dnew->sl;
+      newobj = &dnew->sl;
       old_chain = make_cleanup (xfree, dnew);
 
-      new->lm_info = &dnew->li;
+      newobj->lm_info = &dnew->li;
 
-      strncpy (new->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
       xfree (file_path);
-      new->lm_info->lm_addr = load_addr;
+      newobj->lm_info->lm_addr = load_addr;
 
       if (head == NULL)
-	head = new;
+	head = newobj;
       else
-	tail->next = new;
-      tail = new;
+	tail->next = newobj;
+      tail = newobj;
 
       discard_cleanups (old_chain);
     }
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index cca6892..3b0bf48 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -119,7 +119,7 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
   struct regcache *regcache = get_thread_regcache (ptid);
   CORE_ADDR pc = regcache_read_pc (regcache);
   struct address_space *aspace = get_regcache_aspace (regcache);
-  ia64_insn t0, t1, slot[3], template, insn;
+  ia64_insn t0, t1, slot[3], templ, insn;
   int slotnum;
   bfd_byte bundle[16];
 
@@ -139,12 +139,12 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
   /* bundles are always in little-endian byte order */
   t0 = bfd_getl64 (bundle);
   t1 = bfd_getl64 (bundle + 8);
-  template = (t0 >> 1) & 0xf;
+  templ = (t0 >> 1) & 0xf;
   slot[0] = (t0 >>  5) & 0x1ffffffffffLL;
   slot[1] = ((t0 >> 46) & 0x3ffff) | ((t1 & 0x7fffff) << 18);
   slot[2] = (t1 >> 23) & 0x1ffffffffffLL;
 
-  if (template == 2 && slotnum == 1)
+  if (templ == 2 && slotnum == 1)
     {
       /* skip L slot in MLI template: */
       slotnum = 2;
diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index 64c3d7f..b7214f1 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -426,7 +426,7 @@ pa64_current_sos (void)
     {
       struct load_module_desc dll_desc;
       char *dll_path;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
 
       if (dll_index == 0)
@@ -443,22 +443,22 @@ pa64_current_sos (void)
 			    pa64_target_read_memory,
 			    0, dld_cache.load_map);
 
-      new = (struct so_list *) xmalloc (sizeof (struct so_list));
-      memset (new, 0, sizeof (struct so_list));
-      new->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
-      memset (new->lm_info, 0, sizeof (struct lm_info));
+      newobj = (struct so_list *) xmalloc (sizeof (struct so_list));
+      memset (newobj, 0, sizeof (struct so_list));
+      newobj->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
+      memset (newobj->lm_info, 0, sizeof (struct lm_info));
 
-      strncpy (new->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
 
-      memcpy (&new->lm_info->desc, &dll_desc, sizeof (dll_desc));
+      memcpy (&newobj->lm_info->desc, &dll_desc, sizeof (dll_desc));
 
 #ifdef SOLIB_PA64_DBG
       {
-        struct load_module_desc *d = &new->lm_info->desc;
+        struct load_module_desc *d = &newobj->lm_info->desc;
 
-	printf ("\n+ library \"%s\" is described at index %d\n", new->so_name, 
+	printf ("\n+ library \"%s\" is described at index %d\n", newobj->so_name, 
 		dll_index);
 	printf ("    text_base = %s\n", hex_string (d->text_base));
 	printf ("    text_size = %s\n", hex_string (d->text_size));
@@ -475,9 +475,9 @@ pa64_current_sos (void)
 #endif
 
       /* Link the new object onto the list.  */
-      new->next = NULL;
-      *link_ptr = new;
-      link_ptr = &new->next;
+      newobj->next = NULL;
+      *link_ptr = newobj;
+      link_ptr = &newobj->next;
     }
 
   return head;
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index deb1d17..27e39a7 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -585,18 +585,18 @@ som_current_sos (void)
     {
       char *namebuf;
       CORE_ADDR addr;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
       int errcode;
       struct dld_list dbuf;
       gdb_byte tsdbuf[4];
 
-      new = (struct so_list *) xmalloc (sizeof (struct so_list));
-      old_chain = make_cleanup (xfree, new);
+      newobj = (struct so_list *) xmalloc (sizeof (struct so_list));
+      old_chain = make_cleanup (xfree, newobj);
 
-      memset (new, 0, sizeof (*new));
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      make_cleanup (xfree, new->lm_info);
+      memset (newobj, 0, sizeof (*newobj));
+      newobj->lm_info = xmalloc (sizeof (struct lm_info));
+      make_cleanup (xfree, newobj->lm_info);
 
       read_memory (lm, (gdb_byte *)&dbuf, sizeof (struct dld_list));
 
@@ -608,15 +608,15 @@ som_current_sos (void)
 		 safe_strerror (errcode));
       else
 	{
-	  strncpy (new->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
-	  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+	  strncpy (newobj->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
+	  newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
 	  xfree (namebuf);
-	  strcpy (new->so_original_name, new->so_name);
+	  strcpy (newobj->so_original_name, newobj->so_name);
 	}
 
-	if (new->so_name[0] && !match_main (new->so_name))
+	if (newobj->so_name[0] && !match_main (newobj->so_name))
 	  {
-	    struct lm_info *lmi = new->lm_info;
+	    struct lm_info *lmi = newobj->lm_info;
 	    unsigned int tmp;
 
 	    lmi->lm_addr = lm;
@@ -642,41 +642,41 @@ som_current_sos (void)
 	      = extract_unsigned_integer (tsdbuf, 4, byte_order);
 
 #ifdef SOLIB_SOM_DBG
-	    printf ("\n+ library \"%s\" is described at %s\n", new->so_name,
+	    printf ("\n+ library \"%s\" is described at %s\n", newobj->so_name,
 	    	    paddress (target_gdbarch (), lm));
-	    printf ("  'version' is %d\n", new->lm_info->struct_version);
-	    printf ("  'bind_mode' is %d\n", new->lm_info->bind_mode);
+	    printf ("  'version' is %d\n", newobj->lm_info->struct_version);
+	    printf ("  'bind_mode' is %d\n", newobj->lm_info->bind_mode);
 	    printf ("  'library_version' is %d\n", 
-	    	    new->lm_info->library_version);
+		    newobj->lm_info->library_version);
 	    printf ("  'text_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->text_addr));
 	    printf ("  'text_link_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_link_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->text_link_addr));
 	    printf ("  'text_end' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_end));
+		    paddress (target_gdbarch (), newobj->lm_info->text_end));
 	    printf ("  'data_start' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->data_start));
+		    paddress (target_gdbarch (), newobj->lm_info->data_start));
 	    printf ("  'bss_start' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->bss_start));
+		    paddress (target_gdbarch (), newobj->lm_info->bss_start));
 	    printf ("  'data_end' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->data_end));
+		    paddress (target_gdbarch (), newobj->lm_info->data_end));
 	    printf ("  'got_value' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->got_value));
+		    paddress (target_gdbarch (), newobj->lm_info->got_value));
 	    printf ("  'tsd_start_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->tsd_start_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->tsd_start_addr));
 #endif
 
-	    new->addr_low = lmi->text_addr;
-	    new->addr_high = lmi->text_end;
+	    newobj->addr_low = lmi->text_addr;
+	    newobj->addr_high = lmi->text_end;
 
 	    /* Link the new object onto the list.  */
-	    new->next = NULL;
-	    *link_ptr = new;
-	    link_ptr = &new->next;
+	    newobj->next = NULL;
+	    *link_ptr = newobj;
+	    link_ptr = &newobj->next;
 	  }
  	else
 	  {
-	    free_so (new);
+	    free_so (newobj);
 	  }
 
       lm = EXTRACT (next);
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 6145112..3c8cd1a 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -119,19 +119,19 @@ append_ocl_sos (struct so_list **link_ptr)
 					      byte_order);
 	      if (data != 0x0)
 		{
-		  struct so_list *new;
+		  struct so_list *newobj;
 
 		  /* Allocate so_list structure.  */
-		  new = XCNEW (struct so_list);
+		  newobj = XCNEW (struct so_list);
 
 		  /* Encode FD and object ID in path name.  */
-		  xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
+		  xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>",
 			     hex_string (data),
 			     SPUADDR_SPU (*ocl_program_addr_base));
-		  strcpy (new->so_original_name, new->so_name);
+		  strcpy (newobj->so_original_name, newobj->so_name);
 
-		  *link_ptr = new;
-		  link_ptr = &new->next;
+		  *link_ptr = newobj;
+		  link_ptr = &newobj->next;
 		}
 	    }
 	  if (ex.reason < 0)
@@ -195,7 +195,7 @@ spu_current_sos (void)
   for (i = 0; i < size; i += 4)
     {
       int fd = extract_unsigned_integer (buf + i, 4, byte_order);
-      struct so_list *new;
+      struct so_list *newobj;
 
       unsigned long long addr;
       char annex[32], id[100];
@@ -214,16 +214,16 @@ spu_current_sos (void)
 	continue;
 
       /* Allocate so_list structure.  */
-      new = XCNEW (struct so_list);
+      newobj = XCNEW (struct so_list);
 
       /* Encode FD and object ID in path name.  Choose the name so as not
 	 to conflict with any (normal) SVR4 library path name.  */
-      xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
+      xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>",
 		 hex_string (addr), fd);
-      strcpy (new->so_original_name, new->so_name);
+      strcpy (newobj->so_original_name, newobj->so_name);
 
-      *link_ptr = new;
-      link_ptr = &new->next;
+      *link_ptr = newobj;
+      link_ptr = &newobj->next;
     }
 
   /* Append OpenCL sos.  */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 849c452..2143021 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -932,7 +932,7 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 {
   struct svr4_info *info;
   CORE_ADDR ldsomap;
-  struct so_list *new;
+  struct so_list *newobj;
   struct cleanup *old_chain;
   CORE_ADDR name_lm;
 
@@ -947,11 +947,11 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
   if (!ldsomap)
     return 0;
 
-  new = XCNEW (struct so_list);
-  old_chain = make_cleanup (xfree, new);
-  new->lm_info = lm_info_read (ldsomap);
-  make_cleanup (xfree, new->lm_info);
-  name_lm = new->lm_info ? new->lm_info->l_name : 0;
+  newobj = XCNEW (struct so_list);
+  old_chain = make_cleanup (xfree, newobj);
+  newobj->lm_info = lm_info_read (ldsomap);
+  make_cleanup (xfree, newobj->lm_info);
+  name_lm = newobj->lm_info ? newobj->lm_info->l_name : 0;
   do_cleanups (old_chain);
 
   return (name_lm >= vaddr && name_lm < vaddr + size);
@@ -1087,17 +1087,17 @@ svr4_copy_library_list (struct so_list *src)
 
   while (src != NULL)
     {
-      struct so_list *new;
+      struct so_list *newobj;
 
-      new = xmalloc (sizeof (struct so_list));
-      memcpy (new, src, sizeof (struct so_list));
+      newobj = xmalloc (sizeof (struct so_list));
+      memcpy (newobj, src, sizeof (struct so_list));
 
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      memcpy (new->lm_info, src->lm_info, sizeof (struct lm_info));
+      newobj->lm_info = xmalloc (sizeof (struct lm_info));
+      memcpy (newobj->lm_info, src->lm_info, sizeof (struct lm_info));
 
-      new->next = NULL;
-      *link = new;
-      link = &new->next;
+      newobj->next = NULL;
+      *link = newobj;
+      link = &newobj->next;
 
       src = src->next;
     }
@@ -1272,24 +1272,24 @@ static struct so_list *
 svr4_default_sos (void)
 {
   struct svr4_info *info = get_svr4_info ();
-  struct so_list *new;
+  struct so_list *newobj;
 
   if (!info->debug_loader_offset_p)
     return NULL;
 
-  new = XCNEW (struct so_list);
+  newobj = XCNEW (struct so_list);
 
-  new->lm_info = xzalloc (sizeof (struct lm_info));
+  newobj->lm_info = xzalloc (sizeof (struct lm_info));
 
   /* Nothing will ever check the other fields if we set l_addr_p.  */
-  new->lm_info->l_addr = info->debug_loader_offset;
-  new->lm_info->l_addr_p = 1;
+  newobj->lm_info->l_addr = info->debug_loader_offset;
+  newobj->lm_info->l_addr_p = 1;
 
-  strncpy (new->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
-  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-  strcpy (new->so_original_name, new->so_name);
+  strncpy (newobj->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
+  newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+  strcpy (newobj->so_original_name, newobj->so_name);
 
-  return new;
+  return newobj;
 }
 
 /* Read the whole inferior libraries chain starting at address LM.
@@ -1309,28 +1309,28 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 
   for (; lm != 0; prev_lm = lm, lm = next_lm)
     {
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
       int errcode;
       char *buffer;
 
-      new = XCNEW (struct so_list);
-      old_chain = make_cleanup_free_so (new);
+      newobj = XCNEW (struct so_list);
+      old_chain = make_cleanup_free_so (newobj);
 
-      new->lm_info = lm_info_read (lm);
-      if (new->lm_info == NULL)
+      newobj->lm_info = lm_info_read (lm);
+      if (newobj->lm_info == NULL)
 	{
 	  do_cleanups (old_chain);
 	  return 0;
 	}
 
-      next_lm = new->lm_info->l_next;
+      next_lm = newobj->lm_info->l_next;
 
-      if (new->lm_info->l_prev != prev_lm)
+      if (newobj->lm_info->l_prev != prev_lm)
 	{
 	  warning (_("Corrupted shared library list: %s != %s"),
 		   paddress (target_gdbarch (), prev_lm),
-		   paddress (target_gdbarch (), new->lm_info->l_prev));
+		   paddress (target_gdbarch (), newobj->lm_info->l_prev));
 	  do_cleanups (old_chain);
 	  return 0;
 	}
@@ -1340,18 +1340,18 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
          SVR4, it has no name.  For others (Solaris 2.3 for example), it
          does have a name, so we can no longer use a missing name to
          decide when to ignore it.  */
-      if (ignore_first && new->lm_info->l_prev == 0)
+      if (ignore_first && newobj->lm_info->l_prev == 0)
 	{
 	  struct svr4_info *info = get_svr4_info ();
 
-	  first_l_name = new->lm_info->l_name;
-	  info->main_lm_addr = new->lm_info->lm_addr;
+	  first_l_name = newobj->lm_info->l_name;
+	  info->main_lm_addr = newobj->lm_info->lm_addr;
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
       /* Extract this shared object's name.  */
-      target_read_string (new->lm_info->l_name, &buffer,
+      target_read_string (newobj->lm_info->l_name, &buffer,
 			  SO_NAME_MAX_PATH_SIZE - 1, &errcode);
       if (errcode != 0)
 	{
@@ -1359,30 +1359,30 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 	     inferior executable, then this is not a normal shared
 	     object, but (most likely) a vDSO.  In this case, silently
 	     skip it; otherwise emit a warning. */
-	  if (first_l_name == 0 || new->lm_info->l_name != first_l_name)
+	  if (first_l_name == 0 || newobj->lm_info->l_name != first_l_name)
 	    warning (_("Can't read pathname for load map: %s."),
 		     safe_strerror (errcode));
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
-      strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
       xfree (buffer);
 
       /* If this entry has no name, or its name matches the name
 	 for the main executable, don't include it in the list.  */
-      if (! new->so_name[0] || match_main (new->so_name))
+      if (! newobj->so_name[0] || match_main (newobj->so_name))
 	{
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
       discard_cleanups (old_chain);
-      new->next = 0;
-      **link_ptr_ptr = new;
-      *link_ptr_ptr = &new->next;
+      newobj->next = 0;
+      **link_ptr_ptr = newobj;
+      *link_ptr_ptr = &newobj->next;
     }
 
   return 1;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 2a160c5..a0e6388 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1807,10 +1807,10 @@ again:
         while (**pp && **pp != '#')
           {
             struct type *arg_type = read_type (pp, objfile);
-            struct type_list *new = alloca (sizeof (*new));
-            new->type = arg_type;
-            new->next = arg_types;
-            arg_types = new;
+            struct type_list *newobj = alloca (sizeof (*newobj));
+            newobj->type = arg_type;
+            newobj->next = arg_types;
+            arg_types = newobj;
             num_args++;
           }
         if (**pp == '#')
@@ -2999,7 +2999,7 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
 		    struct objfile *objfile)
 {
   char *p;
-  struct nextfield *new;
+  struct nextfield *newobj;
 
   /* We better set p right now, in case there are no fields at all...    */
 
@@ -3015,11 +3015,11 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
     {
       STABS_CONTINUE (pp, objfile);
       /* Get space to record the next field's data.  */
-      new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (xfree, new);
-      memset (new, 0, sizeof (struct nextfield));
-      new->next = fip->list;
-      fip->list = new;
+      newobj = (struct nextfield *) xmalloc (sizeof (struct nextfield));
+      make_cleanup (xfree, newobj);
+      memset (newobj, 0, sizeof (struct nextfield));
+      newobj->next = fip->list;
+      fip->list = newobj;
 
       /* Get the field name.  */
       p = *pp;
@@ -3097,7 +3097,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 		  struct objfile *objfile)
 {
   int i;
-  struct nextfield *new;
+  struct nextfield *newobj;
 
   if (**pp != '!')
     {
@@ -3137,12 +3137,12 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
-      new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (xfree, new);
-      memset (new, 0, sizeof (struct nextfield));
-      new->next = fip->list;
-      fip->list = new;
-      FIELD_BITSIZE (new->field) = 0;	/* This should be an unpacked
+      newobj = (struct nextfield *) xmalloc (sizeof (struct nextfield));
+      make_cleanup (xfree, newobj);
+      memset (newobj, 0, sizeof (struct nextfield));
+      newobj->next = fip->list;
+      fip->list = newobj;
+      FIELD_BITSIZE (newobj->field) = 0;	/* This should be an unpacked
 					   field!  */
 
       STABS_CONTINUE (pp, objfile);
@@ -3164,8 +3164,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	}
       ++(*pp);
 
-      new->visibility = *(*pp)++;
-      switch (new->visibility)
+      newobj->visibility = *(*pp)++;
+      switch (newobj->visibility)
 	{
 	case VISIBILITY_PRIVATE:
 	case VISIBILITY_PROTECTED:
@@ -3177,8 +3177,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	  {
 	    complaint (&symfile_complaints,
 		       _("Unknown visibility `%c' for baseclass"),
-		       new->visibility);
-	    new->visibility = VISIBILITY_PUBLIC;
+		       newobj->visibility);
+	    newobj->visibility = VISIBILITY_PUBLIC;
 	  }
 	}
 
@@ -3189,7 +3189,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	   corresponding to this baseclass.  Always zero in the absence of
 	   multiple inheritance.  */
 
-	SET_FIELD_BITPOS (new->field, read_huge_number (pp, ',', &nbits, 0));
+	SET_FIELD_BITPOS (newobj->field, read_huge_number (pp, ',', &nbits, 0));
 	if (nbits != 0)
 	  return 0;
       }
@@ -3198,8 +3198,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
          base class.  Read it, and remember it's type name as this
          field's name.  */
 
-      new->field.type = read_type (pp, objfile);
-      new->field.name = type_name_no_tag (new->field.type);
+      newobj->field.type = read_type (pp, objfile);
+      newobj->field.name = type_name_no_tag (newobj->field.type);
 
       /* Skip trailing ';' and bump count of number of fields seen.  */
       if (**pp == ';')
@@ -4350,7 +4350,7 @@ common_block_end (struct objfile *objfile)
      symbol for the common block name for later fixup.  */
   int i;
   struct symbol *sym;
-  struct pending *new = 0;
+  struct pending *newobj = 0;
   struct pending *next;
   int j;
 
@@ -4373,7 +4373,7 @@ common_block_end (struct objfile *objfile)
        next = next->next)
     {
       for (j = 0; j < next->nsyms; j++)
-	add_symbol_to_list (next->symbol[j], &new);
+	add_symbol_to_list (next->symbol[j], &newobj);
     }
 
   /* Copy however much of COMMON_BLOCK we need.  If COMMON_BLOCK is
@@ -4382,9 +4382,9 @@ common_block_end (struct objfile *objfile)
 
   if (common_block != NULL)
     for (j = common_block_i; j < common_block->nsyms; j++)
-      add_symbol_to_list (common_block->symbol[j], &new);
+      add_symbol_to_list (common_block->symbol[j], &newobj);
 
-  SYMBOL_TYPE (sym) = (struct type *) new;
+  SYMBOL_TYPE (sym) = (struct type *) newobj;
 
   /* Should we be putting local_symbols back to what it was?
      Does it matter?  */
@@ -4554,9 +4554,9 @@ cleanup_undefined_types_1 (void)
 		struct pending *ppt;
 		int i;
 		/* Name of the type, without "struct" or "union".  */
-		const char *typename = TYPE_TAG_NAME (*type);
+		const char *type_name = TYPE_TAG_NAME (*type);
 
-		if (typename == NULL)
+		if (type_name == NULL)
 		  {
 		    complaint (&symfile_complaints, _("need a type name"));
 		    break;
@@ -4574,7 +4574,7 @@ cleanup_undefined_types_1 (void)
 			    && (TYPE_INSTANCE_FLAGS (*type) ==
 				TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
 			    && strcmp (SYMBOL_LINKAGE_NAME (sym),
-				       typename) == 0)
+				       type_name) == 0)
                           replace_type (*type, SYMBOL_TYPE (sym));
 		      }
 		  }
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index e0600a9..57b2d35 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -249,7 +249,7 @@ debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 debug_qf_map_matching_symbols (struct objfile *objfile,
-			       const char *name, domain_enum namespace,
+			       const char *name, domain_enum the_namespace,
 			       int global,
 			       int (*callback) (struct block *,
 						struct symbol *, void *),
@@ -263,14 +263,14 @@ debug_qf_map_matching_symbols (struct objfile *objfile,
   fprintf_filtered (gdb_stdlog,
 		    "qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s, %s, %s)\n",
 		    objfile_debug_name (objfile), name,
-		    domain_name (namespace), global,
+		    domain_name (the_namespace), global,
 		    host_address_to_string (callback),
 		    host_address_to_string (data),
 		    host_address_to_string (match),
 		    host_address_to_string (ordered_compare));
 
   debug_data->real_sf->qf->map_matching_symbols (objfile, name,
-						 namespace, global,
+						 the_namespace, global,
 						 callback, data,
 						 match,
 						 ordered_compare);
diff --git a/gdb/symfile.h b/gdb/symfile.h
index a22ee04..c23e7c8 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -256,7 +256,7 @@ struct quick_symbol_functions
      non-zero to indicate that the scan should be terminated.  */
 
   void (*map_matching_symbols) (struct objfile *,
-				const char *name, domain_enum namespace,
+				const char *name, domain_enum the_namespace,
 				int global,
 				int (*callback) (struct block *,
 						 struct symbol *, void *),
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 84e2680..5302c0e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5028,43 +5028,43 @@ completion_list_add_name (const char *symname,
      of matches.  Note that the name is moved to freshly malloc'd space.  */
 
   {
-    char *new;
+    char *newobj;
     enum maybe_add_completion_enum add_status;
 
     if (word == sym_text)
       {
-	new = xmalloc (strlen (symname) + 5);
-	strcpy (new, symname);
+	newobj = xmalloc (strlen (symname) + 5);
+	strcpy (newobj, symname);
       }
     else if (word > sym_text)
       {
 	/* Return some portion of symname.  */
-	new = xmalloc (strlen (symname) + 5);
-	strcpy (new, symname + (word - sym_text));
+	newobj = xmalloc (strlen (symname) + 5);
+	strcpy (newobj, symname + (word - sym_text));
       }
     else
       {
 	/* Return some of SYM_TEXT plus symname.  */
-	new = xmalloc (strlen (symname) + (sym_text - word) + 5);
-	strncpy (new, word, sym_text - word);
-	new[sym_text - word] = '\0';
-	strcat (new, symname);
+	newobj = xmalloc (strlen (symname) + (sym_text - word) + 5);
+	strncpy (newobj, word, sym_text - word);
+	newobj[sym_text - word] = '\0';
+	strcat (newobj, symname);
       }
 
-    add_status = maybe_add_completion (completion_tracker, new);
+    add_status = maybe_add_completion (completion_tracker, newobj);
 
     switch (add_status)
       {
       case MAYBE_ADD_COMPLETION_OK:
-	VEC_safe_push (char_ptr, return_val, new);
+	VEC_safe_push (char_ptr, return_val, newobj);
 	break;
       case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	VEC_safe_push (char_ptr, return_val, new);
+	VEC_safe_push (char_ptr, return_val, newobj);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_DUPLICATE:
-	xfree (new);
+	xfree (newobj);
 	break;
       }
   }
@@ -5664,30 +5664,30 @@ static void
 add_filename_to_list (const char *fname, const char *text, const char *word,
 		      VEC (char_ptr) **list)
 {
-  char *new;
+  char *newobj;
   size_t fnlen = strlen (fname);
 
   if (word == text)
     {
       /* Return exactly fname.  */
-      new = xmalloc (fnlen + 5);
-      strcpy (new, fname);
+      newobj = xmalloc (fnlen + 5);
+      strcpy (newobj, fname);
     }
   else if (word > text)
     {
       /* Return some portion of fname.  */
-      new = xmalloc (fnlen + 5);
-      strcpy (new, fname + (word - text));
+      newobj = xmalloc (fnlen + 5);
+      strcpy (newobj, fname + (word - text));
     }
   else
     {
       /* Return some of TEXT plus fname.  */
-      new = xmalloc (fnlen + (text - word) + 5);
-      strncpy (new, word, text - word);
-      new[text - word] = '\0';
-      strcat (new, fname);
+      newobj = xmalloc (fnlen + (text - word) + 5);
+      strncpy (newobj, word, text - word);
+      newobj[text - word] = '\0';
+      strcat (newobj, fname);
     }
-  VEC_safe_push (char_ptr, *list, new);
+  VEC_safe_push (char_ptr, *list, newobj);
 }
 
 static int
diff --git a/gdb/thread.c b/gdb/thread.c
index a2a5a9b..01eb2ba 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -182,12 +182,12 @@ clear_thread_inferior_resources (struct thread_info *tp)
 static void
 free_thread (struct thread_info *tp)
 {
-  if (tp->private)
+  if (tp->priv)
     {
       if (tp->private_dtor)
-	tp->private_dtor (tp->private);
+	tp->private_dtor (tp->priv);
       else
-	xfree (tp->private);
+	xfree (tp->priv);
     }
 
   xfree (tp->name);
@@ -288,11 +288,11 @@ add_thread_silent (ptid_t ptid)
 }
 
 struct thread_info *
-add_thread_with_info (ptid_t ptid, struct private_thread_info *private)
+add_thread_with_info (ptid_t ptid, struct private_thread_info *priv)
 {
   struct thread_info *result = add_thread_silent (ptid);
 
-  result->private = private;
+  result->priv = priv;
 
   if (print_thread_events)
     printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
diff --git a/gdb/top.c b/gdb/top.c
index 8242e12..55c6896 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -462,7 +462,7 @@ execute_command (char *p, int from_tty)
 	deprecated_cmd_warning (line);
 
       /* c->user_commands would be NULL in the case of a python command.  */
-      if (c->class == class_user && c->user_commands)
+      if (c->theclass == class_user && c->user_commands)
 	execute_user_command (c, arg);
       else if (c->type == set_cmd)
 	do_set_command (arg, from_tty, c);
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 602bddc..5271ee8 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -253,7 +253,7 @@ tui_check_data_values (struct frame_info *frame)
 	    has changed (data_element_ptr, frame, &new_value)
 	    {
 	      data_element_ptr->value = new_value;
-	      update the display with the new value, hiliting it.
+	      update the display with the newobj value, hiliting it.
 	    }
 #endif
 	}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index d39e2e3..234be7f 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -335,9 +335,9 @@ find_typedef_in_hash (const struct type_print_options *flags, struct type *t)
    NEW is the new name for a type TYPE.  */
 
 void
-typedef_print (struct type *type, struct symbol *new, struct ui_file *stream)
+typedef_print (struct type *type, struct symbol *newobj, struct ui_file *stream)
 {
-  LA_PRINT_TYPEDEF (type, new, stream);
+  LA_PRINT_TYPEDEF (type, newobj, stream);
 }
 
 /* The default way to print a typedef.  */
@@ -499,9 +499,9 @@ whatis_command (char *exp, int from_tty)
 /* TYPENAME is either the name of a type, or an expression.  */
 
 static void
-ptype_command (char *typename, int from_tty)
+ptype_command (char *type_name, int from_tty)
 {
-  whatis_exp (typename, 1);
+  whatis_exp (type_name, 1);
 }
 
 /* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
@@ -592,16 +592,16 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
    and whatis_command().  */
 
 void
-maintenance_print_type (char *typename, int from_tty)
+maintenance_print_type (char *type_name, int from_tty)
 {
   struct value *val;
   struct type *type;
   struct cleanup *old_chain;
   struct expression *expr;
 
-  if (typename != NULL)
+  if (type_name != NULL)
     {
-      expr = parse_expression (typename);
+      expr = parse_expression (type_name);
       old_chain = make_cleanup (free_current_contents, &expr);
       if (expr->elts[0].opcode == OP_TYPE)
 	{
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 24155f9..6673574 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -77,7 +77,7 @@ extern void set_ui_file_put (struct ui_file *stream, ui_file_put_ftype *put);
 
 typedef void (ui_file_delete_ftype) (struct ui_file * stream);
 extern void set_ui_file_data (struct ui_file *stream, void *data,
-			      ui_file_delete_ftype *delete);
+			      ui_file_delete_ftype *to_delete);
 
 typedef int (ui_file_fseek_ftype) (struct ui_file *stream, long offset,
 				   int whence);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index f33515c..fb9ec60 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -284,14 +284,14 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
    situations or combinations thereof.  */
 
 static struct value *
-value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
+value_user_defined_cpp_op (struct value **args, int nargs, char *oper,
                            int *static_memfuncp, enum noside noside)
 {
 
   struct symbol *symp = NULL;
   struct value *valp = NULL;
 
-  find_overload_match (args, nargs, operator, BOTH /* could be method */,
+  find_overload_match (args, nargs, oper, BOTH /* could be method */,
                        &args[0] /* objp */,
                        NULL /* pass NULL symbol since symbol is unknown */,
                        &valp, &symp, static_memfuncp, 0, noside);
@@ -308,7 +308,7 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
       return value_of_variable (symp, 0);
     }
 
-  error (_("Could not find %s."), operator);
+  error (_("Could not find %s."), oper);
 }
 
 /* Lookup user defined operator NAME.  Return a value representing the
diff --git a/gdb/value.c b/gdb/value.c
index 9445f25..06da269 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1790,13 +1790,13 @@ record_latest_value (struct value *val)
   i = value_history_count % VALUE_HISTORY_CHUNK;
   if (i == 0)
     {
-      struct value_history_chunk *new
+      struct value_history_chunk *newobj
 	= (struct value_history_chunk *)
 
       xmalloc (sizeof (struct value_history_chunk));
-      memset (new->values, 0, sizeof new->values);
-      new->next = value_history_chain;
-      value_history_chain = new;
+      memset (newobj->values, 0, sizeof newobj->values);
+      newobj->next = value_history_chain;
+      value_history_chain = newobj;
     }
 
   value_history_chain->values[i] = val;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 268ba3c..2d84d11 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -702,7 +702,7 @@ static void
 install_dynamic_child (struct varobj *var,
 		       VEC (varobj_p) **changed,
 		       VEC (varobj_p) **type_changed,
-		       VEC (varobj_p) **new,
+		       VEC (varobj_p) **newobj,
 		       VEC (varobj_p) **unchanged,
 		       int *cchanged,
 		       int index,
@@ -713,9 +713,9 @@ install_dynamic_child (struct varobj *var,
       /* There's no child yet.  */
       struct varobj *child = varobj_add_child (var, item);
 
-      if (new)
+      if (newobj)
 	{
-	  VEC_safe_push (varobj_p, *new, child);
+	  VEC_safe_push (varobj_p, *newobj, child);
 	  *cchanged = 1;
 	}
     }
@@ -790,7 +790,7 @@ static int
 update_dynamic_varobj_children (struct varobj *var,
 				VEC (varobj_p) **changed,
 				VEC (varobj_p) **type_changed,
-				VEC (varobj_p) **new,
+				VEC (varobj_p) **newobj,
 				VEC (varobj_p) **unchanged,
 				int *cchanged,
 				int update_children,
@@ -851,7 +851,7 @@ update_dynamic_varobj_children (struct varobj *var,
 
 	  install_dynamic_child (var, can_mention ? changed : NULL,
 				 can_mention ? type_changed : NULL,
-				 can_mention ? new : NULL,
+				 can_mention ? newobj : NULL,
 				 can_mention ? unchanged : NULL,
 				 can_mention ? cchanged : NULL, i,
 				 item);
@@ -1621,11 +1621,11 @@ varobj_value_has_mutated (const struct varobj *var, struct value *new_value,
    to point to the new varobj.  */
 
 VEC(varobj_update_result) *
-varobj_update (struct varobj **varp, int explicit)
+varobj_update (struct varobj **varp, int is_explicit)
 {
   int type_changed = 0;
   int i;
-  struct value *new;
+  struct value *newobj;
   VEC (varobj_update_result) *stack = NULL;
   VEC (varobj_update_result) *result = NULL;
 
@@ -1634,7 +1634,7 @@ varobj_update (struct varobj **varp, int explicit)
      changing type.  One use case for frozen varobjs is
      retaining previously evaluated expressions, and we don't
      want them to be reevaluated at all.  */
-  if (!explicit && (*varp)->frozen)
+  if (!is_explicit && (*varp)->frozen)
     return result;
 
   if (!(*varp)->root->is_valid)
@@ -1659,15 +1659,15 @@ varobj_update (struct varobj **varp, int explicit)
 	 the frame in which a local existed.  We are letting the 
 	 value_of_root variable dispose of the varobj if the type
 	 has changed.  */
-      new = value_of_root (varp, &type_changed);
-      if (update_type_if_necessary(*varp, new))
+      newobj = value_of_root (varp, &type_changed);
+      if (update_type_if_necessary(*varp, newobj))
 	  type_changed = 1;
       r.varobj = *varp;
       r.type_changed = type_changed;
-      if (install_new_value ((*varp), new, type_changed))
+      if (install_new_value ((*varp), newobj, type_changed))
 	r.changed = 1;
       
-      if (new == NULL)
+      if (newobj == NULL)
 	r.status = VAROBJ_NOT_IN_SCOPE;
       r.value_installed = 1;
 
@@ -1702,15 +1702,15 @@ varobj_update (struct varobj **varp, int explicit)
 	{
 	  struct type *new_type;
 
-	  new = value_of_child (v->parent, v->index);
-	  if (update_type_if_necessary(v, new))
+	  newobj = value_of_child (v->parent, v->index);
+	  if (update_type_if_necessary(v, newobj))
 	    r.type_changed = 1;
-	  if (new)
-	    new_type = value_type (new);
+	  if (newobj)
+	    new_type = value_type (newobj);
 	  else
 	    new_type = v->root->lang_ops->type_of_child (v->parent, v->index);
 
-	  if (varobj_value_has_mutated (v, new, new_type))
+	  if (varobj_value_has_mutated (v, newobj, new_type))
 	    {
 	      /* The children are no longer valid; delete them now.
 	         Report the fact that its type changed as well.  */
@@ -1722,7 +1722,7 @@ varobj_update (struct varobj **varp, int explicit)
 	      r.type_changed = 1;
 	    }
 
-	  if (install_new_value (v, new, r.type_changed))
+	  if (install_new_value (v, newobj, r.type_changed))
 	    {
 	      r.changed = 1;
 	      v->updated = 0;
@@ -1734,7 +1734,7 @@ varobj_update (struct varobj **varp, int explicit)
       if (varobj_is_dynamic_p (v))
 	{
 	  VEC (varobj_p) *changed = 0, *type_changed = 0, *unchanged = 0;
-	  VEC (varobj_p) *new = 0;
+	  VEC (varobj_p) *newobj = 0;
 	  int i, children_changed = 0;
 
 	  if (v->frozen)
@@ -1766,14 +1766,14 @@ varobj_update (struct varobj **varp, int explicit)
 
 	  /* If update_dynamic_varobj_children returns 0, then we have
 	     a non-conforming pretty-printer, so we skip it.  */
-	  if (update_dynamic_varobj_children (v, &changed, &type_changed, &new,
+	  if (update_dynamic_varobj_children (v, &changed, &type_changed, &newobj,
 					      &unchanged, &children_changed, 1,
 					      v->from, v->to))
 	    {
-	      if (children_changed || new)
+	      if (children_changed || newobj)
 		{
 		  r.children_changed = 1;
-		  r.new = new;
+		  r.newobj = newobj;
 		}
 	      /* Push in reverse order so that the first child is
 		 popped from the work stack first, and so will be
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 30c31ef..1d3db01 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -75,7 +75,7 @@ typedef struct varobj_update_result_t
      It lists the new children (which must necessarily come at the end
      of the child list) added during an update.  The caller is
      responsible for freeing this vector.  */
-  VEC (varobj_p) *new;
+  VEC (varobj_p) *newobj;
 } varobj_update_result;
 
 DEF_VEC_O (varobj_update_result);
@@ -303,7 +303,7 @@ extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
 			      void *data);
 
 extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, 
-						 int explicit);
+						 int is_explicit);
 
 extern void varobj_invalidate (void);
 
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index dde9185..30135f0 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1033,7 +1033,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
   /* fcn_cs_saved is global because process_xcoff_symbol needs it.  */
   union internal_auxent fcn_aux_saved = main_aux;
-  struct context_stack *new;
+  struct context_stack *newobj;
 
   char *filestring = " _start_ ";	/* Name of the current file.  */
 
@@ -1360,13 +1360,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
 	      within_function = 1;
 
-	      new = push_context (0, fcn_start_addr + off);
+	      newobj = push_context (0, fcn_start_addr + off);
 
-	      new->name = define_symbol
+	      newobj->name = define_symbol
 		(fcn_cs_saved.c_value + off,
 		 fcn_stab_saved.c_name, 0, 0, objfile);
-	      if (new->name != NULL)
-		SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
+	      if (newobj->name != NULL)
+		SYMBOL_SECTION (newobj->name) = SECT_OFF_TEXT (objfile);
 	    }
 	  else if (strcmp (cs->c_name, ".ef") == 0)
 	    {
@@ -1384,17 +1384,17 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 		  within_function = 0;
 		  break;
 		}
-	      new = pop_context ();
+	      newobj = pop_context ();
 	      /* Stack must be empty now.  */
-	      if (context_stack_depth > 0 || new == NULL)
+	      if (context_stack_depth > 0 || newobj == NULL)
 		{
 		  ef_complaint (cs->c_symnum);
 		  within_function = 0;
 		  break;
 		}
 
-	      finish_block (new->name, &local_symbols, new->old_blocks,
-			    new->start_addr,
+	      finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+			    newobj->start_addr,
 			    (fcn_cs_saved.c_value
 			     + fcn_aux_saved.x_sym.x_misc.x_fsize
 			     + ANOFFSET (objfile->section_offsets,
@@ -1464,7 +1464,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	  if (strcmp (cs->c_name, ".bb") == 0)
 	    {
 	      depth++;
-	      new = push_context (depth,
+	      newobj = push_context (depth,
 				  (cs->c_value
 				   + ANOFFSET (objfile->section_offsets,
 					       SECT_OFF_TEXT (objfile))));
@@ -1476,8 +1476,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 		  eb_complaint (cs->c_symnum);
 		  break;
 		}
-	      new = pop_context ();
-	      if (depth-- != new->depth)
+	      newobj = pop_context ();
+	      if (depth-- != newobj->depth)
 		{
 		  eb_complaint (cs->c_symnum);
 		  break;
@@ -1485,13 +1485,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	      if (local_symbols && context_stack_depth > 0)
 		{
 		  /* Make a block for the local symbols within.  */
-		  finish_block (new->name, &local_symbols, new->old_blocks,
-				new->start_addr,
+		  finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+				newobj->start_addr,
 				(cs->c_value
 				 + ANOFFSET (objfile->section_offsets,
 					     SECT_OFF_TEXT (objfile))));
 		}
-	      local_symbols = new->locals;
+	      local_symbols = newobj->locals;
 	    }
 	  break;
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 12/36] proc-service, extern "C"
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (6 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 19/36] Exported const objects Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 25/36] python/python-internal.h: enum ‘ext_lang_rc’ not defined Pedro Alves
                   ` (32 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

libthread_db.so calls symbols in the client (GDB), through the
proc-service interface.  These routines must have extern "C" linkage
so their symbol names are not mangled when GDB is built as a C++
program.  On the GDBserver side, we were missing fallback declarations for
all these symbols.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.

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

	* gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
	[!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare.
	[!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
	ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
	(ps_lsetfpregs, ps_getpid)
	(ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue)
	(ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs)
	(ps_lsetxregs, ps_plog): Declare.
---
 gdb/gdb_proc_service.h           | 11 ++++++
 gdb/gdbserver/gdb_proc_service.h | 79 ++++++++++++++++++++++++++++++++++++++++
 gdb/gdbserver/proc-service.c     |  4 +-
 3 files changed, 92 insertions(+), 2 deletions(-)

diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
index 2c633b3..e736991 100644
--- a/gdb/gdb_proc_service.h
+++ b/gdb/gdb_proc_service.h
@@ -22,8 +22,15 @@
 #include <sys/types.h>
 
 #ifdef HAVE_PROC_SERVICE_H
+
+/* glibc's proc_service.h doesn't wrap itself with extern "C".  Need
+   to do it ourselves.  */
+EXTERN_C_PUSH
+
 #include <proc_service.h>
 
+EXTERN_C_POP
+
 #else /* HAVE_PROC_SERVICE_H */
 
 /* The following fallback definitions have been imported and adjusted
@@ -55,6 +62,8 @@
 
 #include "gregset.h"
 
+EXTERN_C_PUSH
+
 /* Functions in this interface return one of these status codes.  */
 typedef enum
 {
@@ -150,6 +159,8 @@ extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
 /* Log a message (sends to gdb_stderr).  */
 extern void ps_plog (const char *fmt, ...);
 
+EXTERN_C_POP
+
 #endif /* HAVE_PROC_SERVICE_H */
 
 /* Fix-up some broken systems.  */
diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h
index 1f3e277..2dcfa5b 100644
--- a/gdb/gdbserver/gdb_proc_service.h
+++ b/gdb/gdbserver/gdb_proc_service.h
@@ -22,7 +22,15 @@
 #include <sys/types.h>
 
 #ifdef HAVE_PROC_SERVICE_H
+
+/* glibc's proc_service.h doesn't wrap itself with extern "C".  Need
+   to do it ourselves.  */
+EXTERN_C_PUSH
+
 #include <proc_service.h>
+
+EXTERN_C_POP
+
 #else
 
 #ifdef HAVE_SYS_PROCFS_H
@@ -38,6 +46,8 @@
 # endif
 #endif
 
+EXTERN_C_PUSH
+
 typedef enum
 {
   PS_OK,			/* Success.  */
@@ -61,6 +71,75 @@ typedef void *psaddr_t;
 typedef elf_gregset_t prgregset_t;
 #endif
 
+/* This type is opaque in this interface.  It's defined by the user of
+   libthread_db.  GDB's version is defined below.  */
+struct ps_prochandle;
+
+
+/* Read or write process memory at the given address.  */
+extern ps_err_e ps_pdread (struct ps_prochandle *,
+			   psaddr_t, void *, size_t);
+extern ps_err_e ps_pdwrite (struct ps_prochandle *,
+			    psaddr_t, const void *, size_t);
+extern ps_err_e ps_ptread (struct ps_prochandle *,
+			   psaddr_t, void *, size_t);
+extern ps_err_e ps_ptwrite (struct ps_prochandle *,
+			    psaddr_t, const void *, size_t);
+
+
+/* Get and set the given LWP's general or FPU register set.  */
+extern ps_err_e ps_lgetregs (struct ps_prochandle *,
+			     lwpid_t, prgregset_t);
+extern ps_err_e ps_lsetregs (struct ps_prochandle *,
+			     lwpid_t, const prgregset_t);
+extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
+			       lwpid_t, prfpregset_t *);
+extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
+			       lwpid_t, const prfpregset_t *);
+
+/* Return the PID of the process.  */
+extern pid_t ps_getpid (struct ps_prochandle *);
+
+/* Fetch the special per-thread address associated with the given LWP.
+   This call is only used on a few platforms (most use a normal register).
+   The meaning of the `int' parameter is machine-dependent.  */
+extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
+				    lwpid_t, int, psaddr_t *);
+
+
+/* Look up the named symbol in the named DSO in the symbol tables
+   associated with the process being debugged, filling in *SYM_ADDR
+   with the corresponding run-time address.  */
+extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
+				   const char *object_name,
+				   const char *sym_name,
+				   psaddr_t *sym_addr);
+
+
+/* Stop or continue the entire process.  */
+extern ps_err_e ps_pstop (struct ps_prochandle *);
+extern ps_err_e ps_pcontinue (struct ps_prochandle *);
+
+/* Stop or continue the given LWP alone.  */
+extern ps_err_e ps_lstop (struct ps_prochandle *, lwpid_t);
+extern ps_err_e ps_lcontinue (struct ps_prochandle *, lwpid_t);
+
+/* The following are only defined in/called by Solaris.  */
+
+/* Get size of extra register set.  */
+extern ps_err_e ps_lgetxregsize (struct ps_prochandle *ph,
+				 lwpid_t lwpid, int *xregsize);
+/* Get extra register set.  */
+extern ps_err_e ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
+			      caddr_t xregset);
+extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
+			      caddr_t xregset);
+
+/* Log a message (sends to gdb_stderr).  */
+extern void ps_plog (const char *fmt, ...);
+
+EXTERN_C_POP
+
 #endif /* HAVE_PROC_SERVICE_H */
 
 /* Structure that identifies the target process.  */
diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c
index b181ae5..f36e3fb 100644
--- a/gdb/gdbserver/proc-service.c
+++ b/gdb/gdbserver/proc-service.c
@@ -135,7 +135,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
    process PH and store them in FPREGSET.  */
 
 ps_err_e
-ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset)
+ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prfpregset_t *fpregset)
 {
   /* Unneeded.  */
   return PS_ERR;
@@ -145,7 +145,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset)
    process PH from FPREGSET.  */
 
 ps_err_e
-ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, void *fpregset)
+ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prfpregset_t *fpregset)
 {
   /* Unneeded.  */
   return PS_ERR;
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (20 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:35   ` Andrew Pinski
  2015-02-09 23:21 ` [PATCH 27/36] catch_command_errors: Remove 'mask' parameter Pedro Alves
                   ` (18 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: GCC Patches

Just like libiberty.h.  So that C++ programs, such as GDB when built
as a C++ program, can use it.

include/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* floatformat.h [__cplusplus]: Wrap in extern "C".
---
 include/floatformat.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/floatformat.h b/include/floatformat.h
index 6b559864..71d332b 100644
--- a/include/floatformat.h
+++ b/include/floatformat.h
@@ -20,6 +20,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 #if !defined (FLOATFORMAT_H)
 #define FLOATFORMAT_H 1
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ansidecl.h"
 
 /* A floatformat consists of a sign bit, an exponent and a mantissa.  Once the
@@ -148,4 +152,8 @@ floatformat_from_double (const struct floatformat *, const double *, void *);
 extern int
 floatformat_is_valid (const struct floatformat *fmt, const void *from);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* defined (FLOATFORMAT_H) */
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 13/36] target.h: Include infrun.h
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (12 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 22/36] Remove duplicate const Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 29/36] Normalize TRY_CATCH exception handling block Pedro Alves
                   ` (26 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Fixes:

  src/gdb/target.h:753:10: error: use of enum ‘exec_direction_kind’ without previous declaration

in C++ mode.  We can't forward declare enums.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* target.h: Include "infrun.h".
---
 gdb/target.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/target.h b/gdb/target.h
index fb60123..6dfba61 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -39,6 +39,8 @@ struct traceframe_info;
 struct expression;
 struct dcache_struct;
 
+#include "infrun.h" /* For enum exec_direction_kind.  */
+
 /* This include file defines the interface between the main part
    of the debugger, and the part which is target-specific, or
    specific to the communications interface between us and the
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (15 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-10 15:05   ` Michael Eager
  2015-02-09 23:21 ` [PATCH 17/36] mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args Pedro Alves
                   ` (23 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Building GDB as a C++ program, we see:

  In file included from gdb/microblaze-tdep.c:37:0:
  gdb/../opcodes/../opcodes/microblaze-opcm.h: At global scope:
  gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected identifier before ‘or’ token
     ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
						     ^
  gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected ‘}’ before ‘or’ token
  gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected unqualified-id before ‘or’ token
  gdb/../opcodes/../opcodes/microblaze-opcm.h:60:1: error: expected declaration before ‘}’ token
   };
   ^

opcodes/ChangeLog:
2015-10-20  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
	microblaze_and, microblaze_xor.
	* microblaze-opc.h (struct op_code_struct): Adjust.
---
 opcodes/microblaze-opc.h  | 6 +++---
 opcodes/microblaze-opcm.h | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
index 668e27e..bf62906 100644
--- a/opcodes/microblaze-opc.h
+++ b/opcodes/microblaze-opc.h
@@ -158,9 +158,9 @@ struct op_code_struct
   {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
   {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
   {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
-  {"or",    INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, or, logical_inst },
-  {"and",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, and, logical_inst },
-  {"xor",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, xor, logical_inst },
+  {"or",    INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
+  {"and",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
+  {"xor",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
   {"andn",  INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000000, OPCODE_MASK_H4, andn, logical_inst },
   {"pcmpbf",INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000400, OPCODE_MASK_H4, pcmpbf, logical_inst },
   {"pcmpbc",INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000400, OPCODE_MASK_H4, pcmpbc, logical_inst },
diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
index f59c48c..0263148 100644
--- a/opcodes/microblaze-opcm.h
+++ b/opcodes/microblaze-opcm.h
@@ -29,7 +29,9 @@ enum microblaze_instr
   addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 
   mulh, mulhu, mulhsu,swapb,swaph,
   idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
-  ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
+  ncget, ncput, muli, bslli, bsrai, bsrli, mului,
+  /* 'or/and/xor' are C++ keywords.  */
+  microblaze_or, microblaze_and, microblaze_xor,
   andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, 
   wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
   brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 26/36] Adjust self tests to cope with GDB built as a C++ program
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (4 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 15/36] Don't forward declare enum target_hw_bp_type Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 19/36] Exported const objects Pedro Alves
                   ` (34 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

gdb/testsuite/
2015-02-09  Pedro Alves  <palves@redhat.com>

	* gdb.gdb/complaints.exp (test_initial_complaints): Also accept
	"true" for boolean result.
	* gdb.gdb/selftest.exp (test_with_self): Also accept full
	prototype of main.
---
 gdb/testsuite/gdb.gdb/complaints.exp | 6 ++++--
 gdb/testsuite/gdb.gdb/selftest.exp   | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 500f414..707b2a5 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -43,9 +43,11 @@ proc test_initial_complaints { } {
     gdb_test "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \
 	    "During symbol reading, Register a complaint."
 
-    # Check that there is only one thing in the list
+    # Check that there is only one thing in the list.  How the boolean
+    # result is output depends on whether GDB is built as a C or C++
+    # program.
     gdb_test "print symfile_complaints->root->next == &complaint_sentinel" \
-	    ".\[0-9\]+ = 1" "list has one entry"
+	    ".\[0-9\]+ = \(1|true\)" "list has one entry"
 
     # Add a second complaint, expect it
     gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index b32e799..9f25a48 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -288,9 +288,13 @@ proc test_with_self { executable } {
 	return -1
     }
 
+    # When GDB is built as a C++ program, disassemble shows the full
+    # prototype.
+    set cxx_main_args_re [string_to_regexp "(int, char**)"]
+
     # disassemble yourself
     gdb_test "x/10i main" \
-	    "x/10i.*main.*main.$decimal.*main.$decimal.*" \
+	    "x/10i.*main.*main($cxx_main_args_re)?.$decimal.*main($cxx_main_args_re)?.$decimal.*" \
 	    "Disassemble main"
 
     # Set a breakpoint at main
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 27/36] catch_command_errors: Remove 'mask' parameter
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (21 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 09/36] floatformat.h: Wrap in extern "C" Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:22 ` [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode Pedro Alves
                   ` (17 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

All callers of catch_command_errors pass RETURN_MASK_ALL as mask
argument.  This patch eliminates the mask parameter as unnecessary.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* main.c (catch_command_errors, catch_command_errors_const):
	Remove 'mask' argument.  Adjust.
	(captured_main): Adjust callers.

gdb/testsuite/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* gdb.gdb/python-interrupts.exp (test_python_interrupts): Adjust
	call to catch_command_errors.
	* gdb.gdb/python-selftest.exp (selftest_python): Adjust call to
	catch_command_errors.
---
 gdb/main.c                                  | 49 +++++++++++++----------------
 gdb/testsuite/gdb.gdb/python-interrupts.exp |  2 +-
 gdb/testsuite/gdb.gdb/python-selftest.exp   |  2 +-
 3 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/gdb/main.c b/gdb/main.c
index 0833c81..7237d2d 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -362,11 +362,11 @@ typedef void (catch_command_errors_ftype) (char *, int);
 
 static int
 catch_command_errors (catch_command_errors_ftype *command,
-		      char *arg, int from_tty, return_mask mask)
+		      char *arg, int from_tty)
 {
   volatile struct gdb_exception e;
 
-  TRY_CATCH (e, mask)
+  TRY_CATCH (e, RETURN_MASK_ALL)
     {
       int was_sync = sync_execution;
 
@@ -385,11 +385,11 @@ typedef void (catch_command_errors_const_ftype) (const char *, int);
 
 static int
 catch_command_errors_const (catch_command_errors_const_ftype *command,
-			    const char *arg, int from_tty, return_mask mask)
+			    const char *arg, int from_tty)
 {
   volatile struct gdb_exception e;
 
-  TRY_CATCH (e, mask)
+  TRY_CATCH (e, RETURN_MASK_ALL)
     {
       int was_sync = sync_execution;
 
@@ -992,8 +992,7 @@ captured_main (void *data)
      processed; it sets global parameters, which are independent of
      what file you are debugging or what directory you are in.  */
   if (system_gdbinit && !inhibit_gdbinit)
-    catch_command_errors_const (source_script, system_gdbinit,
-				0, RETURN_MASK_ALL);
+    catch_command_errors_const (source_script, system_gdbinit, 0);
 
   /* Read and execute $HOME/.gdbinit file, if it exists.  This is done
      *before* all the command line arguments are processed; it sets
@@ -1001,8 +1000,7 @@ captured_main (void *data)
      debugging or what directory you are in.  */
 
   if (home_gdbinit && !inhibit_gdbinit && !inhibit_home_gdbinit)
-    catch_command_errors_const (source_script,
-				home_gdbinit, 0, RETURN_MASK_ALL);
+    catch_command_errors_const (source_script, home_gdbinit, 0);
 
   /* Process '-ix' and '-iex' options early.  */
   for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++)
@@ -1010,22 +1008,22 @@ captured_main (void *data)
     {
       case CMDARG_INIT_FILE:
         catch_command_errors_const (source_script, cmdarg_p->string,
-				    !batch_flag, RETURN_MASK_ALL);
+				    !batch_flag);
 	break;
       case CMDARG_INIT_COMMAND:
         catch_command_errors (execute_command, cmdarg_p->string,
-			      !batch_flag, RETURN_MASK_ALL);
+			      !batch_flag);
 	break;
     }
 
   /* Now perform all the actions indicated by the arguments.  */
   if (cdarg != NULL)
     {
-      catch_command_errors (cd_command, cdarg, 0, RETURN_MASK_ALL);
+      catch_command_errors (cd_command, cdarg, 0);
     }
 
   for (i = 0; i < ndir; i++)
-    catch_command_errors (directory_switch, dirarg[i], 0, RETURN_MASK_ALL);
+    catch_command_errors (directory_switch, dirarg[i], 0);
   xfree (dirarg);
 
   /* Skip auto-loading section-specified scripts until we've sourced
@@ -1042,18 +1040,18 @@ captured_main (void *data)
          open it, better only print one error message.
          catch_command_errors returns non-zero on success!  */
       if (catch_command_errors_const (exec_file_attach, execarg,
-				      !batch_flag, RETURN_MASK_ALL))
+				      !batch_flag))
 	catch_command_errors_const (symbol_file_add_main, symarg,
-				    !batch_flag, RETURN_MASK_ALL);
+				    !batch_flag);
     }
   else
     {
       if (execarg != NULL)
 	catch_command_errors_const (exec_file_attach, execarg,
-				    !batch_flag, RETURN_MASK_ALL);
+				    !batch_flag);
       if (symarg != NULL)
 	catch_command_errors_const (symbol_file_add_main, symarg,
-				    !batch_flag, RETURN_MASK_ALL);
+				    !batch_flag);
     }
 
   if (corearg && pidarg)
@@ -1061,11 +1059,9 @@ captured_main (void *data)
 	     "a core file at the same time."));
 
   if (corearg != NULL)
-    catch_command_errors (core_file_command, corearg,
-			  !batch_flag, RETURN_MASK_ALL);
+    catch_command_errors (core_file_command, corearg, !batch_flag);
   else if (pidarg != NULL)
-    catch_command_errors (attach_command, pidarg,
-			  !batch_flag, RETURN_MASK_ALL);
+    catch_command_errors (attach_command, pidarg, !batch_flag);
   else if (pid_or_core_arg)
     {
       /* The user specified 'gdb program pid' or gdb program core'.
@@ -1075,13 +1071,13 @@ captured_main (void *data)
       if (isdigit (pid_or_core_arg[0]))
 	{
 	  if (catch_command_errors (attach_command, pid_or_core_arg,
-				    !batch_flag, RETURN_MASK_ALL) == 0)
+				    !batch_flag) == 0)
 	    catch_command_errors (core_file_command, pid_or_core_arg,
-				  !batch_flag, RETURN_MASK_ALL);
+				  !batch_flag);
 	}
       else /* Can't be a pid, better be a corefile.  */
 	catch_command_errors (core_file_command, pid_or_core_arg,
-			      !batch_flag, RETURN_MASK_ALL);
+			      !batch_flag);
     }
 
   if (ttyarg != NULL)
@@ -1104,8 +1100,7 @@ captured_main (void *data)
 	{
 	  auto_load_local_gdbinit_loaded = 1;
 
-	  catch_command_errors_const (source_script, local_gdbinit, 0,
-				      RETURN_MASK_ALL);
+	  catch_command_errors_const (source_script, local_gdbinit, 0);
 	}
     }
 
@@ -1123,11 +1118,11 @@ captured_main (void *data)
     {
       case CMDARG_FILE:
         catch_command_errors_const (source_script, cmdarg_p->string,
-				    !batch_flag, RETURN_MASK_ALL);
+				    !batch_flag);
 	break;
       case CMDARG_COMMAND:
         catch_command_errors (execute_command, cmdarg_p->string,
-			      !batch_flag, RETURN_MASK_ALL);
+			      !batch_flag);
 	break;
     }
 
diff --git a/gdb/testsuite/gdb.gdb/python-interrupts.exp b/gdb/testsuite/gdb.gdb/python-interrupts.exp
index e2c510a..34b3c36 100644
--- a/gdb/testsuite/gdb.gdb/python-interrupts.exp
+++ b/gdb/testsuite/gdb.gdb/python-interrupts.exp
@@ -25,7 +25,7 @@ proc test_python_interrupts {} {
     }
 
     gdb_breakpoint set_active_ext_lang temporary
-    gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0, RETURN_MASK_ALL)" \
+    gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0)" \
 	"Temporary breakpoint.*silently stop."
     gdb_test "signal SIGINT" \
 	"KeyboardInterrupt.*Error while executing Python code."
diff --git a/gdb/testsuite/gdb.gdb/python-selftest.exp b/gdb/testsuite/gdb.gdb/python-selftest.exp
index 7cb3dd4..ef1ab69 100644
--- a/gdb/testsuite/gdb.gdb/python-selftest.exp
+++ b/gdb/testsuite/gdb.gdb/python-selftest.exp
@@ -22,7 +22,7 @@ proc selftest_python {} {
     }
 
     gdb_test_no_output "set variable gdb_python_initialized = 0"
-    gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0, RETURN_MASK_ALL)" \
+    gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0)" \
 	"Python not initialized.* = 0"
     return 0
 }
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 25/36] python/python-internal.h: enum ‘ext_lang_rc’ not defined
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (7 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 12/36] proc-service, extern "C" Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 23/36] gdbarch.h: include regcache.h Pedro Alves
                   ` (31 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Fixes this in C++ mode:

  src/gdb/python/python-internal.h: At global scope:
  src/gdb/python/python-internal.h:313:13: error: use of enum ‘ext_lang_rc’ without previous declaration
   extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
	       ^
  src/gdb/python/python-internal.h:320:41: error: invalid type in declaration before ‘;’ token
      const struct language_defn *language);
					   ^

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* python/python-internal.h: Include "extension-priv.h".
---
 gdb/python/python-internal.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index a77f5a6..4c4d32a 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -21,6 +21,7 @@
 #define GDB_PYTHON_INTERNAL_H
 
 #include "extension.h"
+#include "extension-priv.h"
 
 /* These WITH_* macros are defined by the CPython API checker that
    comes with the Python plugin for GCC.  See:
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 17/36] mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (16 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 05/36] Fix redefinition errors in C++ mode Pedro Alves
                   ` (22 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

The enums are value compatible by design, but building in C++ mode trips
on them, like:

  ...
  gdb/mi/mi-cmd-stack.c:363:34: error: cannot convert ‘print_values’ to ‘ext_lang_frame_args’ for argument ‘3’ to ‘ext_lang_bt_status apply_ext_lang_frame_filter(frame_info*, int, ext_lang_frame_args, ui_out*, int, int)’
  ...

Fix this by adding a helper function.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): New
	function.
	(mi_cmd_stack_list_locals, mi_cmd_stack_list_args)
	(mi_cmd_stack_list_variables): Use it.
---
 gdb/mi/mi-cmd-stack.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 2cbb9bf..18a357e 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -53,6 +53,22 @@ mi_cmd_enable_frame_filters (char *command, char **argv, int argc)
   frame_filters = 1;
 }
 
+/* Like apply_ext_lang_frame_filter, but take a print_values */
+
+static enum ext_lang_bt_status
+mi_apply_ext_lang_frame_filter (struct frame_info *frame, int flags,
+				enum print_values print_values,
+				struct ui_out *out,
+				int frame_low, int frame_high)
+{
+  /* ext_lang_frame_args's MI options are compatible with MI print
+     values.  */
+  return apply_ext_lang_frame_filter (frame, flags,
+				      (enum ext_lang_frame_args) print_values,
+				      out,
+				      frame_low, frame_high);
+}
+
 /* Print a list of the stack frames.  Args can be none, in which case
    we want to print the whole backtrace, or a pair of numbers
    specifying the frame numbers at which to start and stop the
@@ -252,8 +268,8 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc)
      {
        int flags = PRINT_LEVEL | PRINT_LOCALS;
 
-       result = apply_ext_lang_frame_filter (frame, flags, print_value,
-					     current_uiout, 0, 0);
+       result = mi_apply_ext_lang_frame_filter (frame, flags, print_value,
+						current_uiout, 0, 0);
      }
 
    /* Run the inbuilt backtrace if there are no filters registered, or
@@ -358,9 +374,9 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
       if (py_frame_low == -1)
 	py_frame_low++;
 
-      result = apply_ext_lang_frame_filter (get_current_frame (), flags,
-					    print_values, current_uiout,
-					    py_frame_low, frame_high);
+      result = mi_apply_ext_lang_frame_filter (get_current_frame (), flags,
+					       print_values, current_uiout,
+					       py_frame_low, frame_high);
     }
 
      /* Run the inbuilt backtrace if there are no filters registered, or
@@ -448,8 +464,9 @@ mi_cmd_stack_list_variables (char *command, char **argv, int argc)
      {
        int flags = PRINT_LEVEL | PRINT_ARGS | PRINT_LOCALS;
 
-       result = apply_ext_lang_frame_filter (frame, flags, print_value,
-					     current_uiout, 0, 0);
+       result = mi_apply_ext_lang_frame_filter (frame, flags,
+						print_value,
+						current_uiout, 0, 0);
      }
 
    /* Run the inbuilt backtrace if there are no filters registered, or
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 04/36] Fix struct, union, and enum nesting in C++
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (2 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 11/36] Make functions and variables exported by the IPA be extern "C" Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 15/36] Don't forward declare enum target_hw_bp_type Pedro Alves
                   ` (36 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

From: Tom Tromey <tromey@redhat.com>

In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place.  However, in C++, such a nested structure is given a name that
is nested inside the structure.  This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.

2015-02-09  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* dwarf2-frame.c (enum cfa_how_kind, struct
	dwarf2_frame_state_reg_info): Move out of struct
	dwarf2_frame_state.
	* dwarf2read.c (struct tu_stats): Move out of struct
	dwarf2_per_objfile.
	(struct file_entry): Move out of struct line_header.
	(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
	typedef_field_list): Move out of struct field_info.
	* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
	Move out of struct dynamic_prop.
	(union type_owner, union field_location, struct field, struct
	range_bounds, union type_specific): Move out of struct main_type.
	(struct fn_fieldlist, struct fn_field, struct typedef_field)
	(VOFFSET_STATIC): Move out of struct cplus_struct_type.
	(struct call_site_target, union call_site_parameter_u, struct
	call_site_parameter): Move out of struct call_site.
	* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
	m32c_prologue.
	(enum srcdest_kind): Move out of struct srcdest.
	* main.c (enum cmdarg_kind): Move out of struct cmdarg.
	* prologue-value.h (enum prologue_value_kind): Move out of struct
	prologue_value.
	* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
	gdbarch_tdep.
	* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
	out of struct field_info.
	* symfile.h (struct other_sections): Move out of struct
	section_addr_info.
	* symtab.c (struct symbol_cache_slot): Move out struct
	block_symbol_cache.
	* target-descriptions.c (enum tdesc_type_kind): Move out of
	typedef struct tdesc_type.
	* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
	struct tui_line_or_address.
	* value.c (enum internalvar_kind, union internalvar_data): Move
	out of struct internalvar.
	* xtensa-tdep.h (struct ctype_cache): Move out of struct
	gdbarch_tdep.
---
 gdb/dwarf2-frame.c        |  39 ++--
 gdb/dwarf2read.c          |  96 ++++----
 gdb/gdbtypes.h            | 573 ++++++++++++++++++++++++----------------------
 gdb/m32c-tdep.c           |  35 +--
 gdb/main.c                |  30 +--
 gdb/prologue-value.h      |  41 ++--
 gdb/s390-linux-tdep.c     |   8 +-
 gdb/stabsread.c           |  38 +--
 gdb/symfile.h             |  18 +-
 gdb/symtab.c              |  66 +++---
 gdb/target-descriptions.c |  54 ++---
 gdb/tui/tui-data.h        |   8 +-
 gdb/value.c               | 121 +++++-----
 gdb/xtensa-tdep.h         |  14 +-
 14 files changed, 607 insertions(+), 534 deletions(-)

diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 57da775..71e3f6b 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -165,29 +165,34 @@ static CORE_ADDR read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
 				     CORE_ADDR func_base);
 \f
 
+enum cfa_how_kind
+{
+  CFA_UNSET,
+  CFA_REG_OFFSET,
+  CFA_EXP
+};
+
+struct dwarf2_frame_state_reg_info
+{
+  struct dwarf2_frame_state_reg *reg;
+  int num_regs;
+
+  LONGEST cfa_offset;
+  ULONGEST cfa_reg;
+  enum cfa_how_kind cfa_how;
+  const gdb_byte *cfa_exp;
+
+  /* Used to implement DW_CFA_remember_state.  */
+  struct dwarf2_frame_state_reg_info *prev;
+};
+
 /* Structure describing a frame state.  */
 
 struct dwarf2_frame_state
 {
   /* Each register save state can be described in terms of a CFA slot,
      another register, or a location expression.  */
-  struct dwarf2_frame_state_reg_info
-  {
-    struct dwarf2_frame_state_reg *reg;
-    int num_regs;
-
-    LONGEST cfa_offset;
-    ULONGEST cfa_reg;
-    enum {
-      CFA_UNSET,
-      CFA_REG_OFFSET,
-      CFA_EXP
-    } cfa_how;
-    const gdb_byte *cfa_exp;
-
-    /* Used to implement DW_CFA_remember_state.  */
-    struct dwarf2_frame_state_reg_info *prev;
-  } regs;
+  struct dwarf2_frame_state_reg_info regs;
 
   /* The PC described by the current frame state.  */
   CORE_ADDR pc;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9d12112..f8eced8 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -199,6 +199,15 @@ struct mapped_index
 typedef struct dwarf2_per_cu_data *dwarf2_per_cu_ptr;
 DEF_VEC_P (dwarf2_per_cu_ptr);
 
+struct tu_stats
+{
+  int nr_uniq_abbrev_tables;
+  int nr_symtabs;
+  int nr_symtab_sharers;
+  int nr_stmt_less_type_units;
+  int nr_all_type_units_reallocs;
+};
+
 /* Collection of data recorded per objfile.
    This hangs off of dwarf2_objfile_data_key.  */
 
@@ -250,14 +259,7 @@ struct dwarf2_per_objfile
 
   /* Type unit statistics, to see how well the scaling improvements
      are doing.  */
-  struct tu_stats
-  {
-    int nr_uniq_abbrev_tables;
-    int nr_symtabs;
-    int nr_symtab_sharers;
-    int nr_stmt_less_type_units;
-    int nr_all_type_units_reallocs;
-  } tu_stats;
+  struct tu_stats tu_stats;
 
   /* A chain of compilation units that are currently read in, so that
      they can be freed later.  */
@@ -1022,6 +1024,16 @@ typedef void (die_reader_func_ftype) (const struct die_reader_specs *reader,
 				      int has_children,
 				      void *data);
 
+struct file_entry
+{
+  const char *name;
+  unsigned int dir_index;
+  unsigned int mod_time;
+  unsigned int length;
+  int included_p; /* Non-zero if referenced by the Line Number Program.  */
+  struct symtab *symtab; /* The associated symbol table, if any.  */
+};
+
 /* The line number information for a compilation unit (found in the
    .debug_line section) begins with a "statement program header",
    which contains the following information.  */
@@ -1060,15 +1072,7 @@ struct line_header
      with xmalloc; instead, they are pointers into debug_line_buffer.
      Don't try to free them directly.  */
   unsigned int num_file_names, file_names_size;
-  struct file_entry
-  {
-    const char *name;
-    unsigned int dir_index;
-    unsigned int mod_time;
-    unsigned int length;
-    int included_p; /* Non-zero if referenced by the Line Number Program.  */
-    struct symtab *symtab; /* The associated symbol table, if any.  */
-  } *file_names;
+  struct file_entry *file_names;
 
   /* The start and end of the statement program following this
      header.  These point into dwarf2_per_objfile->line_buffer.  */
@@ -1285,20 +1289,40 @@ struct dwarf_block
    and friends.  */
 static int bits_per_byte = 8;
 
+struct nextfield
+{
+  struct nextfield *next;
+  int accessibility;
+  int virtuality;
+  struct field field;
+};
+
+struct nextfnfield
+{
+  struct nextfnfield *next;
+  struct fn_field fnfield;
+};
+
+struct fnfieldlist
+{
+  const char *name;
+  int length;
+  struct nextfnfield *head;
+};
+
+struct typedef_field_list
+{
+  struct typedef_field field;
+  struct typedef_field_list *next;
+};
+
 /* The routines that read and process dies for a C struct or C++ class
    pass lists of data member fields and lists of member function fields
    in an instance of a field_info structure, as defined below.  */
 struct field_info
   {
     /* List of data member and baseclasses fields.  */
-    struct nextfield
-      {
-	struct nextfield *next;
-	int accessibility;
-	int virtuality;
-	struct field field;
-      }
-     *fields, *baseclasses;
+    struct nextfield *fields, *baseclasses;
 
     /* Number of fields (including baseclasses).  */
     int nfields;
@@ -1311,35 +1335,19 @@ struct field_info
 
     /* Member function fields array, entries are allocated in the order they
        are encountered in the object file.  */
-    struct nextfnfield
-      {
-	struct nextfnfield *next;
-	struct fn_field fnfield;
-      }
-     *fnfields;
+    struct nextfnfield *fnfields;
 
     /* Member function fieldlist array, contains name of possibly overloaded
        member function, number of overloaded member functions and a pointer
        to the head of the member function field chain.  */
-    struct fnfieldlist
-      {
-	const char *name;
-	int length;
-	struct nextfnfield *head;
-      }
-     *fnfieldlists;
+    struct fnfieldlist *fnfieldlists;
 
     /* Number of entries in the fnfieldlists array.  */
     int nfnfields;
 
     /* typedefs defined inside this class.  TYPEDEF_FIELD_LIST contains head of
        a NULL terminated list of TYPEDEF_FIELD_LIST_COUNT elements.  */
-    struct typedef_field_list
-      {
-	struct typedef_field field;
-	struct typedef_field_list *next;
-      }
-    *typedef_field_list;
+    struct typedef_field_list *typedef_field_list;
     unsigned typedef_field_list_count;
   };
 
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ef6d92c..2c5ccf4 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -403,31 +403,35 @@ enum type_instance_flag_value
 #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
 				   & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
 
+enum dynamic_prop_kind
+{
+  PROP_UNDEFINED, /* Not defined.  */
+  PROP_CONST,     /* Constant.  */
+  PROP_ADDR_OFFSET, /* Address offset.  */
+  PROP_LOCEXPR,   /* Location expression.  */
+  PROP_LOCLIST    /* Location list.  */
+};
+
+union dynamic_prop_data
+{
+  /* Storage for constant property.  */
+
+  LONGEST const_val;
+
+  /* Storage for dynamic property.  */
+
+  void *baton;
+};
+
 /* * Used to store a dynamic property.  */
 
 struct dynamic_prop
 {
   /* Determine which field of the union dynamic_prop.data is used.  */
-  enum
-  {
-    PROP_UNDEFINED, /* Not defined.  */
-    PROP_CONST,     /* Constant.  */
-    PROP_ADDR_OFFSET, /* Address offset.  */
-    PROP_LOCEXPR,   /* Location expression.  */
-    PROP_LOCLIST    /* Location list.  */
-  } kind;
+  enum dynamic_prop_kind kind;
 
   /* Storage for dynamic or static value.  */
-  union data
-  {
-    /* Storage for constant property.  */
-
-    LONGEST const_val;
-
-    /* Storage for dynamic property.  */
-
-    void *baton;
-  } data;
+  union dynamic_prop_data data;
 };
 
 
@@ -465,6 +469,128 @@ enum type_specific_kind
   TYPE_SPECIFIC_SELF_TYPE
 };
 
+union type_owner
+{
+  struct objfile *objfile;
+  struct gdbarch *gdbarch;
+};
+
+union field_location
+{
+  /* * Position of this field, counting in bits from start of
+     containing structure.  For gdbarch_bits_big_endian=1
+     targets, it is the bit offset to the MSB.  For
+     gdbarch_bits_big_endian=0 targets, it is the bit offset to
+     the LSB.  */
+
+  int bitpos;
+
+  /* * Enum value.  */
+  LONGEST enumval;
+
+  /* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
+     physaddr is the location (in the target) of the static
+     field.  Otherwise, physname is the mangled label of the
+     static field.  */
+
+  CORE_ADDR physaddr;
+  const char *physname;
+
+  /* * The field location can be computed by evaluating the
+     following DWARF block.  Its DATA is allocated on
+     objfile_obstack - no CU load is needed to access it.  */
+
+  struct dwarf2_locexpr_baton *dwarf_block;
+};
+
+struct field
+{
+  union field_location loc;
+
+  /* * For a function or member type, this is 1 if the argument is
+     marked artificial.  Artificial arguments should not be shown
+     to the user.  For TYPE_CODE_RANGE it is set if the specific
+     bound is not defined.  */
+
+  unsigned int artificial : 1;
+
+  /* * Discriminant for union field_location.  */
+
+  ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
+
+  /* * Size of this field, in bits, or zero if not packed.
+     If non-zero in an array type, indicates the element size in
+     bits (used only in Ada at the moment).
+     For an unpacked field, the field's type's length
+     says how many bytes the field occupies.  */
+
+  unsigned int bitsize : 28;
+
+  /* * In a struct or union type, type of this field.
+     - In a function or member type, type of this argument.
+     - In an array type, the domain-type of the array.  */
+
+  struct type *type;
+
+  /* * Name of field, value or argument.
+     NULL for range bounds, array domains, and member function
+     arguments.  */
+
+  const char *name;
+};
+
+struct range_bounds
+{
+  /* * Low bound of range.  */
+
+  struct dynamic_prop low;
+
+  /* * High bound of range.  */
+
+  struct dynamic_prop high;
+
+  /* True if HIGH range bound contains the number of elements in the
+     subrange. This affects how the final hight bound is computed.  */
+
+  int flag_upper_bound_is_count : 1;
+
+  /* True if LOW or/and HIGH are resolved into a static bound from
+     a dynamic one.  */
+
+  int flag_bound_evaluated : 1;
+};
+
+union type_specific
+{
+  /* * CPLUS_STUFF is for TYPE_CODE_STRUCT.  It is initialized to
+     point to cplus_struct_default, a default static instance of a
+     struct cplus_struct_type.  */
+
+  struct cplus_struct_type *cplus_stuff;
+
+  /* * GNAT_STUFF is for types for which the GNAT Ada compiler
+     provides additional information.  */
+
+  struct gnat_aux_type *gnat_stuff;
+
+  /* * FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to two
+     floatformat objects that describe the floating-point value
+     that resides within the type.  The first is for big endian
+     targets and the second is for little endian targets.  */
+
+  const struct floatformat **floatformat;
+
+  /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types.  */
+
+  struct func_type *func_stuff;
+
+  /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
+     TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
+     is a member of.  */
+
+  struct type *self_type;
+};
+
 /* * Main structure representing a type in GDB.
 
    This structure is space-critical.  Its layout has been tweaked to
@@ -548,11 +674,7 @@ struct main_type
      this is somewhat ugly, but without major overhaul of the internal
      type system, it can't be avoided for now.  */
 
-  union type_owner
-    {
-      struct objfile *objfile;
-      struct gdbarch *gdbarch;
-    } owner;
+  union type_owner owner;
 
   /* * For a pointer type, describes the type of object pointed to.
      - For an array type, describes the type of the elements.
@@ -584,125 +706,18 @@ struct main_type
 
   union 
   {
-    struct field
-    {
-      union field_location
-      {
-	/* * Position of this field, counting in bits from start of
-	   containing structure.  For gdbarch_bits_big_endian=1
-	   targets, it is the bit offset to the MSB.  For
-	   gdbarch_bits_big_endian=0 targets, it is the bit offset to
-	   the LSB.  */
-
-	int bitpos;
-
-	/* * Enum value.  */
-	LONGEST enumval;
-
-	/* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
-	   physaddr is the location (in the target) of the static
-	   field.  Otherwise, physname is the mangled label of the
-	   static field.  */
-
-	CORE_ADDR physaddr;
-	const char *physname;
-
-	/* * The field location can be computed by evaluating the
-	   following DWARF block.  Its DATA is allocated on
-	   objfile_obstack - no CU load is needed to access it.  */
-
-	struct dwarf2_locexpr_baton *dwarf_block;
-      }
-      loc;
-
-      /* * For a function or member type, this is 1 if the argument is
-	 marked artificial.  Artificial arguments should not be shown
-	 to the user.  For TYPE_CODE_RANGE it is set if the specific
-	 bound is not defined.  */
-      unsigned int artificial : 1;
-
-      /* * Discriminant for union field_location.  */
-      ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
-
-      /* * Size of this field, in bits, or zero if not packed.
-	 If non-zero in an array type, indicates the element size in
-	 bits (used only in Ada at the moment).
-	 For an unpacked field, the field's type's length
-	 says how many bytes the field occupies.  */
-
-      unsigned int bitsize : 28;
-
-      /* * In a struct or union type, type of this field.
-	 - In a function or member type, type of this argument.
-	 - In an array type, the domain-type of the array.  */
-
-      struct type *type;
-
-      /* * Name of field, value or argument.
-	 NULL for range bounds, array domains, and member function
-	 arguments.  */
-
-      const char *name;
-    } *fields;
+    struct field *fields;
 
     /* * Union member used for range types.  */
 
-    struct range_bounds
-    {
-      /* * Low bound of range.  */
-
-      struct dynamic_prop low;
-
-      /* * High bound of range.  */
-
-      struct dynamic_prop high;
-
-      /* True if HIGH range bound contains the number of elements in the
-	 subrange. This affects how the final hight bound is computed.  */
-
-      int flag_upper_bound_is_count : 1;
-
-      /* True if LOW or/and HIGH are resolved into a static bound from
-	 a dynamic one.  */
-
-      int flag_bound_evaluated : 1;
-    } *bounds;
+    struct range_bounds *bounds;
 
   } flds_bnds;
 
   /* * Slot to point to additional language-specific fields of this
      type.  */
 
-  union type_specific
-  {
-    /* * CPLUS_STUFF is for TYPE_CODE_STRUCT.  It is initialized to
-       point to cplus_struct_default, a default static instance of a
-       struct cplus_struct_type.  */
-
-    struct cplus_struct_type *cplus_stuff;
-
-    /* * GNAT_STUFF is for types for which the GNAT Ada compiler
-       provides additional information.  */
-
-    struct gnat_aux_type *gnat_stuff;
-
-    /* * FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to two
-       floatformat objects that describe the floating-point value
-       that resides within the type.  The first is for big endian
-       targets and the second is for little endian targets.  */
-
-    const struct floatformat **floatformat;
-
-    /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types.  */
-
-    struct func_type *func_stuff;
-
-    /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
-       TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
-       is a member of.  */
-
-    struct type *self_type;
-  } type_specific;
+  union type_specific type_specific;
 
   /* * Contains a location description value for the current type. Evaluating
      this field yields to the location of the data for an object.  */
@@ -780,6 +795,101 @@ struct type
 
 #define	NULL_TYPE ((struct type *) 0)
 
+struct fn_fieldlist
+{
+
+  /* * The overloaded name.
+     This is generally allocated in the objfile's obstack.
+     However stabsread.c sometimes uses malloc.  */
+
+  const char *name;
+
+  /* * The number of methods with this name.  */
+
+  int length;
+
+  /* * The list of methods.  */
+
+  struct fn_field *fn_fields;
+};
+
+
+
+struct fn_field
+{
+  /* * If is_stub is clear, this is the mangled name which we can look
+     up to find the address of the method (FIXME: it would be cleaner
+     to have a pointer to the struct symbol here instead).
+
+     If is_stub is set, this is the portion of the mangled name which
+     specifies the arguments.  For example, "ii", if there are two int
+     arguments, or "" if there are no arguments.  See gdb_mangle_name
+     for the conversion from this format to the one used if is_stub is
+     clear.  */
+
+  const char *physname;
+
+  /* * The function type for the method.
+	       
+     (This comment used to say "The return value of the method", but
+     that's wrong.  The function type is expected here, i.e. something
+     with TYPE_CODE_METHOD, and *not* the return-value type).  */
+
+  struct type *type;
+
+  /* * For virtual functions.  First baseclass that defines this
+     virtual function.  */
+
+  struct type *fcontext;
+
+  /* Attributes.  */
+
+  unsigned int is_const:1;
+  unsigned int is_volatile:1;
+  unsigned int is_private:1;
+  unsigned int is_protected:1;
+  unsigned int is_public:1;
+  unsigned int is_abstract:1;
+  unsigned int is_static:1;
+  unsigned int is_final:1;
+  unsigned int is_synchronized:1;
+  unsigned int is_native:1;
+  unsigned int is_artificial:1;
+
+  /* * A stub method only has some fields valid (but they are enough
+     to reconstruct the rest of the fields).  */
+
+  unsigned int is_stub:1;
+
+  /* * True if this function is a constructor, false otherwise.  */
+
+  unsigned int is_constructor : 1;
+
+  /* * Unused.  */
+
+  unsigned int dummy:3;
+
+  /* * Index into that baseclass's virtual function table, minus 2;
+     else if static: VOFFSET_STATIC; else: 0.  */
+
+  unsigned int voffset:16;
+
+#define VOFFSET_STATIC 1
+
+};
+
+struct typedef_field
+{
+  /* * Unqualified name to be prefixed by owning class qualified
+     name.  */
+
+  const char *name;
+
+  /* * Type this typedef named NAME represents.  */
+
+  struct type *type;
+};
+
 /* * C++ language-specific information for TYPE_CODE_STRUCT and
    TYPE_CODE_UNION nodes.  */
 
@@ -876,107 +986,13 @@ struct cplus_struct_type
 
        fn_fieldlists points to an array of nfn_fields of these.  */
 
-    struct fn_fieldlist
-      {
-
-	/* * The overloaded name.
-	   This is generally allocated in the objfile's obstack.
-	   However stabsread.c sometimes uses malloc.  */
-
-	const char *name;
-
-	/* * The number of methods with this name.  */
-
-	int length;
-
-	/* * The list of methods.  */
-
-	struct fn_field
-	  {
-
-	    /* * If is_stub is clear, this is the mangled name which
-	       we can look up to find the address of the method
-	       (FIXME: it would be cleaner to have a pointer to the
-	       struct symbol here instead).
-
-	       If is_stub is set, this is the portion of the mangled
-	       name which specifies the arguments.  For example, "ii",
-	       if there are two int arguments, or "" if there are no
-	       arguments.  See gdb_mangle_name for the conversion from
-	       this format to the one used if is_stub is clear.  */
-
-	    const char *physname;
-
-	    /* * The function type for the method.
-	       
-	       (This comment used to say "The return value of the
-	       method", but that's wrong.  The function type is
-	       expected here, i.e. something with TYPE_CODE_METHOD, and
-	       *not* the return-value type).  */
-
-	    struct type *type;
-
-	    /* * For virtual functions.
-	       First baseclass that defines this virtual function.  */
-
-	    struct type *fcontext;
-
-	    /* Attributes.  */
-
-	    unsigned int is_const:1;
-	    unsigned int is_volatile:1;
-	    unsigned int is_private:1;
-	    unsigned int is_protected:1;
-	    unsigned int is_public:1;
-	    unsigned int is_abstract:1;
-	    unsigned int is_static:1;
-	    unsigned int is_final:1;
-	    unsigned int is_synchronized:1;
-	    unsigned int is_native:1;
-	    unsigned int is_artificial:1;
-
-	    /* * A stub method only has some fields valid (but they
-	       are enough to reconstruct the rest of the fields).  */
-
-	    unsigned int is_stub:1;
-
-	    /* * True if this function is a constructor, false
-	       otherwise.  */
-
-	    unsigned int is_constructor : 1;
-
-	    /* * Unused.  */
-
-	    unsigned int dummy:3;
-
-	    /* * Index into that baseclass's virtual function table,
-	       minus 2; else if static: VOFFSET_STATIC; else: 0.  */
-
-	    unsigned int voffset:16;
-
-#define VOFFSET_STATIC 1
-
-	  }
-	 *fn_fields;
-
-      }
-     *fn_fieldlists;
+    struct fn_fieldlist *fn_fieldlists;
 
     /* * typedefs defined inside this class.  typedef_field points to
        an array of typedef_field_count elements.  */
 
-    struct typedef_field
-      {
-	/* * Unqualified name to be prefixed by owning class qualified
-	   name.  */
-
-	const char *name;
-
-	/* * Type this typedef named NAME represents.  */
+    struct typedef_field *typedef_field;
 
-	struct type *type;
-      }
-    *typedef_field;
     unsigned typedef_field_count;
 
     /* * The template arguments.  This is an array with
@@ -1067,6 +1083,55 @@ enum call_site_parameter_kind
   CALL_SITE_PARAMETER_PARAM_OFFSET
 };
 
+struct call_site_target
+{
+  union field_location loc;
+
+  /* * Discriminant for union field_location.  */
+
+  ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
+};
+
+union call_site_parameter_u
+{
+  /* * DW_TAG_formal_parameter's DW_AT_location's DW_OP_regX
+     as DWARF register number, for register passed
+     parameters.  */
+
+  int dwarf_reg;
+
+  /* * Offset from the callee's frame base, for stack passed
+     parameters.  This equals offset from the caller's stack
+     pointer.  */
+
+  CORE_ADDR fb_offset;
+
+  /* * Offset relative to the start of this PER_CU to
+     DW_TAG_formal_parameter which is referenced by both
+     caller and the callee.  */
+
+  cu_offset param_offset;
+};
+
+struct call_site_parameter
+{
+  ENUM_BITFIELD (call_site_parameter_kind) kind : 2;
+
+  union call_site_parameter_u u;
+
+  /* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_value.  It
+     is never NULL.  */
+
+  const gdb_byte *value;
+  size_t value_size;
+
+  /* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_data_value.
+     It may be NULL if not provided by DWARF.  */
+
+  const gdb_byte *data_value;
+  size_t data_value_size;
+};
+
 /* * A place where a function gets called from, represented by
    DW_TAG_GNU_call_site.  It can be looked up from
    symtab->call_site_htab.  */
@@ -1086,15 +1151,7 @@ struct call_site
     /* * Describe DW_AT_GNU_call_site_target.  Missing attribute uses
        FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL.  */
 
-    struct
-      {
-	union field_location loc;
-
-	/* * Discriminant for union field_location.  */
-
-	ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
-      }
-    target;
+    struct call_site_target target;
 
     /* * Size of the PARAMETER array.  */
 
@@ -1107,45 +1164,7 @@ struct call_site
 
     /* * Describe DW_TAG_GNU_call_site's DW_TAG_formal_parameter.  */
 
-    struct call_site_parameter
-      {
-	ENUM_BITFIELD (call_site_parameter_kind) kind : 2;
-
-	union call_site_parameter_u
-	  {
-	    /* * DW_TAG_formal_parameter's DW_AT_location's DW_OP_regX
-	       as DWARF register number, for register passed
-	       parameters.  */
-
-	    int dwarf_reg;
-
-	    /* * Offset from the callee's frame base, for stack passed
-	       parameters.  This equals offset from the caller's stack
-	       pointer.  */
-
-	    CORE_ADDR fb_offset;
-
-	    /* * Offset relative to the start of this PER_CU to
-	       DW_TAG_formal_parameter which is referenced by both
-	       caller and the callee.  */
-
-	    cu_offset param_offset;
-	  }
-	u;
-
-	/* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_value.  It
-	   is never NULL.  */
-
-	const gdb_byte *value;
-	size_t value_size;
-
-	/* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_data_value.
-	   It may be NULL if not provided by DWARF.  */
-
-	const gdb_byte *data_value;
-	size_t data_value_size;
-      }
-    parameter[1];
+    struct call_site_parameter parameter[1];
   };
 
 /* * The default value of TYPE_CPLUS_SPECIFIC(T) points to this shared
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index f6b8289..60b5cfb 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -1010,6 +1010,19 @@ m32c_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
 \f
 /* Prologue analysis.  */
 
+enum m32c_prologue_kind
+{
+  /* This function uses a frame pointer.  */
+  prologue_with_frame_ptr,
+
+  /* This function has no frame pointer.  */
+  prologue_sans_frame_ptr,
+
+  /* This function sets up the stack, so its frame is the first
+     frame on the stack.  */
+  prologue_first_frame
+};
+
 struct m32c_prologue
 {
   /* For consistency with the DWARF 2 .debug_frame info generated by
@@ -1019,18 +1032,7 @@ struct m32c_prologue
   /* The architecture for which we generated this prologue info.  */
   struct gdbarch *arch;
 
-  enum {
-    /* This function uses a frame pointer.  */
-    prologue_with_frame_ptr,
-
-    /* This function has no frame pointer.  */
-    prologue_sans_frame_ptr,
-
-    /* This function sets up the stack, so its frame is the first
-       frame on the stack.  */
-    prologue_first_frame
-
-  } kind;
+  enum m32c_prologue_kind kind;
 
   /* If KIND is prologue_with_frame_ptr, this is the offset from the
      CFA to where the frame pointer points.  This is always zero or
@@ -1100,6 +1102,13 @@ m32c_pv_push (struct m32c_pv_state *state, pv_t value, int size)
 }
 
 
+enum srcdest_kind
+{
+  srcdest_reg,
+  srcdest_partial_reg,
+  srcdest_mem
+};
+
 /* A source or destination location for an m16c or m32c
    instruction.  */
 struct srcdest
@@ -1108,7 +1117,7 @@ struct srcdest
      If srcdest_partial_reg, the location is part of a register pointed
      to by REG.  We don't try to handle this too well.
      If srcdest_mem, the location is memory whose address is ADDR.  */
-  enum { srcdest_reg, srcdest_partial_reg, srcdest_mem } kind;
+  enum srcdest_kind kind;
   pv_t *reg, addr;
 };
 
diff --git a/gdb/main.c b/gdb/main.c
index 86804d2..0833c81 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -400,22 +400,26 @@ catch_command_errors_const (catch_command_errors_const_ftype *command,
   return handle_command_errors (e);
 }
 
-/* Arguments of --command option and its counterpart.  */
-typedef struct cmdarg {
-  /* Type of this option.  */
-  enum {
-    /* Option type -x.  */
-    CMDARG_FILE,
+/* Type of this option.  */
+enum cmdarg_kind
+{
+  /* Option type -x.  */
+  CMDARG_FILE,
 
-    /* Option type -ex.  */
-    CMDARG_COMMAND,
+  /* Option type -ex.  */
+  CMDARG_COMMAND,
 
-    /* Option type -ix.  */
-    CMDARG_INIT_FILE,
+  /* Option type -ix.  */
+  CMDARG_INIT_FILE,
     
-    /* Option type -iex.  */
-    CMDARG_INIT_COMMAND
-  } type;
+  /* Option type -iex.  */
+  CMDARG_INIT_COMMAND
+};
+
+/* Arguments of --command option and its counterpart.  */
+typedef struct cmdarg {
+  /* Type of this option.  */
+  enum cmdarg_kind type;
 
   /* Value of this option - filename or the GDB command itself.  String memory
      is not owned by this structure despite it is 'const'.  */
diff --git a/gdb/prologue-value.h b/gdb/prologue-value.h
index dfd7b33..7d3d779 100644
--- a/gdb/prologue-value.h
+++ b/gdb/prologue-value.h
@@ -19,6 +19,27 @@
 #ifndef PROLOGUE_VALUE_H
 #define PROLOGUE_VALUE_H
 
+/* What sort of value is this?  This determines the interpretation
+   of subsequent fields.  */
+enum prologue_value_kind
+{
+  /* We don't know anything about the value.  This is also used for
+     values we could have kept track of, when doing so would have
+     been too complex and we don't want to bother.  The bottom of
+     our lattice.  */
+  pvk_unknown,
+
+  /* A known constant.  K is its value.  */
+  pvk_constant,
+
+  /* The value that register REG originally had *UPON ENTRY TO THE
+     FUNCTION*, plus K.  If K is zero, this means, obviously, just
+     the value REG had upon entry to the function.  REG is a GDB
+     register number.  Before we start interpreting, we initialize
+     every register R to { pvk_register, R, 0 }.  */
+  pvk_register,
+};
+
 /* When we analyze a prologue, we're really doing 'abstract
    interpretation' or 'pseudo-evaluation': running the function's code
    in simulation, but using conservative approximations of the values
@@ -120,25 +141,7 @@ struct prologue_value {
 
   /* What sort of value is this?  This determines the interpretation
      of subsequent fields.  */
-  enum {
-
-    /* We don't know anything about the value.  This is also used for
-       values we could have kept track of, when doing so would have
-       been too complex and we don't want to bother.  The bottom of
-       our lattice.  */
-    pvk_unknown,
-
-    /* A known constant.  K is its value.  */
-    pvk_constant,
-
-    /* The value that register REG originally had *UPON ENTRY TO THE
-       FUNCTION*, plus K.  If K is zero, this means, obviously, just
-       the value REG had upon entry to the function.  REG is a GDB
-       register number.  Before we start interpreting, we initialize
-       every register R to { pvk_register, R, 0 }.  */
-    pvk_register,
-
-  } kind;
+  enum prologue_value_kind kind;
 
   /* The meanings of the following fields depend on 'kind'; see the
      comments for the specific 'kind' values.  */
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 9bd25fe..5c28d0a 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -70,12 +70,18 @@
 #define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml"
 #define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml"
 
+enum s390_abi_kind
+{
+  ABI_LINUX_S390,
+  ABI_LINUX_ZSERIES
+};
+
 /* The tdep structure.  */
 
 struct gdbarch_tdep
 {
   /* ABI version.  */
-  enum { ABI_LINUX_S390, ABI_LINUX_ZSERIES } abi;
+  enum s390_abi_kind abi;
 
   /* Pseudo register numbers.  */
   int gpr_full_regnum;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index a0e6388..03c9eb1 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -53,6 +53,24 @@
 
 extern void _initialize_stabsread (void);
 
+struct nextfield
+{
+  struct nextfield *next;
+
+  /* This is the raw visibility from the stab.  It is not checked
+     for being one of the visibilities we recognize, so code which
+     examines this field better be able to deal.  */
+  int visibility;
+
+  struct field field;
+};
+
+struct next_fnfieldlist
+{
+  struct next_fnfieldlist *next;
+  struct fn_fieldlist fn_fieldlist;
+};
+
 /* The routines that read and process a complete stabs for a C struct or 
    C++ class pass lists of data member fields and lists of member function
    fields in an instance of a field_info structure, as defined below.
@@ -61,24 +79,8 @@ extern void _initialize_stabsread (void);
 
 struct field_info
   {
-    struct nextfield
-      {
-	struct nextfield *next;
-
-	/* This is the raw visibility from the stab.  It is not checked
-	   for being one of the visibilities we recognize, so code which
-	   examines this field better be able to deal.  */
-	int visibility;
-
-	struct field field;
-      }
-     *list;
-    struct next_fnfieldlist
-      {
-	struct next_fnfieldlist *next;
-	struct fn_fieldlist fn_fieldlist;
-      }
-     *fnlist;
+    struct nextfield *list;
+    struct next_fnfieldlist *fnlist;
   };
 
 static void
diff --git a/gdb/symfile.h b/gdb/symfile.h
index c23e7c8..0feb41c 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -72,6 +72,15 @@ struct psymbol_allocation_list
   int size;
 };
 
+struct other_sections
+{
+  CORE_ADDR addr;
+  char *name;
+
+  /* SECTINDEX must be valid for associated BFD or set to -1.  */
+  int sectindex;
+};
+
 /* Define an array of addresses to accommodate non-contiguous dynamic
    loading of modules.  This is for use when entering commands, so we
    can keep track of the section names until we read the file and can
@@ -85,14 +94,7 @@ struct section_addr_info
      available.  */
   size_t num_sections;
   /* Sections whose names are file format dependent.  */
-  struct other_sections
-  {
-    CORE_ADDR addr;
-    char *name;
-
-    /* SECTINDEX must be valid for associated BFD or set to -1.  */
-    int sectindex;
-  } other[1];
+  struct other_sections other[1];
 };
 
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5302c0e..95bc53d 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -133,6 +133,39 @@ enum symbol_cache_slot_state
   SYMBOL_SLOT_FOUND
 };
 
+struct symbol_cache_slot
+{
+  enum symbol_cache_slot_state state;
+
+  /* The objfile that was current when the symbol was looked up.
+     This is only needed for global blocks, but for simplicity's sake
+     we allocate the space for both.  If data shows the extra space used
+     for static blocks is a problem, we can split things up then.
+
+     Global blocks need cache lookup to include the objfile context because
+     we need to account for gdbarch_iterate_over_objfiles_in_search_order
+     which can traverse objfiles in, effectively, any order, depending on
+     the current objfile, thus affecting which symbol is found.  Normally,
+     only the current objfile is searched first, and then the rest are
+     searched in recorded order; but putting cache lookup inside
+     gdbarch_iterate_over_objfiles_in_search_order would be awkward.
+     Instead we just make the current objfile part of the context of
+     cache lookup.  This means we can record the same symbol multiple times,
+     each with a different "current objfile" that was in effect when the
+     lookup was saved in the cache, but cache space is pretty cheap.  */
+  const struct objfile *objfile_context;
+
+  union
+  {
+    struct symbol *found;
+    struct
+    {
+      char *name;
+      domain_enum domain;
+    } not_found;
+  } value;
+};
+
 /* Symbols don't specify global vs static block.
    So keep them in separate caches.  */
 
@@ -148,38 +181,7 @@ struct block_symbol_cache
      on which to decide.  */
   unsigned int size;
 
-  struct symbol_cache_slot
-  {
-    enum symbol_cache_slot_state state;
-
-    /* The objfile that was current when the symbol was looked up.
-       This is only needed for global blocks, but for simplicity's sake
-       we allocate the space for both.  If data shows the extra space used
-       for static blocks is a problem, we can split things up then.
-
-       Global blocks need cache lookup to include the objfile context because
-       we need to account for gdbarch_iterate_over_objfiles_in_search_order
-       which can traverse objfiles in, effectively, any order, depending on
-       the current objfile, thus affecting which symbol is found.  Normally,
-       only the current objfile is searched first, and then the rest are
-       searched in recorded order; but putting cache lookup inside
-       gdbarch_iterate_over_objfiles_in_search_order would be awkward.
-       Instead we just make the current objfile part of the context of
-       cache lookup.  This means we can record the same symbol multiple times,
-       each with a different "current objfile" that was in effect when the
-       lookup was saved in the cache, but cache space is pretty cheap.  */
-    const struct objfile *objfile_context;
-
-    union
-    {
-      struct symbol *found;
-      struct
-      {
-	char *name;
-	domain_enum domain;
-      } not_found;
-    } value;
-  } symbols[1];
+  struct symbol_cache_slot symbols[1];
 };
 
 /* The symbol cache.
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 885d461..0eec6be 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -101,38 +101,40 @@ typedef struct tdesc_type_flag
 } tdesc_type_flag;
 DEF_VEC_O(tdesc_type_flag);
 
+enum tdesc_type_kind
+{
+  /* Predefined types.  */
+  TDESC_TYPE_INT8,
+  TDESC_TYPE_INT16,
+  TDESC_TYPE_INT32,
+  TDESC_TYPE_INT64,
+  TDESC_TYPE_INT128,
+  TDESC_TYPE_UINT8,
+  TDESC_TYPE_UINT16,
+  TDESC_TYPE_UINT32,
+  TDESC_TYPE_UINT64,
+  TDESC_TYPE_UINT128,
+  TDESC_TYPE_CODE_PTR,
+  TDESC_TYPE_DATA_PTR,
+  TDESC_TYPE_IEEE_SINGLE,
+  TDESC_TYPE_IEEE_DOUBLE,
+  TDESC_TYPE_ARM_FPA_EXT,
+  TDESC_TYPE_I387_EXT,
+
+  /* Types defined by a target feature.  */
+  TDESC_TYPE_VECTOR,
+  TDESC_TYPE_STRUCT,
+  TDESC_TYPE_UNION,
+  TDESC_TYPE_FLAGS
+};
+
 typedef struct tdesc_type
 {
   /* The name of this type.  */
   char *name;
 
   /* Identify the kind of this type.  */
-  enum
-  {
-    /* Predefined types.  */
-    TDESC_TYPE_INT8,
-    TDESC_TYPE_INT16,
-    TDESC_TYPE_INT32,
-    TDESC_TYPE_INT64,
-    TDESC_TYPE_INT128,
-    TDESC_TYPE_UINT8,
-    TDESC_TYPE_UINT16,
-    TDESC_TYPE_UINT32,
-    TDESC_TYPE_UINT64,
-    TDESC_TYPE_UINT128,
-    TDESC_TYPE_CODE_PTR,
-    TDESC_TYPE_DATA_PTR,
-    TDESC_TYPE_IEEE_SINGLE,
-    TDESC_TYPE_IEEE_DOUBLE,
-    TDESC_TYPE_ARM_FPA_EXT,
-    TDESC_TYPE_I387_EXT,
-
-    /* Types defined by a target feature.  */
-    TDESC_TYPE_VECTOR,
-    TDESC_TYPE_STRUCT,
-    TDESC_TYPE_UNION,
-    TDESC_TYPE_FLAGS
-  } kind;
+  enum tdesc_type_kind kind;
 
   /* Kind-specific data.  */
   union
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 8bfb4b3..f87c45d 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -145,10 +145,16 @@ enum tui_register_display_type
   TUI_GENERAL_AND_SPECIAL_REGS
 };
 
+enum tui_line_or_address_kind
+{
+  LOA_LINE,
+  LOA_ADDRESS
+};
+
 /* Structure describing source line or line address.  */
 struct tui_line_or_address
 {
-  enum { LOA_LINE, LOA_ADDRESS } loa;
+  enum tui_line_or_address_kind loa;
   union
     {
       int line_no;
diff --git a/gdb/value.c b/gdb/value.c
index 06da269..b9a45ef 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1891,6 +1891,66 @@ show_values (char *num_exp, int from_tty)
     }
 }
 \f
+enum internalvar_kind
+{
+  /* The internal variable is empty.  */
+  INTERNALVAR_VOID,
+
+  /* The value of the internal variable is provided directly as
+     a GDB value object.  */
+  INTERNALVAR_VALUE,
+
+  /* A fresh value is computed via a call-back routine on every
+     access to the internal variable.  */
+  INTERNALVAR_MAKE_VALUE,
+
+  /* The internal variable holds a GDB internal convenience function.  */
+  INTERNALVAR_FUNCTION,
+
+  /* The variable holds an integer value.  */
+  INTERNALVAR_INTEGER,
+
+  /* The variable holds a GDB-provided string.  */
+  INTERNALVAR_STRING,
+};
+
+union internalvar_data
+{
+  /* A value object used with INTERNALVAR_VALUE.  */
+  struct value *value;
+
+  /* The call-back routine used with INTERNALVAR_MAKE_VALUE.  */
+  struct
+  {
+    /* The functions to call.  */
+    const struct internalvar_funcs *functions;
+
+    /* The function's user-data.  */
+    void *data;
+  } make_value;
+
+  /* The internal function used with INTERNALVAR_FUNCTION.  */
+  struct
+  {
+    struct internal_function *function;
+    /* True if this is the canonical name for the function.  */
+    int canonical;
+  } fn;
+
+  /* An integer value used with INTERNALVAR_INTEGER.  */
+  struct
+  {
+    /* If type is non-NULL, it will be used as the type to generate
+       a value for this internal variable.  If type is NULL, a default
+       integer type for the architecture is used.  */
+    struct type *type;
+    LONGEST val;
+  } integer;
+
+  /* A string value used with INTERNALVAR_STRING.  */
+  char *string;
+};
+
 /* Internal variables.  These are variables within the debugger
    that hold values assigned by debugger commands.
    The user refers to them with a '$' prefix
@@ -1905,66 +1965,9 @@ struct internalvar
      enum internalvar_kind specifies the kind, and union internalvar_data
      provides the data associated with this particular kind.  */
 
-  enum internalvar_kind
-    {
-      /* The internal variable is empty.  */
-      INTERNALVAR_VOID,
-
-      /* The value of the internal variable is provided directly as
-	 a GDB value object.  */
-      INTERNALVAR_VALUE,
-
-      /* A fresh value is computed via a call-back routine on every
-	 access to the internal variable.  */
-      INTERNALVAR_MAKE_VALUE,
-
-      /* The internal variable holds a GDB internal convenience function.  */
-      INTERNALVAR_FUNCTION,
-
-      /* The variable holds an integer value.  */
-      INTERNALVAR_INTEGER,
-
-      /* The variable holds a GDB-provided string.  */
-      INTERNALVAR_STRING,
-
-    } kind;
+  enum internalvar_kind kind;
 
-  union internalvar_data
-    {
-      /* A value object used with INTERNALVAR_VALUE.  */
-      struct value *value;
-
-      /* The call-back routine used with INTERNALVAR_MAKE_VALUE.  */
-      struct
-        {
-	  /* The functions to call.  */
-	  const struct internalvar_funcs *functions;
-
-	  /* The function's user-data.  */
-	  void *data;
-        } make_value;
-
-      /* The internal function used with INTERNALVAR_FUNCTION.  */
-      struct
-	{
-	  struct internal_function *function;
-	  /* True if this is the canonical name for the function.  */
-	  int canonical;
-	} fn;
-
-      /* An integer value used with INTERNALVAR_INTEGER.  */
-      struct
-        {
-	  /* If type is non-NULL, it will be used as the type to generate
-	     a value for this internal variable.  If type is NULL, a default
-	     integer type for the architecture is used.  */
-	  struct type *type;
-	  LONGEST val;
-        } integer;
-
-      /* A string value used with INTERNALVAR_STRING.  */
-      char *string;
-    } u;
+  union internalvar_data u;
 };
 
 static struct internalvar *internalvars;
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 090aaca..adacaf8 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -162,6 +162,13 @@ typedef enum
 } call_abi_t;
 
 
+struct ctype_cache
+{
+  struct ctype_cache *next;
+  int size;
+  struct type *virtual_type;
+};
+
 /*  Xtensa-specific target dependencies.  */
 
 struct gdbarch_tdep
@@ -228,12 +235,7 @@ struct gdbarch_tdep
   unsigned long *gregmap;
 
   /* Cached register types.  */
-  struct ctype_cache
-    {
-      struct ctype_cache *next;
-      int size;
-      struct type *virtual_type;
-    } *type_entries;
+  struct ctype_cache *type_entries;
 };
 
 /* Macro to instantiate a gdbarch_tdep structure.  */
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 19/36] Exported const objects
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (5 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 26/36] Adjust self tests to cope with GDB built as a C++ program Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 12/36] proc-service, extern "C" Pedro Alves
                   ` (33 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

const works different in C vs C++.  In C++, a global "const" variable
has internal linkage by default, resulting in link errors like:

  ...
  extension.o: In function `get_ext_lang_defn(extension_language)':
  gdb/extension.c:126: undefined reference to `extension_language_guile'
  gdb/extension.c:124: undefined reference to `extension_language_guile'
  ...

The fix is to define exported const objects with "extern const".  But
that in C would not be a definition.  So we need to #ifdef C vs C++ in
this case.

EXPORTED_CONST comes from include/ansidecl.h, but in the
feature_to_c.sh case I think it's better to leave the script with no
dependencies.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* cp-valprint.c (vtbl_ptr_name): Use EXPORTED_CONST.
	* guile/guile.c (extension_language_guile): Use EXPORTED_CONST.
	* features/feature_to_c.sh: Tag the generated xml_builtin array
	with extern const in C++ mode.
---
 gdb/cp-valprint.c            | 2 +-
 gdb/features/feature_to_c.sh | 8 +++++++-
 gdb/guile/guile.c            | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 93f4c1b..0ddc96e 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -88,7 +88,7 @@ static void cp_print_value (struct type *, struct type *,
 
 
 /* GCC versions after 2.4.5 use this.  */
-const char vtbl_ptr_name[] = "__vtbl_ptr_type";
+EXPORTED_CONST char vtbl_ptr_name[] = "__vtbl_ptr_type";
 
 /* Return truth value for assertion that TYPE is of the type
    "pointer to virtual function".  */
diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh
index fb37a6b..35db791 100644
--- a/gdb/features/feature_to_c.sh
+++ b/gdb/features/feature_to_c.sh
@@ -63,7 +63,13 @@ for input; do
 done
 
 echo >> $output
-echo "const char *const xml_builtin[][2] = {" >> $output
+
+echo "#ifdef __cplusplus"                    >> $output
+echo "#  define EXPORTED_CONST extern const" >> $output
+echo "#else"                                 >> $output
+echo "#  define EXPORTED_CONST const"        >> $output
+echo "#endif"                                >> $output
+echo "EXPORTED_CONST char *const xml_builtin[][2] = {" >> $output
 
 for input; do
   basename=`echo $input | sed 's,.*/,,'`
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 3e0d11a..1895118 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -77,7 +77,7 @@ extern const struct extension_language_ops guile_extension_ops;
 
 /* The main struct describing GDB's interface to the Guile
    extension language.  */
-const struct extension_language_defn extension_language_guile =
+EXPORTED_CONST struct extension_language_defn extension_language_guile =
 {
   EXT_LANG_GUILE,
   "guile",
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (19 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 28/36] Move exception_none to common code, and use it Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 09/36] floatformat.h: Wrap in extern "C" Pedro Alves
                   ` (19 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Fixes this in C++ mode:

  gdb/gdbserver/tracepoint.c: In function ‘void* gdb_agent_helper_thread(void*)’:
  gdb/gdbserver/tracepoint.c:7190:47: error: cannot convert ‘sockaddr_un*’ to ‘sockaddr*’ for argument ‘2’ to ‘int accept(int, sockaddr*, socklen_t*)’
	  fd = accept (listen_fd, &sockaddr, &tmp);

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

	* tracepoint.c (gdb_agent_helper_thread): Cast 'sockaddr' to
	'struct sockaddr' pointer in 'accept' call.
---
 gdb/features/feature_to_c.sh | 0
 gdb/gdbserver/tracepoint.c   | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 mode change 100644 => 100755 gdb/features/feature_to_c.sh

diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh
old mode 100644
new mode 100755
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 9f87257..dde3597 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -7168,7 +7168,7 @@ gdb_agent_helper_thread (void *arg)
 
 	  do
 	    {
-	      fd = accept (listen_fd, &sockaddr, &tmp);
+	      fd = accept (listen_fd, (struct sockaddr *) &sockaddr, &tmp);
 	    }
 	  /* It seems an ERESTARTSYS can escape out of accept.  */
 	  while (fd == -512 || (fd == -1 && errno == EINTR));
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 15/36] Don't forward declare enum target_hw_bp_type
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (3 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 04/36] Fix struct, union, and enum nesting in C++ Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 26/36] Adjust self tests to cope with GDB built as a C++ program Pedro Alves
                   ` (35 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Can't do that in C++.

2015-02-09  Pedro Alves  <palves@redhat.com>

	* nat/x86-dregs.h (enum target_hw_bp_type): Remove forward
	declaration.
	Include break-common.h.
---
 gdb/nat/x86-dregs.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/nat/x86-dregs.h b/gdb/nat/x86-dregs.h
index ea82e62..a2b9926 100644
--- a/gdb/nat/x86-dregs.h
+++ b/gdb/nat/x86-dregs.h
@@ -32,8 +32,7 @@
 #ifndef X86_DREGS_H
 #define X86_DREGS_H 1
 
-/* Forward declaration.  */
-enum target_hw_bp_type;
+#include "break-common.h" /* target_hw_bp_type */
 
 /* Low-level function vector.  */
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 29/36] Normalize TRY_CATCH exception handling block
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (13 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 13/36] target.h: Include infrun.h Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated Pedro Alves
                   ` (25 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

This normalizes exception catch blocks that check for ex.reason to
look like this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ALL)
    {
      ...
    }
  if (ex.reason < 0)
    {
      ...
    }
~~~

This is a preparation step for running a script that converts all
TRY_CATCH uses to look like this instead:

~~~
  TRY
    {
      ...
    }
  CATCH (ex, RETURN_MASK_ALL)
    {
      ...
    }
  END_CATCH
~~~

The motivation for that change is being able to reimplent TRY/CATCH in
terms of C++ try/catch.

This commit makes it so that:

 - no condition other than ex.reason < 0 is checked in the if
   predicate

 - there's no "else" block to check whether no exception was caught

 - there's no code between the TRY_CATCH (TRY) block and the
   'if (ex.reason < 0)' block (CATCH).

 - the exception object is no longer referred to outside the if/catch
   block.  Note the local volatile exception objects that are
   currently defined inside functions that use TRY_CATCH will
   disappear.  In cases it's more convenient to still refer to the
   exception outside the catch block, a new non-volatile local is
   added and copy to that object is made within the catch block.

The following patches may make this all clearer.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
	(amd64_epilogue_frame_cache): Normal exception handling code.
	* break-catch-throw.c (check_status_exception_catchpoint)
	(re_set_exception_catchpoint): Ditto.
	* cli/cli-interp.c (safe_execute_command):
	* cli/cli-script.c (script_from_file): Ditto.
	* compile/compile-c-symbols.c (generate_c_for_for_one_variable):
	Ditto.
	* compile/compile-object-run.c (compile_object_run): Ditto.
	* cp-abi.c (baseclass_offset): Ditto.
	* cp-valprint.c (cp_print_value): Ditto.
	* exceptions.c (catch_exceptions_with_msg):
	* frame-unwind.c (frame_unwind_try_unwinder): Ditto.
	* frame.c (get_frame_address_in_block_if_available): Ditto.
	* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
	(i386_sigtramp_frame_cache): Ditto.
	* infcmd.c (post_create_inferior): Ditto.
	* linespec.c (parse_linespec, find_linespec_symbols):
	* p-valprint.c (pascal_object_print_value): Ditto.
	* parse.c (parse_expression_for_completion): Ditto.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Ditto.
	* remote.c (remote_get_noisy_reply): Ditto.
	* s390-linux-tdep.c (s390_frame_unwind_cache): Ditto.
	* solib-svr4.c (solib_svr4_r_map): Ditto.
---
 gdb/amd64-tdep.c                 | 21 ++++++++++++++------
 gdb/break-catch-throw.c          | 23 +++++++++++++---------
 gdb/cli/cli-interp.c             |  9 +++++++--
 gdb/cli/cli-script.c             |  7 +------
 gdb/compile/compile-c-symbols.c  | 22 ++++++++++-----------
 gdb/compile/compile-object-run.c | 15 ++++++++-------
 gdb/cp-abi.c                     | 18 ++++++++++--------
 gdb/cp-valprint.c                | 18 ++++++++++--------
 gdb/exceptions.c                 |  9 +++++++--
 gdb/frame-unwind.c               | 23 ++++++++++++----------
 gdb/frame.c                      | 14 ++++++++------
 gdb/i386-tdep.c                  | 21 ++++++++++++++------
 gdb/infcmd.c                     |  7 +++++--
 gdb/linespec.c                   | 17 ++++++++++++-----
 gdb/p-valprint.c                 | 14 ++++++++------
 gdb/parse.c                      |  7 ++++++-
 gdb/python/py-finishbreakpoint.c |  9 +++++++--
 gdb/remote.c                     | 41 ++++++++++++++++++++++------------------
 gdb/rs6000-tdep.c                |  7 +++++--
 gdb/s390-linux-tdep.c            |  7 +++++--
 gdb/solib-svr4.c                 |  3 ++-
 21 files changed, 192 insertions(+), 120 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index e9de0f6..51e79c7 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2480,8 +2480,11 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
     {
       amd64_frame_cache_1 (this_frame, cache);
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   return cache;
 }
@@ -2605,8 +2608,11 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   *this_cache = cache;
   return cache;
@@ -2781,8 +2787,11 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   return cache;
 }
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 2baf506..726825a 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -187,13 +187,16 @@ check_status_exception_catchpoint (struct bpstats *bs)
 	  type_name = canon;
 	}
     }
-
   if (e.reason < 0)
     exception_print (gdb_stderr, e);
-  else if (regexec (self->pattern, type_name, 0, NULL, 0) != 0)
-    bs->stop = 0;
 
-  xfree (type_name);
+  if (type_name != NULL)
+    {
+      if (regexec (self->pattern, type_name, 0, NULL, 0) != 0)
+	bs->stop = 0;
+
+      xfree (type_name);
+    }
 }
 
 /* Implement the 're_set' method.  */
@@ -227,11 +230,13 @@ re_set_exception_catchpoint (struct breakpoint *self)
 
 	  self->ops->decode_linespec (self, &spec, &sals);
 	}
-
-      /* NOT_FOUND_ERROR just means the breakpoint will be pending, so
-	 let it through.  */
-      if (ex.reason < 0 && ex.error != NOT_FOUND_ERROR)
-	throw_exception (ex);
+      if (ex.reason < 0)
+	{
+	  /* NOT_FOUND_ERROR just means the breakpoint will be
+	     pending, so let it through.  */
+	  if (ex.error != NOT_FOUND_ERROR)
+	    throw_exception (ex);
+	}
     }
 
   cleanup = make_cleanup (xfree, sals.sals);
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index d708a36..1069018 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -179,17 +179,22 @@ cli_interpreter_exec (void *data, const char *command_str)
 static struct gdb_exception
 safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
 {
-  volatile struct gdb_exception e;
+  volatile struct gdb_exception exception;
+  struct gdb_exception e = exception_none;
   struct ui_out *saved_uiout;
 
   /* Save and override the global ``struct ui_out'' builder.  */
   saved_uiout = current_uiout;
   current_uiout = command_uiout;
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY_CATCH (exception, RETURN_MASK_ALL)
     {
       execute_command (command, from_tty);
     }
+  if (exception.reason < 0)
+    {
+      e = exception;
+    }
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 65232da..4be7586 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1706,18 +1706,13 @@ script_from_file (FILE *stream, const char *file)
       {
 	read_command_file (stream);
       }
-    switch (e.reason)
+    if (e.reason < 0)
       {
-      case 0:
-	break;
-      case RETURN_ERROR:
 	/* Re-throw the error, but with the file name information
 	   prepended.  */
 	throw_error (e.error,
 		     _("%s:%d: Error in sourced command file:\n%s"),
 		     source_file_name, source_line_number, e.message);
-      default:
-	internal_error (__FILE__, __LINE__, _("bad reason"));
       }
   }
 
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 6562f05..d8d2b2f 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -689,17 +689,17 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 	}
     }
 
-  if (e.reason >= 0)
-    return;
-
-  if (compiler->symbol_err_map == NULL)
-    compiler->symbol_err_map = htab_create_alloc (10,
-						  hash_symbol_error,
-						  eq_symbol_error,
-						  del_symbol_error,
-						  xcalloc,
-						  xfree);
-  insert_symbol_error (compiler->symbol_err_map, sym, e.message);
+  if (e.reason < 0)
+    {
+      if (compiler->symbol_err_map == NULL)
+	compiler->symbol_err_map = htab_create_alloc (10,
+						      hash_symbol_error,
+						      eq_symbol_error,
+						      del_symbol_error,
+						      xcalloc,
+						      xfree);
+      insert_symbol_error (compiler->symbol_err_map, sym, e.message);
+    }
 }
 
 /* See compile-internal.h.  */
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index d34c9ed..c40de0e 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -121,18 +121,19 @@ compile_object_run (struct compile_module *module)
 				       do_module_cleanup, data);
 	}
     }
-  dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
-  if (!executed)
-    data->executedp = NULL;
-  if (ex.reason >= 0)
-    gdb_assert (!dtor_found && executed);
-  else
+  if (ex.reason < 0)
     {
-      /* In the case od DTOR_FOUND or in the case of EXECUTED nothing
+      /* In the case of DTOR_FOUND or in the case of EXECUTED nothing
 	 needs to be done.  */
+      dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
+      if (!executed)
+	data->executedp = NULL;
       gdb_assert (!(dtor_found && executed));
       if (!dtor_found && !executed)
 	do_module_cleanup (data);
       throw_exception (ex);
     }
+
+  dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
+  gdb_assert (!dtor_found && executed);
 }
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 9316c4c..70a0528 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -80,15 +80,17 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
 						embedded_offset,
 						address, val);
     }
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+
+      throw_error (NOT_AVAILABLE_ERROR,
+		   _("Cannot determine virtual baseclass offset "
+		     "of incomplete object"));
+    }
 
-  if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
-    throw_error (NOT_AVAILABLE_ERROR,
-		 _("Cannot determine virtual baseclass offset "
-		   "of incomplete object"));
-  else if (ex.reason < 0)
-    throw_exception (ex);
-  else
-    return res;
+  return res;
 }
 
 struct value *
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 0ddc96e..deb0ed8 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -481,7 +481,7 @@ cp_print_value (struct type *type, struct type *real_type,
   for (i = 0; i < n_baseclasses; i++)
     {
       int boffset = 0;
-      int skip;
+      int skip = 0;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
       const char *basename = TYPE_NAME (baseclass);
       const gdb_byte *base_valaddr = NULL;
@@ -510,14 +510,16 @@ cp_print_value (struct type *type, struct type *real_type,
 	{
 	  boffset = baseclass_offset (type, i, valaddr, offset, address, val);
 	}
-      if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
-	skip = -1;
-      else if (ex.reason < 0)
-	skip = 1;
-      else
- 	{
-	  skip = 0;
+      if (ex.reason < 0)
+	{
+	  if (ex.error == NOT_AVAILABLE_ERROR)
+	    skip = -1;
+	  else
+	    skip = 1;
+	}
 
+      if (skip == 0)
+	{
 	  if (BASETYPE_VIA_VIRTUAL (type, i))
 	    {
 	      /* The virtual base class pointer might have been
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 0ca4c56..64a653a 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -174,7 +174,8 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
 			   char **gdberrmsg,
 		  	   return_mask mask)
 {
-  volatile struct gdb_exception exception;
+  volatile struct gdb_exception ex;
+  struct gdb_exception exception = exception_none;
   volatile int val = 0;
   struct ui_out *saved_uiout;
 
@@ -182,10 +183,14 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
   saved_uiout = current_uiout;
   current_uiout = func_uiout;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY_CATCH (ex, RETURN_MASK_ALL)
     {
       val = (*func) (current_uiout, func_args);
     }
+  if (ex.reason < 0)
+    {
+      exception = ex;
+    }
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index e73650a..fcfedfd 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -105,18 +105,21 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
     {
       res = unwinder->sniffer (unwinder, this_frame, this_cache);
     }
-  if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+  if (ex.reason < 0)
     {
-      /* This usually means that not even the PC is available,
-        thus most unwinders aren't able to determine if they're
-        the best fit.  Keep trying.  Fallback prologue unwinders
-        should always accept the frame.  */
-      do_cleanups (old_cleanup);
-      return 0;
+      if (ex.error == NOT_AVAILABLE_ERROR)
+	{
+	  /* This usually means that not even the PC is available,
+	     thus most unwinders aren't able to determine if they're
+	     the best fit.  Keep trying.  Fallback prologue unwinders
+	     should always accept the frame.  */
+	  do_cleanups (old_cleanup);
+	  return 0;
+	}
+      throw_exception (ex);
     }
-  else if (ex.reason < 0)
-    throw_exception (ex);
-  else if (res)
+
+  if (res)
     {
       discard_cleanups (old_cleanup);
       return 1;
diff --git a/gdb/frame.c b/gdb/frame.c
index 6b1be94..7088f32 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2313,12 +2313,14 @@ get_frame_address_in_block_if_available (struct frame_info *this_frame,
     {
       *pc = get_frame_address_in_block (this_frame);
     }
-  if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
-    return 0;
-  else if (ex.reason < 0)
-    throw_exception (ex);
-  else
-    return 1;
+  if (ex.reason < 0)
+    {
+      if (ex.error == NOT_AVAILABLE_ERROR)
+	return 0;
+      throw_exception (ex);
+    }
+
+  return 1;
 }
 
 void
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 8c08f8b..fa3b841 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2063,8 +2063,11 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
     {
       i386_frame_cache_1 (this_frame, cache);
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   return cache;
 }
@@ -2238,8 +2241,11 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   return cache;
 }
@@ -2431,8 +2437,11 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   *this_cache = cache;
   return cache;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9a1fb8d..5fa3ae5 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -430,8 +430,11 @@ post_create_inferior (struct target_ops *target, int from_tty)
     {
       stop_pc = regcache_read_pc (get_current_regcache ());
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   if (exec_bfd)
     {
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 0d012b4..70b50a0 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2154,7 +2154,7 @@ parse_linespec (linespec_parser *parser, const char **argptr)
 {
   linespec_token token;
   struct symtabs_and_lines values;
-  volatile struct gdb_exception file_exception;
+  struct gdb_exception file_exception = exception_none;
   struct cleanup *cleanup;
 
   /* A special case to start.  It has become quite popular for
@@ -2182,7 +2182,6 @@ parse_linespec (linespec_parser *parser, const char **argptr)
 
   parser->lexer.saved_arg = *argptr;
   parser->lexer.stream = argptr;
-  file_exception.reason = 0;
 
   /* Initialize the default symtab and line offset.  */
   initialize_defaults (&PARSER_STATE (parser)->default_symtab,
@@ -2262,17 +2261,22 @@ parse_linespec (linespec_parser *parser, const char **argptr)
   if (token.type == LSTOKEN_COLON)
     {
       char *user_filename;
+      volatile struct gdb_exception ex;
 
       /* Get the current token again and extract the filename.  */
       token = linespec_lexer_lex_one (parser);
       user_filename = copy_token_string (token);
 
       /* Check if the input is a filename.  */
-      TRY_CATCH (file_exception, RETURN_MASK_ERROR)
+      TRY_CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  PARSER_RESULT (parser)->file_symtabs
 	    = symtabs_from_filename (user_filename);
 	}
+      if (ex.reason < 0)
+	{
+	  file_exception = ex;
+	}
 
       if (file_exception.reason >= 0)
 	{
@@ -3199,8 +3203,11 @@ find_linespec_symbols (struct linespec_state *state,
 
 	  /* If successful, we're done.  If NOT_FOUND_ERROR
 	     was not thrown, rethrow the exception that we did get.  */
-	  if (except.reason < 0 && except.error != NOT_FOUND_ERROR)
-	    throw_exception (except);
+	  if (except.reason < 0)
+	    {
+	      if (except.error != NOT_FOUND_ERROR)
+		throw_exception (except);
+	    }
 	}
     }
 
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index f7e2aae..043f98b 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -749,14 +749,16 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 	{
 	  boffset = baseclass_offset (type, i, valaddr, offset, address, val);
 	}
-      if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
-	skip = -1;
-      else if (ex.reason < 0)
-	skip = 1;
-      else
+      if (ex.reason < 0)
 	{
-	  skip = 0;
+	  if (ex.error == NOT_AVAILABLE_ERROR)
+	    skip = -1;
+	  else
+	    skip = 1;
+	}
 
+      if (skip == 0)
+	{
 	  /* The virtual base class pointer might have been clobbered by the
 	     user program. Make sure that it still points to a valid memory
 	     location.  */
diff --git a/gdb/parse.c b/gdb/parse.c
index af01947..09fb0b3 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1290,8 +1290,13 @@ parse_expression_for_completion (const char *string, char **name,
       parse_completion = 1;
       exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp);
     }
+  if (except.reason < 0)
+    {
+      /* Nothing, EXP remains NULL.  */
+    }
+
   parse_completion = 0;
-  if (except.reason < 0 || ! exp)
+  if (exp == NULL)
     return NULL;
 
   if (expout_tag_completion_type != TYPE_CODE_UNDEF)
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 9b5e3c7..43f6807 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -269,8 +269,13 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
             }
         }
     }
-  if (except.reason < 0
-      || !self_bpfinish->return_type || !self_bpfinish->function_value)
+  if (except.reason < 0)
+    {
+      /* Just swallow.  Either the return type or the function value
+	 remain NULL.  */
+    }
+
+  if (self_bpfinish->return_type == NULL || self_bpfinish->function_value == NULL)
     {
       /* Won't be able to compute return value.  */
       Py_XDECREF (self_bpfinish->return_type);
diff --git a/gdb/remote.c b/gdb/remote.c
index 48dfc5b..45d3bda 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -498,6 +498,7 @@ remote_get_noisy_reply (char **buf_p,
 	  char *p, *pp;
 	  int adjusted_size = 0;
 	  volatile struct gdb_exception ex;
+	  int relocated = 0;
 
 	  p = buf + strlen ("qRelocInsn:");
 	  pp = unpack_varlen_hex (p, &ul);
@@ -514,31 +515,35 @@ remote_get_noisy_reply (char **buf_p,
 	  TRY_CATCH (ex, RETURN_MASK_ALL)
 	    {
 	      gdbarch_relocate_instruction (target_gdbarch (), &to, from);
+	      relocated = 1;
 	    }
-	  if (ex.reason >= 0)
+	  if (ex.reason < 0)
+	    {
+	      if (ex.error == MEMORY_ERROR)
+		{
+		  /* Propagate memory errors silently back to the
+		     target.  The stub may have limited the range of
+		     addresses we can write to, for example.  */
+		}
+	      else
+		{
+		  /* Something unexpectedly bad happened.  Be verbose
+		     so we can tell what, and propagate the error back
+		     to the stub, so it doesn't get stuck waiting for
+		     a response.  */
+		  exception_fprintf (gdb_stderr, ex,
+				     _("warning: relocating instruction: "));
+		}
+	      putpkt ("E01");
+	    }
+
+	  if (relocated)
 	    {
 	      adjusted_size = to - org_to;
 
 	      xsnprintf (buf, *sizeof_buf, "qRelocInsn:%x", adjusted_size);
 	      putpkt (buf);
 	    }
-	  else if (ex.reason < 0 && ex.error == MEMORY_ERROR)
-	    {
-	      /* Propagate memory errors silently back to the target.
-		 The stub may have limited the range of addresses we
-		 can write to, for example.  */
-	      putpkt ("E01");
-	    }
-	  else
-	    {
-	      /* Something unexpectedly bad happened.  Be verbose so
-		 we can tell what, and propagate the error back to the
-		 stub, so it doesn't get stuck waiting for a
-		 response.  */
-	      exception_fprintf (gdb_stderr, ex,
-				 _("warning: relocating instruction: "));
-	      putpkt ("E01");
-	    }
 	}
       else if (buf[0] == 'O' && buf[1] != 'K')
 	remote_console_output (buf + 1);	/* 'O' message from stub */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 46f6e41..1e469cf 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3382,8 +3382,11 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
       trad_frame_set_value (cache->saved_regs,
 			    gdbarch_pc_regnum (gdbarch), lr);
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   return cache;
 }
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 5c28d0a..3b6c329 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -1836,8 +1836,11 @@ s390_frame_unwind_cache (struct frame_info *this_frame,
       if (!s390_prologue_frame_unwind_cache (this_frame, info))
 	s390_backchain_frame_unwind_cache (this_frame, info);
     }
-  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
-    throw_exception (ex);
+  if (ex.reason < 0)
+    {
+      if (ex.error != NOT_AVAILABLE_ERROR)
+	throw_exception (ex);
+    }
 
   return info;
 }
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 2143021..3fa8d6f 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -881,7 +881,8 @@ solib_svr4_r_map (struct svr4_info *info)
       addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
                                         ptr_type);
     }
-  exception_print (gdb_stderr, ex);
+  if (ex.reason < 0)
+    exception_print (gdb_stderr, ex);
   return addr;
 }
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 23/36] gdbarch.h: include regcache.h
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (8 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 25/36] python/python-internal.h: enum ‘ext_lang_rc’ not defined Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 08/36] elf-bfd.h: Wrap in extern "C" Pedro Alves
                   ` (30 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Building GDB in C++ mode, I got:

  src/gdb/gdbarch.h:240:149: error: invalid type in declaration before ‘;’ token
  src/gdb/gdbarch.h:240:14: error: use of enum ‘register_status’ without previous declaration
  src/gdb/gdbarch.h:241:13: error: use of enum ‘register_status’ without previous declaration
  src/gdb/gdbarch.h:241:140: error: invalid type in declaration before ‘;’ token

That's because 'enum register_status' has not been declared (and we can't
forward declare enums in C++).

gdb/ChangeLog:
2014-10-22  Pedro Alves  <palves@redhat.com>

	* gdbarch.sh: Include regcache.h.
	* gdbarch.h: Regenerate.
---
 gdb/gdbarch.h  | 2 ++
 gdb/gdbarch.sh | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index b67d9f6..28d11c5 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -64,6 +64,8 @@ struct elf_internal_linux_prpsinfo;
 struct mem_range;
 struct syscalls_info;
 
+#include "regcache.h"
+
 /* The architecture associated with the inferior through the
    connection to the target.
 
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index dde976a..b668360 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1218,6 +1218,8 @@ struct elf_internal_linux_prpsinfo;
 struct mem_range;
 struct syscalls_info;
 
+#include "regcache.h"
+
 /* The architecture associated with the inferior through the
    connection to the target.
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 22/36] Remove duplicate const
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (11 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 31/36] Split TRY_CATCH into TRY + CATCH Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 13/36] target.h: Include infrun.h Pedro Alves
                   ` (27 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

Building --enable-targets=all in C++ mode fails with:

  gdb/sparc-sol2-tdep.c:179:7: error: duplicate ‘const’
  gdb/arm-tdep.c:13878:33: error: duplicate ‘const’
  gdb/arm-tdep.c:13891:33: error: duplicate ‘const’

2014-10-22  Pedro Alves  <palves@redhat.com>

	* arm-tdep.c (decode_insn) <arm_handle_insn, thumb_handle_insn>:
	Remove duplicate const.
	* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Remove
	duplicate const.
---
 gdb/arm-tdep.c        | 4 ++--
 gdb/sparc-sol2-tdep.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 49b4c07..ce6cba2 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -13794,7 +13794,7 @@ decode_insn (insn_decode_record *arm_record, record_type_t record_type,
 {
 
   /* (Starting from numerical 0); bits 25, 26, 27 decodes type of arm instruction.  */
-  static const sti_arm_hdl_fp_t const arm_handle_insn[8] =                    
+  static const sti_arm_hdl_fp_t arm_handle_insn[8] =
   {
     arm_record_data_proc_misc_ld_str,   /* 000.  */
     arm_record_data_proc_imm,           /* 001.  */
@@ -13807,7 +13807,7 @@ decode_insn (insn_decode_record *arm_record, record_type_t record_type,
   };
 
   /* (Starting from numerical 0); bits 13,14,15 decodes type of thumb instruction.  */
-  static const sti_arm_hdl_fp_t const thumb_handle_insn[8] =
+  static const sti_arm_hdl_fp_t thumb_handle_insn[8] =
   { \
     thumb_record_shift_add_sub,        /* 000.  */
     thumb_record_add_sub_cmp_mov,      /* 001.  */
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index db297bd..1aabe76 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -223,7 +223,7 @@ static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind =
 
 /* Unglobalize NAME.  */
 
-const const char *
+const char *
 sparc_sol2_static_transform_name (const char *name)
 {
   /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop,
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 16/36] x86 Linux/ptrace: fix offsetof usage in C++ mode
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
  2015-02-09 23:20 ` [PATCH 02/36] Add --enable-build-with-cxx configure switch Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 11/36] Make functions and variables exported by the IPA be extern "C" Pedro Alves
                   ` (38 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

In C++ mode, we get:

  gdb/gdbserver/linux-x86-low.c: In function ‘void x86_linux_dr_set(ptid_t, int, long unsigned int)’:
  gdb/gdbserver/linux-x86-low.c:558:38: error: ‘regnum’ cannot appear in a constant-expression
      offsetof (struct user, u_debugreg[regnum]), value);
                                      ^
gdb/gdbserver/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* linux-x86-low.c (u_debugreg_offset): New function.
	(x86_linux_dr_get, x86_linux_dr_set): Use it.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* x86-linux-nat.c (u_debugreg_offset): New function.
	(x86_linux_dr_get, x86_linux_dr_set): Use it.
---
 gdb/gdbserver/linux-x86-low.c | 18 ++++++++++++++----
 gdb/x86-linux-nat.c           | 17 +++++++++++++----
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index eff2847..c70da3d 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -527,6 +527,18 @@ x86_breakpoint_at (CORE_ADDR pc)
   return 0;
 }
 \f
+
+/* Return the offset of REGNUM in the u_debugreg field of struct
+   user.  */
+
+static int
+u_debugreg_offset (int regnum)
+{
+  return (offsetof (struct user, u_debugreg)
+	  + sizeof (((struct user *) 0)->u_debugreg[0]) * regnum);
+}
+
+
 /* Support for debug registers.  */
 
 static unsigned long
@@ -538,8 +550,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
   tid = ptid_get_lwp (ptid);
 
   errno = 0;
-  value = ptrace (PTRACE_PEEKUSER, tid,
-		  offsetof (struct user, u_debugreg[regnum]), 0);
+  value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
   if (errno != 0)
     error ("Couldn't read debug register");
 
@@ -554,8 +565,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
   tid = ptid_get_lwp (ptid);
 
   errno = 0;
-  ptrace (PTRACE_POKEUSER, tid,
-	  offsetof (struct user, u_debugreg[regnum]), value);
+  ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);
   if (errno != 0)
     error ("Couldn't write debug register");
 }
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 9d82be2..c58c01a 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -51,6 +51,16 @@ struct arch_lwp_info
 int have_ptrace_getregset = -1;
 \f
 
+/* Return the offset of REGNUM in the u_debugreg field of struct
+   user.  */
+
+static int
+u_debugreg_offset (int regnum)
+{
+  return (offsetof (struct user, u_debugreg)
+	  + sizeof (((struct user *) 0)->u_debugreg[0]) * regnum);
+}
+
 /* Support for debug registers.  */
 
 /* Get debug register REGNUM value from only the one LWP of PTID.  */
@@ -65,8 +75,8 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
   tid = ptid_get_lwp (ptid);
 
   errno = 0;
-  value = ptrace (PTRACE_PEEKUSER, tid,
-		  offsetof (struct user, u_debugreg[regnum]), 0);
+  value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
+
   if (errno != 0)
     perror_with_name (_("Couldn't read debug register"));
 
@@ -84,8 +94,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
   tid = ptid_get_lwp (ptid);
 
   errno = 0;
-  ptrace (PTRACE_POKEUSER, tid,
-	  offsetof (struct user, u_debugreg[regnum]), value);
+  ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);
   if (errno != 0)
     perror_with_name (_("Couldn't write debug register"));
 }
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 31/36] Split TRY_CATCH into TRY + CATCH
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (10 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 08/36] elf-bfd.h: Wrap in extern "C" Pedro Alves
@ 2015-02-09 23:21 ` Pedro Alves
  2015-03-07 15:58   ` Pedro Alves
  2015-02-09 23:21 ` [PATCH 22/36] Remove duplicate const Pedro Alves
                   ` (28 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:21 UTC (permalink / raw)
  To: gdb-patches

This patch splits the TRY_CATCH macro into three, so that we go from
this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  if (ex.reason < 0)
    {
    }
~~~

to this:

~~~
  TRY
    {
    }
  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH
~~~

(This patch just converts the framework, but doesn't adjust any caller
yet.  Subsequent patches will do that.  My idea is to squash this and
the related patches into a single commit to avoid breaking bisects and
the auto testers.)

Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.

This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as an transition step.

TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:

  TRY
    {
    }

  // some code here.

  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH

Just like it isn't valid to do that with C++'s native try/catch.

By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.

END_CATCH is necessary because we name the exception object in the
CATCH block, which requires creating a scope, which in turn must be
closed somewhere.  Declaring the exception variable in the initializer
field of a for block, like:

  #define CATCH(EXCEPTION, mask) \
    for (struct gdb_exception EXCEPTION; \
         exceptions_state_mc_catch (&EXCEPTION, MASK); \
	 EXCEPTION = exception_none)

would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow declaring variables like that.

IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.

After we require C++, we can trivially sed END_CATCH away, but we'll
still need TRY/CATCH until cleanups are completely phased out --
TRY/CATCH in C++ mode will save/restore the current cleanup chain,
like in C mode, so that C++ cleanups and exceptions can coexist.

gdb/ChangeLog.
2015-02-09  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.c (struct catcher) <exception>: No
	longer a pointer to volatile exception.  Now an exception value.
	<mask>: Delete field.
	(exceptions_state_mc_init): Remove all parameters.  Adjust.
	(exceptions_state_mc): No longer pop the catcher here.
	(exceptions_state_mc_catch): New function.
	(throw_exception): Adjust.
	* common/common-exceptions.h (exceptions_state_mc_init): Remove
	all parameters.
	(exceptions_state_mc_catch): Declare.
	(TRY_CATCH): Rename to ...
	(TRY): ... this.  Remove EXCEPTION and MASK parameters.
	(CATCH, END_CATCH): New.
---
 gdb/common/common-exceptions.c | 64 +++++++++++++++++++++++-------------------
 gdb/common/common-exceptions.h | 32 +++++++++++++--------
 2 files changed, 56 insertions(+), 40 deletions(-)

diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c
index b65f259..2ad0ce1 100644
--- a/gdb/common/common-exceptions.c
+++ b/gdb/common/common-exceptions.c
@@ -46,9 +46,7 @@ struct catcher
   /* Jump buffer pointing back at the exception handler.  */
   SIGJMP_BUF buf;
   /* Status buffer belonging to the exception handler.  */
-  volatile struct gdb_exception *exception;
-  /* Saved/current state.  */
-  int mask;
+  struct gdb_exception exception;
   struct cleanup *saved_cleanup_chain;
   /* Back link.  */
   struct catcher *prev;
@@ -74,16 +72,12 @@ catcher_list_size (void)
 }
 
 SIGJMP_BUF *
-exceptions_state_mc_init (volatile struct gdb_exception *exception,
-			  return_mask mask)
+exceptions_state_mc_init (void)
 {
   struct catcher *new_catcher = XCNEW (struct catcher);
 
-  /* Start with no exception, save it's address.  */
-  *exception = exception_none;
-  new_catcher->exception = exception;
-
-  new_catcher->mask = mask;
+  /* Start with no exception.  */
+  new_catcher->exception = exception_none;
 
   /* Prevent error/quit during FUNC from calling cleanups established
      prior to here.  */
@@ -134,8 +128,7 @@ exceptions_state_mc (enum catcher_action action)
       switch (action)
 	{
 	case CATCH_ITER:
-	  /* No error/quit has occured.  Just clean up.  */
-	  catcher_pop ();
+	  /* No error/quit has occured.  */
 	  return 0;
 	case CATCH_ITER_1:
 	  current_catcher->state = CATCHER_RUNNING_1;
@@ -152,7 +145,6 @@ exceptions_state_mc (enum catcher_action action)
 	{
 	case CATCH_ITER:
 	  /* The did a "break" from the inner while loop.  */
-	  catcher_pop ();
 	  return 0;
 	case CATCH_ITER_1:
 	  current_catcher->state = CATCHER_RUNNING;
@@ -169,21 +161,10 @@ exceptions_state_mc (enum catcher_action action)
 	{
 	case CATCH_ITER:
 	  {
-	    struct gdb_exception exception = *current_catcher->exception;
-
-	    if (current_catcher->mask & RETURN_MASK (exception.reason))
-	      {
-		/* Exit normally if this catcher can handle this
-		   exception.  The caller analyses the func return
-		   values.  */
-		catcher_pop ();
-		return 0;
-	      }
-	    /* The caller didn't request that the event be caught,
-	       relay the event to the next containing
-	       catch_errors().  */
-	    catcher_pop ();
-	    throw_exception (exception);
+	    /* Exit normally if this catcher can handle this
+	       exception.  The caller analyses the func return
+	       values.  */
+	    return 0;
 	  }
 	default:
 	  internal_error (__FILE__, __LINE__, _("bad state"));
@@ -194,6 +175,31 @@ exceptions_state_mc (enum catcher_action action)
 }
 
 int
+exceptions_state_mc_catch (struct gdb_exception *exception,
+			   int mask)
+{
+  *exception = current_catcher->exception;
+  catcher_pop ();
+
+  if (exception->reason < 0)
+    {
+      if (mask & RETURN_MASK (exception->reason))
+	{
+	  /* Exit normally and let the called handle the
+	     exception.  */
+	  return 1;
+	}
+
+      /* The caller didn't request that the event be caught, relay the
+	 event to the next exception_catch/CATCH.  */
+      throw_exception (*exception);
+    }
+
+  /* No exception was thrown.  */
+  return 0;
+}
+
+int
 exceptions_state_mc_action_iter (void)
 {
   return exceptions_state_mc (CATCH_ITER);
@@ -218,7 +224,7 @@ throw_exception (struct gdb_exception exception)
      to that call via setjmp's return value.  Note that REASON can't
      be zero, by definition in defs.h.  */
   exceptions_state_mc (CATCH_THROWING);
-  *current_catcher->exception = exception;
+  current_catcher->exception = exception;
   SIGLONGJMP (current_catcher->buf, exception.reason);
 }
 
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index a32e6f9..d2c0bee 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -118,14 +118,13 @@ struct gdb_exception
 
 /* Functions to drive the exceptions state machine.  Though declared
    here by necessity, these functions should be considered internal to
-   the exceptions subsystem and not used other than via the TRY_CATCH
-   macro defined below.  */
+   the exceptions subsystem and not used other than via the TRY/CATCH
+   macros defined below.  */
 
-extern SIGJMP_BUF *exceptions_state_mc_init (volatile struct
-					     gdb_exception *exception,
-					     return_mask mask);
+extern SIGJMP_BUF *exceptions_state_mc_init (void);
 extern int exceptions_state_mc_action_iter (void);
 extern int exceptions_state_mc_action_iter_1 (void);
+extern int exceptions_state_mc_catch (struct gdb_exception *, int);
 
 /* Macro to wrap up standard try/catch behavior.
 
@@ -138,26 +137,37 @@ extern int exceptions_state_mc_action_iter_1 (void);
 
    *INDENT-OFF*
 
-   volatile struct gdb_exception e;
-   TRY_CATCH (e, RETURN_MASK_ERROR)
+   TRY
      {
      }
-   switch (e.reason)
+   CATCH (e, RETURN_MASK_ERROR)
      {
-     case RETURN_ERROR: ...
+       switch (e.reason)
+         {
+           case RETURN_ERROR: ...
+         }
      }
+   END_CATCH
 
   */
 
-#define TRY_CATCH(EXCEPTION,MASK) \
+#define TRY \
      { \
        SIGJMP_BUF *buf = \
-	 exceptions_state_mc_init (&(EXCEPTION), (MASK)); \
+	 exceptions_state_mc_init (); \
        SIGSETJMP (*buf); \
      } \
      while (exceptions_state_mc_action_iter ()) \
        while (exceptions_state_mc_action_iter_1 ())
 
+#define CATCH(EXCEPTION, MASK)				\
+  {							\
+    struct gdb_exception EXCEPTION;				\
+    if (exceptions_state_mc_catch (&(EXCEPTION), MASK))
+
+#define END_CATCH				\
+  }
+
 /* *INDENT-ON* */
 
 /* Hook to allow client-specific actions to be performed prior to
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (22 preceding siblings ...)
  2015-02-09 23:21 ` [PATCH 27/36] catch_command_errors: Remove 'mask' parameter Pedro Alves
@ 2015-02-09 23:22 ` Pedro Alves
  2015-02-09 23:22 ` [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions Pedro Alves
                   ` (16 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:22 UTC (permalink / raw)
  To: gdb-patches

Although the current TRY/CATCH implementation works in C++ mode too,
it relies on setjmp/longjmp, and longjmp bypasses calling the
destructors of objects on the stack, which is obviously bad for C++.

This patch fixes this by makes TRY/CATCH use real try/catch in C++
mode behind the scenes.  The way this is done allows RAII and cleanups
to coexist while we phase out cleanups, instead of requiring a flag
day.

This patch is not strictly necessary until we require a C++ compiler
and start actually using RAII, though I'm all for baby steps, and it
shows my proposed way forward.  I think we should put it in now, to
allow easier experimentation and exposure of potential problems with
real C++ exceptions.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.c [!__cplusplus] (enum catcher_state)
	(exceptions_state_mc_action_iter)
	(exceptions_state_mc_action_iter_1, exceptions_state_mc_catch):
	Don't define.
	[__cplusplus] (try_scope_depth): New global.
	[__cplusplus] (exception_try_scope_entry)
	(exception_try_scope_exit, gdb_exception_sliced_copy)
	(exception_rethrow): New functions.
	(throw_exception): In C++ mode, throw
	gdb_exception_RETURN_MASK_QUIT for RETURN_QUIT and
	gdb_exception_RETURN_MASK_ERROR for RETURN_ERROR.
	(throw_it): In C++ mode, use try_scope_depth.
	* common/common-exceptions.h [!__cplusplus]
	(exceptions_state_mc_action_iter)
	(exceptions_state_mc_action_iter_1, exceptions_state_mc_catch):
	Don't declare.
	[__cplusplus] (exception_try_scope_entry)
	(exception_try_scope_exit, exception_rethrow): Declare.
	[__cplusplus] (struct exception_try_scope): New struct.
	[__cplusplus] (TRY, CATCH, END_CATCH): Reimplement on top of real
	C++ exceptions.
	(struct gdb_exception_RETURN_MASK_ALL)
	(struct gdb_exception_RETURN_MASK_ERROR)
	(struct gdb_exception_RETURN_MASK_QUIT): New types.
---
 gdb/common/common-exceptions.c | 77 +++++++++++++++++++++++++++++++++++++++++-
 gdb/common/common-exceptions.h | 67 ++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c
index 2ad0ce1..b300a9d 100644
--- a/gdb/common/common-exceptions.c
+++ b/gdb/common/common-exceptions.c
@@ -22,6 +22,8 @@
 
 const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
 
+#ifndef __cplusplus
+
 /* Possible catcher states.  */
 enum catcher_state {
   /* Initial state, a new catcher has just been created.  */
@@ -185,7 +187,7 @@ exceptions_state_mc_catch (struct gdb_exception *exception,
     {
       if (mask & RETURN_MASK (exception->reason))
 	{
-	  /* Exit normally and let the called handle the
+	  /* Exit normally and let the caller handle the
 	     exception.  */
 	  return 1;
 	}
@@ -211,6 +213,56 @@ exceptions_state_mc_action_iter_1 (void)
   return exceptions_state_mc (CATCH_ITER_1);
 }
 
+#else /* !__cplusplus */
+
+/* How many nested TRY blocks we have.  See exception_messages and
+   throw_it.  */
+
+static int try_scope_depth;
+
+/* Called on entry to a TRY scope.  */
+
+void *
+exception_try_scope_entry (void)
+{
+  ++try_scope_depth;
+  return (void *) save_cleanups ();
+}
+
+/* Called on exit of a TRY scope, either normal exit or exception
+   exit.  */
+
+void
+exception_try_scope_exit (void *saved_state)
+{
+  restore_cleanups ((struct cleanup *) saved_state);
+  --try_scope_depth;
+}
+
+/* Called by the default catch block.  IOW, we'll get here before
+   jumping out to the next outermost scope an exception if a GDB
+   exception is not caught.  */
+
+void
+exception_rethrow (void)
+{
+  /* Run this scope's cleanups before re-throwing to the next
+     outermost scope.  */
+  prepare_to_throw_exception ();
+  do_cleanups (all_cleanups ());
+  throw;
+}
+
+/* Copy the 'gdb_exception' portion of FROM to TO.  */
+
+static void
+gdb_exception_sliced_copy (struct gdb_exception *to, const struct gdb_exception *from)
+{
+  *to = *from;
+}
+
+#endif /* !__cplusplus */
+
 /* Return EXCEPTION to the nearest containing catch_errors().  */
 
 void
@@ -220,12 +272,31 @@ throw_exception (struct gdb_exception exception)
 
   do_cleanups (all_cleanups ());
 
+#ifndef __cplusplus
   /* Jump to the containing catch_errors() call, communicating REASON
      to that call via setjmp's return value.  Note that REASON can't
      be zero, by definition in defs.h.  */
   exceptions_state_mc (CATCH_THROWING);
   current_catcher->exception = exception;
   SIGLONGJMP (current_catcher->buf, exception.reason);
+#else
+  if (exception.reason == RETURN_QUIT)
+    {
+      gdb_exception_RETURN_MASK_QUIT ex;
+
+      gdb_exception_sliced_copy (&ex, &exception);
+      throw ex;
+    }
+  else if (exception.reason == RETURN_ERROR)
+    {
+      gdb_exception_RETURN_MASK_ERROR ex;
+
+      gdb_exception_sliced_copy (&ex, &exception);
+      throw ex;
+    }
+  else
+    gdb_assert_not_reached ("invalid return reason");
+#endif
 }
 
 /* A stack of exception messages.
@@ -249,7 +320,11 @@ throw_it (enum return_reason reason, enum errors error, const char *fmt,
 {
   struct gdb_exception e;
   char *new_message;
+#ifndef __cplusplus
   int depth = catcher_list_size ();
+#else
+  int depth = try_scope_depth;
+#endif
 
   gdb_assert (depth > 0);
 
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index d2c0bee..2e6a6d9 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -121,10 +121,16 @@ struct gdb_exception
    the exceptions subsystem and not used other than via the TRY/CATCH
    macros defined below.  */
 
+#ifndef __cplusplus
 extern SIGJMP_BUF *exceptions_state_mc_init (void);
 extern int exceptions_state_mc_action_iter (void);
 extern int exceptions_state_mc_action_iter_1 (void);
 extern int exceptions_state_mc_catch (struct gdb_exception *, int);
+#else
+extern void *exception_try_scope_entry (void);
+extern void exception_try_scope_exit (void *saved_state);
+extern void exception_rethrow (void);
+#endif
 
 /* Macro to wrap up standard try/catch behavior.
 
@@ -151,6 +157,8 @@ extern int exceptions_state_mc_catch (struct gdb_exception *, int);
 
   */
 
+#ifndef __cplusplus
+
 #define TRY \
      { \
        SIGJMP_BUF *buf = \
@@ -168,6 +176,65 @@ extern int exceptions_state_mc_catch (struct gdb_exception *, int);
 #define END_CATCH				\
   }
 
+#else
+
+/* Prevent error/quit during TRY from calling cleanups established
+   prior to here.  This pops out the scope in either case of normal
+   exit or exception exit.  */
+struct exception_try_scope
+{
+  exception_try_scope ()
+  {
+    saved_state = exception_try_scope_entry ();
+  }
+  ~exception_try_scope ()
+  {
+    exception_try_scope_exit (saved_state);
+  }
+
+  void *saved_state;
+};
+
+/* We still need to wrap TRY/CATCH in C++ so that cleanups and C++
+   exceptions can coexist.  The TRY blocked is wrapped in a
+   do/while(0) so that break/continue within the block works the same
+   as in C.  */
+#define TRY								\
+  try									\
+    {									\
+      exception_try_scope exception_try_scope_instance;			\
+      do								\
+	{
+
+#define CATCH(EXCEPTION, MASK)						\
+	} while (0);							\
+    }								        \
+  catch (struct gdb_exception ## _ ## MASK &EXCEPTION)
+
+#define END_CATCH				\
+  catch (...)					\
+  {						\
+    exception_rethrow ();			\
+  }
+
+/* The exception types client code may catch.  They're just shims
+   around gdb_exception that add nothing but type info.  Which is used
+   is selected depending on the MASK argument passed to CATCH.  */
+
+struct gdb_exception_RETURN_MASK_ALL : public gdb_exception
+{
+};
+
+struct gdb_exception_RETURN_MASK_ERROR : public gdb_exception_RETURN_MASK_ALL
+{
+};
+
+struct gdb_exception_RETURN_MASK_QUIT : public gdb_exception_RETURN_MASK_ALL
+{
+};
+
+#endif
+
 /* *INDENT-ON* */
 
 /* Hook to allow client-specific actions to be performed prior to
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (24 preceding siblings ...)
  2015-02-09 23:22 ` [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions Pedro Alves
@ 2015-02-09 23:22 ` Pedro Alves
  2015-02-09 23:35 ` [PATCH 18/36] Rename struct lzma_stream to avoid clash with system header Pedro Alves
                   ` (14 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:22 UTC (permalink / raw)
  To: gdb-patches

This converts all TRY_CATCH callers to TRY + CATCH + END_CATCH.

This was all done with a script, no manual editing involved, but I
audited the patch to make sure things were converted as expected.

This is split from the previous patch only for review and maintanance
convencience.  I plan on merging this with the previous patch before
pushing.
---
 gdb/ada-lang.c                   |  42 ++++---
 gdb/ada-typeprint.c              |   7 +-
 gdb/ada-valprint.c               |   7 +-
 gdb/amd64-tdep.c                 |  18 +--
 gdb/break-catch-throw.c          |  22 ++--
 gdb/breakpoint.c                 |  80 +++++++------
 gdb/btrace.c                     |  18 ++-
 gdb/c-varobj.c                   |  33 ++++--
 gdb/cli/cli-interp.c             |   6 +-
 gdb/cli/cli-script.c             |  12 +-
 gdb/compile/compile-c-symbols.c  |  27 +++--
 gdb/compile/compile-object-run.c |   6 +-
 gdb/completer.c                  |  11 +-
 gdb/corelow.c                    |  19 ++--
 gdb/cp-abi.c                     |  17 +--
 gdb/cp-support.c                 |  20 +++-
 gdb/cp-valprint.c                |  21 ++--
 gdb/dwarf2-frame-tailcall.c      |   6 +-
 gdb/dwarf2-frame.c               |  17 +--
 gdb/dwarf2loc.c                  |  13 ++-
 gdb/dwarf2read.c                 |  24 ++--
 gdb/eval.c                       |  33 +++---
 gdb/event-loop.c                 |   7 +-
 gdb/event-top.c                  |  12 +-
 gdb/exceptions.c                 |  13 ++-
 gdb/f-valprint.c                 |  11 +-
 gdb/frame-unwind.c               |   6 +-
 gdb/frame.c                      |  25 ++--
 gdb/gcore.c                      |  14 ++-
 gdb/gdbserver/server.c           |  20 ++--
 gdb/gdbtypes.c                   |  20 ++--
 gdb/gnu-v3-abi.c                 |  11 +-
 gdb/guile/guile.c                |   8 +-
 gdb/guile/scm-block.c            |   9 +-
 gdb/guile/scm-breakpoint.c       |  75 ++++++++----
 gdb/guile/scm-cmd.c              |   9 +-
 gdb/guile/scm-disasm.c           |   9 +-
 gdb/guile/scm-frame.c            | 166 ++++++++++++++++++---------
 gdb/guile/scm-lazy-string.c      |  15 ++-
 gdb/guile/scm-math.c             |  36 ++++--
 gdb/guile/scm-param.c            |  17 ++-
 gdb/guile/scm-ports.c            |   9 +-
 gdb/guile/scm-pretty-print.c     |   7 +-
 gdb/guile/scm-symbol.c           |  42 +++++--
 gdb/guile/scm-symtab.c           |   9 +-
 gdb/guile/scm-type.c             | 105 +++++++++++------
 gdb/guile/scm-value.c            | 240 ++++++++++++++++++++++++++-------------
 gdb/i386-tdep.c                  |  18 +--
 gdb/inf-loop.c                   |  14 ++-
 gdb/infcall.c                    |   6 +-
 gdb/infcmd.c                     |  16 +--
 gdb/infrun.c                     |  20 ++--
 gdb/jit.c                        |  16 ++-
 gdb/linespec.c                   |  12 +-
 gdb/linux-nat.c                  |   6 +-
 gdb/linux-tdep.c                 |  11 +-
 gdb/linux-thread-db.c            |  19 ++--
 gdb/main.c                       |  16 ++-
 gdb/mi/mi-cmd-stack.c            |   7 +-
 gdb/mi/mi-interp.c               |  24 +++-
 gdb/mi/mi-main.c                 |  13 ++-
 gdb/p-valprint.c                 |   6 +-
 gdb/parse.c                      |  12 +-
 gdb/ppc-linux-tdep.c             |  10 +-
 gdb/printcmd.c                   |  40 ++++---
 gdb/python/py-arch.c             |   6 +-
 gdb/python/py-block.c            |   9 +-
 gdb/python/py-breakpoint.c       |  55 +++++----
 gdb/python/py-cmd.c              |   7 +-
 gdb/python/py-finishbreakpoint.c |  38 ++++---
 gdb/python/py-frame.c            | 158 +++++++++++++++++---------
 gdb/python/py-framefilter.c      | 134 ++++++++++++----------
 gdb/python/py-gdb-readline.c     |  10 +-
 gdb/python/py-inferior.c         |  35 ++++--
 gdb/python/py-infthread.c        |   9 +-
 gdb/python/py-lazy-string.c      |   9 +-
 gdb/python/py-linetable.c        |   9 +-
 gdb/python/py-objfile.c          |  18 ++-
 gdb/python/py-param.c            |   7 +-
 gdb/python/py-prettyprint.c      |  16 ++-
 gdb/python/py-symbol.c           |  45 +++++---
 gdb/python/py-type.c             | 147 ++++++++++++++++--------
 gdb/python/py-utils.c            |   9 +-
 gdb/python/py-value.c            | 224 ++++++++++++++++++++++++------------
 gdb/python/python.c              |  64 +++++++----
 gdb/record-btrace.c              |  67 +++++++----
 gdb/remote.c                     |  35 +++---
 gdb/rs6000-aix-tdep.c            |   7 +-
 gdb/rs6000-tdep.c                |   6 +-
 gdb/s390-linux-tdep.c            |   6 +-
 gdb/solib-dsbt.c                 |   8 +-
 gdb/solib-frv.c                  |   8 +-
 gdb/solib-ia64-hpux.c            |  20 ++--
 gdb/solib-spu.c                  |   6 +-
 gdb/solib-svr4.c                 |  19 +++-
 gdb/solib.c                      |  48 ++++----
 gdb/stack.c                      |  77 +++++++++----
 gdb/symtab.c                     |   6 +-
 gdb/target.c                     |   6 +-
 gdb/top.c                        |  37 +++---
 gdb/tracefile-tfile.c            |   6 +-
 gdb/tui/tui.c                    |   6 +-
 gdb/typeprint.c                  |  10 +-
 gdb/valops.c                     |  13 ++-
 gdb/valprint.c                   |  10 +-
 gdb/value.c                      |  11 +-
 gdb/varobj.c                     |  40 ++++---
 gdb/xml-support.c                |  12 +-
 108 files changed, 1968 insertions(+), 1125 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 04cff1e..b9887ec 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6480,7 +6480,6 @@ type_from_tag (struct value *tag)
 struct value *
 ada_tag_value_at_base_address (struct value *obj)
 {
-  volatile struct gdb_exception e;
   struct value *val;
   LONGEST offset_to_top = 0;
   struct type *ptr_type, *obj_type;
@@ -6515,13 +6514,16 @@ ada_tag_value_at_base_address (struct value *obj)
      see ada_tag_name for more details.  We do not print the error
      message for the same reason.  */
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       offset_to_top = value_as_long (value_ind (value_ptradd (val, -2)));
     }
 
-  if (e.reason < 0)
-    return obj;
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      return obj;
+    }
+  END_CATCH
 
   /* If offset is null, nothing to do.  */
 
@@ -6633,7 +6635,6 @@ ada_tag_name_from_tsd (struct value *tsd)
 const char *
 ada_tag_name (struct value *tag)
 {
-  volatile struct gdb_exception e;
   char *name = NULL;
 
   if (!ada_is_tag_type (value_type (tag)))
@@ -6648,13 +6649,17 @@ ada_tag_name (struct value *tag)
      We also do not print the error message either (which often is very
      low-level (Eg: "Cannot read memory at 0x[...]"), but instead let
      the caller print a more meaningful message if necessary.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct value *tsd = ada_get_tsd_from_tag (tag);
 
       if (tsd != NULL)
 	name = ada_tag_name_from_tsd (tsd);
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   return name;
 }
@@ -11818,19 +11823,19 @@ static CORE_ADDR
 ada_exception_name_addr (enum ada_exception_catchpoint_kind ex,
                          struct breakpoint *b)
 {
-  volatile struct gdb_exception e;
   CORE_ADDR result = 0;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       result = ada_exception_name_addr_1 (ex, b);
     }
 
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       warning (_("failed to get exception name: %s"), e.message);
       return 0;
     }
+  END_CATCH
 
   return result;
 }
@@ -11930,16 +11935,15 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
 
       if (!bl->shlib_disabled)
 	{
-	  volatile struct gdb_exception e;
 	  const char *s;
 
 	  s = cond_string;
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      exp = parse_exp_1 (&s, bl->address,
 				 block_for_pc (bl->address), 0);
 	    }
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ERROR)
 	    {
 	      warning (_("failed to reevaluate internal exception condition "
 			 "for catchpoint %d: %s"),
@@ -11952,6 +11956,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
 		 to NULL.  */
 	      exp = NULL;
 	    }
+	  END_CATCH
 	}
 
       ada_loc->excep_cond_expr = exp;
@@ -12015,7 +12020,6 @@ should_stop_exception (const struct bp_location *bl)
   struct ada_catchpoint *c = (struct ada_catchpoint *) bl->owner;
   const struct ada_catchpoint_location *ada_loc
     = (const struct ada_catchpoint_location *) bl;
-  volatile struct gdb_exception ex;
   int stop;
 
   /* With no specific exception, should always stop.  */
@@ -12030,7 +12034,7 @@ should_stop_exception (const struct bp_location *bl)
     }
 
   stop = 1;
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       struct value *mark;
 
@@ -12038,9 +12042,13 @@ should_stop_exception (const struct bp_location *bl)
       stop = value_true (evaluate_expression (ada_loc->excep_cond_expr));
       value_free_to_mark (mark);
     }
-  if (ex.reason < 0)
-    exception_fprintf (gdb_stderr, ex,
-		       _("Error in testing exception condition:\n"));
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_fprintf (gdb_stderr, ex,
+			 _("Error in testing exception condition:\n"));
+    }
+  END_CATCH
+
   return stop;
 }
 
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 6dba71b..cd481b6 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -159,19 +159,18 @@ print_range (struct type *type, struct ui_file *stream,
     case TYPE_CODE_ENUM:
       {
 	struct type *target_type;
-	volatile struct gdb_exception e;
 	LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
 
 	target_type = TYPE_TARGET_TYPE (type);
 	if (target_type == NULL)
 	  target_type = type;
 
-	TRY_CATCH (e, RETURN_MASK_ERROR)
+	TRY
 	  {
 	    lo = ada_discrete_type_low_bound (type);
 	    hi = ada_discrete_type_high_bound (type);
 	  }
-	if (e.reason < 0)
+	CATCH (e, RETURN_MASK_ERROR)
 	  {
 	    /* This can happen when the range is dynamic.  Sometimes,
 	       resolving dynamic property values requires us to have
@@ -180,6 +179,8 @@ print_range (struct type *type, struct ui_file *stream,
 	       Print the range as an unbounded range.  */
 	    fprintf_filtered (stream, "<>");
 	  }
+	END_CATCH
+
 	else
 	  {
 	    ada_print_scalar (target_type, lo, stream);
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index d5cd04f..34539de 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -1159,15 +1159,18 @@ ada_val_print (struct type *type, const gdb_byte *valaddr,
 	       const struct value *val,
 	       const struct value_print_options *options)
 {
-  volatile struct gdb_exception except;
 
   /* XXX: this catches QUIT/ctrl-c as well.  Isn't that busted?  */
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       ada_val_print_1 (type, valaddr, embedded_offset, address,
 		       stream, recurse, val, options,
 		       current_language);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 }
 
 void
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 51e79c7..4d7fe98 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2467,7 +2467,6 @@ amd64_frame_cache_1 (struct frame_info *this_frame,
 static struct amd64_frame_cache *
 amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct amd64_frame_cache *cache;
 
   if (*this_cache)
@@ -2476,15 +2475,16 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = amd64_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       amd64_frame_cache_1 (this_frame, cache);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
@@ -2583,7 +2583,6 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  volatile struct gdb_exception ex;
   struct amd64_frame_cache *cache;
   CORE_ADDR addr;
   gdb_byte buf[8];
@@ -2594,7 +2593,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
   cache = amd64_alloc_frame_cache ();
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
       cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8;
@@ -2608,11 +2607,12 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   *this_cache = cache;
   return cache;
@@ -2759,7 +2759,6 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  volatile struct gdb_exception ex;
   struct amd64_frame_cache *cache;
   gdb_byte buf[8];
 
@@ -2769,7 +2768,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = amd64_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* Cache base will be %esp plus cache->sp_offset (-8).  */
       get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
@@ -2787,11 +2786,12 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 726825a..f5616c8 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -163,7 +163,6 @@ check_status_exception_catchpoint (struct bpstats *bs)
   struct exception_catchpoint *self
     = (struct exception_catchpoint *) bs->breakpoint_at;
   char *type_name = NULL;
-  volatile struct gdb_exception e;
 
   bkpt_breakpoint_ops.check_status (bs);
   if (bs->stop == 0)
@@ -172,7 +171,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
   if (self->pattern == NULL)
     return;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct value *typeinfo_arg;
       char *canon;
@@ -187,8 +186,11 @@ check_status_exception_catchpoint (struct bpstats *bs)
 	  type_name = canon;
 	}
     }
-  if (e.reason < 0)
-    exception_print (gdb_stderr, e);
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, e);
+    }
+  END_CATCH
 
   if (type_name != NULL)
     {
@@ -206,38 +208,38 @@ re_set_exception_catchpoint (struct breakpoint *self)
 {
   struct symtabs_and_lines sals = {0};
   struct symtabs_and_lines sals_end = {0};
-  volatile struct gdb_exception e;
   struct cleanup *cleanup;
   enum exception_event_kind kind = classify_exception_breakpoint (self);
 
   /* We first try to use the probe interface.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       char *spec = ASTRDUP (exception_functions[kind].probe);
 
       sals = parse_probes (&spec, NULL);
     }
 
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
-      volatile struct gdb_exception ex;
 
       /* Using the probe interface failed.  Let's fallback to the normal
 	 catchpoint mode.  */
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  char *spec = ASTRDUP (exception_functions[kind].function);
 
 	  self->ops->decode_linespec (self, &spec, &sals);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  /* NOT_FOUND_ERROR just means the breakpoint will be
 	     pending, so let it through.  */
 	  if (ex.error != NOT_FOUND_ERROR)
 	    throw_exception (ex);
 	}
+      END_CATCH
     }
+  END_CATCH
 
   cleanup = make_cleanup (xfree, sals.sals);
   update_breakpoint_locations (self, sals, sals_end);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 006acef..67870f5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2225,25 +2225,25 @@ static struct agent_expr *
 parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
 {
   struct agent_expr *aexpr = NULL;
-  volatile struct gdb_exception ex;
 
   if (!cond)
     return NULL;
 
   /* We don't want to stop processing, so catch any errors
      that may show up.  */
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       aexpr = gen_eval_for_expr (scope, cond);
     }
 
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       /* If we got here, it means the condition could not be parsed to a valid
 	 bytecode expression and thus can't be evaluated on the target's side.
 	 It's no use iterating through the conditions.  */
       return NULL;
     }
+  END_CATCH
 
   /* We have a valid agent expression.  */
   return aexpr;
@@ -2365,7 +2365,6 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
   struct cleanup *old_cleanups = 0;
   struct expression *expr, **argvec;
   struct agent_expr *aexpr = NULL;
-  volatile struct gdb_exception ex;
   const char *cmdrest;
   const char *format_start, *format_end;
   struct format_piece *fpieces;
@@ -2424,7 +2423,7 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 
   /* We don't want to stop processing, so catch any errors
      that may show up.  */
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       aexpr = gen_printf (scope, gdbarch, 0, 0,
 			  format_start, format_end - format_start,
@@ -2433,13 +2432,14 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 
   do_cleanups (old_cleanups);
 
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       /* If we got here, it means the command could not be parsed to a valid
 	 bytecode expression and thus can't be evaluated on the target's side.
 	 It's no use iterating through the other commands.  */
       return NULL;
     }
+  END_CATCH
 
   /* We have a valid agent expression, return it.  */
   return aexpr;
@@ -2576,7 +2576,6 @@ insert_bp_location (struct bp_location *bl,
 {
   enum errors bp_err = GDB_NO_ERROR;
   const char *bp_err_message = NULL;
-  volatile struct gdb_exception e;
 
   if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
     return 0;
@@ -2679,7 +2678,7 @@ insert_bp_location (struct bp_location *bl,
 	  || !(section_is_overlay (bl->section)))
 	{
 	  /* No overlay handling: just set the breakpoint.  */
-	  TRY_CATCH (e, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      int val;
 
@@ -2687,11 +2686,12 @@ insert_bp_location (struct bp_location *bl,
 	      if (val)
 		bp_err = GENERIC_ERROR;
 	    }
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ALL)
 	    {
 	      bp_err = e.error;
 	      bp_err_message = e.message;
 	    }
+	  END_CATCH
 	}
       else
 	{
@@ -2714,7 +2714,7 @@ insert_bp_location (struct bp_location *bl,
 		  bl->overlay_target_info.reqstd_address = addr;
 
 		  /* No overlay handling: just set the breakpoint.  */
-		  TRY_CATCH (e, RETURN_MASK_ALL)
+		  TRY
 		    {
 		      int val;
 
@@ -2723,11 +2723,12 @@ insert_bp_location (struct bp_location *bl,
 		      if (val)
 			bp_err = GENERIC_ERROR;
 		    }
-		  if (e.reason < 0)
+		  CATCH (e, RETURN_MASK_ALL)
 		    {
 		      bp_err = e.error;
 		      bp_err_message = e.message;
 		    }
+		  END_CATCH
 
 		  if (bp_err != GDB_NO_ERROR)
 		    fprintf_unfiltered (tmp_error_stream,
@@ -2740,7 +2741,7 @@ insert_bp_location (struct bp_location *bl,
 	  if (section_is_mapped (bl->section))
 	    {
 	      /* Yes.  This overlay section is mapped into memory.  */
-	      TRY_CATCH (e, RETURN_MASK_ALL)
+	      TRY
 	        {
 		  int val;
 
@@ -2748,11 +2749,12 @@ insert_bp_location (struct bp_location *bl,
 		  if (val)
 		    bp_err = GENERIC_ERROR;
 	        }
-	      if (e.reason < 0)
+	      CATCH (e, RETURN_MASK_ALL)
 	        {
 		  bp_err = e.error;
 		  bp_err_message = e.message;
 	        }
+	      END_CATCH
 	    }
 	  else
 	    {
@@ -9976,7 +9978,6 @@ create_breakpoint (struct gdbarch *gdbarch,
 		   int from_tty, int enabled, int internal,
 		   unsigned flags)
 {
-  volatile struct gdb_exception e;
   char *copy_arg = NULL;
   char *addr_start = arg;
   struct linespec_result canonical;
@@ -9990,11 +9991,15 @@ create_breakpoint (struct gdbarch *gdbarch,
 
   init_linespec_result (&canonical);
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       ops->create_sals_from_address (&arg, &canonical, type_wanted,
 				     addr_start, &copy_arg);
     }
+  CATCH (e, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   /* If caller is interested in rc value from parse, set value.  */
   switch (e.reason)
@@ -11315,7 +11320,6 @@ static void
 watch_command_1 (const char *arg, int accessflag, int from_tty,
 		 int just_location, int internal)
 {
-  volatile struct gdb_exception e;
   struct breakpoint *b, *scope_breakpoint = NULL;
   struct expression *exp;
   const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
@@ -11627,17 +11631,18 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   if (!just_location)
     value_free_to_mark (mark);
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       /* Finally update the new watchpoint.  This creates the locations
 	 that should be inserted.  */
       update_watchpoint (w, 1);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ALL)
     {
       delete_breakpoint (b);
       throw_exception (e);
     }
+  END_CATCH
 
   install_breakpoint (internal, b, 1);
   do_cleanups (back_to);
@@ -12984,10 +12989,15 @@ breakpoint_retire_moribund (void)
 static void
 update_global_location_list_nothrow (enum ugll_insert_mode insert_mode)
 {
-  volatile struct gdb_exception e;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
-    update_global_location_list (insert_mode);
+  TRY
+    {
+      update_global_location_list (insert_mode);
+    }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 /* Clear BKP from a BPS.  */
@@ -14458,22 +14468,22 @@ update_breakpoint_locations (struct breakpoint *b,
       if (b->cond_string != NULL)
 	{
 	  const char *s;
-	  volatile struct gdb_exception e;
 
 	  s = b->cond_string;
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      new_loc->cond = parse_exp_1 (&s, sals.sals[i].pc,
 					   block_for_pc (sals.sals[i].pc), 
 					   0);
 	    }
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ERROR)
 	    {
 	      warning (_("failed to reevaluate condition "
 			 "for breakpoint %d: %s"), 
 		       b->number, e.message);
 	      new_loc->enabled = 0;
 	    }
+	  END_CATCH
 	}
 
       if (sals_end.nelts)
@@ -14537,16 +14547,15 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
 {
   char *s;
   struct symtabs_and_lines sals = {0};
-  volatile struct gdb_exception e;
 
   gdb_assert (b->ops != NULL);
   s = addr_string;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       b->ops->decode_linespec (b, &s, &sals);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       int not_found_and_ok = 0;
       /* For pending breakpoints, it's expected that parsing will
@@ -14575,6 +14584,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
 	  throw_exception (e);
 	}
     }
+  END_CATCH
 
   if (e.reason == 0 || e.error != NOT_FOUND_ERROR)
     {
@@ -15067,9 +15077,8 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
     {
       /* Initialize it just to avoid a GCC false warning.  */
       enum enable_state orig_enable_state = 0;
-      volatile struct gdb_exception e;
 
-      TRY_CATCH (e, RETURN_MASK_ALL)
+      TRY
 	{
 	  struct watchpoint *w = (struct watchpoint *) bpt;
 
@@ -15077,13 +15086,14 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
 	  bpt->enable_state = bp_enabled;
 	  update_watchpoint (w, 1 /* reparse */);
 	}
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ALL)
 	{
 	  bpt->enable_state = orig_enable_state;
 	  exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "),
 			     bpt->number);
 	  return;
 	}
+      END_CATCH
     }
 
   bpt->enable_state = bp_enabled;
@@ -15897,19 +15907,21 @@ save_breakpoints (char *filename, int from_tty,
 
     if (tp->type != bp_dprintf && tp->commands)
       {
-	volatile struct gdb_exception ex;	
 
 	fprintf_unfiltered (fp, "  commands\n");
 	
 	ui_out_redirect (current_uiout, fp);
-	TRY_CATCH (ex, RETURN_MASK_ALL)
+	TRY
 	  {
 	    print_command_lines (current_uiout, tp->commands->commands, 2);
 	  }
 	ui_out_redirect (current_uiout, NULL);
 
-	if (ex.reason < 0)
-	  throw_exception (ex);
+	CATCH (ex, RETURN_MASK_ALL)
+	  {
+	    throw_exception (ex);
+	  }
+	END_CATCH
 
 	fprintf_unfiltered (fp, "  end\n");
       }
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 206e692..a94ddc9 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -593,11 +593,10 @@ ftrace_update_insns (struct btrace_function *bfun,
 static enum btrace_insn_class
 ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  volatile struct gdb_exception error;
   enum btrace_insn_class iclass;
 
   iclass = BTRACE_INSN_OTHER;
-  TRY_CATCH (error, RETURN_MASK_ERROR)
+  TRY
     {
       if (gdbarch_insn_is_call (gdbarch, pc))
 	iclass = BTRACE_INSN_CALL;
@@ -606,6 +605,10 @@ ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
       else if (gdbarch_insn_is_jump (gdbarch, pc))
 	iclass = BTRACE_INSN_JUMP;
     }
+  CATCH (error, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   return iclass;
 }
@@ -642,7 +645,6 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
 
       for (;;)
 	{
-	  volatile struct gdb_exception error;
 	  struct btrace_insn insn;
 	  int size;
 
@@ -672,8 +674,14 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
 	    level = min (level, end->level);
 
 	  size = 0;
-	  TRY_CATCH (error, RETURN_MASK_ERROR)
-	    size = gdb_insn_length (gdbarch, pc);
+	  TRY
+	    {
+	      size = gdb_insn_length (gdbarch, pc);
+	    }
+	  CATCH (error, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 
 	  insn.pc = pc;
 	  insn.size = size;
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 9394d7c..fd0751f 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -91,15 +91,17 @@ adjust_value_for_child_access (struct value **value,
 	{
 	  if (value && *value)
 	    {
-	      volatile struct gdb_exception except;
 
-	      TRY_CATCH (except, RETURN_MASK_ERROR)
+	      TRY
 		{
 		  *value = value_ind (*value);
 		}
 
-	      if (except.reason < 0)
-		*value = NULL;
+	      CATCH (except, RETURN_MASK_ERROR)
+		{
+		  *value = NULL;
+		}
+	      END_CATCH
 	    }
 	  *type = target_type;
 	  if (was_ptr)
@@ -245,7 +247,6 @@ static struct value *
 value_struct_element_index (struct value *value, int type_index)
 {
   struct value *result = NULL;
-  volatile struct gdb_exception e;
   struct type *type = value_type (value);
 
   type = check_typedef (type);
@@ -253,17 +254,19 @@ value_struct_element_index (struct value *value, int type_index)
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
 	      || TYPE_CODE (type) == TYPE_CODE_UNION);
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       if (field_is_static (&TYPE_FIELD (type, type_index)))
 	result = value_static_field (type, type_index);
       else
 	result = value_primitive_field (value, 0, type_index, type);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       return NULL;
     }
+  END_CATCH
+
   else
     {
       return result;
@@ -290,7 +293,6 @@ c_describe_child (struct varobj *parent, int index,
   struct type *type = varobj_get_value_type (parent);
   char *parent_expression = NULL;
   int was_ptr;
-  volatile struct gdb_exception except;
 
   if (cname)
     *cname = NULL;
@@ -319,10 +321,14 @@ c_describe_child (struct varobj *parent, int index,
 	{
 	  int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      *cvalue = value_subscript (value, real_index);
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 	}
 
       if (ctype)
@@ -391,13 +397,16 @@ c_describe_child (struct varobj *parent, int index,
 
       if (cvalue && value)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      *cvalue = value_ind (value);
 	    }
 
-	  if (except.reason < 0)
-	    *cvalue = NULL;
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	      *cvalue = NULL;
+	    }
+	  END_CATCH
 	}
 
       /* Don't use get_target_type because it calls
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 1069018..ce43a4a 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -179,7 +179,6 @@ cli_interpreter_exec (void *data, const char *command_str)
 static struct gdb_exception
 safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
 {
-  volatile struct gdb_exception exception;
   struct gdb_exception e = exception_none;
   struct ui_out *saved_uiout;
 
@@ -187,14 +186,15 @@ safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
   saved_uiout = current_uiout;
   current_uiout = command_uiout;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       execute_command (command, from_tty);
     }
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       e = exception;
     }
+  END_CATCH
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 4be7586..434c1a7 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1111,17 +1111,17 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
 
   if (validator)
     {
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  validator ((*command)->line, closure);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  xfree (*command);
 	  throw_exception (ex);
 	}
+      END_CATCH
     }
 
   /* Nothing special.  */
@@ -1700,13 +1700,12 @@ script_from_file (FILE *stream, const char *file)
   interpreter_async = 0;
 
   {
-    volatile struct gdb_exception e;
 
-    TRY_CATCH (e, RETURN_MASK_ERROR)
+    TRY
       {
 	read_command_file (stream);
       }
-    if (e.reason < 0)
+    CATCH (e, RETURN_MASK_ERROR)
       {
 	/* Re-throw the error, but with the file name information
 	   prepended.  */
@@ -1714,6 +1713,7 @@ script_from_file (FILE *stream, const char *file)
 		     _("%s:%d: Error in sourced command file:\n%s"),
 		     source_file_name, source_line_number, e.message);
       }
+    END_CATCH
   }
 
   do_cleanups (old_cleanups);
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index d8d2b2f..d4d5d87 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -418,7 +418,6 @@ gcc_convert_symbol (void *datum,
 {
   struct compile_c_instance *context = datum;
   domain_enum domain;
-  volatile struct gdb_exception e;
   int found = 0;
 
   switch (request)
@@ -438,7 +437,7 @@ gcc_convert_symbol (void *datum,
 
   /* We can't allow exceptions to escape out of this callback.  Safest
      is to simply emit a gcc error.  */
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       struct symbol *sym;
 
@@ -461,8 +460,11 @@ gcc_convert_symbol (void *datum,
 	}
     }
 
-  if (e.reason < 0)
-    C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+    }
+  END_CATCH
 
   if (compile_debug && !found)
     fprintf_unfiltered (gdb_stdout,
@@ -478,13 +480,12 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
 		    const char *identifier)
 {
   struct compile_c_instance *context = datum;
-  volatile struct gdb_exception e;
   gcc_address result = 0;
   int found = 0;
 
   /* We can't allow exceptions to escape out of this callback.  Safest
      is to simply emit a gcc error.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct symbol *sym;
 
@@ -517,8 +518,11 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
 	}
     }
 
-  if (e.reason < 0)
-    C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+    }
+  END_CATCH
 
   if (compile_debug && !found)
     fprintf_unfiltered (gdb_stdout,
@@ -633,9 +637,8 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 				 CORE_ADDR pc,
 				 struct symbol *sym)
 {
-  volatile struct gdb_exception e;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       if (is_dynamic_type (SYMBOL_TYPE (sym)))
 	{
@@ -688,8 +691,7 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 	    }
 	}
     }
-
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       if (compiler->symbol_err_map == NULL)
 	compiler->symbol_err_map = htab_create_alloc (10,
@@ -700,6 +702,7 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 						      xfree);
       insert_symbol_error (compiler->symbol_err_map, sym, e.message);
     }
+  END_CATCH
 }
 
 /* See compile-internal.h.  */
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index c40de0e..6738aad 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -87,7 +87,6 @@ compile_object_run (struct compile_module *module)
   struct frame_id dummy_id;
   struct cleanup *cleanups;
   struct do_module_cleanup *data;
-  volatile struct gdb_exception ex;
   const char *objfile_name_s = objfile_name (module->objfile);
   int dtor_found, executed = 0;
   CORE_ADDR func_addr = module->func_addr;
@@ -101,7 +100,7 @@ compile_object_run (struct compile_module *module)
   xfree (module->source_file);
   xfree (module);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       func_val = value_from_pointer
 		 (builtin_type (target_gdbarch ())->builtin_func_ptr,
@@ -121,7 +120,7 @@ compile_object_run (struct compile_module *module)
 				       do_module_cleanup, data);
 	}
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       /* In the case of DTOR_FOUND or in the case of EXECUTED nothing
 	 needs to be done.  */
@@ -133,6 +132,7 @@ compile_object_run (struct compile_module *module)
 	do_module_cleanup (data);
       throw_exception (ex);
     }
+  END_CATCH
 
   dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
   gdb_assert (!dtor_found && executed);
diff --git a/gdb/completer.c b/gdb/completer.c
index 2a0dca9..bc8fee4 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -395,18 +395,21 @@ expression_completer (struct cmd_list_element *ignore,
   struct type *type = NULL;
   char *fieldname;
   const char *p;
-  volatile struct gdb_exception except;
   enum type_code code = TYPE_CODE_UNDEF;
 
   /* Perform a tentative parse of the expression, to see whether a
      field completion is required.  */
   fieldname = NULL;
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       type = parse_expression_for_completion (text, &fieldname, &code);
     }
-  if (except.reason < 0)
-    return NULL;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      return NULL;
+    }
+  END_CATCH
+
   if (fieldname && type)
     {
       for (;;)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index c7d4318..2c3ff88 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -278,7 +278,6 @@ core_open (const char *arg, int from_tty)
   bfd *temp_bfd;
   int scratch_chan;
   int flags;
-  volatile struct gdb_exception except;
   char *filename;
 
   target_preopen (from_tty);
@@ -411,13 +410,16 @@ core_open (const char *arg, int from_tty)
      may be a thread_stratum target loaded on top of target core by
      now.  The layer above should claim threads found in the BFD
      sections.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       target_update_thread_list ();
     }
 
-  if (except.reason < 0)
-    exception_print (gdb_stderr, except);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, except);
+    }
+  END_CATCH
 
   p = bfd_core_file_failing_command (core_bfd);
   if (p)
@@ -462,12 +464,15 @@ core_open (const char *arg, int from_tty)
      anything about threads.  That is why the test is >= 2.  */
   if (thread_count () >= 2)
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  thread_command (NULL, from_tty);
 	}
-      if (except.reason < 0)
-	exception_print (gdb_stderr, except);
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	  exception_print (gdb_stderr, except);
+	}
+      END_CATCH
     }
 }
 
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 70a0528..b8af8f0 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -69,18 +69,17 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
 		  int embedded_offset, CORE_ADDR address,
 		  const struct value *val)
 {
-  volatile struct gdb_exception ex;
   int res = 0;
 
   gdb_assert (current_cp_abi.baseclass_offset != NULL);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       res = (*current_cp_abi.baseclass_offset) (type, index, valaddr,
 						embedded_offset,
 						address, val);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
@@ -89,6 +88,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
 		   _("Cannot determine virtual baseclass offset "
 		     "of incomplete object"));
     }
+  END_CATCH
 
   return res;
 }
@@ -109,16 +109,19 @@ value_rtti_type (struct value *v, int *full,
 		 int *top, int *using_enc)
 {
   struct type *ret = NULL;
-  volatile struct gdb_exception e;
 
   if ((current_cp_abi.rtti_type) == NULL)
     return NULL;
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       ret = (*current_cp_abi.rtti_type) (v, full, top, using_enc);
     }
-  if (e.reason < 0)
-    return NULL;
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      return NULL;
+    }
+  END_CATCH
+
   return ret;
 }
 
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 260601f..9530070 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -157,7 +157,6 @@ inspect_type (struct demangle_parse_info *info,
   int i;
   char *name;
   struct symbol *sym;
-  volatile struct gdb_exception except;
 
   /* Copy the symbol's name from RET_COMP and look it up
      in the symbol table.  */
@@ -173,10 +172,14 @@ inspect_type (struct demangle_parse_info *info,
     }
 
   sym = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
   {
     sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
   }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   if (except.reason >= 0 && sym != NULL)
     {
@@ -241,18 +244,19 @@ inspect_type (struct demangle_parse_info *info,
 	    }
 
 	  buf = mem_fileopen ();
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	  {
 	    type_print (type, "", buf, -1);
 	  }
 
 	  /* If type_print threw an exception, there is little point
 	     in continuing, so just bow out gracefully.  */
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      ui_file_delete (buf);
 	      return 0;
 	    }
+	  END_CATCH
 
 	  name = ui_file_obsavestring (buf, &info->obstack, &len);
 	  ui_file_delete (buf);
@@ -447,13 +451,17 @@ replace_typedefs (struct demangle_parse_info *info,
 	  if (local_name != NULL)
 	    {
 	      struct symbol *sym;
-	      volatile struct gdb_exception except;
 
 	      sym = NULL;
-	      TRY_CATCH (except, RETURN_MASK_ALL)
+	      TRY
 		{
 		  sym = lookup_symbol (local_name, 0, VAR_DOMAIN, 0);
 		}
+	      CATCH (except, RETURN_MASK_ALL)
+		{
+		}
+	      END_CATCH
+
 	      xfree (local_name);
 
 	      if (except.reason >= 0 && sym != NULL)
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index deb0ed8..feb3a66 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -313,18 +313,21 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 		}
 	      else if (field_is_static (&TYPE_FIELD (type, i)))
 		{
-		  volatile struct gdb_exception ex;
 		  struct value *v = NULL;
 
-		  TRY_CATCH (ex, RETURN_MASK_ERROR)
+		  TRY
 		    {
 		      v = value_static_field (type, i);
 		    }
 
-		  if (ex.reason < 0)
-		    fprintf_filtered (stream,
-				      _("<error reading variable: %s>"),
-				      ex.message);
+		  CATCH (ex, RETURN_MASK_ERROR)
+		    {
+		      fprintf_filtered (stream,
+					_("<error reading variable: %s>"),
+					ex.message);
+		    }
+		  END_CATCH
+
 		  cp_print_static_field (TYPE_FIELD_TYPE (type, i),
 					 v, stream, recurse + 1,
 					 options);
@@ -486,7 +489,6 @@ cp_print_value (struct type *type, struct type *real_type,
       const char *basename = TYPE_NAME (baseclass);
       const gdb_byte *base_valaddr = NULL;
       const struct value *base_val = NULL;
-      volatile struct gdb_exception ex;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
 	{
@@ -506,17 +508,18 @@ cp_print_value (struct type *type, struct type *real_type,
       thisoffset = offset;
       thistype = real_type;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  boffset = baseclass_offset (type, i, valaddr, offset, address, val);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    skip = -1;
 	  else
 	    skip = 1;
 	}
+      END_CATCH
 
       if (skip == 0)
 	{
diff --git a/gdb/dwarf2-frame-tailcall.c b/gdb/dwarf2-frame-tailcall.c
index c99fde0..b412a5b 100644
--- a/gdb/dwarf2-frame-tailcall.c
+++ b/gdb/dwarf2-frame-tailcall.c
@@ -368,7 +368,6 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
   struct gdbarch *prev_gdbarch;
   struct call_site_chain *chain = NULL;
   struct tailcall_cache *cache;
-  volatile struct gdb_exception except;
 
   gdb_assert (*tailcall_cachep == NULL);
 
@@ -377,7 +376,7 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
   this_pc = get_frame_address_in_block (this_frame);
 
   /* Catch any unwinding errors.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       int sp_regnum;
 
@@ -397,12 +396,13 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
       prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum);
       prev_sp_p = 1;
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       if (entry_values_debug)
 	exception_print (gdb_stdout, except);
       return;
     }
+  END_CATCH
 
   /* Ambiguous unwind or unambiguous unwind verified as matching.  */
   if (chain == NULL || chain->length == 0)
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 71e3f6b..3a218e7 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1025,7 +1025,6 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct dwarf2_frame_cache *cache;
   struct dwarf2_frame_state *fs;
   struct dwarf2_fde *fde;
-  volatile struct gdb_exception ex;
   CORE_ADDR entry_pc;
   const gdb_byte *instr;
 
@@ -1102,7 +1101,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
   execute_cfa_program (fde, instr, fde->end, gdbarch,
 		       get_frame_address_in_block (this_frame), fs);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* Calculate the CFA.  */
       switch (fs->regs.cfa_how)
@@ -1126,7 +1125,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
 	  internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
 	}
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	{
@@ -1138,6 +1137,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       throw_exception (ex);
     }
+  END_CATCH
 
   /* Initialize the register state.  */
   {
@@ -2269,7 +2269,6 @@ dwarf2_build_frame_info (struct objfile *objfile)
   struct dwarf2_cie_table cie_table;
   struct dwarf2_fde_table fde_table;
   struct dwarf2_fde_table *fde_table2;
-  volatile struct gdb_exception e;
 
   cie_table.num_entries = 0;
   cie_table.entries = NULL;
@@ -2311,7 +2310,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
           if (txt)
             unit->tbase = txt->vma;
 
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      frame_ptr = unit->dwarf_frame_buffer;
 	      while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
@@ -2320,7 +2319,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 						EH_CIE_OR_FDE_TYPE_ID);
 	    }
 
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ERROR)
 	    {
 	      warning (_("skipping .eh_frame info of %s: %s"),
 		       objfile_name (objfile), e.message);
@@ -2333,6 +2332,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 		}
 	      /* The cie_table is discarded by the next if.  */
 	    }
+	  END_CATCH
 
           if (cie_table.num_entries != 0)
             {
@@ -2352,7 +2352,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
     {
       int num_old_fde_entries = fde_table.num_entries;
 
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  frame_ptr = unit->dwarf_frame_buffer;
 	  while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
@@ -2360,7 +2360,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 					    &cie_table, &fde_table,
 					    EH_CIE_OR_FDE_TYPE_ID);
 	}
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ERROR)
 	{
 	  warning (_("skipping .debug_frame info of %s: %s"),
 		   objfile_name (objfile), e.message);
@@ -2383,6 +2383,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 	  fde_table.num_entries = num_old_fde_entries;
 	  /* The cie_table is discarded by the next if.  */
 	}
+      END_CATCH
     }
 
   /* Discard the cie_table, it is no longer needed.  */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index aa569ee..e674933 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -983,14 +983,13 @@ struct call_site_chain *
 call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
 		      CORE_ADDR callee_pc)
 {
-  volatile struct gdb_exception e;
   struct call_site_chain *retval = NULL;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       retval = call_site_find_chain_1 (gdbarch, caller_pc, callee_pc);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       if (e.error == NO_ENTRY_VALUE_ERROR)
 	{
@@ -1002,6 +1001,8 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
       else
 	throw_exception (e);
     }
+  END_CATCH
+
   return retval;
 }
 
@@ -2183,7 +2184,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
   struct dwarf_expr_context *ctx;
   struct cleanup *old_chain, *value_chain;
   struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
-  volatile struct gdb_exception ex;
 
   if (byte_offset < 0)
     invalid_synthetic_pointer ();
@@ -2206,11 +2206,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
   ctx->baton = &baton;
   ctx->funcs = &dwarf_expr_ctx_funcs;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       dwarf_expr_eval (ctx, data, size);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	{
@@ -2229,6 +2229,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
       else
 	throw_exception (ex);
     }
+  END_CATCH
 
   if (ctx->num_pieces > 0)
     {
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f8eced8..0368d0a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4221,14 +4221,13 @@ dwarf2_initialize_objfile (struct objfile *objfile)
 void
 dwarf2_build_psymtabs (struct objfile *objfile)
 {
-  volatile struct gdb_exception except;
 
   if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
     {
       init_psymbol_list (objfile, 1024);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       /* This isn't really ideal: all the data we allocate on the
 	 objfile's obstack is still uselessly kept around.  However,
@@ -4238,8 +4237,11 @@ dwarf2_build_psymtabs (struct objfile *objfile)
       dwarf2_build_psymtabs_hard (objfile);
       discard_cleanups (cleanups);
     }
-  if (except.reason < 0)
-    exception_print (gdb_stderr, except);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, except);
+    }
+  END_CATCH
 }
 
 /* Return the total length of the CU described by HEADER.  */
@@ -23158,16 +23160,18 @@ save_gdb_index_command (char *arg, int from_tty)
     dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
     if (dwarf2_per_objfile)
       {
-	volatile struct gdb_exception except;
 
-	TRY_CATCH (except, RETURN_MASK_ERROR)
+	TRY
 	  {
 	    write_psymtabs_to_index (objfile, arg);
 	  }
-	if (except.reason < 0)
-	  exception_fprintf (gdb_stderr, except,
-			     _("Error while writing index for `%s': "),
-			     objfile_name (objfile));
+	CATCH (except, RETURN_MASK_ERROR)
+	  {
+	    exception_fprintf (gdb_stderr, except,
+			       _("Error while writing index for `%s': "),
+			       objfile_name (objfile));
+	  }
+	END_CATCH
       }
   }
 }
diff --git a/gdb/eval.c b/gdb/eval.c
index bb2a0da..9804a97 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -212,7 +212,6 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 		    int preserve_errors)
 {
   struct value *mark, *new_mark, *result;
-  volatile struct gdb_exception ex;
 
   *valp = NULL;
   if (resultp)
@@ -224,11 +223,11 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
   mark = value_mark ();
   result = NULL;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       result = evaluate_subexp (NULL_TYPE, exp, pc, EVAL_NORMAL);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       /* Ignore memory errors if we want watchpoints pointing at
 	 inaccessible memory to still be created; otherwise, throw the
@@ -243,6 +242,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 	  break;
 	}
     }
+  END_CATCH
 
   new_mark = value_mark ();
   if (mark == new_mark)
@@ -258,13 +258,16 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 	*valp = result;
       else
 	{
-	  volatile struct gdb_exception except;
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      value_fetch_lazy (result);
 	      *valp = result;
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 	}
     }
 
@@ -762,16 +765,15 @@ evaluate_subexp_standard (struct type *expect_type,
 	 or reference to a base class and print object is on.  */
 
       {
-	volatile struct gdb_exception except;
 	struct value *ret = NULL;
 
-	TRY_CATCH (except, RETURN_MASK_ERROR)
+	TRY
 	  {
 	    ret = value_of_variable (exp->elts[pc + 2].symbol,
 				     exp->elts[pc + 1].block);
 	  }
 
-	if (except.reason < 0)
+	CATCH (except, RETURN_MASK_ERROR)
 	  {
 	    if (noside == EVAL_AVOID_SIDE_EFFECTS)
 	      ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
@@ -779,6 +781,7 @@ evaluate_subexp_standard (struct type *expect_type,
 	    else
 	      throw_exception (except);
 	  }
+	END_CATCH
 
 	return ret;
       }
@@ -1446,20 +1449,21 @@ evaluate_subexp_standard (struct type *expect_type,
 	         operator and continue evaluation.  */
 	      while (unop_user_defined_p (op, arg2))
 		{
-		  volatile struct gdb_exception except;
 		  struct value *value = NULL;
-		  TRY_CATCH (except, RETURN_MASK_ERROR)
+		  TRY
 		    {
 		      value = value_x_unop (arg2, op, noside);
 		    }
 
-		  if (except.reason < 0)
+		  CATCH (except, RETURN_MASK_ERROR)
 		    {
 		      if (except.error == NOT_FOUND_ERROR)
 			break;
 		      else
 			throw_exception (except);
 		    }
+		  END_CATCH
+
 		  arg2 = value;
 		}
 	    }
@@ -1863,20 +1867,21 @@ evaluate_subexp_standard (struct type *expect_type,
          arg1 with the value returned by evaluating operator->().  */
       while (unop_user_defined_p (op, arg1))
 	{
-	  volatile struct gdb_exception except;
 	  struct value *value = NULL;
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      value = value_x_unop (arg1, op, noside);
 	    }
 
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      if (except.error == NOT_FOUND_ERROR)
 		break;
 	      else
 		throw_exception (except);
 	    }
+	  END_CATCH
+
 	  arg1 = value;
 	}
 
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index a2b41a7..79e41fd 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -326,14 +326,13 @@ start_event_loop (void)
      processes it.  */
   while (1)
     {
-      volatile struct gdb_exception ex;
       int result = 0;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  result = gdb_do_one_event ();
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  exception_print (gdb_stderr, ex);
 
@@ -356,6 +355,8 @@ start_event_loop (void)
 	  /* Maybe better to set a flag to be checked somewhere as to
 	     whether display the prompt or not.  */
 	}
+      END_CATCH
+
       if (result < 0)
 	break;
     }
diff --git a/gdb/event-top.c b/gdb/event-top.c
index bbda5dc..e9cc2d7 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -935,24 +935,28 @@ handle_sighup (int sig)
 static void
 async_disconnect (gdb_client_data arg)
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       quit_cover ();
     }
 
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       fputs_filtered ("Could not kill the program being debugged",
 		      gdb_stderr);
       exception_print (gdb_stderr, exception);
     }
+  END_CATCH
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       pop_all_targets ();
     }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   signal (SIGHUP, SIG_DFL);	/*FIXME: ???????????  */
   raise (SIGHUP);
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 64a653a..ba97ad5 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -174,7 +174,6 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
 			   char **gdberrmsg,
 		  	   return_mask mask)
 {
-  volatile struct gdb_exception ex;
   struct gdb_exception exception = exception_none;
   volatile int val = 0;
   struct ui_out *saved_uiout;
@@ -183,14 +182,15 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
   saved_uiout = current_uiout;
   current_uiout = func_uiout;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       val = (*func) (current_uiout, func_args);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       exception = ex;
     }
+  END_CATCH
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
@@ -229,16 +229,19 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
 	      return_mask mask)
 {
   volatile int val = 0;
-  volatile struct gdb_exception exception;
   struct ui_out *saved_uiout;
 
   /* Save the global ``struct ui_out'' builder.  */
   saved_uiout = current_uiout;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       val = func (func_args);
     }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index c2aca71..e841edf 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -443,19 +443,22 @@ info_common_command_for_block (const struct block *block, const char *comname,
 	for (index = 0; index < common->n_entries; index++)
 	  {
 	    struct value *val = NULL;
-	    volatile struct gdb_exception except;
 
 	    printf_filtered ("%s = ",
 			     SYMBOL_PRINT_NAME (common->contents[index]));
 
-	    TRY_CATCH (except, RETURN_MASK_ERROR)
+	    TRY
 	      {
 		val = value_of_variable (common->contents[index], block);
 		value_print (val, gdb_stdout, &opts);
 	      }
 
-	    if (except.reason < 0)
-	      printf_filtered ("<error reading variable: %s>", except.message);
+	    CATCH (except, RETURN_MASK_ERROR)
+	      {
+		printf_filtered ("<error reading variable: %s>", except.message);
+	      }
+	    END_CATCH
+
 	    putchar_filtered ('\n');
 	  }
       }
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index fcfedfd..bba1ae7 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -96,16 +96,15 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
                           const struct frame_unwind *unwinder)
 {
   struct cleanup *old_cleanup;
-  volatile struct gdb_exception ex;
   int res = 0;
 
   old_cleanup = frame_prepare_for_sniffer (this_frame, unwinder);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       res = unwinder->sniffer (unwinder, this_frame, this_cache);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	{
@@ -118,6 +117,7 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
 	}
       throw_exception (ex);
     }
+  END_CATCH
 
   if (res)
     {
diff --git a/gdb/frame.c b/gdb/frame.c
index 7088f32..a9d8c3f 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -784,7 +784,6 @@ frame_unwind_pc (struct frame_info *this_frame)
     {
       if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
 	{
-	  volatile struct gdb_exception ex;
 	  struct gdbarch *prev_gdbarch;
 	  CORE_ADDR pc = 0;
 
@@ -806,11 +805,11 @@ frame_unwind_pc (struct frame_info *this_frame)
 	     different ways that a PC could be unwound.  */
 	  prev_gdbarch = frame_unwind_arch (this_frame);
 
-	  TRY_CATCH (ex, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
 	    }
-	  if (ex.reason < 0)
+	  CATCH (ex, RETURN_MASK_ERROR)
 	    {
 	      if (ex.error == NOT_AVAILABLE_ERROR)
 		{
@@ -835,6 +834,8 @@ frame_unwind_pc (struct frame_info *this_frame)
 	      else
 		throw_exception (ex);
 	    }
+	  END_CATCH
+
 	  else
 	    {
 	      this_frame->prev_pc.value = pc;
@@ -1963,14 +1964,13 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
 struct frame_info *
 get_prev_frame_always (struct frame_info *this_frame)
 {
-  volatile struct gdb_exception ex;
   struct frame_info *prev_frame = NULL;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       prev_frame = get_prev_frame_always_1 (this_frame);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == MEMORY_ERROR)
 	{
@@ -1994,6 +1994,7 @@ get_prev_frame_always (struct frame_info *this_frame)
       else
 	throw_exception (ex);
     }
+  END_CATCH
 
   return prev_frame;
 }
@@ -2222,21 +2223,21 @@ get_frame_pc (struct frame_info *frame)
 int
 get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
 {
-  volatile struct gdb_exception ex;
 
   gdb_assert (frame->next != NULL);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       *pc = frame_unwind_pc (frame->next);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	return 0;
       else
 	throw_exception (ex);
     }
+  END_CATCH
 
   return 1;
 }
@@ -2307,18 +2308,18 @@ int
 get_frame_address_in_block_if_available (struct frame_info *this_frame,
 					 CORE_ADDR *pc)
 {
-  volatile struct gdb_exception ex;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       *pc = get_frame_address_in_block (this_frame);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	return 0;
       throw_exception (ex);
     }
+  END_CATCH
 
   return 1;
 }
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 1ebff2a..8ab386f 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -114,17 +114,21 @@ write_gcore_file_1 (bfd *obfd)
 void
 write_gcore_file (bfd *obfd)
 {
-  volatile struct gdb_exception except;
 
   target_prepare_to_generate_core ();
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    write_gcore_file_1 (obfd);
+  TRY
+    {
+      write_gcore_file_1 (obfd);
+    }
 
   target_done_generating_core ();
 
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 }
 
 static void
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 156fcc8..ec783ca 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -3124,19 +3124,19 @@ static int exit_code;
 static void
 detach_or_kill_for_exit_cleanup (void *ignore)
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       detach_or_kill_for_exit ();
     }
 
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       fflush (stdout);
       fprintf (stderr, "Detach or kill failed: %s\n", exception.message);
       exit_code = 1;
     }
+  END_CATCH
 }
 
 /* Main function.  This is called by the real "main" function,
@@ -3369,7 +3369,6 @@ captured_main (int argc, char *argv[])
 
   while (1)
     {
-      volatile struct gdb_exception exception;
 
       noack_mode = 0;
       multi_process = 0;
@@ -3379,7 +3378,7 @@ captured_main (int argc, char *argv[])
 
       remote_open (port);
 
-      TRY_CATCH (exception, RETURN_MASK_ERROR)
+      TRY
 	{
 	  /* Wait for events.  This will return when all event sources
 	     are removed from the event loop.  */
@@ -3432,6 +3431,10 @@ captured_main (int argc, char *argv[])
 		}
 	    }
 	}
+      CATCH (exception, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
 
       if (exception.reason == RETURN_ERROR)
 	{
@@ -3449,12 +3452,15 @@ captured_main (int argc, char *argv[])
 int
 main (int argc, char *argv[])
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       captured_main (argc, argv);
     }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   /* captured_main should never return.  */
   gdb_assert (exception.reason < 0);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 46be7a5..54130b6 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2291,20 +2291,22 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
 {
   struct ui_file *saved_gdb_stderr;
   struct type *type = NULL; /* Initialize to keep gcc happy.  */
-  volatile struct gdb_exception except;
 
   /* Suppress error messages.  */
   saved_gdb_stderr = gdb_stderr;
   gdb_stderr = ui_file_new ();
 
   /* Call parse_and_eval_type() without fear of longjmp()s.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       type = parse_and_eval_type (p, length);
     }
 
-  if (except.reason < 0)
-    type = builtin_type (gdbarch)->builtin_void;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      type = builtin_type (gdbarch)->builtin_void;
+    }
+  END_CATCH
 
   /* Stop suppressing error messages.  */
   ui_file_delete (gdb_stderr);
@@ -3227,7 +3229,6 @@ check_types_worklist (VEC (type_equality_entry_d) **worklist,
 int
 types_deeply_equal (struct type *type1, struct type *type2)
 {
-  volatile struct gdb_exception except;
   int result = 0;
   struct bcache *cache;
   VEC (type_equality_entry_d) *worklist = NULL;
@@ -3245,7 +3246,7 @@ types_deeply_equal (struct type *type1, struct type *type2)
   entry.type2 = type2;
   VEC_safe_push (type_equality_entry_d, worklist, &entry);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = check_types_worklist (&worklist, cache);
     }
@@ -3256,8 +3257,11 @@ types_deeply_equal (struct type *type1, struct type *type2)
   bcache_xfree (cache);
   VEC_free (type_equality_entry_d, worklist);
   /* Rethrow if there was a problem.  */
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 
   return result;
 }
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index f65b4ec..2677716 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -904,7 +904,6 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
       /* Initialize it just to avoid a GCC false warning.  */
       CORE_ADDR addr = 0;
       struct value *vfn;
-      volatile struct gdb_exception ex;
 
       printf_filtered ("[%d]: ", i);
 
@@ -915,12 +914,16 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
       if (gdbarch_vtable_function_descriptors (gdbarch))
 	vfn = value_addr (vfn);
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  addr = value_as_address (vfn);
 	}
-      if (ex.reason < 0)
-	printf_filtered (_("<error: %s>"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  printf_filtered (_("<error: %s>"), ex.message);
+	}
+      END_CATCH
+
       else
 	print_function_pointer_address (opts, gdbarch, addr, gdb_stdout);
       printf_filtered ("\n");
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 1895118..03ae53a 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -310,7 +310,6 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
 {
   int from_tty_arg_pos = -1, to_string_arg_pos = -1;
   int from_tty = 0, to_string = 0;
-  volatile struct gdb_exception except;
   const SCM keywords[] = { from_tty_keyword, to_string_keyword, SCM_BOOL_F };
   char *command;
   char *result = NULL;
@@ -325,7 +324,7 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
      executed.  */
   cleanups = make_cleanup (xfree, command);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *inner_cleanups;
 
@@ -346,6 +345,11 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
 
       do_cleanups (inner_cleanups);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 36c14da..50dc6c7 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -678,18 +678,21 @@ gdbscm_lookup_block (SCM pc_scm)
   CORE_ADDR pc;
   const struct block *block = NULL;
   struct compunit_symtab *cust = NULL;
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       cust = find_pc_compunit_symtab (pc);
 
       if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
 	block = block_for_pc (pc);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
     {
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index c1f9f91..f438e01 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -407,7 +407,6 @@ gdbscm_register_breakpoint_x (SCM self)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
   /* We only support registering breakpoints created with make-breakpoint.  */
   if (!bp_smob->is_scheme_bkpt)
@@ -418,7 +417,7 @@ gdbscm_register_breakpoint_x (SCM self)
 
   pending_breakpoint_scm = self;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       char *location = bp_smob->spec.location;
       int internal = bp_smob->spec.is_internal;
@@ -455,6 +454,11 @@ gdbscm_register_breakpoint_x (SCM self)
 	  gdb_assert_not_reached ("invalid breakpoint type");
 	}
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   /* Ensure this gets reset, even if there's an error.  */
   pending_breakpoint_scm = SCM_BOOL_F;
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -473,13 +477,16 @@ gdbscm_delete_breakpoint_x (SCM self)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       delete_breakpoint (bp_smob->bp);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -565,19 +572,22 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
 		   _("boolean"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (gdbscm_is_true (newvalue))
 	enable_breakpoint (bp_smob->bp);
       else
 	disable_breakpoint (bp_smob->bp);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -600,16 +610,19 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
 		   _("boolean"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       breakpoint_set_silent (bp_smob->bp, gdbscm_is_true (newvalue));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -634,7 +647,6 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   long value;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX),
 		   newvalue, SCM_ARG2, FUNC_NAME, _("integer"));
@@ -643,11 +655,15 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
   if (value < 0)
     value = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_ignore_count (bp_smob->number, (int) value, 0);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -755,17 +771,20 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   long id;
   int valid_id = 0;
-  volatile struct gdb_exception except;
 
   if (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX))
     {
       id = scm_to_long (newvalue);
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  valid_id = valid_task_id (id);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (! valid_id)
 	{
@@ -778,11 +797,15 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
   else
     SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       breakpoint_set_task (bp_smob->bp, id);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -855,7 +878,6 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   char *exp;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue),
 		   newvalue, SCM_ARG2, FUNC_NAME,
@@ -866,10 +888,15 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
   else
     exp = gdbscm_scm_to_c_string (newvalue);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_breakpoint_condition (bp_smob->bp, exp ? exp : "", 0);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   xfree (exp);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -936,7 +963,6 @@ gdbscm_breakpoint_commands (SCM self)
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct breakpoint *bp;
   long length;
-  volatile struct gdb_exception except;
   struct ui_file *string_file;
   struct cleanup *chain;
   SCM result;
@@ -951,16 +977,17 @@ gdbscm_breakpoint_commands (SCM self)
   chain = make_cleanup_ui_file_delete (string_file);
 
   ui_out_redirect (current_uiout, string_file);
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
   ui_out_redirect (current_uiout, NULL);
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       do_cleanups (chain);
       gdbscm_throw_gdb_exception (except);
     }
+  END_CATCH
 
   cmdstr = ui_file_xstrdup (string_file, &length);
   make_cleanup (xfree, cmdstr);
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 7c6d010..c870fcc 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -762,7 +762,6 @@ gdbscm_register_command_x (SCM self)
   char *cmd_name, *pfx_name;
   struct cmd_list_element **cmd_list;
   struct cmd_list_element *cmd = NULL;
-  volatile struct gdb_exception except;
 
   if (cmdscm_is_valid (c_smob))
     scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL);
@@ -772,7 +771,7 @@ gdbscm_register_command_x (SCM self)
   c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
   xfree (cmd_name);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (c_smob->is_prefix)
 	{
@@ -790,7 +789,11 @@ gdbscm_register_command_x (SCM self)
 			 NULL, c_smob->doc, cmd_list);
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Note: At this point the command exists in gdb.
      So no more errors after this point.  */
diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
index 5ae7075..782d915 100644
--- a/gdb/guile/scm-disasm.c
+++ b/gdb/guile/scm-disasm.c
@@ -283,9 +283,8 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
       char *as = NULL;
       struct ui_file *memfile = mem_fileopen ();
       struct cleanup *cleanups = make_cleanup_ui_file_delete (memfile);
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (using_port)
 	    {
@@ -295,7 +294,11 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
 	  else
 	    insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+	}
+      END_CATCH
 
       as = ui_file_xstrdup (memfile, NULL);
 
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index a30c093..09f79b6 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -220,7 +220,6 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
   SCM f_scm;
   htab_t htab;
   eqable_gdb_smob **slot;
-  volatile struct gdb_exception except;
   struct frame_id frame_id = null_frame_id;
   struct gdbarch *gdbarch = NULL;
   int frame_id_is_next = 0;
@@ -234,7 +233,7 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
   if (*slot != NULL)
     return (*slot)->containing_scm;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Try to get the previous frame, to determine if this is the last frame
 	 in a corrupt stack.  If so, we need to store the frame_id of the next
@@ -253,8 +252,11 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
 	}
       gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
-    return gdbscm_scm_from_gdb_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      return gdbscm_scm_from_gdb_exception (except);
+    }
+  END_CATCH
 
   f_scm = frscm_make_frame_smob ();
   f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);
@@ -396,15 +398,18 @@ gdbscm_frame_valid_p (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (frame != NULL);
 }
@@ -421,18 +426,21 @@ gdbscm_frame_name (SCM self)
   enum language lang = language_minimal;
   struct frame_info *frame = NULL;
   SCM result;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	find_frame_funname (frame, &name, &lang, NULL);
     }
-  if (except.reason < 0)
-    xfree (name);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      xfree (name);
+    }
+  END_CATCH
+
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
   if (frame == NULL)
@@ -461,17 +469,20 @@ gdbscm_frame_type (SCM self)
   frame_smob *f_smob;
   enum frame_type type = NORMAL_FRAME;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	type = get_frame_type (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -490,15 +501,18 @@ gdbscm_frame_arch (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -517,16 +531,19 @@ gdbscm_frame_unwind_stop_reason (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
   enum unwind_stop_reason stop_reason;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -548,17 +565,20 @@ gdbscm_frame_pc (SCM self)
   frame_smob *f_smob;
   CORE_ADDR pc = 0;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	pc = get_frame_pc (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -578,17 +598,20 @@ gdbscm_frame_block (SCM self)
   frame_smob *f_smob;
   const struct block *block = NULL, *fn_block;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	block = get_frame_block (frame, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -626,17 +649,20 @@ gdbscm_frame_function (SCM self)
   frame_smob *f_smob;
   struct symbol *sym = NULL;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	sym = find_pc_function (get_frame_address_in_block (frame));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -660,17 +686,20 @@ gdbscm_frame_older (SCM self)
   frame_smob *f_smob;
   struct frame_info *prev = NULL;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	prev = get_prev_frame (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -694,17 +723,20 @@ gdbscm_frame_newer (SCM self)
   frame_smob *f_smob;
   struct frame_info *next = NULL;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	next = get_next_frame (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -727,17 +759,20 @@ gdbscm_frame_sal (SCM self)
   frame_smob *f_smob;
   struct symtab_and_line sal;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	find_frame_sal (frame, &sal);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -767,15 +802,18 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
   struct frame_info *frame = NULL;
   struct symbol *var = NULL;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -797,7 +835,6 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
       char *var_name;
       const struct block *block = NULL;
       struct cleanup *cleanup;
-      volatile struct gdb_exception except;
 
       if (! SCM_UNBNDP (block_scm))
 	{
@@ -815,14 +852,18 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
       /* N.B. Between here and the call to do_cleanups, don't do anything
 	 to cause a Scheme exception without performing the cleanup.  */
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (block == NULL)
 	    block = get_frame_block (frame, NULL);
 	  var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
 	}
-      if (except.reason < 0)
-	do_cleanups (cleanup);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  do_cleanups (cleanup);
+	}
+      END_CATCH
+
       GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
       if (var == NULL)
@@ -841,11 +882,15 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
 		       _("gdb:symbol or string"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = read_var_value (var, frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (value);
 }
@@ -858,17 +903,20 @@ gdbscm_frame_select (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	select_frame (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -886,13 +934,16 @@ static SCM
 gdbscm_newest_frame (void)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_current_frame ();
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frscm_scm_from_frame_unsafe (frame, current_inferior ());
 }
@@ -904,13 +955,16 @@ static SCM
 gdbscm_selected_frame (void)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_selected_frame (_("No frame is currently selected"));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frscm_scm_from_frame_unsafe (frame, current_inferior ());
 }
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index d9ca97e9..c84ead7 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -234,7 +234,6 @@ gdbscm_lazy_string_to_value (SCM self)
   SCM ls_scm = lsscm_get_lazy_string_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (ls_scm);
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   if (ls_smob->address == 0)
     {
@@ -242,11 +241,15 @@ gdbscm_lazy_string_to_value (SCM self)
 				_("cannot create a value from NULL")));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = value_at_lazy (ls_smob->type, ls_smob->address);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (value);
 }
@@ -268,7 +271,6 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
 {
   lazy_string_smob *ls_smob;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   gdb_assert (lsscm_is_lazy_string (string));
 
@@ -283,15 +285,16 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = value_at_lazy (ls_smob->type, ls_smob->address);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       *except_scmp = gdbscm_scm_from_gdb_exception (except);
       return NULL;
     }
+  END_CATCH
 
   return value;
 }
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 7ff37ce..03baa3f 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -83,7 +83,6 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
   struct value *res_val = NULL;
   SCM except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -95,7 +94,7 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (opcode)
 	{
@@ -128,7 +127,11 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
 	  gdb_assert_not_reached ("unsupported operation");
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -156,7 +159,6 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
   struct value *res_val = NULL;
   SCM except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -175,7 +177,7 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (opcode)
 	{
@@ -264,7 +266,11 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
 	  gdb_assert_not_reached ("unsupported operation");
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -441,7 +447,6 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
   int result = 0;
   SCM except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -460,7 +465,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (op)
 	{
@@ -487,6 +492,11 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
 	  gdb_assert_not_reached ("invalid <gdb:value> comparison");
       }
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -742,7 +752,6 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
 {
   struct value *value = NULL;
   SCM except_scm = SCM_BOOL_F;
-  volatile struct gdb_exception except;
 
   if (type == NULL)
     {
@@ -752,7 +761,7 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
 
   *except_scmp = SCM_BOOL_F;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (vlscm_is_value (obj))
 	{
@@ -859,8 +868,11 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
 	  value = NULL;
 	}
     }
-  if (except.reason < 0)
-    except_scm = gdbscm_scm_from_gdb_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      except_scm = gdbscm_scm_from_gdb_exception (except);
+    }
+  END_CATCH
 
   if (gdbscm_is_true (except_scm))
     {
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 02b4f8a..c229d46 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -990,7 +990,6 @@ gdbscm_register_parameter_x (SCM self)
     = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   char *cmd_name;
   struct cmd_list_element **set_list, **show_list;
-  volatile struct gdb_exception except;
 
   if (pascm_is_valid (p_smob))
     scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
@@ -1014,7 +1013,7 @@ gdbscm_register_parameter_x (SCM self)
 		_("parameter exists, \"show\" command is already defined"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       add_setshow_generic (p_smob->type, p_smob->cmd_class,
 			   p_smob->cmd_name, p_smob,
@@ -1026,7 +1025,11 @@ gdbscm_register_parameter_x (SCM self)
 			   set_list, show_list,
 			   &p_smob->set_command, &p_smob->show_command);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Note: At this point the parameter exists in gdb.
      So no more errors after this point.  */
@@ -1063,16 +1066,20 @@ gdbscm_parameter_value (SCM self)
       const char *arg;
       char *newarg;
       int found = -1;
-      volatile struct gdb_exception except;
 
       name = gdbscm_scm_to_host_string (self, NULL, &except_scm);
       if (name == NULL)
 	gdbscm_throw (except_scm);
       newarg = concat ("show ", name, (char *) NULL);
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
 	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       xfree (name);
       xfree (newarg);
       GDBSCM_HANDLE_GDB_EXCEPTION (except);
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index dcf7d2d..8967b92 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -263,20 +263,23 @@ fputsn_filtered (const char *s, size_t size, struct ui_file *stream)
 static void
 ioscm_write (SCM port, const void *data, size_t size)
 {
-  volatile struct gdb_exception except;
 
   /* If we're called on stdin, punt.  */
   if (scm_is_eq (port, input_port_scm))
     return;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (scm_is_eq (port, error_port_scm))
 	fputsn_filtered (data, size, gdb_stderr);
       else
 	fputsn_filtered (data, size, gdb_stdout);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 }
 
 /* Flush gdb's stdout or stderr.  */
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 82cf96c..860cf8e 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -529,11 +529,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
 			      struct gdbarch *gdbarch,
 			      const struct language_defn *language)
 {
-  volatile struct gdb_exception except;
   SCM result = SCM_BOOL_F;
 
   *out_value = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       int rc;
       pretty_printer_worker_smob *w_smob
@@ -568,6 +567,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
 	    (_("invalid result from pretty-printer to-string"), result);
 	}
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   return result;
 }
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 1891237..0bce7d1 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -483,14 +483,17 @@ gdbscm_symbol_needs_frame_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct symbol *symbol = s_smob->symbol;
-  volatile struct gdb_exception except;
   int result = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = symbol_read_needs_frame (symbol);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (result);
 }
@@ -523,7 +526,6 @@ gdbscm_symbol_value (SCM self, SCM rest)
   frame_smob *f_smob = NULL;
   struct frame_info *frame_info = NULL;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O",
 			      rest, &frame_pos, &frame_scm);
@@ -536,7 +538,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
 				 _("cannot get the value of a typedef"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (f_smob != NULL)
 	{
@@ -550,7 +552,11 @@ gdbscm_symbol_value (SCM self, SCM rest)
 
       value = read_var_value (symbol, frame_info);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (value);
 }
@@ -571,7 +577,6 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
   int block_arg_pos = -1, domain_arg_pos = -1;
   struct field_of_this_result is_a_field_of_this;
   struct symbol *symbol = NULL;
-  volatile struct gdb_exception except;
   struct cleanup *cleanups;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
@@ -597,18 +602,27 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
     {
       struct frame_info *selected_frame;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  selected_frame = get_selected_frame (_("no frame selected"));
 	  block = get_frame_block (selected_frame, NULL);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+	}
+      END_CATCH
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -630,7 +644,6 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
   int domain_arg_pos = -1;
   int domain = VAR_DOMAIN;
   struct symbol *symbol = NULL;
-  volatile struct gdb_exception except;
   struct cleanup *cleanups;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
@@ -639,10 +652,15 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
 
   cleanups = make_cleanup (xfree, name);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_global_symbol (name, NULL, domain);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 03f616d..009a2b4 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -590,19 +590,22 @@ gdbscm_find_pc_line (SCM pc_scm)
 {
   ULONGEST pc_ull;
   struct symtab_and_line sal;
-  volatile struct gdb_exception except;
 
   init_sal (&sal); /* -Wall */
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CORE_ADDR pc = (CORE_ADDR) pc_ull;
 
       sal = find_pc_line (pc, 0);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return stscm_scm_from_sal (sal);
 }
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 196b4a1..363c793 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -108,9 +108,8 @@ static char *
 tyscm_type_name (struct type *type, SCM *excp)
 {
   char *name = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *old_chain;
       struct ui_file *stb;
@@ -123,11 +122,12 @@ tyscm_type_name (struct type *type, SCM *excp)
       name = ui_file_xstrdup (stb, NULL);
       do_cleanups (old_chain);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       *excp = gdbscm_scm_from_gdb_exception (except);
       return NULL;
     }
+  END_CATCH
 
   return name;
 }
@@ -239,7 +239,6 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
   type_smob *type1_smob, *type2_smob;
   struct type *type1, *type2;
   int result = 0;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (tyscm_is_type (type1_scm), type1_scm, SCM_ARG1, FUNC_NAME,
 		   type_smob_name);
@@ -250,11 +249,15 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
   type1 = type1_smob->type;
   type2 = type2_smob->type;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = types_deeply_equal (type1, type2);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (result);
 }
@@ -628,12 +631,16 @@ gdbscm_type_sizeof (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       check_typedef (type);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   /* Ignore exceptions.  */
 
   return scm_from_long (TYPE_LENGTH (type));
@@ -648,13 +655,16 @@ gdbscm_type_strip_typedefs (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -665,15 +675,18 @@ gdbscm_type_strip_typedefs (SCM self)
 static struct type *
 tyscm_get_composite (struct type *type)
 {
-  volatile struct gdb_exception except;
 
   for (;;)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  type = check_typedef (type);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (TYPE_CODE (type) != TYPE_CODE_PTR
 	  && TYPE_CODE (type) != TYPE_CODE_REF)
@@ -702,7 +715,6 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
   struct type *type = t_smob->type;
   long n1, n2 = 0;
   struct type *array = NULL;
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l",
 			      n1_scm, &n1, n2_scm, &n2);
@@ -721,13 +733,17 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
 				 _("Array length must not be negative"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       array = lookup_array_range_type (type, n1, n2);
       if (is_vector)
 	make_vector_type (array);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (array);
 }
@@ -773,13 +789,16 @@ gdbscm_type_pointer (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_pointer_type (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -832,13 +851,16 @@ gdbscm_type_reference (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_reference_type (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -867,13 +889,16 @@ gdbscm_type_const (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (1, 0, type, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -887,13 +912,16 @@ gdbscm_type_volatile (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 1, type, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -907,13 +935,16 @@ gdbscm_type_unqualified (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 0, type, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -1212,9 +1243,8 @@ static struct type *
 tyscm_lookup_typename (const char *type_name, const struct block *block)
 {
   struct type *type = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (!strncmp (type_name, "struct ", 7))
 	type = lookup_struct (type_name + 7, NULL);
@@ -1226,8 +1256,11 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
 	type = lookup_typename (current_language, get_current_arch (),
 				type_name, block, 0);
     }
-  if (except.reason < 0)
-    return NULL;
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      return NULL;
+    }
+  END_CATCH
 
   return type;
 }
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index cacc55c..0509a9c 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -143,7 +143,6 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
   value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
   char *s = NULL;
   struct value_print_options opts;
-  volatile struct gdb_exception except;
 
   if (pstate->writingp)
     gdbscm_printf (port, "#<%s ", value_smob_name);
@@ -157,7 +156,7 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
      instead of writingp.  */
   opts.raw = !!pstate->writingp;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct ui_file *stb = mem_fileopen ();
       struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -167,7 +166,11 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
 
       do_cleanups (old_chain);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (s != NULL)
     {
@@ -192,13 +195,16 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2)
   const value_smob *v1_smob = (value_smob *) SCM_SMOB_DATA (v1);
   const value_smob *v2_smob = (value_smob *) SCM_SMOB_DATA (v2);
   int result = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = value_equal (v1_smob->value, v2_smob->value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (result);
 }
@@ -360,7 +366,6 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
   struct value *value = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   t_smob = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG1, FUNC_NAME);
   type = tyscm_type_smob_type (t_smob);
@@ -372,11 +377,15 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
 
   /* There's no (current) need to wrap this in a TRY_CATCH, but for consistency
      and future-proofing we do.  */
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
   {
     value = value_from_contents_and_address (type, NULL, address);
   }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   result = vlscm_scm_from_value (value);
 
@@ -396,13 +405,16 @@ gdbscm_value_optimized_out_p (SCM self)
     = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct value *value = v_smob->value;
   int opt = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       opt = value_optimized_out (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (opt);
 }
@@ -423,14 +435,17 @@ gdbscm_value_address (SCM self)
       struct cleanup *cleanup
 	= make_cleanup_value_free_to_mark (value_mark ());
       SCM address;
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  res_val = value_addr (value);
 	}
-      if (except.reason < 0)
-	address = SCM_BOOL_F;
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  address = SCM_BOOL_F;
+	}
+      END_CATCH
+
       else
 	address = vlscm_scm_from_value (res_val);
 
@@ -457,15 +472,18 @@ gdbscm_value_dereference (SCM self)
   SCM result;
   struct value *res_val = NULL;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = value_ind (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   result = vlscm_scm_from_value (res_val);
 
@@ -495,11 +513,10 @@ gdbscm_value_referenced_value (SCM self)
   SCM result;
   struct value *res_val = NULL;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (TYPE_CODE (check_typedef (value_type (value))))
         {
@@ -514,7 +531,11 @@ gdbscm_value_referenced_value (SCM self)
 		   " neither a pointer nor a reference"));
         }
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   result = vlscm_scm_from_value (res_val);
 
@@ -550,12 +571,11 @@ gdbscm_value_dynamic_type (SCM self)
     = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct value *value = v_smob->value;
   struct type *type = NULL;
-  volatile struct gdb_exception except;
 
   if (! SCM_UNBNDP (v_smob->type))
     return v_smob->dynamic_type;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup
 	= make_cleanup_value_free_to_mark (value_mark ());
@@ -594,7 +614,11 @@ gdbscm_value_dynamic_type (SCM self)
 
       do_cleanups (cleanup);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (type == NULL)
     v_smob->dynamic_type = gdbscm_value_type (self);
@@ -619,11 +643,10 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
   SCM result;
   struct value *res_val = NULL;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (op == UNOP_DYNAMIC_CAST)
 	res_val = value_dynamic_cast (type, value);
@@ -635,7 +658,11 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
 	  res_val = value_cast (type, value);
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -686,7 +713,6 @@ gdbscm_value_field (SCM self, SCM field_scm)
   struct value *res_val = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
 		   _("string"));
@@ -696,13 +722,17 @@ gdbscm_value_field (SCM self, SCM field_scm)
   field = gdbscm_scm_to_c_string (field_scm);
   make_cleanup (xfree, field);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *tmp = value;
 
       res_val = value_struct_elt (&tmp, NULL, field, NULL, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -730,7 +760,6 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
   struct gdbarch *gdbarch;
   SCM result, except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -749,7 +778,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *tmp = value;
 
@@ -765,7 +794,11 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
 
       res_val = value_subscript (tmp, value_as_long (index));
    }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -792,13 +825,16 @@ gdbscm_value_call (SCM self, SCM args)
   long args_count;
   struct value **vargs = NULL;
   SCM result = SCM_BOOL_F;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       ftype = check_typedef (value_type (function));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
 		   SCM_ARG1, FUNC_NAME,
@@ -832,7 +868,7 @@ gdbscm_value_call (SCM self, SCM args)
       gdb_assert (gdbscm_is_true (scm_null_p (args)));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
       struct value *return_value;
@@ -841,7 +877,11 @@ gdbscm_value_call (SCM self, SCM args)
       result = vlscm_scm_from_value (return_value);
       do_cleanups (cleanup);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (gdbscm_is_exception (result))
     gdbscm_throw (result);
@@ -861,17 +901,20 @@ gdbscm_value_to_bytevector (SCM self)
   size_t length = 0;
   const gdb_byte *contents = NULL;
   SCM bv;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
       length = TYPE_LENGTH (type);
       contents = value_contents (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   bv = scm_c_make_bytevector (length);
   memcpy (SCM_BYTEVECTOR_CONTENTS (bv), contents, length);
@@ -902,27 +945,34 @@ gdbscm_value_to_bool (SCM self)
   struct value *value = v_smob->value;
   struct type *type;
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
 		   _("integer-like gdb value"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (TYPE_CODE (type) == TYPE_CODE_PTR)
 	l = value_as_address (value);
       else
 	l = value_as_long (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (l != 0);
 }
@@ -938,27 +988,34 @@ gdbscm_value_to_integer (SCM self)
   struct value *value = v_smob->value;
   struct type *type;
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
 		   _("integer-like gdb value"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (TYPE_CODE (type) == TYPE_CODE_PTR)
 	l = value_as_address (value);
       else
 	l = value_as_long (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (TYPE_UNSIGNED (type))
     return gdbscm_scm_from_ulongest (l);
@@ -977,24 +1034,31 @@ gdbscm_value_to_real (SCM self)
   struct value *value = v_smob->value;
   struct type *type;
   DOUBLEST d = 0;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
 		   self, SCM_ARG1, FUNC_NAME, _("number"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       d = value_as_double (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* TODO: Is there a better way to check if the value fits?  */
   if (d != (double) d)
@@ -1045,7 +1109,6 @@ gdbscm_value_to_string (SCM self, SCM rest)
   struct type *char_type = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1081,11 +1144,15 @@ gdbscm_value_to_string (SCM self, SCM rest)
   /* We don't assume anything about the result of scm_port_conversion_strategy.
      From this point on, if errors is not 'errors, use 'substitute.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   /* If errors is "error" scm_from_stringn may throw a Scheme exception.
      Make sure we don't leak.  This is done via scm_dynwind_begin, et.al.  */
@@ -1131,7 +1198,6 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
   int length = -1;
   SCM result = SCM_BOOL_F; /* -Wall */
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1142,7 +1208,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
 
   cleanups = make_cleanup (xfree, encoding);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *inner_cleanup
 	= make_cleanup_value_free_to_mark (value_mark ());
@@ -1155,6 +1221,11 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
 
       do_cleanups (inner_cleanup);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -1184,14 +1255,17 @@ gdbscm_value_fetch_lazy_x (SCM self)
   value_smob *v_smob
     = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct value *value = v_smob->value;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (value_lazy (value))
 	value_fetch_lazy (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -1207,12 +1281,11 @@ gdbscm_value_print (SCM self)
   struct value_print_options opts;
   char *s = NULL;
   SCM result;
-  volatile struct gdb_exception except;
 
   get_user_print_options (&opts);
   opts.deref_ref = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct ui_file *stb = mem_fileopen ();
       struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -1222,7 +1295,11 @@ gdbscm_value_print (SCM self)
 
       do_cleanups (old_chain);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Use SCM_FAILED_CONVERSION_QUESTION_MARK to ensure this doesn't
      throw an error if the encoding fails.
@@ -1246,7 +1323,6 @@ gdbscm_parse_and_eval (SCM expr_scm)
   struct value *res_val = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1257,11 +1333,15 @@ gdbscm_parse_and_eval (SCM expr_scm)
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
   make_cleanup (xfree, expr_str);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = parse_and_eval (expr_str);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -1282,15 +1362,18 @@ gdbscm_history_ref (SCM index)
 {
   int i;
   struct value *res_val = NULL; /* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", index, &i);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = access_value_history (i);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (res_val);
 }
@@ -1304,16 +1387,19 @@ gdbscm_history_append_x (SCM value)
   int res_index = -1;
   struct value *v;
   value_smob *v_smob;
-  volatile struct gdb_exception except;
 
   v_smob = vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME);
   v = v_smob->value;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_index = record_latest_value (v);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_int (res_index);
 }
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index fa3b841..73f4b6d 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2050,7 +2050,6 @@ i386_frame_cache_1 (struct frame_info *this_frame,
 static struct i386_frame_cache *
 i386_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct i386_frame_cache *cache;
 
   if (*this_cache)
@@ -2059,15 +2058,16 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = i386_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       i386_frame_cache_1 (this_frame, cache);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
@@ -2217,7 +2217,6 @@ i386_epilogue_frame_sniffer (const struct frame_unwind *self,
 static struct i386_frame_cache *
 i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct i386_frame_cache *cache;
   CORE_ADDR sp;
 
@@ -2227,7 +2226,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = i386_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       cache->pc = get_frame_func (this_frame);
 
@@ -2241,11 +2240,12 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
@@ -2403,7 +2403,6 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  volatile struct gdb_exception ex;
   struct i386_frame_cache *cache;
   CORE_ADDR addr;
   gdb_byte buf[4];
@@ -2413,7 +2412,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
   cache = i386_alloc_frame_cache ();
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       get_frame_register (this_frame, I386_ESP_REGNUM, buf);
       cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4;
@@ -2437,11 +2436,12 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   *this_cache = cache;
   return cache;
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index adeb659..8c99752 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -50,13 +50,12 @@ inferior_event_handler (enum inferior_event_type event_type,
 	 error status.  If an error occurs while getting an event from
 	 the target, just cancel the current command.  */
       {
-	volatile struct gdb_exception ex;
 
-	TRY_CATCH (ex, RETURN_MASK_ALL)
+	TRY
 	  {
 	    fetch_inferior_event (client_data);
 	  }
-	if (ex.reason < 0)
+	CATCH (ex, RETURN_MASK_ALL)
 	  {
 	    bpstat_clear_actions ();
 	    do_all_intermediate_continuations (1);
@@ -64,6 +63,7 @@ inferior_event_handler (enum inferior_event_type event_type,
 
 	    throw_exception (ex);
 	  }
+	END_CATCH
       }
       break;
 
@@ -111,17 +111,21 @@ inferior_event_handler (enum inferior_event_type event_type,
 	 are only run when the command list is all done.  */
       if (interpreter_async)
 	{
-	  volatile struct gdb_exception e;
 
 	  check_frame_language_change ();
 
 	  /* Don't propagate breakpoint commands errors.  Either we're
 	     stopping or some command resumes the inferior.  The user will
 	     be informed.  */
-	  TRY_CATCH (e, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      bpstat_do_actions ();
 	    }
+	  CATCH (e, RETURN_MASK_ALL)
+	    {
+	    }
+	  END_CATCH
+
 	  exception_print (gdb_stderr, e);
 	}
       break;
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 350572b..187b5c7 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -383,7 +383,6 @@ get_function_name (CORE_ADDR funaddr, char *buf, int buf_size)
 static struct gdb_exception
 run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 {
-  volatile struct gdb_exception e;
   int saved_in_infcall = call_thread->control.in_infcall;
   ptid_t call_thread_ptid = call_thread->ptid;
   int saved_sync_execution = sync_execution;
@@ -401,7 +400,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
   /* We want stop_registers, please...  */
   call_thread->control.proceed_to_finish = 1;
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       int was_sync = sync_execution;
 
@@ -435,11 +434,12 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
      If all error()s out of proceed ended up calling normal_stop
      (and perhaps they should; it already does in the special case
      of error out of resume()), then we wouldn't need this.  */
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ALL)
     {
       if (call_thread != NULL)
 	breakpoint_auto_delete (call_thread->control.stop_bpstat);
     }
+  END_CATCH
 
   if (call_thread != NULL)
     call_thread->control.in_infcall = saved_in_infcall;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 5fa3ae5..9f4211d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -411,7 +411,6 @@ strip_bg_char (const char *args, int *bg_char_p)
 void
 post_create_inferior (struct target_ops *target, int from_tty)
 {
-  volatile struct gdb_exception ex;
 
   /* Be sure we own the terminal in case write operations are performed.  */ 
   target_terminal_ours ();
@@ -426,15 +425,16 @@ post_create_inferior (struct target_ops *target, int from_tty)
      if the PC is unavailable (e.g., we're opening a core file with
      missing registers info), ignore it.  */
   stop_pc = 0;
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       stop_pc = regcache_read_pc (get_current_regcache ());
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   if (exec_bfd)
     {
@@ -1663,19 +1663,21 @@ finish_command_continuation (void *arg, int err)
 
 	  if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
 	    {
-	      volatile struct gdb_exception ex;
 	      struct value *func;
 
 	      func = read_var_value (a->function, get_current_frame ());
-	      TRY_CATCH (ex, RETURN_MASK_ALL)
+	      TRY
 		{
 		  /* print_return_value can throw an exception in some
 		     circumstances.  We need to catch this so that we still
 		     delete the breakpoint.  */
 		  print_return_value (func, value_type);
 		}
-	      if (ex.reason < 0)
-		exception_print (gdb_stdout, ex);
+	      CATCH (ex, RETURN_MASK_ALL)
+		{
+		  exception_print (gdb_stdout, ex);
+		}
+	      END_CATCH
 	    }
 	}
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 11dcc0e..04af8a1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5941,10 +5941,9 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 				    struct frame_info *frame,
 				    struct symbol *sym)
 {
-  volatile struct gdb_exception e;
 
   /* We want to ignore errors here.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct symbol *vsym;
       struct value *value;
@@ -5973,6 +5972,10 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 	  inferior_thread ()->control.exception_resume_breakpoint = bp;
 	}
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 /* A helper for check_exception_resume that sets an
@@ -6013,7 +6016,6 @@ static void
 check_exception_resume (struct execution_control_state *ecs,
 			struct frame_info *frame)
 {
-  volatile struct gdb_exception e;
   struct bound_probe probe;
   struct symbol *func;
 
@@ -6032,7 +6034,7 @@ check_exception_resume (struct execution_control_state *ecs,
   if (!func)
     return;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       const struct block *b;
       struct block_iterator iter;
@@ -6069,6 +6071,10 @@ check_exception_resume (struct execution_control_state *ecs,
 	    }
 	}
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 static void
@@ -6111,7 +6117,6 @@ keep_going (struct execution_control_state *ecs)
     }
   else
     {
-      volatile struct gdb_exception e;
       struct regcache *regcache = get_current_regcache ();
       int remove_bp;
       int remove_wps;
@@ -6151,16 +6156,17 @@ keep_going (struct execution_control_state *ecs)
 	clear_step_over_info ();
 
       /* Stop stepping if inserting breakpoints fails.  */
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  insert_breakpoints ();
 	}
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ERROR)
 	{
 	  exception_print (gdb_stderr, e);
 	  stop_waiting (ecs);
 	  return;
 	}
+      END_CATCH
 
       ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
 
diff --git a/gdb/jit.c b/gdb/jit.c
index 32a3fc7..e872c8f 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -816,7 +816,6 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
   int status;
   jit_dbg_reader_data priv_data;
   struct gdb_reader_funcs *funcs;
-  volatile struct gdb_exception e;
   struct gdb_symbol_callbacks callbacks =
     {
       jit_object_open_impl,
@@ -839,12 +838,17 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
   gdb_mem = xmalloc (code_entry->symfile_size);
 
   status = 1;
-  TRY_CATCH (e, RETURN_MASK_ALL)
-    if (target_read_memory (code_entry->symfile_addr, gdb_mem,
-                            code_entry->symfile_size))
+  TRY
+    {
+      if (target_read_memory (code_entry->symfile_addr, gdb_mem,
+			      code_entry->symfile_size))
+	status = 0;
+    }
+  CATCH (e, RETURN_MASK_ALL)
+    {
       status = 0;
-  if (e.reason < 0)
-    status = 0;
+    }
+  END_CATCH
 
   if (status)
     {
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 70b50a0..e731fb2 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2261,22 +2261,22 @@ parse_linespec (linespec_parser *parser, const char **argptr)
   if (token.type == LSTOKEN_COLON)
     {
       char *user_filename;
-      volatile struct gdb_exception ex;
 
       /* Get the current token again and extract the filename.  */
       token = linespec_lexer_lex_one (parser);
       user_filename = copy_token_string (token);
 
       /* Check if the input is a filename.  */
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  PARSER_RESULT (parser)->file_symtabs
 	    = symtabs_from_filename (user_filename);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  file_exception = ex;
 	}
+      END_CATCH
 
       if (file_exception.reason >= 0)
 	{
@@ -3107,7 +3107,6 @@ find_linespec_symbols (struct linespec_state *state,
   struct cleanup *cleanup;
   char *canon;
   const char *lookup_name;
-  volatile struct gdb_exception except;
 
   cleanup = demangle_for_lookup (name, state->language->la_language,
 				 &lookup_name);
@@ -3195,7 +3194,7 @@ find_linespec_symbols (struct linespec_state *state,
       if (!VEC_empty (symbolp, classes))
 	{
 	  /* Now locate a list of suitable methods named METHOD.  */
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      find_method (state, file_symtabs, klass, method, classes,
 			   symbols, minsyms);
@@ -3203,11 +3202,12 @@ find_linespec_symbols (struct linespec_state *state,
 
 	  /* If successful, we're done.  If NOT_FOUND_ERROR
 	     was not thrown, rethrow the exception that we did get.  */
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      if (except.error != NOT_FOUND_ERROR)
 		throw_exception (except);
 	    }
+	  END_CATCH
 	}
     }
 
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 169188a..e6ca28a 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1188,16 +1188,15 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
   struct lwp_info *lp;
   int status;
   ptid_t ptid;
-  volatile struct gdb_exception ex;
 
   /* Make sure we report all signals during attach.  */
   linux_nat_pass_signals (ops, 0, NULL);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       linux_ops->to_attach (ops, args, from_tty);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       pid_t pid = parse_pid_to_attach (args);
       struct buffer buffer;
@@ -1218,6 +1217,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
       else
 	throw_error (ex.error, "%s", message);
     }
+  END_CATCH
 
   /* The ptrace base target adds the main thread with (pid,0,0)
      format.  Decorate it with lwp info.  */
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 64684d0..07329ac 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1544,7 +1544,6 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
   char *note_data = NULL;
   gdb_byte *auxv;
   int auxv_len;
-  volatile struct gdb_exception e;
 
   if (! gdbarch_iterate_over_regset_sections_p (gdbarch))
     return NULL;
@@ -1571,12 +1570,16 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
     }
 
   /* Thread register information.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       update_thread_list ();
     }
-  if (e.reason < 0)
-    exception_print (gdb_stderr, e);
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, e);
+    }
+  END_CATCH
+
   thread_args.gdbarch = gdbarch;
   thread_args.pid = ptid_get_pid (inferior_ptid);
   thread_args.obfd = obfd;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 7ce4991..87596d2 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -672,14 +672,13 @@ enable_thread_event_reporting (void)
 static int
 thread_db_find_new_threads_silently (ptid_t ptid)
 {
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       thread_db_find_new_threads_2 (ptid, 1);
     }
 
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       if (libthread_db_debug)
 	exception_fprintf (gdb_stdlog, except,
@@ -709,6 +708,8 @@ thread_db_find_new_threads_silently (ptid_t ptid)
 	  return 1;
 	}
     }
+  END_CATCH
+
   return 0;
 }
 
@@ -1712,14 +1713,13 @@ static int
 find_new_threads_once (struct thread_db_info *info, int iteration,
 		       td_err_e *errp)
 {
-  volatile struct gdb_exception except;
   struct callback_data data;
   td_err_e err = TD_ERR;
 
   data.info = info;
   data.new_threads = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       /* Iterate over all user-space threads to discover new threads.  */
       err = info->td_ta_thr_iter_p (info->thread_agent,
@@ -1733,9 +1733,12 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
 
   if (libthread_db_debug)
     {
-      if (except.reason < 0)
-	exception_fprintf (gdb_stdlog, except,
-			   "Warning: find_new_threads_once: ");
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	  exception_fprintf (gdb_stdlog, except,
+			     "Warning: find_new_threads_once: ");
+	}
+      END_CATCH
 
       fprintf_unfiltered (gdb_stdlog,
 			  _("Found %d new threads in iteration %d.\n"),
diff --git a/gdb/main.c b/gdb/main.c
index 7237d2d..c56d263 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -364,9 +364,8 @@ static int
 catch_command_errors (catch_command_errors_ftype *command,
 		      char *arg, int from_tty)
 {
-  volatile struct gdb_exception e;
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       int was_sync = sync_execution;
 
@@ -374,6 +373,11 @@ catch_command_errors (catch_command_errors_ftype *command,
 
       maybe_wait_sync_command_done (was_sync);
     }
+  CATCH (e, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   return handle_command_errors (e);
 }
 
@@ -387,9 +391,8 @@ static int
 catch_command_errors_const (catch_command_errors_const_ftype *command,
 			    const char *arg, int from_tty)
 {
-  volatile struct gdb_exception e;
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       int was_sync = sync_execution;
 
@@ -397,6 +400,11 @@ catch_command_errors_const (catch_command_errors_const_ftype *command,
 
       maybe_wait_sync_command_done (was_sync);
     }
+  CATCH (e, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   return handle_command_errors (e);
 }
 
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 18a357e..d45cede 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -537,7 +537,6 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 
   if (arg->val || arg->error)
     {
-      volatile struct gdb_exception except;
 
       if (arg->error)
 	except.message = arg->error;
@@ -545,7 +544,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 	{
 	  /* TRY_CATCH has two statements, wrap it in a block.  */
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      struct value_print_options opts;
 
@@ -554,6 +553,10 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 	      common_val_print (arg->val, stb, 0, &opts,
 				language_def (SYMBOL_LANGUAGE (arg->sym)));
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 	}
       if (except.message)
 	fprintf_filtered (stb, _("<error reading variable: %s>"),
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index f10b0bb..99ce385 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -808,7 +808,6 @@ mi_breakpoint_created (struct breakpoint *b)
 {
   struct mi_interp *mi = top_level_interpreter_data ();
   struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
-  volatile struct gdb_exception e;
 
   if (mi_suppress_notification.breakpoint)
     return;
@@ -827,8 +826,15 @@ mi_breakpoint_created (struct breakpoint *b)
      breakpoint_created notifications.  So, we use
      ui_out_redirect.  */
   ui_out_redirect (mi_uiout, mi->event_channel);
-  TRY_CATCH (e, RETURN_MASK_ERROR)
-    gdb_breakpoint_query (mi_uiout, b->number, NULL);
+  TRY
+    {
+      gdb_breakpoint_query (mi_uiout, b->number, NULL);
+    }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
+
   ui_out_redirect (mi_uiout, NULL);
 
   gdb_flush (mi->event_channel);
@@ -862,7 +868,6 @@ mi_breakpoint_modified (struct breakpoint *b)
 {
   struct mi_interp *mi = top_level_interpreter_data ();
   struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
-  volatile struct gdb_exception e;
 
   if (mi_suppress_notification.breakpoint)
     return;
@@ -881,8 +886,15 @@ mi_breakpoint_modified (struct breakpoint *b)
      breakpoint_created notifications.  So, we use
      ui_out_redirect.  */
   ui_out_redirect (mi_uiout, mi->event_channel);
-  TRY_CATCH (e, RETURN_MASK_ERROR)
-    gdb_breakpoint_query (mi_uiout, b->number, NULL);
+  TRY
+    {
+      gdb_breakpoint_query (mi_uiout, b->number, NULL);
+    }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
+
   ui_out_redirect (mi_uiout, NULL);
 
   gdb_flush (mi->event_channel);
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 7412f7d..980b558 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2080,7 +2080,6 @@ mi_execute_command (const char *cmd, int from_tty)
 {
   char *token;
   struct mi_parse *command = NULL;
-  volatile struct gdb_exception exception;
 
   /* This is to handle EOF (^D). We just quit gdb.  */
   /* FIXME: we should call some API function here.  */
@@ -2089,18 +2088,19 @@ mi_execute_command (const char *cmd, int from_tty)
 
   target_log_command (cmd);
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       command = mi_parse (cmd, &token);
     }
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       mi_print_exception (token, exception);
       xfree (token);
     }
+  END_CATCH
+
   else
     {
-      volatile struct gdb_exception result;
       ptid_t previous_ptid = inferior_ptid;
 
       command->token = token;
@@ -2112,17 +2112,18 @@ mi_execute_command (const char *cmd, int from_tty)
 	  timestamp (command->cmd_start);
 	}
 
-      TRY_CATCH (result, RETURN_MASK_ALL)
+      TRY
 	{
 	  captured_mi_execute_command (current_uiout, command);
 	}
-      if (result.reason < 0)
+      CATCH (result, RETURN_MASK_ALL)
 	{
 	  /* The command execution failed and error() was called
 	     somewhere.  */
 	  mi_print_exception (command->token, result);
 	  mi_out_rewind (current_uiout);
 	}
+      END_CATCH
 
       bpstat_do_actions ();
 
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 043f98b..a66ff44 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -725,7 +725,6 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
       const char *basename = type_name_no_tag (baseclass);
       const gdb_byte *base_valaddr = NULL;
       int thisoffset;
-      volatile struct gdb_exception ex;
       int skip = 0;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
@@ -745,17 +744,18 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 
       thisoffset = offset;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  boffset = baseclass_offset (type, i, valaddr, offset, address, val);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    skip = -1;
 	  else
 	    skip = 1;
 	}
+      END_CATCH
 
       if (skip == 0)
 	{
diff --git a/gdb/parse.c b/gdb/parse.c
index 09fb0b3..ec23dbb 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1133,7 +1133,6 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
 			const struct block *block,
 			int comma, int void_context_p, int *out_subexp)
 {
-  volatile struct gdb_exception except;
   struct cleanup *old_chain, *inner_chain;
   const struct language_defn *lang = NULL;
   struct parser_state ps;
@@ -1215,12 +1214,12 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
   inner_chain = make_cleanup_restore_current_language ();
   set_language (lang->la_language);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (lang->la_parser (&ps))
         lang->la_error (NULL);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       if (! parse_completion)
 	{
@@ -1228,6 +1227,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
 	  throw_exception (except);
 	}
     }
+  END_CATCH
 
   reallocate_expout (&ps);
 
@@ -1283,17 +1283,17 @@ parse_expression_for_completion (const char *string, char **name,
   struct expression *exp = NULL;
   struct value *val;
   int subexp;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       parse_completion = 1;
       exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       /* Nothing, EXP remains NULL.  */
     }
+  END_CATCH
 
   parse_completion = 0;
   if (exp == NULL)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index a7b1163..7d59a18 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1231,9 +1231,8 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
   if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
     {
       struct target_ops *target = &current_target;
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  /* We do not call target_translate_tls_address here, because
 	     svr4_fetch_objfile_link_map may invalidate the frame chain,
@@ -1248,8 +1247,11 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
 	  spe_context_cache_ptid = inferior_ptid;
 	}
 
-      if (ex.reason < 0)
-	return 0;
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  return 0;
+	}
+      END_CATCH
     }
 
   /* Read variable value.  */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index cdbed30..05c68a0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1692,15 +1692,14 @@ do_one_display (struct display *d)
 
   if (d->exp == NULL)
     {
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  innermost_block = NULL;
 	  d->exp = parse_expression (d->exp_string);
 	  d->block = innermost_block;
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  /* Can't re-parse the expression.  Disable this display item.  */
 	  d->enabled_p = 0;
@@ -1708,6 +1707,7 @@ do_one_display (struct display *d)
 		   d->exp_string, ex.message);
 	  return;
 	}
+      END_CATCH
     }
 
   if (d->block)
@@ -1731,7 +1731,6 @@ do_one_display (struct display *d)
   printf_filtered (": ");
   if (d->format.size)
     {
-      volatile struct gdb_exception ex;
 
       annotate_display_format ();
 
@@ -1755,7 +1754,7 @@ do_one_display (struct display *d)
 
       annotate_display_value ();
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
         {
 	  struct value *val;
 	  CORE_ADDR addr;
@@ -1766,13 +1765,15 @@ do_one_display (struct display *d)
 	    addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
 	  do_examine (d->format, d->exp->gdbarch, addr);
 	}
-      if (ex.reason < 0)
-	fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
+	}
+      END_CATCH
     }
   else
     {
       struct value_print_options opts;
-      volatile struct gdb_exception ex;
 
       annotate_display_format ();
 
@@ -1791,15 +1792,19 @@ do_one_display (struct display *d)
       get_formatted_print_options (&opts, d->format.format);
       opts.raw = d->format.raw;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
         {
 	  struct value *val;
 
 	  val = evaluate_expression (d->exp);
 	  print_formatted (val, d->format.size, &opts, gdb_stdout);
 	}
-      if (ex.reason < 0)
-	fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+	}
+      END_CATCH
+
       printf_filtered ("\n");
     }
 
@@ -1975,13 +1980,12 @@ print_variable_and_value (const char *name, struct symbol *var,
 			  struct frame_info *frame,
 			  struct ui_file *stream, int indent)
 {
-  volatile struct gdb_exception except;
 
   if (!name)
     name = SYMBOL_PRINT_NAME (var);
 
   fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       struct value *val;
       struct value_print_options opts;
@@ -1995,9 +1999,13 @@ print_variable_and_value (const char *name, struct symbol *var,
 	 function.  */
       frame = NULL;
     }
-  if (except.reason < 0)
-    fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
-		     except.message);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
+		       except.message);
+    }
+  END_CATCH
+
   fprintf_filtered (stream, "\n");
 }
 
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index 49c654b..4fece39 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -199,7 +199,6 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
       char *as = NULL;
       struct ui_file *memfile = mem_fileopen ();
       PyObject *insn_dict = PyDict_New ();
-      volatile struct gdb_exception except;
 
       if (insn_dict == NULL)
         {
@@ -217,11 +216,11 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
           return NULL;  /* PyList_Append Sets the exception.  */
         }
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
         {
           insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
         }
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
         {
           Py_DECREF (result_list);
           ui_file_delete (memfile);
@@ -229,6 +228,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
 	  gdbpy_convert_exception (except);
 	  return NULL;
         }
+      END_CATCH
 
       as = ui_file_xstrdup (memfile, NULL);
       if (PyDict_SetItemString (insn_dict, "addr",
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index fb6a6b6..6c0f5cb 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -373,19 +373,22 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
   gdb_py_ulongest pc;
   const struct block *block = NULL;
   struct compunit_symtab *cust = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       cust = find_pc_compunit_symtab (pc);
 
       if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
 	block = block_for_pc (pc);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
     {
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 7807e4e..2eefed3 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -114,7 +114,6 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   int cmp;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -136,14 +135,18 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
   if (cmp < 0)
     return -1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (cmp == 1)
 	enable_breakpoint (self_bp->bp);
       else
 	disable_breakpoint (self_bp->bp);
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return 0;
 }
@@ -227,7 +230,6 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   long id;
   int valid_id = 0;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -242,11 +244,15 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
       if (! gdb_py_int_as_long (newvalue, &id))
 	return -1;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  valid_id = valid_task_id (id);
 	}
-      GDB_PY_SET_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_SET_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (! valid_id)
 	{
@@ -278,15 +284,18 @@ static PyObject *
 bppy_delete_breakpoint (PyObject *self, PyObject *args)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
-  volatile struct gdb_exception except;
 
   BPPY_REQUIRE_VALID (self_bp);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       delete_breakpoint (self_bp->bp);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -298,7 +307,6 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   long value;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -321,11 +329,15 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
   if (value < 0)
     value = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_ignore_count (self_bp->number, (int) value, 0);
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return 0;
 }
@@ -429,7 +441,6 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
 {
   char *exp;
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -448,10 +459,14 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
 	return -1;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_breakpoint_condition (self_bp->bp, exp, 0);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   if (newvalue != Py_None)
     xfree (exp);
@@ -468,7 +483,6 @@ bppy_get_commands (PyObject *self, void *closure)
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   struct breakpoint *bp = self_bp->bp;
   long length;
-  volatile struct gdb_exception except;
   struct ui_file *string_file;
   struct cleanup *chain;
   PyObject *result;
@@ -483,17 +497,18 @@ bppy_get_commands (PyObject *self, void *closure)
   chain = make_cleanup_ui_file_delete (string_file);
 
   ui_out_redirect (current_uiout, string_file);
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
   ui_out_redirect (current_uiout, NULL);
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       do_cleanups (chain);
       gdbpy_convert_exception (except);
       return NULL;
     }
+  END_CATCH
 
   cmdstr = ui_file_xstrdup (string_file, &length);
   make_cleanup (xfree, cmdstr);
@@ -619,7 +634,6 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   PyObject *temporary = NULL;
   int internal_bp = 0;
   int temporary_bp = 0;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiOO", keywords,
 				     &spec, &type, &access_type,
@@ -644,7 +658,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   bppy_pending_object->number = -1;
   bppy_pending_object->bp = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       char *copy = xstrdup (spec);
       struct cleanup *cleanup = make_cleanup (xfree, copy);
@@ -681,13 +695,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 
       do_cleanups (cleanup);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       PyErr_Format (except.reason == RETURN_QUIT
 		    ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
 		    "%s", except.message);
       return -1;
     }
+  END_CATCH
 
   BPPY_SET_REQUIRE_VALID ((gdbpy_breakpoint_object *) self);
   return 0;
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index a5e96d6..1d89912 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -537,7 +537,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
   int cmdtype;
   int completetype = -1;
   char *docstring = NULL;
-  volatile struct gdb_exception except;
   struct cmd_list_element **cmd_list;
   char *cmd_name, *pfx_name;
   static char *keywords[] = { "name", "command_class", "completer_class",
@@ -637,7 +636,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 
   Py_INCREF (self);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cmd_list_element *cmd;
 
@@ -668,7 +667,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 	set_cmd_completer_handle_brkchars (cmd,
 					   cmdpy_completer_handle_brkchars);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (cmd_name);
       xfree (docstring);
@@ -679,6 +678,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 		    "%s", except.message);
       return -1;
     }
+  END_CATCH
+
   return 0;
 }
 
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 43f6807..cf1642a 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -93,7 +93,6 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
 {
   struct finish_breakpoint_object *self_finishbp =
         (struct finish_breakpoint_object *) bp_obj;
-  volatile struct gdb_exception except;
 
   /* Can compute return_value only once.  */
   gdb_assert (!self_finishbp->return_value);
@@ -101,7 +100,7 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
   if (!self_finishbp->return_type)
     return;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *function =
         value_object_to_value (self_finishbp->function_value);
@@ -121,11 +120,12 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
           self_finishbp->return_value = Py_None;
         }
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       gdbpy_print_stack ();
     }
+  END_CATCH
 }
 
 /* Triggered when gdbpy_should_stop has triggered the `stop' callback
@@ -134,19 +134,19 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
 void
 bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
 {
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Can't delete it here, but it will be removed at the next stop.  */
       disable_breakpoint (bp_obj->bp);
       gdb_assert (bp_obj->bp->disposition == disp_del);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       gdbpy_print_stack ();
     }
+  END_CATCH
 }
 
 /* Python function to create a new breakpoint.  */
@@ -166,7 +166,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   PyObject *internal = NULL;
   int internal_bp = 0;
   CORE_ADDR finish_pc, pc;
-  volatile struct gdb_exception except;
   char *addr_str, small_buf[100];
   struct symbol *function;
 
@@ -174,7 +173,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
                                     &frame_obj, &internal))
     return -1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Default frame to newest frame if necessary.  */
       if (frame_obj == NULL)
@@ -212,11 +211,13 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 	    }
 	}
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       return -1;
     }
+  END_CATCH
+
   else if (PyErr_Occurred ())
     return -1;
 
@@ -243,7 +244,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   self_bpfinish->return_type = NULL;
   self_bpfinish->function_value = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (get_frame_pc_if_available (frame, &pc))
         {
@@ -269,11 +270,12 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
             }
         }
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       /* Just swallow.  Either the return type or the function value
 	 remain NULL.  */
     }
+  END_CATCH
 
   if (self_bpfinish->return_type == NULL || self_bpfinish->function_value == NULL)
     {
@@ -289,7 +291,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   bppy_pending_object->number = -1;
   bppy_pending_object->bp = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Set a breakpoint on the return address.  */
       finish_pc = get_frame_pc (prev_frame);
@@ -306,7 +308,11 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
                          &bkpt_breakpoint_ops,
                          0, 1, internal_bp, 0);
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   self_bpfinish->py_bp.bp->frame_id = frame_id;
   self_bpfinish->py_bp.is_finish_bp = 1;
@@ -347,7 +353,6 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
 static int
 bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
 {
-  volatile struct gdb_exception except;
   struct breakpoint *bp_stopped = (struct breakpoint *) args;
   PyObject *py_bp = (PyObject *) b->py_bp_object;
   struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
@@ -362,18 +367,19 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
       /* Check scope if not currently stopped at the FinishBreakpoint.  */
       if (b != bp_stopped)
         {
-          TRY_CATCH (except, RETURN_MASK_ALL)
+          TRY
             {
               if (b->pspace == current_inferior ()->pspace
                   && (!target_has_registers
                       || frame_find_by_id (b->frame_id) == NULL))
                 bpfinishpy_out_of_scope (finish_bp);
             }
-          if (except.reason < 0)
+          CATCH (except, RETURN_MASK_ALL)
             {
               gdbpy_convert_exception (except);
               gdbpy_print_stack ();
             }
+	  END_CATCH
         }
     }
 
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 9ef8608..fd1541b 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -101,13 +101,16 @@ static PyObject *
 frapy_is_valid (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frame_object_to_frame_info (self);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     Py_RETURN_FALSE;
@@ -125,17 +128,19 @@ frapy_name (PyObject *self, PyObject *args)
   char *name = NULL;
   enum language lang;
   PyObject *result;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       find_frame_funname (frame, &name, &lang, NULL);
     }
 
-  if (except.reason < 0)
-    xfree (name);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      xfree (name);
+    }
+  END_CATCH
 
   GDB_PY_HANDLE_EXCEPTION (except);
 
@@ -161,15 +166,18 @@ frapy_type (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       type = get_frame_type (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return PyInt_FromLong (type);
 }
@@ -182,13 +190,16 @@ frapy_arch (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;    /* Initialize to appease gcc warning.  */
   frame_object *obj = (frame_object *) self;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdbarch_to_arch_object (obj->gdbarch);
 }
@@ -200,14 +211,17 @@ static PyObject *
 frapy_unwind_stop_reason (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;    /* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
   enum unwind_stop_reason stop_reason;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   stop_reason = get_frame_unwind_stop_reason (frame);
 
@@ -222,15 +236,18 @@ frapy_pc (PyObject *self, PyObject *args)
 {
   CORE_ADDR pc = 0;	      /* Initialize to appease gcc warning.  */
   struct frame_info *frame;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       pc = get_frame_pc (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdb_py_long_from_ulongest (pc);
 }
@@ -241,14 +258,13 @@ frapy_pc (PyObject *self, PyObject *args)
 static PyObject *
 frapy_read_register (PyObject *self, PyObject *args)
 {
-  volatile struct gdb_exception except;
   const char *regnum_str;
   struct value *val = NULL;
 
   if (!PyArg_ParseTuple (args, "s", &regnum_str))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct frame_info *frame;
       int regnum;
@@ -264,7 +280,11 @@ frapy_read_register (PyObject *self, PyObject *args)
       if (val == NULL)
         PyErr_SetString (PyExc_ValueError, _("Unknown register."));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return val == NULL ? NULL : value_to_value_object (val);
 }
@@ -277,14 +297,17 @@ frapy_block (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   const struct block *block = NULL, *fn_block;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
       block = get_frame_block (frame, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   for (fn_block = block;
        fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
@@ -316,15 +339,18 @@ frapy_function (PyObject *self, PyObject *args)
 {
   struct symbol *sym = NULL;
   struct frame_info *frame;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       sym = find_pc_function (get_frame_address_in_block (frame));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (sym)
     return symbol_to_symbol_object (sym);
@@ -339,13 +365,12 @@ PyObject *
 frame_info_to_frame_object (struct frame_info *frame)
 {
   frame_object *frame_obj;
-  volatile struct gdb_exception except;
 
   frame_obj = PyObject_New (frame_object, &frame_object_type);
   if (frame_obj == NULL)
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
 
       /* Try to get the previous frame, to determine if this is the last frame
@@ -365,12 +390,14 @@ frame_info_to_frame_object (struct frame_info *frame)
 	}
       frame_obj->gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       Py_DECREF (frame_obj);
       gdbpy_convert_exception (except);
       return NULL;
     }
+  END_CATCH
+
   return (PyObject *) frame_obj;
 }
 
@@ -382,16 +409,19 @@ static PyObject *
 frapy_older (PyObject *self, PyObject *args)
 {
   struct frame_info *frame, *prev = NULL;
-  volatile struct gdb_exception except;
   PyObject *prev_obj = NULL;   /* Initialize to appease gcc warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       prev = get_prev_frame (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (prev)
     prev_obj = (PyObject *) frame_info_to_frame_object (prev);
@@ -412,16 +442,19 @@ static PyObject *
 frapy_newer (PyObject *self, PyObject *args)
 {
   struct frame_info *frame, *next = NULL;
-  volatile struct gdb_exception except;
   PyObject *next_obj = NULL;   /* Initialize to appease gcc warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       next = get_next_frame (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (next)
     next_obj = (PyObject *) frame_info_to_frame_object (next);
@@ -442,17 +475,20 @@ frapy_find_sal (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   struct symtab_and_line sal;
-  volatile struct gdb_exception except;
   PyObject *sal_obj = NULL;   /* Initialize to appease gcc warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       find_frame_sal (frame, &sal);
       sal_obj = symtab_and_line_to_sal_object (sal);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return sal_obj;
 }
@@ -471,7 +507,6 @@ frapy_read_var (PyObject *self, PyObject *args)
   PyObject *sym_obj, *block_obj = NULL;
   struct symbol *var = NULL;	/* gcc-4.3.2 false warning.  */
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "O|O", &sym_obj, &block_obj))
     return NULL;
@@ -483,7 +518,6 @@ frapy_read_var (PyObject *self, PyObject *args)
       char *var_name;
       const struct block *block = NULL;
       struct cleanup *cleanup;
-      volatile struct gdb_exception except;
 
       var_name = python_string_to_target_string (sym_obj);
       if (!var_name)
@@ -502,7 +536,7 @@ frapy_read_var (PyObject *self, PyObject *args)
 	    }
 	}
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  FRAPY_REQUIRE_VALID (self, frame);
 
@@ -510,12 +544,13 @@ frapy_read_var (PyObject *self, PyObject *args)
 	    block = get_frame_block (frame, NULL);
 	  var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  do_cleanups (cleanup);
 	  gdbpy_convert_exception (except);
 	  return NULL;
 	}
+      END_CATCH
 
       if (!var)
 	{
@@ -535,13 +570,17 @@ frapy_read_var (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       val = read_var_value (var, frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
@@ -552,15 +591,18 @@ static PyObject *
 frapy_select (PyObject *self, PyObject *args)
 {
   struct frame_info *fi;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, fi);
 
       select_frame (fi);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -572,13 +614,16 @@ PyObject *
 gdbpy_newest_frame (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_current_frame ();
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frame_info_to_frame_object (frame);
 }
@@ -590,13 +635,16 @@ PyObject *
 gdbpy_selected_frame (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_selected_frame ("No frame is currently selected.");
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frame_info_to_frame_object (frame);
 }
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 97dce89..41a82b4 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -201,9 +201,8 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
 static enum ext_lang_bt_status
 py_print_type (struct ui_out *out, struct value *val)
 {
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct type *type;
       struct ui_file *stb;
@@ -216,11 +215,12 @@ py_print_type (struct ui_out *out, struct value *val)
       ui_out_field_stream (out, "type", stb);
       do_cleanups (cleanup);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       return EXT_LANG_BT_ERROR;
     }
+  END_CATCH
 
   return EXT_LANG_BT_OK;
 }
@@ -242,7 +242,6 @@ py_print_value (struct ui_out *out, struct value *val,
 		const struct language_defn *language)
 {
   int should_print = 0;
-  volatile struct gdb_exception except;
   int local_indent = (4 * indent);
 
   /* Never set an indent level for common_val_print if MI.  */
@@ -257,15 +256,16 @@ py_print_value (struct ui_out *out, struct value *val,
     {
       struct type *type = NULL;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  type = check_typedef (value_type (val));
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
 
       if (args_type == MI_PRINT_ALL_VALUES)
 	should_print = 1;
@@ -280,7 +280,7 @@ py_print_value (struct ui_out *out, struct value *val,
 
   if (should_print)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  struct ui_file *stb;
 	  struct cleanup *cleanup;
@@ -291,11 +291,12 @@ py_print_value (struct ui_out *out, struct value *val,
 	  ui_out_field_stream (out, "value", stb);
 	  do_cleanups (cleanup);
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
     }
 
   return EXT_LANG_BT_OK;
@@ -363,7 +364,6 @@ py_print_single_arg (struct ui_out *out,
 		     const struct language_defn *language)
 {
   struct value *val;
-  volatile struct gdb_exception except;
   enum ext_lang_bt_status retval = EXT_LANG_BT_OK;
 
   if (fa != NULL)
@@ -376,7 +376,7 @@ py_print_single_arg (struct ui_out *out,
   else
     val = fv;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
 
@@ -473,8 +473,11 @@ py_print_single_arg (struct ui_out *out,
 
       do_cleanups (cleanups);
     }
-  if (except.reason < 0)
-    gdbpy_convert_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      gdbpy_convert_exception (except);
+    }
+  END_CATCH
 
   return retval;
 }
@@ -499,7 +502,6 @@ enumerate_args (PyObject *iter,
 {
   PyObject *item;
   struct value_print_options opts;
-  volatile struct gdb_exception except;
 
   get_user_print_options (&opts);
 
@@ -511,15 +513,16 @@ enumerate_args (PyObject *iter,
 
   opts.deref_ref = 1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       annotate_frame_args ();
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto error;
     }
+  END_CATCH
 
   /*  Collect the first argument outside of the loop, so output of
       commas in the argument output is correct.  At the end of the
@@ -578,16 +581,17 @@ enumerate_args (PyObject *iter,
 	      goto error;
 	    }
 
-	  TRY_CATCH (except, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      read_frame_arg (sym, frame, &arg, &entryarg);
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ALL)
 	    {
 	      xfree (sym_name);
 	      gdbpy_convert_exception (except);
 	      goto error;
 	    }
+	  END_CATCH
 
 	  /* The object has not provided a value, so this is a frame
 	     argument to be read by GDB.  In this case we have to
@@ -612,12 +616,12 @@ enumerate_args (PyObject *iter,
 	    {
 	      if (arg.entry_kind != print_entry_values_only)
 		{
-		  TRY_CATCH (except, RETURN_MASK_ALL)
+		  TRY
 		    {
 		      ui_out_text (out, ", ");
 		      ui_out_wrap_hint (out, "    ");
 		    }
-		  if (except.reason < 0)
+		  CATCH (except, RETURN_MASK_ALL)
 		    {
 		      xfree (arg.error);
 		      xfree (entryarg.error);
@@ -625,6 +629,7 @@ enumerate_args (PyObject *iter,
 		      gdbpy_convert_exception (except);
 		      goto error;
 		    }
+		  END_CATCH
 		}
 
 	      if (py_print_single_arg (out, NULL, &entryarg, NULL, &opts,
@@ -664,30 +669,32 @@ enumerate_args (PyObject *iter,
       item = PyIter_Next (iter);
       if (item != NULL)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      ui_out_text (out, ", ");
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ALL)
 	    {
 	      Py_DECREF (item);
 	      gdbpy_convert_exception (except);
 	      goto error;
 	    }
+	  END_CATCH
 	}
       else if (PyErr_Occurred ())
 	goto error;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  annotate_arg_end ();
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  Py_DECREF (item);
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
     }
 
   return EXT_LANG_BT_OK;
@@ -729,7 +736,6 @@ enumerate_locals (PyObject *iter,
       struct value *val;
       enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
       struct symbol *sym;
-      volatile struct gdb_exception except;
       int local_indent = 8 + (8 * indent);
       struct cleanup *locals_cleanups;
 
@@ -761,16 +767,17 @@ enumerate_locals (PyObject *iter,
       /* If the object did not provide a value, read it.  */
       if (val == NULL)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      val = read_var_value (sym, frame);
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ALL)
 	    {
 	      gdbpy_convert_exception (except);
 	      do_cleanups (locals_cleanups);
 	      goto error;
 	    }
+	  END_CATCH
 	}
 
       /* With PRINT_NO_VALUES, MI does not emit a tuple normally as
@@ -781,7 +788,7 @@ enumerate_locals (PyObject *iter,
 	  if (print_args_field || args_type != NO_VALUES)
 	    make_cleanup_ui_out_tuple_begin_end (out, NULL);
 	}
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (! ui_out_is_mi_like_p (out))
 	    {
@@ -794,12 +801,13 @@ enumerate_locals (PyObject *iter,
 	  if (! ui_out_is_mi_like_p (out))
 	    ui_out_text (out, " = ");
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  do_cleanups (locals_cleanups);
 	  goto error;
 	}
+      END_CATCH
 
       if (args_type == MI_PRINT_SIMPLE_VALUES)
 	{
@@ -838,15 +846,16 @@ enumerate_locals (PyObject *iter,
 
       do_cleanups (locals_cleanups);
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  ui_out_text (out, "\n");
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
     }
 
   if (item == NULL && PyErr_Occurred ())
@@ -947,40 +956,41 @@ py_print_args (PyObject *filter,
 {
   PyObject *args_iter  = get_py_iter_from_func (filter, "frame_args");
   struct cleanup *old_chain = make_cleanup_py_xdecref (args_iter);
-  volatile struct gdb_exception except;
 
   if (args_iter == NULL)
     goto args_error;
 
   make_cleanup_ui_out_list_begin_end (out, "args");
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       annotate_frame_args ();
       if (! ui_out_is_mi_like_p (out))
 	ui_out_text (out, " (");
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto args_error;
     }
+  END_CATCH
 
   if (args_iter != Py_None)
     if (enumerate_args (args_iter, out, args_type, 0, frame)
 	== EXT_LANG_BT_ERROR)
       goto args_error;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (! ui_out_is_mi_like_p (out))
 	ui_out_text (out, ")");
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto args_error;
     }
+  END_CATCH
 
   do_cleanups (old_chain);
   return EXT_LANG_BT_OK;
@@ -1018,7 +1028,6 @@ py_print_frame (PyObject *filter, int flags,
   struct value_print_options opts;
   PyObject *py_inf_frame, *elided;
   int print_level, print_frame_info, print_args, print_locals;
-  volatile struct gdb_exception except;
 
   /* Extract print settings from FLAGS.  */
   print_level = (flags & PRINT_LEVEL) ? 1 : 0;
@@ -1042,15 +1051,16 @@ py_print_frame (PyObject *filter, int flags,
   if (frame == NULL)
     goto error;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto error;
     }
+  END_CATCH
 
 
   /* stack-list-variables.  */
@@ -1077,15 +1087,16 @@ py_print_frame (PyObject *filter, int flags,
 	 and are printed with indention.  */
       if (indent > 0)
 	{
-	TRY_CATCH (except, RETURN_MASK_ALL)
+	TRY
 	  {
 	    ui_out_spaces (out, indent*4);
 	  }
-	if (except.reason < 0)
+	CATCH (except, RETURN_MASK_ALL)
 	  {
 	    gdbpy_convert_exception (except);
 	    goto error;
 	  }
+	END_CATCH
 	}
 
       /* The address is required for frame annotations, and also for
@@ -1113,11 +1124,10 @@ py_print_frame (PyObject *filter, int flags,
     {
       struct frame_info **slot;
       int level;
-      volatile struct gdb_exception except;
 
       slot = (struct frame_info **) htab_find_slot (levels_printed,
 						    frame, INSERT);
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  level = frame_relative_level (frame);
 
@@ -1137,11 +1147,12 @@ py_print_frame (PyObject *filter, int flags,
 				    level);
 	    }
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
     }
 
   if (print_frame_info)
@@ -1150,18 +1161,19 @@ py_print_frame (PyObject *filter, int flags,
 	 print nothing.  */
       if (opts.addressprint && has_addr)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      annotate_frame_address ();
 	      ui_out_field_core_addr (out, "addr", gdbarch, address);
 	      annotate_frame_address_end ();
 	      ui_out_text (out, " in ");
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ALL)
 	    {
 	      gdbpy_convert_exception (except);
 	      goto error;
 	    }
+	  END_CATCH
 	}
 
       /* Print frame function name.  */
@@ -1209,7 +1221,7 @@ py_print_frame (PyObject *filter, int flags,
 		}
 
 
-	      TRY_CATCH (except, RETURN_MASK_ALL)
+	      TRY
 		{
 		  annotate_frame_function_name ();
 		  if (function == NULL)
@@ -1217,12 +1229,14 @@ py_print_frame (PyObject *filter, int flags,
 		  else
 		    ui_out_field_string (out, "func", function);
 		}
-	      if (except.reason < 0)
+	      CATCH (except, RETURN_MASK_ALL)
 		{
 		  Py_DECREF (py_func);
 		  gdbpy_convert_exception (except);
 		  goto error;
 		}
+	      END_CATCH
+
 	      Py_DECREF (py_func);
 	    }
 	  else
@@ -1242,15 +1256,16 @@ py_print_frame (PyObject *filter, int flags,
   /* File name/source/line number information.  */
   if (print_frame_info)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  annotate_frame_source_begin ();
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
 
       if (PyObject_HasAttrString (filter, "filename"))
 	{
@@ -1269,7 +1284,7 @@ py_print_frame (PyObject *filter, int flags,
 		    }
 
 		  make_cleanup (xfree, filename);
-		  TRY_CATCH (except, RETURN_MASK_ALL)
+		  TRY
 		    {
 		      ui_out_wrap_hint (out, "   ");
 		      ui_out_text (out, " at ");
@@ -1277,12 +1292,13 @@ py_print_frame (PyObject *filter, int flags,
 		      ui_out_field_string (out, "file", filename);
 		      annotate_frame_source_file_end ();
 		    }
-		  if (except.reason < 0)
+		  CATCH (except, RETURN_MASK_ALL)
 		    {
 		      Py_DECREF (py_fn);
 		      gdbpy_convert_exception (except);
 		      goto error;
 		    }
+		  END_CATCH
 		}
 	      Py_DECREF (py_fn);
 	    }
@@ -1300,18 +1316,19 @@ py_print_frame (PyObject *filter, int flags,
 	      if (py_line != Py_None)
 		{
 		  line = PyLong_AsLong (py_line);
-		  TRY_CATCH (except, RETURN_MASK_ALL)
+		  TRY
 		    {
 		      ui_out_text (out, ":");
 		      annotate_frame_source_line ();
 		      ui_out_field_int (out, "line", line);
 		    }
-		  if (except.reason < 0)
+		  CATCH (except, RETURN_MASK_ALL)
 		    {
 		      Py_DECREF (py_line);
 		      gdbpy_convert_exception (except);
 		      goto error;
 		    }
+		  END_CATCH
 		}
 	      Py_DECREF (py_line);
 	    }
@@ -1324,16 +1341,17 @@ py_print_frame (PyObject *filter, int flags,
      elided frames, so if MI output detected do not send newline.  */
   if (! ui_out_is_mi_like_p (out))
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  annotate_frame_end ();
 	  ui_out_text (out, "\n");
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
     }
 
   if (print_locals)
@@ -1474,22 +1492,22 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
   struct cleanup *cleanups;
   enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
   PyObject *iterable;
-  volatile struct gdb_exception except;
   PyObject *item;
   htab_t levels_printed;
 
   if (!gdb_python_initialized)
     return EXT_LANG_BT_NO_FILTERS;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       /* Let gdb try to print the stack trace.  */
       return EXT_LANG_BT_NO_FILTERS;
     }
+  END_CATCH
 
   cleanups = ensure_python_env (gdbarch, current_language);
 
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index 7a5c853..02e6d09 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -37,17 +37,18 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
 {
   int n;
   char *p = NULL, *q;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    p = command_line_input (prompt, 0, "python");
+  TRY
+    {
+      p = command_line_input (prompt, 0, "python");
+    }
 
   /* Detect user interrupt (Ctrl-C).  */
   if (except.reason == RETURN_QUIT)
     return NULL;
 
   /* Handle errors by raising Python exceptions.  */
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       /* The thread state is nulled during gdbpy_readline_wrapper,
 	 with the original value saved in the following undocumented
@@ -58,6 +59,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
       PyEval_SaveThread ();
       return NULL;
     }
+  END_CATCH
 
   /* Detect EOF (Ctrl-D).  */
   if (p == NULL)
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 5d13e07..56b79cf 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -395,13 +395,18 @@ infpy_threads (PyObject *self, PyObject *args)
   struct threadlist_entry *entry;
   inferior_object *inf_obj = (inferior_object *) self;
   PyObject *tuple;
-  volatile struct gdb_exception except;
 
   INFPY_REQUIRE_VALID (inf_obj);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    update_thread_list ();
-  GDB_PY_HANDLE_EXCEPTION (except);
+  TRY
+    {
+      update_thread_list ();
+    }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   tuple = PyTuple_New (inf_obj->nthreads);
   if (!tuple)
@@ -503,7 +508,6 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
   void *buffer = NULL;
   membuf_object *membuf_obj;
   PyObject *addr_obj, *length_obj, *result;
-  volatile struct gdb_exception except;
   static char *keywords[] = { "address", "length", NULL };
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "OO", keywords,
@@ -514,17 +518,18 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
       || get_addr_from_python (length_obj, &length) < 0)
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       buffer = xmalloc (length);
 
       read_memory (addr, buffer, length);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (buffer);
       GDB_PY_HANDLE_EXCEPTION (except);
     }
+  END_CATCH
 
   membuf_obj = PyObject_New (membuf_object, &membuf_object_type);
   if (membuf_obj == NULL)
@@ -561,7 +566,6 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
   const char *buffer;
   CORE_ADDR addr, length;
   PyObject *addr_obj, *length_obj = NULL;
-  volatile struct gdb_exception except;
   static char *keywords[] = { "address", "buffer", "length", NULL };
 #ifdef IS_PY3K
   Py_buffer pybuf;
@@ -588,10 +592,15 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
   else if (get_addr_from_python (length_obj, &length) < 0)
     goto fail;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       write_memory_with_notification (addr, (gdb_byte *) buffer, length);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
 #ifdef IS_PY3K
   PyBuffer_Release (&pybuf);
 #endif
@@ -704,7 +713,6 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
   CORE_ADDR start_addr, length;
   static char *keywords[] = { "address", "length", "pattern", NULL };
   PyObject *start_addr_obj, *length_obj;
-  volatile struct gdb_exception except;
   Py_ssize_t pattern_size;
   const void *buffer;
   CORE_ADDR found_addr;
@@ -760,12 +768,17 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
       goto fail;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       found = target_search_memory (start_addr, length,
 				    buffer, pattern_size,
 				    &found_addr);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
 #ifdef IS_PY3K
   PyBuffer_Release (&pybuf);
 #endif
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 9a9a2e6..4d0a020 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -147,15 +147,18 @@ static PyObject *
 thpy_switch (PyObject *self, PyObject *args)
 {
   thread_object *thread_obj = (thread_object *) self;
-  volatile struct gdb_exception except;
 
   THPY_REQUIRE_VALID (thread_obj);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch_to_thread (thread_obj->thread->ptid);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 9c0f7a4..c9774ab 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -96,7 +96,6 @@ stpy_convert_to_value  (PyObject *self, PyObject *args)
 {
   lazy_string_object *self_string = (lazy_string_object *) self;
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
   if (self_string->address == 0)
     {
@@ -105,11 +104,15 @@ stpy_convert_to_value  (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val = value_at_lazy (self_string->type, self_string->address);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index ff1716b..195a8b3 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -172,18 +172,21 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
   linetable_entry_object *result;
   VEC (CORE_ADDR) *pcs = NULL;
   PyObject *tuple;
-  volatile struct gdb_exception except;
 
   LTPY_REQUIRE_VALID (self, symtab);
 
   if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       pcs = find_pcs_for_symtab_line (symtab, py_line, &best_entry);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   tuple = build_line_table_tuple_from_pcs (py_line, pcs);
   VEC_free (CORE_ADDR, pcs);
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 0a10623..157d200 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -131,15 +131,18 @@ objfpy_get_build_id (PyObject *self, void *closure)
   objfile_object *obj = (objfile_object *) self;
   struct objfile *objfile = obj->objfile;
   const struct elf_build_id *build_id = NULL;
-  volatile struct gdb_exception except;
 
   OBJFPY_REQUIRE_VALID (obj);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       build_id = build_id_bfd_get (objfile->obfd);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (build_id != NULL)
     {
@@ -386,20 +389,23 @@ objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw)
   objfile_object *obj = (objfile_object *) self;
   const char *file_name;
   int symfile_flags = 0;
-  volatile struct gdb_exception except;
 
   OBJFPY_REQUIRE_VALID (obj);
 
   if (!PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       bfd *abfd = symfile_bfd_open (file_name);
 
       symbol_file_add_separate (abfd, file_name, symfile_flags, obj->objfile);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 2fe5be6..06b9ae9 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -662,7 +662,6 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   int parmclass, cmdtype;
   PyObject *enum_values = NULL;
   struct cmd_list_element **set_list, **show_list;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "sii|O", &name, &cmdtype, &parmclass,
 			  &enum_values))
@@ -724,14 +723,14 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 
   Py_INCREF (self);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       add_setshow_generic (parmclass, (enum command_class) cmdtype,
 			   cmd_name, obj,
 			   set_doc, show_doc,
 			   doc, set_list, show_list);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (cmd_name);
       xfree (set_doc);
@@ -743,6 +742,8 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 		    "%s", except.message);
       return -1;
     }
+  END_CATCH
+
   return 0;
 }
 
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index f4c91d0..d8579fa 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -213,11 +213,10 @@ find_pretty_printer (PyObject *value)
 static PyObject *
 pretty_print_one_value (PyObject *printer, struct value **out_value)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
   *out_value = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
       if (result)
@@ -233,6 +232,10 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
 	    }
 	}
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   return result;
 }
@@ -803,13 +806,16 @@ gdbpy_get_varobj_pretty_printer (struct value *value)
 {
   PyObject *val_obj;
   PyObject *pretty_printer = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = value_copy (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   val_obj = value_to_value_object (value);
   if (! val_obj)
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 729bc64..4306f61 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -192,16 +192,19 @@ static PyObject *
 sympy_needs_frame (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  volatile struct gdb_exception except;
   int result = 0;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = symbol_read_needs_frame (symbol);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (result)
     Py_RETURN_TRUE;
@@ -246,7 +249,6 @@ sympy_value (PyObject *self, PyObject *args)
   struct frame_info *frame_info = NULL;
   PyObject *frame_obj = NULL;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "|O", &frame_obj))
     return NULL;
@@ -264,7 +266,7 @@ sympy_value (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (frame_obj != NULL)
 	{
@@ -278,7 +280,11 @@ sympy_value (PyObject *self, PyObject *args)
 
       value = read_var_value (symbol, frame_info);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (value);
 }
@@ -365,7 +371,6 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
   struct symbol *symbol = NULL;
   PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
   const struct block *block = NULL;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
 				     &block_object_type, &block_obj, &domain))
@@ -376,21 +381,28 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
   else
     {
       struct frame_info *selected_frame;
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  selected_frame = get_selected_frame (_("No frame selected."));
 	  block = get_frame_block (selected_frame, NULL);
 	}
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   ret_tuple = PyTuple_New (2);
   if (!ret_tuple)
@@ -430,17 +442,20 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
   static char *keywords[] = { "name", "domain", NULL };
   struct symbol *symbol = NULL;
   PyObject *sym_obj;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
 				     &domain))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_global_symbol (name, NULL, domain);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (symbol)
     {
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index a3da678..4ca379e 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -341,15 +341,18 @@ typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
 {
   PyObject *py_type = self;
   PyObject *result = NULL, *iter = NULL;
-  volatile struct gdb_exception except;
   struct type *type = ((type_object *) py_type)->type;
   struct type *checked_type = type;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (checked_type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (checked_type != type)
     py_type = type_to_type_object (checked_type);
@@ -449,13 +452,16 @@ static PyObject *
 typy_strip_typedefs (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -466,15 +472,18 @@ typy_strip_typedefs (PyObject *self, PyObject *args)
 static struct type *
 typy_get_composite (struct type *type)
 {
-  volatile struct gdb_exception except;
 
   for (;;)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  CHECK_TYPEDEF (type);
 	}
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (TYPE_CODE (type) != TYPE_CODE_PTR
 	  && TYPE_CODE (type) != TYPE_CODE_REF)
@@ -505,7 +514,6 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
   PyObject *n2_obj = NULL;
   struct type *array = NULL;
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "l|O", &n1, &n2_obj))
     return NULL;
@@ -535,13 +543,17 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       array = lookup_array_range_type (type, n1, n2);
       if (is_vector)
 	make_vector_type (array);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (array);
 }
@@ -567,13 +579,16 @@ static PyObject *
 typy_pointer (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_pointer_type (type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -648,13 +663,16 @@ static PyObject *
 typy_reference (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_reference_type (type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -680,13 +698,16 @@ static PyObject *
 typy_const (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (1, 0, type, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -696,13 +717,16 @@ static PyObject *
 typy_volatile (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 1, type, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -712,13 +736,16 @@ static PyObject *
 typy_unqualified (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 0, type, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -728,12 +755,16 @@ static PyObject *
 typy_get_sizeof (PyObject *self, void *closure)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       check_typedef (type);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   /* Ignore exceptions.  */
 
   return gdb_py_long_from_longest (TYPE_LENGTH (type));
@@ -743,9 +774,8 @@ static struct type *
 typy_lookup_typename (const char *type_name, const struct block *block)
 {
   struct type *type = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (!strncmp (type_name, "struct ", 7))
 	type = lookup_struct (type_name + 7, NULL);
@@ -757,7 +787,11 @@ typy_lookup_typename (const char *type_name, const struct block *block)
 	type = lookup_typename (python_language, python_gdbarch,
 				type_name, block, 0);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type;
 }
@@ -769,7 +803,6 @@ typy_lookup_type (struct demangle_component *demangled,
   struct type *type, *rtype = NULL;
   char *type_name = NULL;
   enum demangle_component_type demangled_type;
-  volatile struct gdb_exception except;
 
   /* Save the type: typy_lookup_type() may (indirectly) overwrite
      memory pointed by demangled.  */
@@ -784,7 +817,7 @@ typy_lookup_type (struct demangle_component *demangled,
       if (! type)
 	return NULL;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  /* If the demangled_type matches with one of the types
 	     below, run the corresponding function and save the type
@@ -806,7 +839,11 @@ typy_lookup_type (struct demangle_component *demangled,
 	      break;
 	    }
 	}
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
 
   /* If we have a type from the switch statement above, just return
@@ -837,7 +874,6 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
   const char *err;
   struct type *argtype;
   struct cleanup *cleanup;
-  volatile struct gdb_exception except;
 
   if (TYPE_NAME (type) == NULL)
     {
@@ -845,12 +881,16 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Note -- this is not thread-safe.  */
       info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (! info)
     {
@@ -903,7 +943,6 @@ typy_template_argument (PyObject *self, PyObject *args)
   PyObject *block_obj = NULL;
   struct symbol *sym;
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "i|O", &argno, &block_obj))
     return NULL;
@@ -919,13 +958,17 @@ typy_template_argument (PyObject *self, PyObject *args)
 	}
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (type);
       if (TYPE_CODE (type) == TYPE_CODE_REF)
 	type = check_typedef (TYPE_TARGET_TYPE (type));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* We might not have DW_TAG_template_*, so try to parse the type's
      name.  This is inefficient if we do not have a template type --
@@ -950,11 +993,15 @@ typy_template_argument (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val = value_of_variable (sym, block);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
@@ -962,12 +1009,11 @@ typy_template_argument (PyObject *self, PyObject *args)
 static PyObject *
 typy_str (PyObject *self)
 {
-  volatile struct gdb_exception except;
   char *thetype = NULL;
   long length = 0;
   PyObject *result;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *old_chain;
       struct ui_file *stb;
@@ -981,11 +1027,12 @@ typy_str (PyObject *self)
       thetype = ui_file_xstrdup (stb, &length);
       do_cleanups (old_chain);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (thetype);
       GDB_PY_HANDLE_EXCEPTION (except);
     }
+  END_CATCH
 
   result = PyUnicode_Decode (thetype, length, host_charset (), NULL);
   xfree (thetype);
@@ -1001,7 +1048,6 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
   int result = Py_NE;
   struct type *type1 = type_object_to_type (self);
   struct type *type2 = type_object_to_type (other);
-  volatile struct gdb_exception except;
 
   /* We can only compare ourselves to another Type object, and only
      for equality or inequality.  */
@@ -1015,10 +1061,15 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
     result = Py_EQ;
   else
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  result = types_deeply_equal (type1, type2);
 	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       /* If there is a GDB exception, a comparison is not capable
 	 (or trusted), so exit.  */
       GDB_PY_HANDLE_EXCEPTION (except);
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 58a5934..2e32f11 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -316,13 +316,16 @@ get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
 {
   if (gdbpy_is_value_object (obj))
     {
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  *addr = value_as_address (value_object_to_value (obj));
 	}
-      GDB_PY_SET_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_SET_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
   else
     {
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 5a13777..1c8245b 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -172,10 +172,9 @@ gdbpy_preserve_values (const struct extension_language_defn *extlang,
 static PyObject *
 valpy_dereference (PyObject *self, PyObject *args)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *res_val;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -184,7 +183,11 @@ valpy_dereference (PyObject *self, PyObject *args)
       result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -200,10 +203,9 @@ valpy_dereference (PyObject *self, PyObject *args)
 static PyObject *
 valpy_referenced_value (PyObject *self, PyObject *args)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *self_val, *res_val;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -225,7 +227,11 @@ valpy_referenced_value (PyObject *self, PyObject *args)
       result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -235,11 +241,10 @@ static PyObject *
 valpy_get_address (PyObject *self, void *closure)
 {
   value_object *val_obj = (value_object *) self;
-  volatile struct gdb_exception except;
 
   if (!val_obj->address)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  struct value *res_val;
 	  struct cleanup *cleanup
@@ -249,11 +254,12 @@ valpy_get_address (PyObject *self, void *closure)
 	  val_obj->address = value_to_value_object (res_val);
 	  do_cleanups (cleanup);
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  val_obj->address = Py_None;
 	  Py_INCREF (Py_None);
 	}
+      END_CATCH
     }
 
   Py_XINCREF (val_obj->address);
@@ -283,7 +289,6 @@ static PyObject *
 valpy_get_dynamic_type (PyObject *self, void *closure)
 {
   value_object *obj = (value_object *) self;
-  volatile struct gdb_exception except;
   struct type *type = NULL;
 
   if (obj->dynamic_type != NULL)
@@ -292,7 +297,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
       return obj->dynamic_type;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *val = obj->value;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -331,7 +336,11 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (type == NULL)
     obj->dynamic_type = valpy_get_type (self, NULL);
@@ -358,13 +367,12 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
   const char *user_encoding = NULL;
   static char *keywords[] = { "encoding", "length", NULL };
   PyObject *str_obj = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG, keywords,
 				    &user_encoding, &length))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -377,7 +385,11 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return str_obj;
 }
@@ -394,7 +406,6 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
   int length = -1;
   gdb_byte *buffer;
   struct value *value = ((value_object *) self)->value;
-  volatile struct gdb_exception except;
   PyObject *unicode;
   const char *encoding = NULL;
   const char *errors = NULL;
@@ -407,11 +418,15 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
 				    &user_encoding, &errors, &length))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
   unicode = PyUnicode_Decode ((const char *) buffer,
@@ -429,7 +444,6 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
 {
   PyObject *type_obj, *result = NULL;
   struct type *type;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "O", &type_obj))
     return NULL;
@@ -442,7 +456,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *val = ((value_object *) self)->value;
       struct value *res_val;
@@ -461,7 +475,11 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
       result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -508,7 +526,6 @@ value_has_field (struct value *v, PyObject *field)
   struct type *parent_type, *val_type;
   enum type_code type_code;
   PyObject *type_object = PyObject_GetAttrString (field, "parent_type");
-  volatile struct gdb_exception except;
   int has_field = 0;
 
   if (type_object == NULL)
@@ -524,7 +541,7 @@ value_has_field (struct value *v, PyObject *field)
       return -1;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val_type = value_type (v);
       val_type = check_typedef (val_type);
@@ -539,7 +556,11 @@ value_has_field (struct value *v, PyObject *field)
       else
 	has_field = 0;
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return has_field;
 }
@@ -595,7 +616,6 @@ valpy_getitem (PyObject *self, PyObject *key)
   char *field = NULL;
   struct type *base_class_type = NULL, *field_type = NULL;
   long bitpos = -1;
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
   if (gdbpy_is_string (key))
@@ -673,7 +693,7 @@ valpy_getitem (PyObject *self, PyObject *key)
 	}
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *tmp = self_value->value;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -723,6 +743,10 @@ valpy_getitem (PyObject *self, PyObject *key)
 	result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   xfree (field);
   GDB_PY_HANDLE_EXCEPTION (except);
@@ -744,18 +768,21 @@ static PyObject *
 valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
 {
   Py_ssize_t args_count;
-  volatile struct gdb_exception except;
   struct value *function = ((value_object *) self)->value;
   struct value **vargs = NULL;
   struct type *ftype = NULL;
   struct value *mark = value_mark ();
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       ftype = check_typedef (value_type (function));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (TYPE_CODE (ftype) != TYPE_CODE_FUNC)
     {
@@ -790,7 +817,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
 	}
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
       struct value *return_value;
@@ -799,7 +826,11 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
       result = value_to_value_object (return_value);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -812,12 +843,11 @@ valpy_str (PyObject *self)
   char *s = NULL;
   PyObject *result;
   struct value_print_options opts;
-  volatile struct gdb_exception except;
 
   get_user_print_options (&opts);
   opts.deref_ref = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct ui_file *stb = mem_fileopen ();
       struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -828,7 +858,11 @@ valpy_str (PyObject *self)
 
       do_cleanups (old_chain);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
   xfree (s);
@@ -842,13 +876,16 @@ valpy_get_is_optimized_out (PyObject *self, void *closure)
 {
   struct value *value = ((value_object *) self)->value;
   int opt = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       opt = value_optimized_out (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (opt)
     Py_RETURN_TRUE;
@@ -862,13 +899,16 @@ valpy_get_is_lazy (PyObject *self, void *closure)
 {
   struct value *value = ((value_object *) self)->value;
   int opt = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       opt = value_lazy (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (opt)
     Py_RETURN_TRUE;
@@ -881,14 +921,17 @@ static PyObject *
 valpy_fetch_lazy (PyObject *self, PyObject *args)
 {
   struct value *value = ((value_object *) self)->value;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (value_lazy (value))
 	value_fetch_lazy (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -926,10 +969,9 @@ enum valpy_opcode
 static PyObject *
 valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *arg1, *arg2;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -1049,7 +1091,11 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -1103,10 +1149,9 @@ valpy_power (PyObject *self, PyObject *other, PyObject *unused)
 static PyObject *
 valpy_negative (PyObject *self)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Perhaps overkill, but consistency has some virtue.  */
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -1116,7 +1161,11 @@ valpy_negative (PyObject *self)
       result = value_to_value_object (val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -1131,10 +1180,9 @@ static PyObject *
 valpy_absolute (PyObject *self)
 {
   struct value *value = ((value_object *) self)->value;
-  volatile struct gdb_exception except;
   int isabs = 1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -1143,7 +1191,11 @@ valpy_absolute (PyObject *self)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (isabs)
     return valpy_positive (self);
@@ -1155,12 +1207,11 @@ valpy_absolute (PyObject *self)
 static int
 valpy_nonzero (PyObject *self)
 {
-  volatile struct gdb_exception except;
   value_object *self_value = (value_object *) self;
   struct type *type;
   int nonzero = 0; /* Appease GCC warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (value_type (self_value->value));
 
@@ -1176,6 +1227,11 @@ valpy_nonzero (PyObject *self)
 	/* All other values are True.  */
 	nonzero = 1;
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   /* This is not documented in the Python documentation, but if this
      function fails, return -1 as slot_nb_nonzero does (the default
      Python nonzero function).  */
@@ -1189,13 +1245,16 @@ static PyObject *
 valpy_invert (PyObject *self)
 {
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val = value_complement (((value_object *) self)->value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
@@ -1241,7 +1300,6 @@ static PyObject *
 valpy_richcompare (PyObject *self, PyObject *other, int op)
 {
   int result = 0;
-  volatile struct gdb_exception except;
 
   if (other == Py_None)
     /* Comparing with None is special.  From what I can tell, in Python
@@ -1262,7 +1320,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
 	return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *value_other, *mark = value_mark ();
       struct cleanup *cleanup;
@@ -1307,7 +1365,11 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* In this case, the Python exception has already been set.  */
   if (result < 0)
@@ -1327,16 +1389,19 @@ valpy_int (PyObject *self)
   struct value *value = ((value_object *) self)->value;
   struct type *type = value_type (value);
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (!is_integral_type (type))
 	error (_("Cannot convert value to int."));
 
       l = value_as_long (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdb_py_object_from_longest (l);
 }
@@ -1349,9 +1414,8 @@ valpy_long (PyObject *self)
   struct value *value = ((value_object *) self)->value;
   struct type *type = value_type (value);
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
 
@@ -1361,7 +1425,11 @@ valpy_long (PyObject *self)
 
       l = value_as_long (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdb_py_long_from_longest (l);
 }
@@ -1373,9 +1441,8 @@ valpy_float (PyObject *self)
   struct value *value = ((value_object *) self)->value;
   struct type *type = value_type (value);
   double d = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
 
@@ -1384,7 +1451,11 @@ valpy_float (PyObject *self)
 
       d = value_as_double (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return PyFloat_FromDouble (d);
 }
@@ -1431,12 +1502,11 @@ struct value *
 convert_value_from_python (PyObject *obj)
 {
   struct value *value = NULL; /* -Wall */
-  volatile struct gdb_exception except;
   int cmp;
 
   gdb_assert (obj != NULL);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (PyBool_Check (obj))
 	{
@@ -1532,13 +1602,14 @@ convert_value_from_python (PyObject *obj)
 		      PyString_AsString (PyObject_Str (obj)));
 #endif
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       PyErr_Format (except.reason == RETURN_QUIT
 		    ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
 		    "%s", except.message);
       return NULL;
     }
+  END_CATCH
 
   return value;
 }
@@ -1549,16 +1620,19 @@ gdbpy_history (PyObject *self, PyObject *args)
 {
   int i;
   struct value *res_val = NULL;	  /* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "i", &i))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = access_value_history (i);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (res_val);
 }
diff --git a/gdb/python/python.c b/gdb/python/python.c
index a13638f..e9bcadb 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -568,17 +568,21 @@ gdbpy_parameter (PyObject *self, PyObject *args)
   const char *arg;
   char *newarg;
   int found = -1;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "s", &arg))
     return NULL;
 
   newarg = concat ("show ", arg, (char *) NULL);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   xfree (newarg);
   GDB_PY_HANDLE_EXCEPTION (except);
   if (!found)
@@ -619,7 +623,6 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
   const char *arg;
   PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
   int from_tty, to_string;
-  volatile struct gdb_exception except;
   static char *keywords[] = {"command", "from_tty", "to_string", NULL };
   char *result = NULL;
 
@@ -646,7 +649,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
       to_string = cmp;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Copy the argument text in case the command modifies it.  */
       char *copy = xstrdup (arg);
@@ -666,7 +669,11 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Do any commands attached to breakpoint we stopped at.  */
   bpstat_do_actions ();
@@ -719,7 +726,6 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   PyObject *result = NULL;
   PyObject *return_result = NULL;
   PyObject *unparsed = NULL;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "|s", &arg))
     return NULL;
@@ -727,7 +733,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   cleanups = make_cleanup (null_cleanup, NULL);
 
   sals.sals = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (arg)
 	{
@@ -743,6 +749,10 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
 	  sals.nelts = 1;
 	}
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   if (sals.sals != NULL && sals.sals != &sal)
     {
@@ -824,16 +834,19 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args)
 {
   const char *expr_str;
   struct value *result = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "s", &expr_str))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = parse_and_eval (expr_str);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (result);
 }
@@ -845,13 +858,12 @@ static PyObject *
 gdbpy_find_pc_line (PyObject *self, PyObject *args)
 {
   gdb_py_ulongest pc_llu;
-  volatile struct gdb_exception except;
   PyObject *result = NULL; /* init for gcc -Wall */
 
   if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc_llu))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct symtab_and_line sal;
       CORE_ADDR pc;
@@ -860,7 +872,11 @@ gdbpy_find_pc_line (PyObject *self, PyObject *args)
       sal = find_pc_line (pc, 0);
       result = symtab_and_line_to_sal_object (sal);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -1096,13 +1112,12 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
   const char *arg;
   static char *keywords[] = {"text", "stream", NULL };
   int stream_type = 0;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg,
 				     &stream_type))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (stream_type)
         {
@@ -1120,7 +1135,11 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
           fprintf_filtered (gdb_stdout, "%s", arg);
         }
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -1165,7 +1184,6 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
 void
 gdbpy_print_stack (void)
 {
-  volatile struct gdb_exception except;
 
   /* Print "none", just clear exception.  */
   if (gdbpy_should_print_stack == python_excp_none)
@@ -1179,10 +1197,14 @@ gdbpy_print_stack (void)
       /* PyErr_Print doesn't necessarily end output with a newline.
 	 This works because Python's stdout/stderr is fed through
 	 printf_filtered.  */
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  begin_line ();
 	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
     }
   /* Print "message", just error print message.  */
   else
@@ -1196,7 +1218,7 @@ gdbpy_print_stack (void)
       msg = gdbpy_exception_to_string (ptype, pvalue);
       type = gdbpy_obj_to_string (ptype);
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (msg == NULL)
 	    {
@@ -1210,6 +1232,10 @@ gdbpy_print_stack (void)
 	    fprintf_filtered (gdb_stderr, "Python Exception %s %s: \n",
 			      type, msg);
 	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
 
       Py_XDECREF (ptype);
       Py_XDECREF (pvalue);
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 35c775a..d98472a 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -139,10 +139,15 @@ require_btrace (void)
 static void
 record_btrace_enable_warn (struct thread_info *tp)
 {
-  volatile struct gdb_exception error;
 
-  TRY_CATCH (error, RETURN_MASK_ERROR)
-    btrace_enable (tp, &record_btrace_conf);
+  TRY
+    {
+      btrace_enable (tp, &record_btrace_conf);
+    }
+  CATCH (error, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   if (error.message != NULL)
     warning ("%s", error.message);
@@ -1101,7 +1106,6 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
 				 struct gdbarch *gdbarch,
 				 struct bp_target_info *bp_tgt)
 {
-  volatile struct gdb_exception except;
   const char *old;
   int ret;
 
@@ -1111,13 +1115,18 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
   replay_memory_access = replay_memory_access_read_write;
 
   ret = 0;
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+  TRY
+    {
+      ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+    }
 
   replay_memory_access = old;
 
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 
   return ret;
 }
@@ -1129,7 +1138,6 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
 				 struct gdbarch *gdbarch,
 				 struct bp_target_info *bp_tgt)
 {
-  volatile struct gdb_exception except;
   const char *old;
   int ret;
 
@@ -1139,13 +1147,18 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
   replay_memory_access = replay_memory_access_read_write;
 
   ret = 0;
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
+  TRY
+    {
+      ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
+    }
 
   replay_memory_access = old;
 
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 
   return ret;
 }
@@ -1583,7 +1596,6 @@ record_btrace_find_resume_thread (ptid_t ptid)
 static struct btrace_insn_iterator *
 record_btrace_start_replaying (struct thread_info *tp)
 {
-  volatile struct gdb_exception except;
   struct btrace_insn_iterator *replay;
   struct btrace_thread_info *btinfo;
   int executing;
@@ -1610,7 +1622,7 @@ record_btrace_start_replaying (struct thread_info *tp)
      Since frames are computed differently when we're replaying, we need to
      recompute those stored frames and fix them up so we can still detect
      subroutines after we started replaying.  */
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct frame_info *frame;
       struct frame_id frame_id;
@@ -1662,7 +1674,7 @@ record_btrace_start_replaying (struct thread_info *tp)
   /* Restore the previous execution state.  */
   set_executing (tp->ptid, executing);
 
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (btinfo->replay);
       btinfo->replay = NULL;
@@ -1671,6 +1683,7 @@ record_btrace_start_replaying (struct thread_info *tp)
 
       throw_exception (except);
     }
+  END_CATCH
 
   return replay;
 }
@@ -2212,15 +2225,20 @@ init_record_btrace_ops (void)
 static void
 cmd_record_btrace_bts_start (char *args, int from_tty)
 {
-  volatile struct gdb_exception exception;
 
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
 
   record_btrace_conf.format = BTRACE_FORMAT_BTS;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
-    execute_command ("target record-btrace", from_tty);
+  TRY
+    {
+      execute_command ("target record-btrace", from_tty);
+    }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   if (exception.error != 0)
     {
@@ -2234,15 +2252,20 @@ cmd_record_btrace_bts_start (char *args, int from_tty)
 static void
 cmd_record_btrace_start (char *args, int from_tty)
 {
-  volatile struct gdb_exception exception;
 
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
 
   record_btrace_conf.format = BTRACE_FORMAT_BTS;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
-    execute_command ("target record-btrace", from_tty);
+  TRY
+    {
+      execute_command ("target record-btrace", from_tty);
+    }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   if (exception.error == 0)
     return;
diff --git a/gdb/remote.c b/gdb/remote.c
index 45d3bda..3cdbe54 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -497,7 +497,6 @@ remote_get_noisy_reply (char **buf_p,
 	  CORE_ADDR from, to, org_to;
 	  char *p, *pp;
 	  int adjusted_size = 0;
-	  volatile struct gdb_exception ex;
 	  int relocated = 0;
 
 	  p = buf + strlen ("qRelocInsn:");
@@ -512,12 +511,12 @@ remote_get_noisy_reply (char **buf_p,
 
 	  org_to = to;
 
-	  TRY_CATCH (ex, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      gdbarch_relocate_instruction (target_gdbarch (), &to, from);
 	      relocated = 1;
 	    }
-	  if (ex.reason < 0)
+	  CATCH (ex, RETURN_MASK_ALL)
 	    {
 	      if (ex.error == MEMORY_ERROR)
 		{
@@ -536,6 +535,7 @@ remote_get_noisy_reply (char **buf_p,
 		}
 	      putpkt ("E01");
 	    }
+	  END_CATCH
 
 	  if (relocated)
 	    {
@@ -4360,13 +4360,12 @@ remote_open_1 (const char *name, int from_tty,
      all the ``target ....'' commands to share a common callback
      function.  See cli-dump.c.  */
   {
-    volatile struct gdb_exception ex;
 
-    TRY_CATCH (ex, RETURN_MASK_ALL)
+    TRY
       {
 	remote_start_remote (from_tty, target, extended_p);
       }
-    if (ex.reason < 0)
+    CATCH (ex, RETURN_MASK_ALL)
       {
 	/* Pop the partially set up target - unless something else did
 	   already before throwing the exception.  */
@@ -4376,6 +4375,7 @@ remote_open_1 (const char *name, int from_tty,
 	  wait_forever_enabled_p = 1;
 	throw_exception (ex);
       }
+    END_CATCH
   }
 
   remote_btrace_reset ();
@@ -7788,15 +7788,14 @@ getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever,
 static void
 remote_kill (struct target_ops *ops)
 {
-  volatile struct gdb_exception ex;
 
   /* Catch errors so the user can quit from gdb even when we
      aren't on speaking terms with the remote system.  */
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       putpkt ("k");
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == TARGET_CLOSE_ERROR)
 	{
@@ -7814,6 +7813,7 @@ remote_kill (struct target_ops *ops)
 	   user or higher layers decide what to do.  */
 	throw_exception (ex);
     }
+  END_CATCH
 
   /* We've killed the remote end, we get to mourn it.  Since this is
      target remote, single-process, mourning the inferior also
@@ -10861,7 +10861,6 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
   char *p = NULL;
   /* FIXME we need to get register block size some other way.  */
   extern int trace_regblock_size;
-  volatile struct gdb_exception ex;
   enum packet_result result;
 
   if (packet_support (PACKET_qTStatus) == PACKET_DISABLE)
@@ -10871,11 +10870,11 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
 
   putpkt ("qTStatus");
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       p = remote_get_noisy_reply (&target_buf, &target_buf_size);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != TARGET_CLOSE_ERROR)
 	{
@@ -10884,6 +10883,7 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
 	}
       throw_exception (ex);
     }
+  END_CATCH
 
   result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]);
 
@@ -11450,7 +11450,6 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
   struct remote_state *rs = get_remote_state ();
   char *buf = rs->buf;
   char *endbuf = rs->buf + get_remote_packet_size ();
-  volatile struct gdb_exception err;
 
   if (packet_config_support (packet) != PACKET_ENABLE)
     error (_("Target does not support branch tracing."));
@@ -11478,8 +11477,14 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
 
   /* If we fail to read the configuration, we lose some information, but the
      tracing itself is not impacted.  */
-  TRY_CATCH (err, RETURN_MASK_ERROR)
-    btrace_read_config (&tinfo->conf);
+  TRY
+    {
+      btrace_read_config (&tinfo->conf);
+    }
+  CATCH (err, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   if (err.message != NULL)
     warning ("%s", err.message);
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 6940727..ca262e9 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -572,19 +572,20 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
     {
       CORE_ADDR pc = 0;
       struct obj_section *pc_section;
-      volatile struct gdb_exception e;
 
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
         {
           pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
         }
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ERROR)
         {
           /* An error occured during reading.  Probably a memory error
              due to the section not being loaded yet.  This address
              cannot be a function descriptor.  */
           return addr;
         }
+      END_CATCH
+
       pc_section = find_pc_section (pc);
 
       if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 1e469cf..ab99ac8 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3355,7 +3355,6 @@ static const struct frame_unwind rs6000_frame_unwind =
 static struct rs6000_frame_cache *
 rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct rs6000_frame_cache *cache;
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -3367,7 +3366,7 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   (*this_cache) = cache;
   cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* At this point the stack looks as if we just entered the
 	 function, and the return address is stored in LR.  */
@@ -3382,11 +3381,12 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
       trad_frame_set_value (cache->saved_regs,
 			    gdbarch_pc_regnum (gdbarch), lr);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 3b6c329..12f8bd8 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -1816,7 +1816,6 @@ static struct s390_unwind_cache *
 s390_frame_unwind_cache (struct frame_info *this_frame,
 			 void **this_prologue_cache)
 {
-  volatile struct gdb_exception ex;
   struct s390_unwind_cache *info;
 
   if (*this_prologue_cache)
@@ -1829,18 +1828,19 @@ s390_frame_unwind_cache (struct frame_info *this_frame,
   info->frame_base = -1;
   info->local_base = -1;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* Try to use prologue analysis to fill the unwind cache.
 	 If this fails, fall back to reading the stack backchain.  */
       if (!s390_prologue_frame_unwind_cache (this_frame, info))
 	s390_backchain_frame_unwind_cache (this_frame, info);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return info;
 }
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 685534f..7da5833 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -820,7 +820,6 @@ enable_break (void)
       CORE_ADDR addr;
       gdb_byte addr_buf[TIC6X_PTR_SIZE];
       struct int_elf32_dsbt_loadmap *ldm;
-      volatile struct gdb_exception ex;
       int ret;
 
       /* Read the contents of the .interp section into a local buffer;
@@ -834,10 +833,15 @@ enable_break (void)
 	 loaded so that we can load its symbols and place a breakpoint
 	 in the dynamic linker itself.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  tmp_bfd = solib_bfd_open (buf);
 	}
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       if (tmp_bfd == NULL)
 	{
 	  enable_break_failure_warning ();
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 76f6527..f7ef38b 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -539,7 +539,6 @@ enable_break2 (void)
       CORE_ADDR addr, interp_loadmap_addr;
       gdb_byte addr_buf[FRV_PTR_SIZE];
       struct int_elf32_fdpic_loadmap *ldm;
-      volatile struct gdb_exception ex;
 
       /* Read the contents of the .interp section into a local buffer;
          the contents specify the dynamic linker this program uses.  */
@@ -557,10 +556,15 @@ enable_break2 (void)
          be trivial on GNU/Linux).  Therefore, we have to try an alternate
          mechanism to find the dynamic linker's base address.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
         {
           tmp_bfd = solib_bfd_open (buf);
         }
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       if (tmp_bfd == NULL)
 	{
 	  enable_break_failure_warning ();
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index 3b0bf48..b133c12 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -163,18 +163,20 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
 int
 ia64_hpux_at_dld_breakpoint_p (ptid_t ptid)
 {
-  volatile struct gdb_exception e;
   ptid_t saved_ptid = inferior_ptid;
   int result = 0;
 
   inferior_ptid = ptid;
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       result = ia64_hpux_at_dld_breakpoint_1_p (ptid);
     }
   inferior_ptid = saved_ptid;
-  if (e.reason < 0)
-    warning (_("error while checking for dld breakpoint: %s"), e.message);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      warning (_("error while checking for dld breakpoint: %s"), e.message);
+    }
+  END_CATCH
 
   return result;
 }
@@ -277,17 +279,19 @@ ia64_hpux_handle_dld_breakpoint_1 (ptid_t ptid)
 void
 ia64_hpux_handle_dld_breakpoint (ptid_t ptid)
 {
-  volatile struct gdb_exception e;
   ptid_t saved_ptid = inferior_ptid;
 
   inferior_ptid = ptid;
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       ia64_hpux_handle_dld_breakpoint_1 (ptid);
     }
   inferior_ptid = saved_ptid;
-  if (e.reason < 0)
-    warning (_("error detected while handling dld breakpoint: %s"), e.message);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      warning (_("error detected while handling dld breakpoint: %s"), e.message);
+    }
+  END_CATCH
 }
 
 /* Find the address of the code and data segments in ABFD, and update
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 3c8cd1a..250cf21 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -110,8 +110,7 @@ append_ocl_sos (struct so_list **link_ptr)
         {
 	  enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)?
 					 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
-	  volatile struct gdb_exception ex;
-	  TRY_CATCH (ex, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      CORE_ADDR data =
 		read_memory_unsigned_integer (*ocl_program_addr_base,
@@ -134,7 +133,7 @@ append_ocl_sos (struct so_list **link_ptr)
 		  link_ptr = &newobj->next;
 		}
 	    }
-	  if (ex.reason < 0)
+	  CATCH (ex, RETURN_MASK_ALL)
 	    {
 	      /* Ignore memory errors.  */
 	      switch (ex.error)
@@ -146,6 +145,7 @@ append_ocl_sos (struct so_list **link_ptr)
 		  break;
 		}
 	    }
+	  END_CATCH
 	}
     }
 }
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 3fa8d6f..0cecc2a 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -874,15 +874,18 @@ solib_svr4_r_map (struct svr4_info *info)
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
   struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
   CORE_ADDR addr = 0;
-  volatile struct gdb_exception ex;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
                                         ptr_type);
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
+
   return addr;
 }
 
@@ -2267,7 +2270,6 @@ enable_break (struct svr4_info *info, int from_tty)
       struct so_list *so;
       bfd *tmp_bfd = NULL;
       struct target_ops *tmp_bfd_target;
-      volatile struct gdb_exception ex;
 
       sym_addr = 0;
 
@@ -2280,10 +2282,15 @@ enable_break (struct svr4_info *info, int from_tty)
          be trivial on GNU/Linux).  Therefore, we have to try an alternate
          mechanism to find the dynamic linker's base address.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
         {
 	  tmp_bfd = solib_bfd_open (interp_name);
 	}
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       if (tmp_bfd == NULL)
 	goto bkpt_at_symbol;
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 98d5cfd..99263d2 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -613,11 +613,10 @@ solib_read_symbols (struct so_list *so, int flags)
     }
   else
     {
-      volatile struct gdb_exception e;
 
       flags |= current_inferior ()->symfile_flags;
 
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  struct section_addr_info *sap;
 
@@ -640,10 +639,14 @@ solib_read_symbols (struct so_list *so, int flags)
 	  free_section_addr_info (sap);
 	}
 
-      if (e.reason < 0)
-	exception_fprintf (gdb_stderr, e, _("Error while reading shared"
-					    " library symbols for %s:\n"),
-			   so->so_name);
+      CATCH (e, RETURN_MASK_ERROR)
+	{
+	  exception_fprintf (gdb_stderr, e, _("Error while reading shared"
+					      " library symbols for %s:\n"),
+			     so->so_name);
+	}
+      END_CATCH
+
       else
 	so->symbols_loaded = 1;
       return 1;
@@ -814,12 +817,11 @@ update_solib_list (int from_tty, struct target_ops *target)
       /* Fill in the rest of each of the `struct so_list' nodes.  */
       for (i = inferior; i; i = i->next)
 	{
-	  volatile struct gdb_exception e;
 
 	  i->pspace = current_program_space;
 	  VEC_safe_push (so_list_ptr, current_program_space->added_solibs, i);
 
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      /* Fill in the rest of the `struct so_list' node.  */
 	      if (!solib_map_sections (i))
@@ -830,10 +832,13 @@ update_solib_list (int from_tty, struct target_ops *target)
 		}
 	    }
 
-	  if (e.reason < 0)
-	    exception_fprintf (gdb_stderr, e,
-			       _("Error while mapping shared "
-				 "library sections:\n"));
+	  CATCH (e, RETURN_MASK_ERROR)
+	    {
+	      exception_fprintf (gdb_stderr, e,
+				 _("Error while mapping shared "
+				   "library sections:\n"));
+	    }
+	  END_CATCH
 
 	  /* Notify any observer that the shared object has been
 	     loaded now that we've added it to GDB's tables.  */
@@ -1320,15 +1325,20 @@ reload_shared_libraries_1 (int from_tty)
 	  && (!was_loaded
 	      || filename_cmp (found_pathname, so->so_name) != 0))
 	{
-	  volatile struct gdb_exception e;
 
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
-	    solib_map_sections (so);
+	  TRY
+	    {
+	      solib_map_sections (so);
+	    }
+
+	  CATCH (e, RETURN_MASK_ERROR)
+	    {
+	      exception_fprintf (gdb_stderr, e,
+				 _("Error while mapping "
+				   "shared library sections:\n"));
+	    }
+	  END_CATCH
 
-	  if (e.reason < 0)
-	    exception_fprintf (gdb_stderr, e,
-			       _("Error while mapping "
-				 "shared library sections:\n"));
 	  else if (auto_solib_add || was_loaded || libpthread_solib_p (so))
 	    solib_read_symbols (so, flags);
 	}
diff --git a/gdb/stack.c b/gdb/stack.c
index 5831999..4cd45d4 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -154,19 +154,22 @@ print_stack_frame (struct frame_info *frame, int print_level,
 		   enum print_what print_what,
 		   int set_current_sal)
 {
-  volatile struct gdb_exception e;
 
   /* For mi, alway print location and address.  */
   if (ui_out_is_mi_like_p (current_uiout))
     print_what = LOC_AND_ADDRESS;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       print_frame_info (frame, print_level, print_what, 1 /* print_args */,
 			set_current_sal);
       if (set_current_sal)
 	set_current_sal_from_frame (frame);
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 /* Print nameless arguments of frame FRAME on STREAM, where START is
@@ -210,7 +213,6 @@ static void
 print_frame_arg (const struct frame_arg *arg)
 {
   struct ui_out *uiout = current_uiout;
-  volatile struct gdb_exception except;
   struct cleanup *old_chain;
   struct ui_file *stb;
 
@@ -255,7 +257,7 @@ print_frame_arg (const struct frame_arg *arg)
 	{
 	  /* TRY_CATCH has two statements, wrap it in a block.  */
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      const struct language_defn *language;
 	      struct value_print_options opts;
@@ -284,6 +286,10 @@ print_frame_arg (const struct frame_arg *arg)
 
 	      common_val_print (arg->val, stb, 2, &opts, language);
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 	}
       if (except.message)
 	fprintf_filtered (stb, _("<error reading variable: %s>"),
@@ -306,13 +312,16 @@ void
 read_frame_local (struct symbol *sym, struct frame_info *frame,
 		  struct frame_arg *argp)
 {
-  volatile struct gdb_exception except;
   struct value *val = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       val = read_var_value (sym, frame);
     }
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
   argp->sym = sym;
@@ -330,15 +339,19 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
   struct value *val = NULL, *entryval = NULL;
   char *val_error = NULL, *entryval_error = NULL;
   int val_equal = 0;
-  volatile struct gdb_exception except;
 
   if (print_entry_values != print_entry_values_only
       && print_entry_values != print_entry_values_preferred)
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  val = read_var_value (sym, frame);
 	}
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
+
       if (!val)
 	{
 	  val_error = alloca (strlen (except.message) + 1);
@@ -352,13 +365,18 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
       && (print_entry_values != print_entry_values_if_needed
 	  || !val || value_optimized_out (val)))
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  const struct symbol_computed_ops *ops;
 
 	  ops = SYMBOL_COMPUTED_OPS (sym);
 	  entryval = ops->read_variable_at_entry (sym, frame);
 	}
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
+
       if (!entryval)
 	{
 	  entryval_error = alloca (strlen (except.message) + 1);
@@ -396,7 +414,7 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 		     dereferenced DW_AT_GNU_call_site_data_value does not
 		     differ.  */
 
-		  TRY_CATCH (except, RETURN_MASK_ERROR)
+		  TRY
 		    {
 		      struct type *type_deref;
 
@@ -417,6 +435,10 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 						TYPE_LENGTH (type_deref)))
 			val_equal = 1;
 		    }
+		  CATCH (except, RETURN_MASK_ERROR)
+		    {
+		    }
+		  END_CATCH
 
 		  /* Value was not a reference; and its content matches.  */
 		  if (val == val_deref)
@@ -455,10 +477,15 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
     {
       if (print_entry_values == print_entry_values_preferred)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      val = read_var_value (sym, frame);
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
+
 	  if (!val)
 	    {
 	      val_error = alloca (strlen (except.message) + 1);
@@ -748,20 +775,20 @@ static void
 do_gdb_disassembly (struct gdbarch *gdbarch,
 		    int how_many, CORE_ADDR low, CORE_ADDR high)
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ERROR)
+  TRY
     {
       gdb_disassembly (gdbarch, current_uiout, 0,
 		       DISASSEMBLY_RAW_INSN, how_many,
 		       low, high);
     }
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ERROR)
     {
       /* If an exception was thrown while doing the disassembly, print
 	 the error message, to give the user a clue of what happened.  */
       exception_print (gdb_stderr, exception);
     }
+  END_CATCH
 }
 
 /* Print information about frame FRAME.  The output is format according
@@ -1188,7 +1215,6 @@ print_frame (struct frame_info *frame, int print_level,
       struct gdbarch *gdbarch = get_frame_arch (frame);
       int numargs;
       struct cleanup *args_list_chain;
-      volatile struct gdb_exception e;
 
       if (gdbarch_frame_num_args_p (gdbarch))
 	{
@@ -1199,10 +1225,15 @@ print_frame (struct frame_info *frame, int print_level,
 	numargs = -1;
     
       args_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "args");
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  print_frame_args (func, frame, numargs, gdb_stdout);
 	}
+      CATCH (e, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
+
       /* FIXME: ARGS must be a list.  If one argument is a string it
 	  will have " that will not be properly escaped.  */
       /* Invoke ui_out_tuple_end.  */
@@ -1410,7 +1441,6 @@ frame_info (char *addr_exp, int from_tty)
   int frame_pc_p;
   /* Initialize it to avoid "may be used uninitialized" warning.  */
   CORE_ADDR caller_pc = 0;
-  volatile struct gdb_exception ex;
 
   fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
   gdbarch = get_frame_arch (fi);
@@ -1498,11 +1528,11 @@ frame_info (char *addr_exp, int from_tty)
   wrap_here ("    ");
   printf_filtered ("saved %s = ", pc_regname);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       caller_pc = frame_unwind_caller_pc (fi);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       switch (ex.error)
 	{
@@ -1517,6 +1547,8 @@ frame_info (char *addr_exp, int from_tty)
 	  break;
 	}
     }
+  END_CATCH
+
   else
     fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
   printf_filtered ("\n");
@@ -2571,7 +2603,6 @@ get_frame_language (void)
 
   if (frame)
     {
-      volatile struct gdb_exception ex;
       CORE_ADDR pc = 0;
 
       /* We determine the current frame language by looking up its
@@ -2583,15 +2614,17 @@ get_frame_language (void)
          a PC that is guaranteed to be inside the frame's code
          block.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  pc = get_frame_address_in_block (frame);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  if (ex.error != NOT_AVAILABLE_ERROR)
 	    throw_exception (ex);
 	}
+      END_CATCH
+
       else
 	{
 	  struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 95bc53d..8095a46 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5499,21 +5499,21 @@ default_make_symbol_completion_list_break_on (const char *text,
 					      enum type_code code)
 {
   struct cleanup *back_to;
-  volatile struct gdb_exception except;
 
   return_val = NULL;
   back_to = make_cleanup (do_free_completion_list, &return_val);
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       default_make_symbol_completion_list_break_on_1 (text, word,
 						      break_on, code);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
 	throw_exception (except);
     }
+  END_CATCH
 
   discard_cleanups (back_to);
   return return_val;
diff --git a/gdb/target.c b/gdb/target.c
index 569c999..ad9d68a 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -817,9 +817,8 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
   if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
     {
       ptid_t ptid = inferior_ptid;
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  CORE_ADDR lm_addr;
 	  
@@ -832,7 +831,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 	}
       /* If an error occurred, print TLS related messages here.  Otherwise,
          throw the error to some higher catcher.  */
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  int objfile_is_library = (objfile->flags & OBJF_SHARED);
 
@@ -881,6 +880,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 	      break;
 	    }
 	}
+      END_CATCH
     }
   /* It wouldn't be wrong here to try a gdbarch method, too; finding
      TLS is an ABI-specific thing.  But we don't do that yet.  */
diff --git a/gdb/top.c b/gdb/top.c
index 699a399..f746af8 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1465,7 +1465,6 @@ quit_force (char *args, int from_tty)
 {
   int exit_code = 0;
   struct qt_args qt;
-  volatile struct gdb_exception ex;
 
   /* An optional expression may be used to cause gdb to terminate with the 
      value of that expression.  */
@@ -1484,40 +1483,52 @@ quit_force (char *args, int from_tty)
   /* We want to handle any quit errors and exit regardless.  */
 
   /* Get out of tfind mode, and kill or detach all inferiors.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       disconnect_tracing ();
       iterate_over_inferiors (kill_or_detach, &qt);
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   /* Give all pushed targets a chance to do minimal cleanup, and pop
      them all out.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       pop_all_targets ();
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   /* Save the history information if it is appropriate to do so.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       if (write_history_p && history_filename
 	  && input_from_terminal_p ())
 	gdb_safe_append_history ();
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   /* Do any final cleanups before exiting.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       do_final_cleanups (all_cleanups ());
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   exit (exit_code);
 }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 44c6189..2333e2f 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -378,7 +378,6 @@ tfile_read (gdb_byte *readbuf, int size)
 static void
 tfile_open (const char *arg, int from_tty)
 {
-  volatile struct gdb_exception ex;
   char *temp;
   struct cleanup *old_chain;
   int flags;
@@ -443,7 +442,7 @@ tfile_open (const char *arg, int from_tty)
   ts->disconnected_tracing = 0;
   ts->circular_buffer = 0;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       /* Read through a section of newline-terminated lines that
 	 define things like tracepoints.  */
@@ -476,12 +475,13 @@ tfile_open (const char *arg, int from_tty)
       if (trace_regblock_size == 0)
 	error (_("No register block size recorded in trace file"));
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       /* Remove the partially set up target.  */
       unpush_target (&tfile_ops);
       throw_exception (ex);
     }
+  END_CATCH
 
   inferior_appeared (current_inferior (), TFILE_PID);
   inferior_ptid = pid_to_ptid (TFILE_PID);
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 92463df..183bb5d 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -90,11 +90,10 @@ static Keymap tui_readline_standard_keymap;
 static int
 tui_rl_switch_mode (int notused1, int notused2)
 {
-  volatile struct gdb_exception ex;
 
   /* Don't let exceptions escape.  We're in the middle of a readline
      callback that isn't prepared for that.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       if (tui_active)
 	{
@@ -108,13 +107,14 @@ tui_rl_switch_mode (int notused1, int notused2)
 	  tui_enable ();
 	}
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       exception_print (gdb_stderr, ex);
 
       if (!tui_active)
 	rl_prep_terminal (0);
     }
+  END_CATCH
 
   /* Clear the readline in case switching occurred in middle of
      something.  */
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 234be7f..5a97ace 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -372,18 +372,20 @@ type_to_string (struct type *type)
   char *s = NULL;
   struct ui_file *stb;
   struct cleanup *old_chain;
-  volatile struct gdb_exception except;
 
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type_print (type, "", stb, -1);
       s = ui_file_xstrdup (stb, NULL);
     }
-  if (except.reason < 0)
-    s = NULL;
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      s = NULL;
+    }
+  END_CATCH
 
   do_cleanups (old_chain);
 
diff --git a/gdb/valops.c b/gdb/valops.c
index 23a4b37..d677863 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3601,13 +3601,12 @@ value_rtti_indirect_type (struct value *v, int *full,
     target = coerce_ref (v);
   else if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
         {
 	  target = value_ind (v);
         }
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  if (except.error == MEMORY_ERROR)
 	    {
@@ -3618,6 +3617,7 @@ value_rtti_indirect_type (struct value *v, int *full,
 	    }
 	  throw_exception (except);
 	}
+      END_CATCH
     }
   else
     return NULL;
@@ -3754,12 +3754,15 @@ struct value *
 value_of_this_silent (const struct language_defn *lang)
 {
   struct value *ret = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       ret = value_of_this (lang);
     }
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   return ret;
 }
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 29a3473..9a70b2f 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -740,7 +740,6 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	   const struct value_print_options *options,
 	   const struct language_defn *language)
 {
-  volatile struct gdb_exception except;
   int ret = 0;
   struct value_print_options local_opts = *options;
   struct type *real_type = check_typedef (type);
@@ -782,14 +781,17 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       return;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       language->la_val_print (type, valaddr, embedded_offset, address,
 			      stream, recurse, val,
 			      &local_opts);
     }
-  if (except.reason < 0)
-    fprintf_filtered (stream, _("<error reading variable>"));
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      fprintf_filtered (stream, _("<error reading variable>"));
+    }
+  END_CATCH
 }
 
 /* Check whether the value VAL is printable.  Return 1 if it is;
diff --git a/gdb/value.c b/gdb/value.c
index b9a45ef..cb56849 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2545,7 +2545,6 @@ show_convenience (char *ignore, int from_tty)
   get_user_print_options (&opts);
   for (var = internalvars; var; var = var->next)
     {
-      volatile struct gdb_exception ex;
 
       if (!varseen)
 	{
@@ -2553,15 +2552,19 @@ show_convenience (char *ignore, int from_tty)
 	}
       printf_filtered (("$%s = "), var->name);
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  struct value *val;
 
 	  val = value_of_internalvar (gdbarch, var);
 	  value_print (val, gdb_stdout, &opts);
 	}
-      if (ex.reason < 0)
-	fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+	}
+      END_CATCH
+
       printf_filtered (("\n"));
     }
   if (!varseen)
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 2d84d11..1b735d3 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -298,7 +298,6 @@ varobj_create (char *objname,
       const struct block *block;
       const char *p;
       struct value *value = NULL;
-      volatile struct gdb_exception except;
       CORE_ADDR pc;
 
       /* Parse and evaluate the expression, filling in as much of the
@@ -338,16 +337,17 @@ varobj_create (char *objname,
       innermost_block = NULL;
       /* Wrap the call to parse expression, so we can 
          return a sensible error.  */
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  var->root->exp = parse_exp_1 (&p, pc, block, 0);
 	}
 
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  do_cleanups (old_chain);
 	  return NULL;
 	}
+      END_CATCH
 
       /* Don't allow variables to be created for types.  */
       if (var->root->exp->elts[0].opcode == OP_TYPE
@@ -388,12 +388,12 @@ varobj_create (char *objname,
       /* We definitely need to catch errors here.
          If evaluate_expression succeeds we got the value we wanted.
          But if it fails, we still go on with a call to evaluate_type().  */
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  value = evaluate_expression (var->root->exp);
 	}
 
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  /* Error getting the value.  Try to at least get the
 	     right type.  */
@@ -401,6 +401,8 @@ varobj_create (char *objname,
 
 	  var->type = value_type (type_only_value);
 	}
+      END_CATCH
+
 	else
 	  {
 	    int real_type_found = 0;
@@ -1102,23 +1104,23 @@ varobj_set_value (struct varobj *var, char *expression)
   struct value *value = NULL; /* Initialize to keep gcc happy.  */
   int saved_input_radix = input_radix;
   const char *s = expression;
-  volatile struct gdb_exception except;
 
   gdb_assert (varobj_editable_p (var));
 
   input_radix = 10;		/* ALWAYS reset to decimal temporarily.  */
   exp = parse_exp_1 (&s, 0, 0, 0);
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       value = evaluate_expression (exp);
     }
 
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       /* We cannot proceed without a valid expression.  */
       xfree (exp);
       return 0;
     }
+  END_CATCH
 
   /* All types that are editable must also be changeable.  */
   gdb_assert (varobj_value_is_changeable_p (var));
@@ -1137,13 +1139,16 @@ varobj_set_value (struct varobj *var, char *expression)
 
   /* The new value may be lazy.  value_assign, or
      rather value_contents, will take care of this.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       val = value_assign (var->value, value);
     }
 
-  if (except.reason < 0)
-    return 0;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      return 0;
+    }
+  END_CATCH
 
   /* If the value has changed, record it, so that next -var-update can
      report this change.  If a variable had a value of '1', we've set it
@@ -1394,20 +1399,20 @@ install_new_value (struct varobj *var, struct value *value, int initial)
 	}
       else
 	{
-	  volatile struct gdb_exception except;
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      value_fetch_lazy (value);
 	    }
 
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      /* Set the value to NULL, so that for the next -var-update,
 		 we don't try to compare the new value with this value,
 		 that we couldn't even read.  */
 	      value = NULL;
 	    }
+	  END_CATCH
 	}
     }
 
@@ -2368,14 +2373,17 @@ value_of_root_1 (struct varobj **var_handle)
 
   if (within_scope)
     {
-      volatile struct gdb_exception except;
 
       /* We need to catch errors here, because if evaluate
          expression fails we want to just return NULL.  */
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  new_val = evaluate_expression (var->root->exp);
 	}
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
     }
 
   do_cleanups (back_to);
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 4306c5c..9756acb 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -313,22 +313,22 @@ gdb_xml_start_element_wrapper (void *data, const XML_Char *name,
 			       const XML_Char **attrs)
 {
   struct gdb_xml_parser *parser = data;
-  volatile struct gdb_exception ex;
 
   if (parser->error.reason < 0)
     return;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       gdb_xml_start_element (data, name, attrs);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       parser->error = ex;
 #ifdef HAVE_XML_STOPPARSER
       XML_StopParser (parser->expat_parser, XML_FALSE);
 #endif
     }
+  END_CATCH
 }
 
 /* Handle the end of an element.  DATA is our local XML parser, and
@@ -396,22 +396,22 @@ static void
 gdb_xml_end_element_wrapper (void *data, const XML_Char *name)
 {
   struct gdb_xml_parser *parser = data;
-  volatile struct gdb_exception ex;
 
   if (parser->error.reason < 0)
     return;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       gdb_xml_end_element (data, name);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       parser->error = ex;
 #ifdef HAVE_XML_STOPPARSER
       XML_StopParser (parser->expat_parser, XML_FALSE);
 #endif
     }
+  END_CATCH
 }
 
 /* Free a parser and all its associated state.  */
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (23 preceding siblings ...)
  2015-02-09 23:22 ` [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode Pedro Alves
@ 2015-02-09 23:22 ` Pedro Alves
  2015-02-09 23:22 ` [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere Pedro Alves
                   ` (15 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:22 UTC (permalink / raw)
  To: gdb-patches

This fixes the cases where we're using the exception object outside of
a the CATCH block, and cases where we were using "else" after a CATCH.

I originally planned on doing these changes in the preparatory patch
that normalizes TRY_CATCH (the one just before the wholesale scripted
conversion patch), but then that feels like it'd make the resulting
patch harder to read and not as clear.  It's a lot less work this way
too.  :-) I can still do that if people prefer though.  Otherwise, I
plan to squash this with the previous patch, and push it all together.
---
 gdb/ada-typeprint.c              |  4 +-
 gdb/breakpoint.c                 | 44 +++++++++-------------
 gdb/c-varobj.c                   |  5 +--
 gdb/cp-support.c                 | 14 ++++---
 gdb/exceptions.c                 |  4 +-
 gdb/frame.c                      |  4 +-
 gdb/gcore.c                      | 13 ++++---
 gdb/gdbserver/server.c           | 28 ++++++--------
 gdb/gnu-v3-abi.c                 |  7 ++--
 gdb/guile/guile.c                |  4 +-
 gdb/guile/scm-breakpoint.c       |  8 +++-
 gdb/guile/scm-frame.c            | 12 ++++--
 gdb/guile/scm-math.c             |  4 +-
 gdb/guile/scm-param.c            |  4 +-
 gdb/guile/scm-symbol.c           |  8 +++-
 gdb/guile/scm-value.c            |  6 ++-
 gdb/inf-loop.c                   |  3 +-
 gdb/infcall.c                    | 11 ++++--
 gdb/infrun.c                     |  3 +-
 gdb/main.c                       |  8 ++--
 gdb/mi/mi-cmd-stack.c            | 10 ++---
 gdb/mi/mi-main.c                 |  2 +-
 gdb/python/py-breakpoint.c       |  4 +-
 gdb/python/py-finishbreakpoint.c |  2 +-
 gdb/python/py-frame.c            |  4 +-
 gdb/python/py-gdb-readline.c     |  9 ++---
 gdb/python/py-inferior.c         |  8 +++-
 gdb/python/py-type.c             |  7 ++--
 gdb/python/py-value.c            |  8 +++-
 gdb/python/python.c              |  9 ++++-
 gdb/record-btrace.c              | 19 ++--------
 gdb/remote.c                     |  5 +--
 gdb/solib.c                      | 12 +++---
 gdb/stack.c                      | 80 +++++++++++++++++++---------------------
 gdb/varobj.c                     | 15 ++++----
 35 files changed, 200 insertions(+), 188 deletions(-)

diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index cd481b6..fd85138 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -160,6 +160,7 @@ print_range (struct type *type, struct ui_file *stream,
       {
 	struct type *target_type;
 	LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
+	int got_error = 0;
 
 	target_type = TYPE_TARGET_TYPE (type);
 	if (target_type == NULL)
@@ -178,10 +179,11 @@ print_range (struct type *type, struct ui_file *stream,
 	       when the user is using the "ptype" command on a type.
 	       Print the range as an unbounded range.  */
 	    fprintf_filtered (stream, "<>");
+	    got_error = 1;
 	  }
 	END_CATCH
 
-	else
+	if (!got_error)
 	  {
 	    ada_print_scalar (target_type, lo, stream);
 	    fprintf_filtered (stream, " .. ");
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 67870f5..b5a9704 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2429,18 +2429,17 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 			  format_start, format_end - format_start,
 			  fpieces, nargs, argvec);
     }
-
-  do_cleanups (old_cleanups);
-
   CATCH (ex, RETURN_MASK_ERROR)
     {
       /* If we got here, it means the command could not be parsed to a valid
 	 bytecode expression and thus can't be evaluated on the target's side.
 	 It's no use iterating through the other commands.  */
-      return NULL;
+      aexpr = NULL;
     }
   END_CATCH
 
+  do_cleanups (old_cleanups);
+
   /* We have a valid agent expression, return it.  */
   return aexpr;
 }
@@ -9996,23 +9995,12 @@ create_breakpoint (struct gdbarch *gdbarch,
       ops->create_sals_from_address (&arg, &canonical, type_wanted,
 				     addr_start, &copy_arg);
     }
-  CATCH (e, RETURN_MASK_ALL)
-    {
-    }
-  END_CATCH
-
-  /* If caller is interested in rc value from parse, set value.  */
-  switch (e.reason)
+  CATCH (e, RETURN_MASK_ERROR)
     {
-    case GDB_NO_ERROR:
-      if (VEC_empty (linespec_sals, canonical.sals))
-	return 0;
-      break;
-    case RETURN_ERROR:
-      switch (e.error)
+      /* If caller is interested in rc value from parse, set
+	 value.  */
+      if (e.error == NOT_FOUND_ERROR)
 	{
-	case NOT_FOUND_ERROR:
-
 	  /* If pending breakpoint support is turned off, throw
 	     error.  */
 
@@ -10043,14 +10031,14 @@ create_breakpoint (struct gdbarch *gdbarch,
 	    pending = 1;
 	    VEC_safe_push (linespec_sals, canonical.sals, &lsal);
 	  }
-	  break;
-	default:
-	  throw_exception (e);
 	}
-      break;
-    default:
-      throw_exception (e);
+      else
+	throw_exception (e);
     }
+  END_CATCH
+
+  if (VEC_empty (linespec_sals, canonical.sals))
+    return 0;
 
   /* Create a chain of things that always need to be cleaned up.  */
   old_chain = make_cleanup_destroy_linespec_result (&canonical);
@@ -14547,6 +14535,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
 {
   char *s;
   struct symtabs_and_lines sals = {0};
+  struct gdb_exception exception = exception_none;
 
   gdb_assert (b->ops != NULL);
   s = addr_string;
@@ -14558,6 +14547,9 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
   CATCH (e, RETURN_MASK_ERROR)
     {
       int not_found_and_ok = 0;
+
+      exception = e;
+
       /* For pending breakpoints, it's expected that parsing will
 	 fail until the right shared library is loaded.  User has
 	 already told to create pending breakpoints and don't need
@@ -14586,7 +14578,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
     }
   END_CATCH
 
-  if (e.reason == 0 || e.error != NOT_FOUND_ERROR)
+  if (exception.reason == 0 || exception.error != NOT_FOUND_ERROR)
     {
       int i;
 
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index fd0751f..98775be 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -267,10 +267,7 @@ value_struct_element_index (struct value *value, int type_index)
     }
   END_CATCH
 
-  else
-    {
-      return result;
-    }
+  return result;
 }
 
 /* Obtain the information about child INDEX of the variable
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 9530070..4bbee94 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -172,16 +172,18 @@ inspect_type (struct demangle_parse_info *info,
     }
 
   sym = NULL;
+
   TRY
-  {
-    sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
-  }
+    {
+      sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
+    }
   CATCH (except, RETURN_MASK_ALL)
     {
+      return 0;
     }
   END_CATCH
 
-  if (except.reason >= 0 && sym != NULL)
+  if (sym != NULL)
     {
       struct type *otype = SYMBOL_TYPE (sym);
 
@@ -450,7 +452,7 @@ replace_typedefs (struct demangle_parse_info *info,
 
 	  if (local_name != NULL)
 	    {
-	      struct symbol *sym;
+	      struct symbol *sym = NULL;
 
 	      sym = NULL;
 	      TRY
@@ -464,7 +466,7 @@ replace_typedefs (struct demangle_parse_info *info,
 
 	      xfree (local_name);
 
-	      if (except.reason >= 0 && sym != NULL)
+	      if (sym != NULL)
 		{
 		  struct type *otype = SYMBOL_TYPE (sym);
 		  const char *new_name = (*finder) (otype, data);
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index ba97ad5..623e8e0 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -228,6 +228,7 @@ int
 catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
 	      return_mask mask)
 {
+  struct gdb_exception exception = exception_none;
   volatile int val = 0;
   struct ui_out *saved_uiout;
 
@@ -238,8 +239,9 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
     {
       val = func (func_args);
     }
-  CATCH (exception, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      exception = ex;
     }
   END_CATCH
 
diff --git a/gdb/frame.c b/gdb/frame.c
index a9d8c3f..b3cbf23 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -786,6 +786,7 @@ frame_unwind_pc (struct frame_info *this_frame)
 	{
 	  struct gdbarch *prev_gdbarch;
 	  CORE_ADDR pc = 0;
+	  int pc_p = 0;
 
 	  /* The right way.  The `pure' way.  The one true way.  This
 	     method depends solely on the register-unwind code to
@@ -808,6 +809,7 @@ frame_unwind_pc (struct frame_info *this_frame)
 	  TRY
 	    {
 	      pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+	      pc_p = 1;
 	    }
 	  CATCH (ex, RETURN_MASK_ERROR)
 	    {
@@ -836,7 +838,7 @@ frame_unwind_pc (struct frame_info *this_frame)
 	    }
 	  END_CATCH
 
-	  else
+	  if (pc_p)
 	    {
 	      this_frame->prev_pc.value = pc;
 	      this_frame->prev_pc.status = CC_VALUE;
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 8ab386f..c308af8 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -114,6 +114,7 @@ write_gcore_file_1 (bfd *obfd)
 void
 write_gcore_file (bfd *obfd)
 {
+  struct gdb_exception except = exception_none;
 
   target_prepare_to_generate_core ();
 
@@ -121,14 +122,16 @@ write_gcore_file (bfd *obfd)
     {
       write_gcore_file_1 (obfd);
     }
-
-  target_done_generating_core ();
-
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (e, RETURN_MASK_ALL)
     {
-      throw_exception (except);
+      except = e;
     }
   END_CATCH
+
+  target_done_generating_core ();
+
+  if (except.reason < 0)
+    throw_exception (except);
 }
 
 static void
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index ec783ca..8b7a1f2 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -3433,17 +3433,13 @@ captured_main (int argc, char *argv[])
 	}
       CATCH (exception, RETURN_MASK_ERROR)
 	{
-	}
-      END_CATCH
-
-      if (exception.reason == RETURN_ERROR)
-	{
 	  if (response_needed)
 	    {
 	      write_enn (own_buf);
 	      putpkt (own_buf);
 	    }
 	}
+      END_CATCH
     }
 }
 
@@ -3459,21 +3455,19 @@ main (int argc, char *argv[])
     }
   CATCH (exception, RETURN_MASK_ALL)
     {
-    }
-  END_CATCH
-
-  /* captured_main should never return.  */
-  gdb_assert (exception.reason < 0);
+      if (exception.reason == RETURN_ERROR)
+	{
+	  fflush (stdout);
+	  fprintf (stderr, "%s\n", exception.message);
+	  fprintf (stderr, "Exiting\n");
+	  exit_code = 1;
+	}
 
-  if (exception.reason == RETURN_ERROR)
-    {
-      fflush (stdout);
-      fprintf (stderr, "%s\n", exception.message);
-      fprintf (stderr, "Exiting\n");
-      exit_code = 1;
+      exit (exit_code);
     }
+  END_CATCH
 
-  exit (exit_code);
+  gdb_assert_not_reached ("captured_main should never return");
 }
 
 /* Skip PACKET until the next semi-colon (or end of string).  */
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 2677716..39a333c 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -901,8 +901,8 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
 
   for (i = 0; i <= max_voffset; ++i)
     {
-      /* Initialize it just to avoid a GCC false warning.  */
-      CORE_ADDR addr = 0;
+      CORE_ADDR addr;
+      int got_error = 0;
       struct value *vfn;
 
       printf_filtered ("[%d]: ", i);
@@ -921,10 +921,11 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
       CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  printf_filtered (_("<error: %s>"), ex.message);
+	  got_error = 1;
 	}
       END_CATCH
 
-      else
+      if (!got_error)
 	print_function_pointer_address (opts, gdbarch, addr, gdb_stdout);
       printf_filtered ("\n");
     }
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 03ae53a..16d15b7 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -314,6 +314,7 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
   char *command;
   char *result = NULL;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#tt",
 			      command_scm, &command, rest,
@@ -345,8 +346,9 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
 
       do_cleanups (inner_cleanups);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index f438e01..ad853ed 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -407,6 +407,7 @@ gdbscm_register_breakpoint_x (SCM self)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+  struct gdb_exception except = exception_none;
 
   /* We only support registering breakpoints created with make-breakpoint.  */
   if (!bp_smob->is_scheme_bkpt)
@@ -454,8 +455,9 @@ gdbscm_register_breakpoint_x (SCM self)
 	  gdb_assert_not_reached ("invalid breakpoint type");
 	}
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
@@ -878,6 +880,7 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   char *exp;
+  struct gdb_exception except = exception_none;
 
   SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue),
 		   newvalue, SCM_ARG2, FUNC_NAME,
@@ -892,8 +895,9 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
     {
       set_breakpoint_condition (bp_smob->bp, exp ? exp : "", 0);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 09f79b6..6189802 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -426,6 +426,7 @@ gdbscm_frame_name (SCM self)
   enum language lang = language_minimal;
   struct frame_info *frame = NULL;
   SCM result;
+  struct gdb_exception except = exception_none;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
@@ -435,12 +436,13 @@ gdbscm_frame_name (SCM self)
       if (frame != NULL)
 	find_frame_funname (frame, &name, &lang, NULL);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
-      xfree (name);
+      except = ex;
     }
   END_CATCH
 
+  xfree (name);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
   if (frame == NULL)
@@ -835,6 +837,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
       char *var_name;
       const struct block *block = NULL;
       struct cleanup *cleanup;
+      struct gdb_exception except = exception_none;
 
       if (! SCM_UNBNDP (block_scm))
 	{
@@ -858,12 +861,13 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
 	    block = get_frame_block (frame, NULL);
 	  var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
 	}
-      CATCH (except, RETURN_MASK_ALL)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
-	  do_cleanups (cleanup);
+	  except = ex;
 	}
       END_CATCH
 
+      do_cleanups (cleanup);
       GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
       if (var == NULL)
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 03baa3f..4b6bb5d 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -447,6 +447,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
   int result = 0;
   SCM except_scm;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -492,8 +493,9 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
 	  gdb_assert_not_reached ("invalid <gdb:value> comparison");
       }
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index c229d46..508bcb9 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -1066,6 +1066,7 @@ gdbscm_parameter_value (SCM self)
       const char *arg;
       char *newarg;
       int found = -1;
+      struct gdb_exception except = exception_none;
 
       name = gdbscm_scm_to_host_string (self, NULL, &except_scm);
       if (name == NULL)
@@ -1075,8 +1076,9 @@ gdbscm_parameter_value (SCM self)
 	{
 	  found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
 	}
-      CATCH (except, RETURN_MASK_ALL)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
+	  except = ex;
 	}
       END_CATCH
 
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 0bce7d1..99ef928 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -578,6 +578,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
   struct field_of_this_result is_a_field_of_this;
   struct symbol *symbol = NULL;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
 			      name_scm, &name, rest,
@@ -618,8 +619,9 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
     {
       symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
@@ -645,6 +647,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
   int domain = VAR_DOMAIN;
   struct symbol *symbol = NULL;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
 			      name_scm, &name, rest,
@@ -656,8 +659,9 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
     {
       symbol = lookup_global_symbol (name, NULL, domain);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 0509a9c..b10460d 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -446,7 +446,7 @@ gdbscm_value_address (SCM self)
 	}
       END_CATCH
 
-      else
+      if (res_val != NULL)
 	address = vlscm_scm_from_value (res_val);
 
       do_cleanups (cleanup);
@@ -1198,6 +1198,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
   int length = -1;
   SCM result = SCM_BOOL_F; /* -Wall */
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1221,8 +1222,9 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
 
       do_cleanups (inner_cleanup);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index 8c99752..429cd73 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -123,10 +123,9 @@ inferior_event_handler (enum inferior_event_type event_type,
 	    }
 	  CATCH (e, RETURN_MASK_ALL)
 	    {
+	      exception_print (gdb_stderr, e);
 	    }
 	  END_CATCH
-
-	  exception_print (gdb_stderr, e);
 	}
       break;
 
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 187b5c7..705e377 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -383,6 +383,7 @@ get_function_name (CORE_ADDR funaddr, char *buf, int buf_size)
 static struct gdb_exception
 run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 {
+  struct gdb_exception caught_error = exception_none;
   int saved_in_infcall = call_thread->control.in_infcall;
   ptid_t call_thread_ptid = call_thread->ptid;
   int saved_sync_execution = sync_execution;
@@ -422,6 +423,11 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 	    async_disable_stdin ();
 	}
     }
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      caught_error = e;
+    }
+  END_CATCH
 
   /* At this point the current thread may have changed.  Refresh
      CALL_THREAD as it could be invalid if its thread has exited.  */
@@ -434,19 +440,18 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
      If all error()s out of proceed ended up calling normal_stop
      (and perhaps they should; it already does in the special case
      of error out of resume()), then we wouldn't need this.  */
-  CATCH (e, RETURN_MASK_ALL)
+  if (caught_error.reason < 0)
     {
       if (call_thread != NULL)
 	breakpoint_auto_delete (call_thread->control.stop_bpstat);
     }
-  END_CATCH
 
   if (call_thread != NULL)
     call_thread->control.in_infcall = saved_in_infcall;
 
   sync_execution = saved_sync_execution;
 
-  return e;
+  return caught_error;
 }
 
 /* A cleanup function that calls delete_std_terminate_breakpoint.  */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 04af8a1..b6a90dd 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5941,8 +5941,6 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 				    struct frame_info *frame,
 				    struct symbol *sym)
 {
-
-  /* We want to ignore errors here.  */
   TRY
     {
       struct symbol *vsym;
@@ -5974,6 +5972,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
     }
   CATCH (e, RETURN_MASK_ERROR)
     {
+      /* We want to ignore errors here.  */
     }
   END_CATCH
 }
diff --git a/gdb/main.c b/gdb/main.c
index c56d263..ceca807 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -364,7 +364,6 @@ static int
 catch_command_errors (catch_command_errors_ftype *command,
 		      char *arg, int from_tty)
 {
-
   TRY
     {
       int was_sync = sync_execution;
@@ -375,10 +374,11 @@ catch_command_errors (catch_command_errors_ftype *command,
     }
   CATCH (e, RETURN_MASK_ALL)
     {
+      return handle_command_errors (e);
     }
   END_CATCH
 
-  return handle_command_errors (e);
+  return 1;
 }
 
 /* Type of the command callback passed to catch_command_errors_const.  */
@@ -391,7 +391,6 @@ static int
 catch_command_errors_const (catch_command_errors_const_ftype *command,
 			    const char *arg, int from_tty)
 {
-
   TRY
     {
       int was_sync = sync_execution;
@@ -402,10 +401,11 @@ catch_command_errors_const (catch_command_errors_const_ftype *command,
     }
   CATCH (e, RETURN_MASK_ALL)
     {
+      return handle_command_errors (e);
     }
   END_CATCH
 
-  return handle_command_errors (e);
+  return 1;
 }
 
 /* Type of this option.  */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index d45cede..1b863eb 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -537,13 +537,12 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 
   if (arg->val || arg->error)
     {
+      const char *error_message = NULL;
 
       if (arg->error)
-	except.message = arg->error;
+	error_message = arg->error;
       else
 	{
-	  /* TRY_CATCH has two statements, wrap it in a block.  */
-
 	  TRY
 	    {
 	      struct value_print_options opts;
@@ -555,12 +554,13 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 	    }
 	  CATCH (except, RETURN_MASK_ERROR)
 	    {
+	      error_message = except.message;
 	    }
 	  END_CATCH
 	}
-      if (except.message)
+      if (error_message != NULL)
 	fprintf_filtered (stb, _("<error reading variable: %s>"),
-			  except.message);
+			  error_message);
       ui_out_field_stream (uiout, "value", stb);
     }
 
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 980b558..acbdb55 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2099,7 +2099,7 @@ mi_execute_command (const char *cmd, int from_tty)
     }
   END_CATCH
 
-  else
+  if (command != NULL)
     {
       ptid_t previous_ptid = inferior_ptid;
 
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 2eefed3..dcf1d5a 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -441,6 +441,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
 {
   char *exp;
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
+  struct gdb_exception except = exception_none;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -463,8 +464,9 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
     {
       set_breakpoint_condition (self_bp->bp, exp, 0);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index cf1642a..34e9643 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -218,7 +218,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
     }
   END_CATCH
 
-  else if (PyErr_Occurred ())
+  if (PyErr_Occurred ())
     return -1;
 
   thread = pid_to_thread_id (inferior_ptid);
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index fd1541b..cd6e859 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -135,15 +135,13 @@ frapy_name (PyObject *self, PyObject *args)
 
       find_frame_funname (frame, &name, &lang, NULL);
     }
-
   CATCH (except, RETURN_MASK_ALL)
     {
       xfree (name);
+      GDB_PY_HANDLE_EXCEPTION (except);
     }
   END_CATCH
 
-  GDB_PY_HANDLE_EXCEPTION (except);
-
   if (name)
     {
       result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index 02e6d09..0cf4dfd 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -42,14 +42,13 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
     {
       p = command_line_input (prompt, 0, "python");
     }
-
-  /* Detect user interrupt (Ctrl-C).  */
-  if (except.reason == RETURN_QUIT)
-    return NULL;
-
   /* Handle errors by raising Python exceptions.  */
   CATCH (except, RETURN_MASK_ALL)
     {
+      /* Detect user interrupt (Ctrl-C).  */
+      if (except.reason == RETURN_QUIT)
+	return NULL;
+
       /* The thread state is nulled during gdbpy_readline_wrapper,
 	 with the original value saved in the following undocumented
 	 variable (see Python's Parser/myreadline.c and
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 56b79cf..fe8a705 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -562,6 +562,7 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
 static PyObject *
 infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
 {
+  struct gdb_exception except = exception_none;
   Py_ssize_t buf_len;
   const char *buffer;
   CORE_ADDR addr, length;
@@ -596,8 +597,9 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
     {
       write_memory_with_notification (addr, (gdb_byte *) buffer, length);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
@@ -710,6 +712,7 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 static PyObject *
 infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
 {
+  struct gdb_exception except = exception_none;
   CORE_ADDR start_addr, length;
   static char *keywords[] = { "address", "length", "pattern", NULL };
   PyObject *start_addr_obj, *length_obj;
@@ -774,8 +777,9 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
 				    buffer, pattern_size,
 				    &found_addr);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 4ca379e..31b7e07 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -1067,12 +1067,11 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
 	}
       CATCH (except, RETURN_MASK_ALL)
 	{
+	  /* If there is a GDB exception, a comparison is not capable
+	     (or trusted), so exit.  */
+	  GDB_PY_HANDLE_EXCEPTION (except);
 	}
       END_CATCH
-
-      /* If there is a GDB exception, a comparison is not capable
-	 (or trusted), so exit.  */
-      GDB_PY_HANDLE_EXCEPTION (except);
     }
 
   if (op == (result ? Py_EQ : Py_NE))
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 1c8245b..6622d11 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -612,6 +612,7 @@ get_field_type (PyObject *field)
 static PyObject *
 valpy_getitem (PyObject *self, PyObject *key)
 {
+  struct gdb_exception except = exception_none;
   value_object *self_value = (value_object *) self;
   char *field = NULL;
   struct type *base_class_type = NULL, *field_type = NULL;
@@ -743,8 +744,9 @@ valpy_getitem (PyObject *self, PyObject *key)
 	result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
@@ -1207,6 +1209,7 @@ valpy_absolute (PyObject *self)
 static int
 valpy_nonzero (PyObject *self)
 {
+  struct gdb_exception except = exception_none;
   value_object *self_value = (value_object *) self;
   struct type *type;
   int nonzero = 0; /* Appease GCC warning.  */
@@ -1227,8 +1230,9 @@ valpy_nonzero (PyObject *self)
 	/* All other values are True.  */
 	nonzero = 1;
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index e9bcadb..79896d4 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -564,6 +564,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
 PyObject *
 gdbpy_parameter (PyObject *self, PyObject *args)
 {
+  struct gdb_exception except = exception_none;
   struct cmd_list_element *alias, *prefix, *cmd;
   const char *arg;
   char *newarg;
@@ -578,8 +579,9 @@ gdbpy_parameter (PyObject *self, PyObject *args)
     {
       found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
@@ -717,6 +719,7 @@ gdbpy_solib_name (PyObject *self, PyObject *args)
 static PyObject *
 gdbpy_decode_line (PyObject *self, PyObject *args)
 {
+  struct gdb_exception except = exception_none;
   struct symtabs_and_lines sals = { NULL, 0 }; /* Initialize to
 						  appease gcc.  */
   struct symtab_and_line sal;
@@ -733,6 +736,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   cleanups = make_cleanup (null_cleanup, NULL);
 
   sals.sals = NULL;
+
   TRY
     {
       if (arg)
@@ -749,8 +753,9 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
 	  sals.nelts = 1;
 	}
     }
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
+      except = ex;
     }
   END_CATCH
 
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index d98472a..1cbbd3e 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -139,18 +139,15 @@ require_btrace (void)
 static void
 record_btrace_enable_warn (struct thread_info *tp)
 {
-
   TRY
     {
       btrace_enable (tp, &record_btrace_conf);
     }
   CATCH (error, RETURN_MASK_ERROR)
     {
+      warning ("%s", error.message);
     }
   END_CATCH
-
-  if (error.message != NULL)
-    warning ("%s", error.message);
 }
 
 /* Callback function to disable branch tracing for one thread.  */
@@ -2237,14 +2234,10 @@ cmd_record_btrace_bts_start (char *args, int from_tty)
     }
   CATCH (exception, RETURN_MASK_ALL)
     {
-    }
-  END_CATCH
-
-  if (exception.error != 0)
-    {
       record_btrace_conf.format = BTRACE_FORMAT_NONE;
       throw_exception (exception);
     }
+  END_CATCH
 }
 
 /* Alias for "target record".  */
@@ -2264,14 +2257,10 @@ cmd_record_btrace_start (char *args, int from_tty)
     }
   CATCH (exception, RETURN_MASK_ALL)
     {
+      record_btrace_conf.format = BTRACE_FORMAT_NONE;
+      throw_exception (exception);
     }
   END_CATCH
-
-  if (exception.error == 0)
-    return;
-
-  record_btrace_conf.format = BTRACE_FORMAT_NONE;
-  throw_exception (exception);
 }
 
 /* The "set record btrace" command.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index 3cdbe54..d664842 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11483,12 +11483,11 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
     }
   CATCH (err, RETURN_MASK_ERROR)
     {
+      if (err.message != NULL)
+	warning ("%s", err.message);
     }
   END_CATCH
 
-  if (err.message != NULL)
-    warning ("%s", err.message);
-
   return tinfo;
 }
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 99263d2..8417f88 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -637,8 +637,9 @@ solib_read_symbols (struct so_list *so, int flags)
 						  NULL);
 	  so->objfile->addr_low = so->addr_low;
 	  free_section_addr_info (sap);
-	}
 
+	  so->symbols_loaded = 1;
+	}
       CATCH (e, RETURN_MASK_ERROR)
 	{
 	  exception_fprintf (gdb_stderr, e, _("Error while reading shared"
@@ -647,8 +648,6 @@ solib_read_symbols (struct so_list *so, int flags)
 	}
       END_CATCH
 
-      else
-	so->symbols_loaded = 1;
       return 1;
     }
 
@@ -1325,6 +1324,7 @@ reload_shared_libraries_1 (int from_tty)
 	  && (!was_loaded
 	      || filename_cmp (found_pathname, so->so_name) != 0))
 	{
+	  int got_error = 0;
 
 	  TRY
 	    {
@@ -1336,11 +1336,13 @@ reload_shared_libraries_1 (int from_tty)
 	      exception_fprintf (gdb_stderr, e,
 				 _("Error while mapping "
 				   "shared library sections:\n"));
+	      got_error = 1;
 	    }
 	  END_CATCH
 
-	  else if (auto_solib_add || was_loaded || libpthread_solib_p (so))
-	    solib_read_symbols (so, flags);
+	    if (!got_error
+		&& (auto_solib_add || was_loaded || libpthread_solib_p (so)))
+	      solib_read_symbols (so, flags);
 	}
     }
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 4cd45d4..76a2360 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -215,6 +215,7 @@ print_frame_arg (const struct frame_arg *arg)
   struct ui_out *uiout = current_uiout;
   struct cleanup *old_chain;
   struct ui_file *stb;
+  const char *error_message = NULL;
 
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
@@ -252,11 +253,9 @@ print_frame_arg (const struct frame_arg *arg)
   else
     {
       if (arg->error)
-	except.message = arg->error;
+	error_message = arg->error;
       else
 	{
-	  /* TRY_CATCH has two statements, wrap it in a block.  */
-
 	  TRY
 	    {
 	      const struct language_defn *language;
@@ -288,12 +287,13 @@ print_frame_arg (const struct frame_arg *arg)
 	    }
 	  CATCH (except, RETURN_MASK_ERROR)
 	    {
+	      error_message = except.message;
 	    }
 	  END_CATCH
 	}
-      if (except.message)
+      if (error_message != NULL)
 	fprintf_filtered (stb, _("<error reading variable: %s>"),
-			  except.message);
+			  error_message);
     }
 
   ui_out_field_stream (uiout, "value", stb);
@@ -314,18 +314,19 @@ read_frame_local (struct symbol *sym, struct frame_info *frame,
 {
   struct value *val = NULL;
 
+  argp->sym = sym;
+  argp->val = NULL;
+  argp->error = NULL;
+
   TRY
     {
-      val = read_var_value (sym, frame);
+      argp->val = read_var_value (sym, frame);
     }
   CATCH (except, RETURN_MASK_ERROR)
     {
+      argp->error = xstrdup (except.message);
     }
   END_CATCH
-
-  argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
-  argp->sym = sym;
-  argp->val = val;
 }
 
 /* Read in inferior function parameter SYM at FRAME into ARGP.  Caller is
@@ -349,14 +350,10 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 	}
       CATCH (except, RETURN_MASK_ERROR)
 	{
-	}
-      END_CATCH
-
-      if (!val)
-	{
 	  val_error = alloca (strlen (except.message) + 1);
 	  strcpy (val_error, except.message);
 	}
+      END_CATCH
     }
 
   if (SYMBOL_COMPUTED_OPS (sym) != NULL
@@ -374,21 +371,16 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 	}
       CATCH (except, RETURN_MASK_ERROR)
 	{
+	  if (except.error != NO_ENTRY_VALUE_ERROR)
+	    {
+	      entryval_error = (char *) alloca (strlen (except.message) + 1);
+	      strcpy (entryval_error, except.message);
+	    }
 	}
       END_CATCH
 
-      if (!entryval)
-	{
-	  entryval_error = alloca (strlen (except.message) + 1);
-	  strcpy (entryval_error, except.message);
-	}
-
-      if (except.error == NO_ENTRY_VALUE_ERROR
-	  || (entryval && value_optimized_out (entryval)))
-	{
-	  entryval = NULL;
-	  entryval_error = NULL;
-	}
+      if (entryval != NULL && value_optimized_out (entryval))
+	entryval = NULL;
 
       if (print_entry_values == print_entry_values_compact
 	  || print_entry_values == print_entry_values_default)
@@ -437,21 +429,21 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 		    }
 		  CATCH (except, RETURN_MASK_ERROR)
 		    {
+		      /* If the dereferenced content could not be
+			 fetched do not display anything.  */
+		      if (except.error == NO_ENTRY_VALUE_ERROR)
+			val_equal = 1;
+		      else if (except.message != NULL)
+			{
+			  entryval_error = (char *) alloca (strlen (except.message) + 1);
+			  strcpy (entryval_error, except.message);
+			}
 		    }
 		  END_CATCH
 
 		  /* Value was not a reference; and its content matches.  */
 		  if (val == val_deref)
 		    val_equal = 1;
-		  /* If the dereferenced content could not be fetched do not
-		     display anything.  */
-		  else if (except.error == NO_ENTRY_VALUE_ERROR)
-		    val_equal = 1;
-		  else if (except.message)
-		    {
-		      entryval_error = alloca (strlen (except.message) + 1);
-		      strcpy (entryval_error, except.message);
-		    }
 
 		  if (val_equal)
 		    entryval = NULL;
@@ -477,20 +469,18 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
     {
       if (print_entry_values == print_entry_values_preferred)
 	{
+	  gdb_assert (val == NULL);
+
 	  TRY
 	    {
 	      val = read_var_value (sym, frame);
 	    }
 	  CATCH (except, RETURN_MASK_ERROR)
 	    {
-	    }
-	  END_CATCH
-
-	  if (!val)
-	    {
 	      val_error = alloca (strlen (except.message) + 1);
 	      strcpy (val_error, except.message);
 	    }
+	  END_CATCH
 	}
       if (print_entry_values == print_entry_values_only
 	  || print_entry_values == print_entry_values_both
@@ -1441,6 +1431,7 @@ frame_info (char *addr_exp, int from_tty)
   int frame_pc_p;
   /* Initialize it to avoid "may be used uninitialized" warning.  */
   CORE_ADDR caller_pc = 0;
+  int caller_pc_p = 0;
 
   fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
   gdbarch = get_frame_arch (fi);
@@ -1531,6 +1522,7 @@ frame_info (char *addr_exp, int from_tty)
   TRY
     {
       caller_pc = frame_unwind_caller_pc (fi);
+      caller_pc_p = 1;
     }
   CATCH (ex, RETURN_MASK_ERROR)
     {
@@ -1549,7 +1541,7 @@ frame_info (char *addr_exp, int from_tty)
     }
   END_CATCH
 
-  else
+  if (caller_pc_p)
     fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
   printf_filtered ("\n");
 
@@ -2604,6 +2596,7 @@ get_frame_language (void)
   if (frame)
     {
       CORE_ADDR pc = 0;
+      int pc_p = 0;
 
       /* We determine the current frame language by looking up its
          associated symtab.  To retrieve this symtab, we use the frame
@@ -2617,6 +2610,7 @@ get_frame_language (void)
       TRY
 	{
 	  pc = get_frame_address_in_block (frame);
+	  pc_p = 1;
 	}
       CATCH (ex, RETURN_MASK_ERROR)
 	{
@@ -2625,7 +2619,7 @@ get_frame_language (void)
 	}
       END_CATCH
 
-      else
+      if (pc_p)
 	{
 	  struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
 
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 1b735d3..646df0a 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -392,7 +392,6 @@ varobj_create (char *objname,
 	{
 	  value = evaluate_expression (var->root->exp);
 	}
-
       CATCH (except, RETURN_MASK_ERROR)
 	{
 	  /* Error getting the value.  Try to at least get the
@@ -403,14 +402,14 @@ varobj_create (char *objname,
 	}
       END_CATCH
 
-	else
-	  {
-	    int real_type_found = 0;
+      if (value != NULL)
+	{
+	  int real_type_found = 0;
 
-	    var->type = value_actual_type (value, 0, &real_type_found);
-	    if (real_type_found)
-	      value = value_cast (var->type, value);
-	  }
+	  var->type = value_actual_type (value, 0, &real_type_found);
+	  if (real_type_found)
+	    value = value_cast (var->type, value);
+	}
 
       /* Set language info */
       var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 08/36] elf-bfd.h: Wrap in extern "C".
  2015-02-09 23:21 ` [PATCH 08/36] elf-bfd.h: Wrap in extern "C" Pedro Alves
@ 2015-02-09 23:33   ` Andrew Pinski
  2015-02-10 12:05     ` [PATCH v2] Wrap BFD headers " Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Andrew Pinski @ 2015-02-09 23:33 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches, Binutils Development

On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
> Just like bfd-in2.h.  So that C++ programs, such as when GDB is built
> as a C++ program, can use it.
>
> bfd/ChangeLog:
> 2015-02-09  Pedro Alves  <palves@redhat.com>
>
>         * elf-bfd.h [__cplusplus]: Wrap in extern "C".
> ---
>  bfd/elf-bfd.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
> index 49ffe79..0587cc2 100644
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -22,6 +22,10 @@
>  #ifndef _LIBELF_H_
>  #define _LIBELF_H_ 1
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  #include "elf/common.h"
>  #include "elf/external.h"
>  #include "elf/internal.h"

This is bad form to wrap header files also.

Thanks,
Andrew

> @@ -2540,4 +2544,7 @@ extern asection _bfd_elf_large_com_section;
>      (!(H)->unique_global \
>       && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)))
>
> +#ifdef __cplusplus
> +}
> +#endif
>  #endif /* _LIBELF_H_ */
> --
> 1.9.3
>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-09 23:21 ` [PATCH 09/36] floatformat.h: Wrap in extern "C" Pedro Alves
@ 2015-02-09 23:35   ` Andrew Pinski
  2015-02-09 23:49     ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Andrew Pinski @ 2015-02-09 23:35 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches, GCC Patches

On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
> Just like libiberty.h.  So that C++ programs, such as GDB when built
> as a C++ program, can use it.

Why is not needed for GCC building with C++ compiler?

Thanks,
Andrew

>
> include/ChangeLog:
> 2015-02-09  Pedro Alves  <palves@redhat.com>
>
>         * floatformat.h [__cplusplus]: Wrap in extern "C".
> ---
>  include/floatformat.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/include/floatformat.h b/include/floatformat.h
> index 6b559864..71d332b 100644
> --- a/include/floatformat.h
> +++ b/include/floatformat.h
> @@ -20,6 +20,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
>  #if !defined (FLOATFORMAT_H)
>  #define FLOATFORMAT_H 1
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  #include "ansidecl.h"
>
>  /* A floatformat consists of a sign bit, an exponent and a mantissa.  Once the
> @@ -148,4 +152,8 @@ floatformat_from_double (const struct floatformat *, const double *, void *);
>  extern int
>  floatformat_is_valid (const struct floatformat *fmt, const void *from);
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #endif /* defined (FLOATFORMAT_H) */
> --
> 1.9.3
>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 18/36] Rename struct lzma_stream to avoid clash with system header
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (25 preceding siblings ...)
  2015-02-09 23:22 ` [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere Pedro Alves
@ 2015-02-09 23:35 ` Pedro Alves
  2015-02-09 23:45 ` [PATCH 06/36] record-btrace.c: Remove redefinitions Pedro Alves
                   ` (13 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:35 UTC (permalink / raw)
  To: gdb-patches

From: Tom Tromey <tromey@redhat.com>

/home/pedro/gdb/mygit/src/gdb/minidebug.c: At global scope:
/home/pedro/gdb/mygit/src/gdb/minidebug.c:55:8: error: using typedef-name ‘lzma_stream’ after ‘struct’
 struct lzma_stream
        ^
In file included from /usr/include/lzma.h:281:0,
                 from /home/pedro/gdb/mygit/src/gdb/minidebug.c:28:
/usr/include/lzma/base.h:498:3: note: ‘lzma_stream’ has a previous declaration here
 } lzma_stream;
   ^

gdb/ChangeLog:
2015-02-09  Tom Tromey  <tromey@redhat.com>

	* minidebug.c (struct lzma_stream): Rename to ...
	(struct gdb_lzma_stream): ... this.
	(lzma_open, lzma_pread, lzma_close, lzma_stat): Adjust.
---
 gdb/minidebug.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index b6b6e89..cc20914 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -52,7 +52,7 @@ static lzma_allocator gdb_lzma_allocator = { alloc_lzma, free_lzma, NULL };
    a section.  This keeps only the last decompressed block in memory
    to allow larger data without using to much memory.  */
 
-struct lzma_stream
+struct gdb_lzma_stream
 {
   /* Section of input BFD from which we are decoding data.  */
   asection *section;
@@ -70,8 +70,8 @@ struct lzma_stream
    find_separate_debug_file_in_section.  OPEN_CLOSURE is 'asection *'
    of the section to decompress.
 
-   Return 'struct lzma_stream *' must be freed by caller by xfree, together
-   with its INDEX lzma data.  */
+   Return 'struct gdb_lzma_stream *' must be freed by caller by xfree,
+   together with its INDEX lzma data.  */
 
 static void *
 lzma_open (struct bfd *nbfd, void *open_closure)
@@ -84,7 +84,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
   lzma_index *index;
   int ret;
   uint64_t memlimit = UINT64_MAX;
-  struct lzma_stream *lstream;
+  struct gdb_lzma_stream *lstream;
   size_t pos;
 
   size = bfd_get_section_size (section);
@@ -118,7 +118,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
     }
   xfree (indexdata);
 
-  lstream = xzalloc (sizeof (struct lzma_stream));
+  lstream = xzalloc (sizeof (struct gdb_lzma_stream));
   lstream->section = section;
   lstream->index = index;
 
@@ -127,13 +127,13 @@ lzma_open (struct bfd *nbfd, void *open_closure)
 
 /* bfd_openr_iovec PREAD_P implementation for
    find_separate_debug_file_in_section.  Passed STREAM
-   is 'struct lzma_stream *'.  */
+   is 'struct gdb_lzma_stream *'.  */
 
 static file_ptr
 lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
 	    file_ptr offset)
 {
-  struct lzma_stream *lstream = stream;
+  struct gdb_lzma_stream *lstream = stream;
   bfd_size_type chunk_size;
   lzma_index_iter iter;
   gdb_byte *compressed, *uncompressed;
@@ -214,13 +214,13 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
 
 /* bfd_openr_iovec CLOSE_P implementation for
    find_separate_debug_file_in_section.  Passed STREAM
-   is 'struct lzma_stream *'.  */
+   is 'struct gdb_lzma_stream *'.  */
 
 static int
 lzma_close (struct bfd *nbfd,
 	    void *stream)
 {
-  struct lzma_stream *lstream = stream;
+  struct gdb_lzma_stream *lstream = stream;
 
   lzma_index_end (lstream->index, &gdb_lzma_allocator);
   xfree (lstream->data);
@@ -232,14 +232,14 @@ lzma_close (struct bfd *nbfd,
 
 /* bfd_openr_iovec STAT_P implementation for
    find_separate_debug_file_in_section.  Passed STREAM
-   is 'struct lzma_stream *'.  */
+   is 'struct gdb_lzma_stream *'.  */
 
 static int
 lzma_stat (struct bfd *abfd,
 	   void *stream,
 	   struct stat *sb)
 {
-  struct lzma_stream *lstream = stream;
+  struct gdb_lzma_stream *lstream = stream;
 
   sb->st_size = lzma_index_uncompressed_size (lstream->index);
   return 0;
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it
  2015-02-09 23:53 ` [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it Pedro Alves
@ 2015-02-09 23:35   ` Pedro Alves
  2015-02-27 16:23   ` Pedro Alves
  1 sibling, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: GCC Patches

Bah, looks like I dropped gdb-patches@ by accident, adding it back
(patch here: https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00580.html).

For the gcc folks, this is part of this series:
 https://sourceware.org/ml/gdb-patches/2015-02/msg00202.html

Thanks,
Pedro Alves

On 02/09/2015 11:20 PM, Pedro Alves wrote:
> Converting GDB to be a C++ program, I stumbled on 'basename' issues,
> like:
> 
>  src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’
>  /usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’
> 
> which I believe led to this bit in gold's configure.ac:
> 
>  dnl We have to check these in C, not C++, because autoconf generates
>  dnl tests which have no type information, and current glibc provides
>  dnl multiple declarations of functions like basename when compiling
>  dnl with C++.
>  AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
> 
> These checks IIUC intend to generate all the HAVE_DECL_FOO symbols
> that libiberty.h and ansidecl.h check.
> 
> GDB is missing these checks currently, which results in the conflict
> shown above.
> 
> I could just copy gold's bits over to GDB.  But, since libiberty's
> ansidecl.h and libiberty.h check HAVE_DECL_XXX symbols, ISTM that all
> programs that use these headers should be doing the exact same
> corresponding AC_CHECK_DECLS autoconf checks, and that there's good
> potential for bit rot here.
> 
> So I thought of adding a m4 file that projects that use libiberty can
> source to pull in the autoconf checks that libiberty needs done in
> order to use its public headers.
> 
> Turns out that this has already happened.  Since I first wrote this a
> few months back, libiberty gained more HAVE_DECL_FOO checks even, for
> the strtol & friends replacements.
> 
> Are the libiberty changes OK?
> 
> libiberty/ChangeLog:
> 2015-02-09  Pedro Alves  <palves@redhat.com>
> 
> 	* libiberty.m4: New file.
> 
> gdb/ChangeLog:
> 2015-02-09  Pedro Alves  <palves@redhat.com>
> 
> 	* acinclude.m4: Include libiberty.m4.
> 	* config.in, configure: Regenerate.
> 	* configure.ac: Call libiberty_INIT.
> 
> gdb/gdbserver/
> 2015-02-09  Pedro Alves  <palves@redhat.com>
> 
> 	* acinclude.m4: Include libiberty.m4.
> 	* config.in, configure: Regenerate.
> 	* configure.ac: Call libiberty_INIT.
> ---
>  gdb/acinclude.m4           |   3 +
>  gdb/config.in              |  45 ++++++
>  gdb/configure              | 266 +++++++++++++++++++++++++++--------
>  gdb/configure.ac           |   2 +
>  gdb/gdbserver/acinclude.m4 |   3 +
>  gdb/gdbserver/config.in    |  41 ++++++
>  gdb/gdbserver/configure    | 338 +++++++++++++++++++++++++++++++++++++++++++++
>  gdb/gdbserver/configure.ac |   2 +
>  libiberty/libiberty.m4     |  33 +++++
>  9 files changed, 679 insertions(+), 54 deletions(-)
>  create mode 100644 libiberty/libiberty.m4
> 
> diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
> index 6f71486..ff4aff0 100644
> --- a/gdb/acinclude.m4
> +++ b/gdb/acinclude.m4
> @@ -54,6 +54,9 @@ sinclude([../config/zlib.m4])
>  
>  m4_include([common/common.m4])
>  
> +dnl For libiberty_INIT.
> +m4_include(../libiberty/libiberty.m4)
> +
>  ## ----------------------------------------- ##
>  ## ANSIfy the C compiler whenever possible.  ##
>  ## From Franc,ois Pinard                     ##
> diff --git a/gdb/config.in b/gdb/config.in
> index 806cbac..6a8df15 100644
> --- a/gdb/config.in
> +++ b/gdb/config.in
> @@ -85,6 +85,17 @@
>     you don't. */
>  #undef HAVE_DECL_ADDR_NO_RANDOMIZE
>  
> +/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_ASPRINTF
> +
> +/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
> +   you don't. */
> +#undef HAVE_DECL_BASENAME
> +
> +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
> +#undef HAVE_DECL_FFS
> +
>  /* Define to 1 if you have the declaration of `free', and to 0 if you don't.
>     */
>  #undef HAVE_DECL_FREE
> @@ -117,6 +128,34 @@
>     */
>  #undef HAVE_DECL_STRSTR
>  
> +/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
> +   */
> +#undef HAVE_DECL_STRTOL
> +
> +/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRTOLL
> +
> +/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRTOUL
> +
> +/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRTOULL
> +
> +/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRVERSCMP
> +
> +/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_VASPRINTF
> +
> +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_VSNPRINTF
> +
>  /* Define to 1 if you have the <dlfcn.h> header file. */
>  #undef HAVE_DLFCN_H
>  
> @@ -225,6 +264,9 @@
>  /* Define to 1 if the compiler supports long double. */
>  #undef HAVE_LONG_DOUBLE
>  
> +/* Define if you have the `long long' type. */
> +#undef HAVE_LONG_LONG
> +
>  /* Define if <sys/procfs.h> has lwpid_t. */
>  #undef HAVE_LWPID_T
>  
> @@ -635,6 +677,9 @@
>  /* The size of `long', as computed by sizeof. */
>  #undef SIZEOF_LONG
>  
> +/* The size of `long long', as computed by sizeof. */
> +#undef SIZEOF_LONG_LONG
> +
>  /* The size of `unsigned long', as computed by sizeof. */
>  #undef SIZEOF_UNSIGNED_LONG
>  
> diff --git a/gdb/configure b/gdb/configure
> index 9632f9a..05e355c 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -2184,6 +2184,60 @@ $as_echo "$ac_res" >&6; }
>  
>  } # ac_fn_c_check_func
>  
> +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
> +# -------------------------------------------
> +# Tests whether TYPE exists after having included INCLUDES, setting cache
> +# variable VAR accordingly.
> +ac_fn_c_check_type ()
> +{
> +  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
> +$as_echo_n "checking for $2... " >&6; }
> +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  eval "$3=no"
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +if (sizeof ($2))
> +	 return 0;
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +if (sizeof (($2)))
> +	    return 0;
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +
> +else
> +  eval "$3=yes"
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +fi
> +eval ac_res=\$$3
> +	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
> +$as_echo "$ac_res" >&6; }
> +  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
> +
> +} # ac_fn_c_check_type
> +
>  # ac_fn_c_check_decl LINENO SYMBOL VAR
>  # ------------------------------------
>  # Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
> @@ -2285,60 +2339,6 @@ $as_echo "$ac_res" >&6; }
>    eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
>  
>  } # ac_fn_c_check_member
> -
> -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
> -# -------------------------------------------
> -# Tests whether TYPE exists after having included INCLUDES, setting cache
> -# variable VAR accordingly.
> -ac_fn_c_check_type ()
> -{
> -  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
> -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
> -$as_echo_n "checking for $2... " >&6; }
> -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
> -  $as_echo_n "(cached) " >&6
> -else
> -  eval "$3=no"
> -  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> -/* end confdefs.h.  */
> -$4
> -int
> -main ()
> -{
> -if (sizeof ($2))
> -	 return 0;
> -  ;
> -  return 0;
> -}
> -_ACEOF
> -if ac_fn_c_try_compile "$LINENO"; then :
> -  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> -/* end confdefs.h.  */
> -$4
> -int
> -main ()
> -{
> -if (sizeof (($2)))
> -	    return 0;
> -  ;
> -  return 0;
> -}
> -_ACEOF
> -if ac_fn_c_try_compile "$LINENO"; then :
> -
> -else
> -  eval "$3=yes"
> -fi
> -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> -fi
> -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> -fi
> -eval ac_res=\$$3
> -	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
> -$as_echo "$ac_res" >&6; }
> -  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
> -
> -} # ac_fn_c_check_type
>  cat >config.log <<_ACEOF
>  This file contains any messages produced by compilers while
>  running configure, to aid debugging if configure makes a mistake.
> @@ -9584,6 +9584,164 @@ done
>  # Checks for declarations.  #
>  # ------------------------- #
>  
> +
> +  # Check for presence of long long.
> +  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
> +if test "x$ac_cv_type_long_long" = x""yes; then :
> +
> +$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h
> + # The cast to long int works around a bug in the HP C Compiler
> +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
> +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
> +# This bug is HP SR number 8606223364.
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
> +$as_echo_n "checking size of long long... " >&6; }
> +if test "${ac_cv_sizeof_long_long+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
> +
> +else
> +  if test "$ac_cv_type_long_long" = yes; then
> +     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
> +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
> +{ as_fn_set_status 77
> +as_fn_error "cannot compute sizeof (long long)
> +See \`config.log' for more details." "$LINENO" 5; }; }
> +   else
> +     ac_cv_sizeof_long_long=0
> +   fi
> +fi
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
> +$as_echo "$ac_cv_sizeof_long_long" >&6; }
> +
> +
> +
> +cat >>confdefs.h <<_ACEOF
> +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
> +_ACEOF
> +
> +
> +fi
> +
> +
> +  ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_BASENAME $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_ffs" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_FFS $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_asprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_ASPRINTF $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_vasprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_VASPRINTF $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_snprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_SNPRINTF $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_VSNPRINTF $ac_have_decl
> +_ACEOF
> +
> +  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtol" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOL $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtoul" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOUL $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtoll" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOLL $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtoull" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOULL $ac_have_decl
> +_ACEOF
> +
> +  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strverscmp" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRVERSCMP $ac_have_decl
> +_ACEOF
> +
> +
> +
>  ac_fn_c_check_decl "$LINENO" "free" "ac_cv_have_decl_free" "$ac_includes_default"
>  if test "x$ac_cv_have_decl_free" = x""yes; then :
>    ac_have_decl=1
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index dfc6947..920e580 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -1283,6 +1283,8 @@ AC_CHECK_HEADERS(term.h, [], [],
>  # Checks for declarations.  #
>  # ------------------------- #
>  
> +libiberty_INIT
> +
>  AC_CHECK_DECLS([free, malloc, realloc, snprintf])
>  AM_LC_MESSAGES
>  
> diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
> index 744871a..ba4a21f 100644
> --- a/gdb/gdbserver/acinclude.m4
> +++ b/gdb/gdbserver/acinclude.m4
> @@ -20,6 +20,9 @@ dnl anything else in gdbserver.
>  m4_include(../../config/codeset.m4)
>  m4_include(../common/common.m4)
>  
> +dnl For libiberty_INIT.
> +m4_include(../../libiberty/libiberty.m4)
> +
>  dnl Check for existence of a type $1 in libthread_db.h
>  dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
>  
> diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
> index 8f68ed2..cf8e59d 100644
> --- a/gdb/gdbserver/config.in
> +++ b/gdb/gdbserver/config.in
> @@ -22,10 +22,25 @@
>     you don't. */
>  #undef HAVE_DECL_ADDR_NO_RANDOMIZE
>  
> +/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_ASPRINTF
> +
> +/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
> +   you don't. */
> +#undef HAVE_DECL_BASENAME
> +
> +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
> +#undef HAVE_DECL_FFS
> +
>  /* Define to 1 if you have the declaration of `perror', and to 0 if you don't.
>     */
>  #undef HAVE_DECL_PERROR
>  
> +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_SNPRINTF
> +
>  /* Define to 1 if you have the declaration of `strerror', and to 0 if you
>     don't. */
>  #undef HAVE_DECL_STRERROR
> @@ -34,6 +49,26 @@
>     */
>  #undef HAVE_DECL_STRSTR
>  
> +/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
> +   */
> +#undef HAVE_DECL_STRTOL
> +
> +/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRTOLL
> +
> +/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRTOUL
> +
> +/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRTOULL
> +
> +/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
> +   don't. */
> +#undef HAVE_DECL_STRVERSCMP
> +
>  /* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
>     don't. */
>  #undef HAVE_DECL_VASPRINTF
> @@ -96,6 +131,9 @@
>  /* Define to 1 if you have the <locale.h> header file. */
>  #undef HAVE_LOCALE_H
>  
> +/* Define if you have the `long long' type. */
> +#undef HAVE_LONG_LONG
> +
>  /* Define if <thread_db.h> has lwpid_t. */
>  #undef HAVE_LWPID_T
>  
> @@ -253,6 +291,9 @@
>  /* Bug reporting address */
>  #undef REPORT_BUGS_TO
>  
> +/* The size of `long long', as computed by sizeof. */
> +#undef SIZEOF_LONG_LONG
> +
>  /* If using the C implementation of alloca, define if you know the
>     direction of stack growth for your system; otherwise it will be
>     automatically deduced at runtime.
> diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
> index 2240b78..5623746 100755
> --- a/gdb/gdbserver/configure
> +++ b/gdb/gdbserver/configure
> @@ -1882,6 +1882,184 @@ $as_echo "$ac_res" >&6; }
>    eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
>  
>  } # ac_fn_c_check_type
> +
> +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
> +# --------------------------------------------
> +# Tries to find the compile-time value of EXPR in a program that includes
> +# INCLUDES, setting VAR accordingly. Returns whether the value could be
> +# computed
> +ac_fn_c_compute_int ()
> +{
> +  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
> +  if test "$cross_compiling" = yes; then
> +    # Depending upon the size, compute the lo and hi bounds.
> +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) >= 0)];
> +test_array [0] = 0
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  ac_lo=0 ac_mid=0
> +  while :; do
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) <= $ac_mid)];
> +test_array [0] = 0
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  ac_hi=$ac_mid; break
> +else
> +  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
> +			if test $ac_lo -le $ac_mid; then
> +			  ac_lo= ac_hi=
> +			  break
> +			fi
> +			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +  done
> +else
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) < 0)];
> +test_array [0] = 0
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  ac_hi=-1 ac_mid=-1
> +  while :; do
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) >= $ac_mid)];
> +test_array [0] = 0
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  ac_lo=$ac_mid; break
> +else
> +  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
> +			if test $ac_mid -le $ac_hi; then
> +			  ac_lo= ac_hi=
> +			  break
> +			fi
> +			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +  done
> +else
> +  ac_lo= ac_hi=
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +# Binary search between lo and hi bounds.
> +while test "x$ac_lo" != "x$ac_hi"; do
> +  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) <= $ac_mid)];
> +test_array [0] = 0
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  ac_hi=$ac_mid
> +else
> +  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +done
> +case $ac_lo in #((
> +?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
> +'') ac_retval=1 ;;
> +esac
> +  else
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +$4
> +static long int longval () { return $2; }
> +static unsigned long int ulongval () { return $2; }
> +#include <stdio.h>
> +#include <stdlib.h>
> +int
> +main ()
> +{
> +
> +  FILE *f = fopen ("conftest.val", "w");
> +  if (! f)
> +    return 1;
> +  if (($2) < 0)
> +    {
> +      long int i = longval ();
> +      if (i != ($2))
> +	return 1;
> +      fprintf (f, "%ld", i);
> +    }
> +  else
> +    {
> +      unsigned long int i = ulongval ();
> +      if (i != ($2))
> +	return 1;
> +      fprintf (f, "%lu", i);
> +    }
> +  /* Do not output a trailing newline, as this causes \r\n confusion
> +     on some platforms.  */
> +  return ferror (f) || fclose (f) != 0;
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_run "$LINENO"; then :
> +  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
> +else
> +  ac_retval=1
> +fi
> +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
> +  conftest.$ac_objext conftest.beam conftest.$ac_ext
> +rm -f conftest.val
> +
> +  fi
> +  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
> +  return $ac_retval
> +
> +} # ac_fn_c_compute_int
>  cat >config.log <<_ACEOF
>  This file contains any messages produced by compilers while
>  running configure, to aid debugging if configure makes a mistake.
> @@ -5338,6 +5516,166 @@ done
>  
>  LIBS="$old_LIBS"
>  
> +
> +
> +  # Check for presense of long long
> +  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
> +if test "x$ac_cv_type_long_long" = x""yes; then :
> +
> +$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h
> + # The cast to long int works around a bug in the HP C Compiler
> +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
> +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
> +# This bug is HP SR number 8606223364.
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
> +$as_echo_n "checking size of long long... " >&6; }
> +if test "${ac_cv_sizeof_long_long+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
> +
> +else
> +  if test "$ac_cv_type_long_long" = yes; then
> +     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
> +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
> +{ as_fn_set_status 77
> +as_fn_error "cannot compute sizeof (long long)
> +See \`config.log' for more details." "$LINENO" 5; }; }
> +   else
> +     ac_cv_sizeof_long_long=0
> +   fi
> +fi
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
> +$as_echo "$ac_cv_sizeof_long_long" >&6; }
> +
> +
> +
> +cat >>confdefs.h <<_ACEOF
> +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
> +_ACEOF
> +
> +
> +fi
> +
> +
> +  ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_BASENAME $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_ffs" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_FFS $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_asprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_ASPRINTF $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_vasprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_VASPRINTF $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_snprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_SNPRINTF $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_VSNPRINTF $ac_have_decl
> +_ACEOF
> +
> +  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtol" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOL $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtoul" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOUL $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtoll" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOLL $ac_have_decl
> +_ACEOF
> +ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strtoull" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRTOULL $ac_have_decl
> +_ACEOF
> +
> +  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
> +if test "x$ac_cv_have_decl_strverscmp" = x""yes; then :
> +  ac_have_decl=1
> +else
> +  ac_have_decl=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define HAVE_DECL_STRVERSCMP $ac_have_decl
> +_ACEOF
> +
> +
> +
> +
>  ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
>  if test "x$ac_cv_have_decl_strerror" = x""yes; then :
>    ac_have_decl=1
> diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
> index f883adc..60636f7 100644
> --- a/gdb/gdbserver/configure.ac
> +++ b/gdb/gdbserver/configure.ac
> @@ -193,6 +193,8 @@ LIBS="$LIBS -ldl"
>  AC_CHECK_FUNCS(dladdr)
>  LIBS="$old_LIBS"
>  
> +libiberty_INIT
> +
>  AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
>  
>  AC_CHECK_TYPES(socklen_t, [], [],
> diff --git a/libiberty/libiberty.m4 b/libiberty/libiberty.m4
> new file mode 100644
> index 0000000..6d9fd05
> --- /dev/null
> +++ b/libiberty/libiberty.m4
> @@ -0,0 +1,33 @@
> +dnl Bits libiberty clients must do on their autoconf step.
> +dnl
> +dnl   Copyright (C) 2012-2015 Free Software Foundation, Inc.
> +dnl
> +dnl This file 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; see the file COPYING3.  If not see
> +dnl <http://www.gnu.org/licenses/>.
> +dnl
> +
> +dnl Checks for declarations ansidecl.h and libiberty.h themselves
> +dnl check with HAVE_DECL_XXX, etc.
> +
> +AC_DEFUN([libiberty_INIT],
> +[
> +  # Check for presence of long long.
> +  AC_CHECK_TYPE([long long],
> +    [AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the `long long' type.]) AC_CHECK_SIZEOF([long long])],
> +    [])
> +
> +  AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
> +  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
> +  AC_CHECK_DECLS([strverscmp])
> +])
> 


^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 06/36] record-btrace.c: Remove redefinitions
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (26 preceding siblings ...)
  2015-02-09 23:35 ` [PATCH 18/36] Rename struct lzma_stream to avoid clash with system header Pedro Alves
@ 2015-02-09 23:45 ` Pedro Alves
  2015-02-09 23:46 ` [PATCH 35/36] kill volatile struct gdb_exception Pedro Alves
                   ` (12 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:45 UTC (permalink / raw)
  To: gdb-patches

The set_record_btrace_cmdlist and show_record_btrace_cmdlist objects
are declared twice in the file, seemingly a simply copy/paste
oversight.  In C, the first time counts as forward declaration, but in
C++, they are all definitions.  That results in:

 src/gdb/record-btrace.c:80:33: error: redefinition of ‘cmd_list_element* set_record_btrace_cmdlist’
 src/gdb/record-btrace.c:61:33: error: ‘cmd_list_element* set_record_btrace_cmdlist’ previously declared here
 src/gdb/record-btrace.c:81:33: error: redefinition of ‘cmd_list_element* show_record_btrace_cmdlist’
 src/gdb/record-btrace.c:62:33: error: ‘cmd_list_element* show_record_btrace_cmdlist’ previously declared here

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* record-btrace.c (set_record_btrace_cmdlist)
	(show_record_btrace_cmdlist): Remove redefinitions.
 ---

 gdb/record-btrace.c |    4 ----
 1 file changed, 4 deletions(-)
---
 gdb/record-btrace.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 102e0eb..35c775a 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -76,10 +76,6 @@ static struct btrace_config record_btrace_conf;
 /* Command list for "record btrace".  */
 static struct cmd_list_element *record_btrace_cmdlist;
 
-/* Command lists for "set/show record btrace".  */
-static struct cmd_list_element *set_record_btrace_cmdlist;
-static struct cmd_list_element *show_record_btrace_cmdlist;
-
 /* Command lists for "set/show record btrace bts".  */
 static struct cmd_list_element *set_record_btrace_bts_cmdlist;
 static struct cmd_list_element *show_record_btrace_bts_cmdlist;
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 35/36] kill volatile struct gdb_exception
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (27 preceding siblings ...)
  2015-02-09 23:45 ` [PATCH 06/36] record-btrace.c: Remove redefinitions Pedro Alves
@ 2015-02-09 23:46 ` Pedro Alves
  2015-02-09 23:49 ` [PATCH 00/36] Support building GDB as a C++ program Doug Evans
                   ` (11 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:46 UTC (permalink / raw)
  To: gdb-patches

After the previous patch, this is the last remaining use of a volatile
struct gdb_exception.  Kill it, as it's troublesome for C++: we can't
assign volatile <-> non-volatile without copy constructors /
assignment operators that do that, which I'd rather avoid.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* main.c (handle_command_errors): Remove volatile qualifier from
	parameter.
---
 gdb/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/main.c b/gdb/main.c
index ceca807..72b8714 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -339,7 +339,7 @@ captured_command_loop (void *data)
    catch_command_errors/catch_command_errors_const.  */
 
 static int
-handle_command_errors (volatile struct gdb_exception e)
+handle_command_errors (struct gdb_exception e)
 {
   if (e.reason < 0)
     {
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-09 23:35   ` Andrew Pinski
@ 2015-02-09 23:49     ` Pedro Alves
  2015-02-12 11:49       ` Pedro Alves
  2015-02-14 17:29       ` Doug Evans
  0 siblings, 2 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:49 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gdb-patches, GCC Patches

On 02/09/2015 11:35 PM, Andrew Pinski wrote:
> On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
>> Just like libiberty.h.  So that C++ programs, such as GDB when built
>> as a C++ program, can use it.
> 
> Why is not needed for GCC building with C++ compiler?

Because it doesn't include it.

The header of the file claims it is part of GDB, though MAINTAINERS
nowadays says that everything under include/ is owned by GCC.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (28 preceding siblings ...)
  2015-02-09 23:46 ` [PATCH 35/36] kill volatile struct gdb_exception Pedro Alves
@ 2015-02-09 23:49 ` Doug Evans
  2015-02-09 23:50 ` [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks Pedro Alves
                   ` (10 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Doug Evans @ 2015-02-09 23:49 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
> I'm glad to announce that the global maintainers have reached
> consensus on converting GDB to use C++ as implementation language.
> [...]

Awesome, though this kinda came "out of the blue".
I know we basically reached consensus but it would have been
nice to get a heads up that this was going out.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (29 preceding siblings ...)
  2015-02-09 23:49 ` [PATCH 00/36] Support building GDB as a C++ program Doug Evans
@ 2015-02-09 23:50 ` Pedro Alves
  2015-03-07 15:59   ` Pedro Alves
  2015-02-09 23:51 ` [PATCH 07/36] Make array object extern Pedro Alves
                   ` (9 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:50 UTC (permalink / raw)
  To: gdb-patches

All these were caught by actually making TRY/CATCH use try/catch
behind the scenes, which then resulted in the build failing because
there was code between the try and catch blocks.

As with the prior patch, this could either be done _before_ running
the TRY_CATCH conversion script, or be squashed into it.
---
 gdb/breakpoint.c           |  5 +++--
 gdb/gdbtypes.c             | 24 ++++++++++++++----------
 gdb/guile/scm-frame.c      |  9 +++------
 gdb/linux-thread-db.c      | 10 ++++++----
 gdb/python/py-breakpoint.c |  3 ++-
 gdb/record-btrace.c        | 20 ++++++++++----------
 6 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index b5a9704..4db4084 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15899,6 +15899,7 @@ save_breakpoints (char *filename, int from_tty,
 
     if (tp->type != bp_dprintf && tp->commands)
       {
+	struct gdb_exception exception;
 
 	fprintf_unfiltered (fp, "  commands\n");
 	
@@ -15907,14 +15908,14 @@ save_breakpoints (char *filename, int from_tty,
 	  {
 	    print_command_lines (current_uiout, tp->commands->commands, 2);
 	  }
-	ui_out_redirect (current_uiout, NULL);
-
 	CATCH (ex, RETURN_MASK_ALL)
 	  {
+	    ui_out_redirect (current_uiout, NULL);
 	    throw_exception (ex);
 	  }
 	END_CATCH
 
+	ui_out_redirect (current_uiout, NULL);
 	fprintf_unfiltered (fp, "  end\n");
       }
 
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 54130b6..ff3bdf4 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2301,7 +2301,6 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
     {
       type = parse_and_eval_type (p, length);
     }
-
   CATCH (except, RETURN_MASK_ERROR)
     {
       type = builtin_type (gdbarch)->builtin_void;
@@ -3229,6 +3228,7 @@ check_types_worklist (VEC (type_equality_entry_d) **worklist,
 int
 types_deeply_equal (struct type *type1, struct type *type2)
 {
+  struct gdb_exception except = exception_none;
   int result = 0;
   struct bcache *cache;
   VEC (type_equality_entry_d) *worklist = NULL;
@@ -3246,23 +3246,27 @@ types_deeply_equal (struct type *type1, struct type *type2)
   entry.type2 = type2;
   VEC_safe_push (type_equality_entry_d, worklist, &entry);
 
+  /* check_types_worklist calls several nested helper functions, some
+     of which can raise a GDB exception, so we just check and rethrow
+     here.  If there is a GDB exception, a comparison is not capable
+     (or trusted), so exit.  */
   TRY
     {
       result = check_types_worklist (&worklist, cache);
     }
-  /* check_types_worklist calls several nested helper functions,
-     some of which can raise a GDB Exception, so we just check
-     and rethrow here.  If there is a GDB exception, a comparison
-     is not capable (or trusted), so exit.  */
-  bcache_xfree (cache);
-  VEC_free (type_equality_entry_d, worklist);
-  /* Rethrow if there was a problem.  */
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
-      throw_exception (except);
+      except = ex;
     }
   END_CATCH
 
+  bcache_xfree (cache);
+  VEC_free (type_equality_entry_d, worklist);
+
+  /* Rethrow if there was a problem.  */
+  if (except.reason < 0)
+    throw_exception (except);
+
   return result;
 }
 \f
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 6189802..ea51d1b 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -426,7 +426,6 @@ gdbscm_frame_name (SCM self)
   enum language lang = language_minimal;
   struct frame_info *frame = NULL;
   SCM result;
-  struct gdb_exception except = exception_none;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
@@ -436,15 +435,13 @@ gdbscm_frame_name (SCM self)
       if (frame != NULL)
 	find_frame_funname (frame, &name, &lang, NULL);
     }
-  CATCH (ex, RETURN_MASK_ALL)
+  CATCH (except, RETURN_MASK_ALL)
     {
-      except = ex;
+      xfree (name);
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
     }
   END_CATCH
 
-  xfree (name);
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
-
   if (frame == NULL)
     {
       gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 87596d2..74f7e69 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1730,16 +1730,18 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
 				    TD_SIGNO_MASK,
 				    TD_THR_ANY_USER_FLAGS);
     }
-
-  if (libthread_db_debug)
+  CATCH (except, RETURN_MASK_ERROR)
     {
-      CATCH (except, RETURN_MASK_ERROR)
+      if (libthread_db_debug)
 	{
 	  exception_fprintf (gdb_stdlog, except,
 			     "Warning: find_new_threads_once: ");
 	}
-      END_CATCH
+    }
+  END_CATCH
 
+  if (libthread_db_debug)
+    {
       fprintf_unfiltered (gdb_stdlog,
 			  _("Found %d new threads in iteration %d.\n"),
 			  data.new_threads, iteration);
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index dcf1d5a..42a8596 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -503,15 +503,16 @@ bppy_get_commands (PyObject *self, void *closure)
     {
       print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
-  ui_out_redirect (current_uiout, NULL);
   CATCH (except, RETURN_MASK_ALL)
     {
+      ui_out_redirect (current_uiout, NULL);
       do_cleanups (chain);
       gdbpy_convert_exception (except);
       return NULL;
     }
   END_CATCH
 
+  ui_out_redirect (current_uiout, NULL);
   cmdstr = ui_file_xstrdup (string_file, &length);
   make_cleanup (xfree, cmdstr);
   result = PyString_Decode (cmdstr, strlen (cmdstr), host_charset (), NULL);
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 1cbbd3e..8aedb0b 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1116,14 +1116,13 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
     {
       ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
     }
-
-  replay_memory_access = old;
-
   CATCH (except, RETURN_MASK_ALL)
     {
+      replay_memory_access = old;
       throw_exception (except);
     }
   END_CATCH
+  replay_memory_access = old;
 
   return ret;
 }
@@ -1148,14 +1147,13 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
     {
       ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
     }
-
-  replay_memory_access = old;
-
   CATCH (except, RETURN_MASK_ALL)
     {
+      replay_memory_access = old;
       throw_exception (except);
     }
   END_CATCH
+  replay_memory_access = old;
 
   return ret;
 }
@@ -1667,12 +1665,11 @@ record_btrace_start_replaying (struct thread_info *tp)
       if (upd_step_stack_frame_id)
 	tp->control.step_stack_frame_id = frame_id;
     }
-
-  /* Restore the previous execution state.  */
-  set_executing (tp->ptid, executing);
-
   CATCH (except, RETURN_MASK_ALL)
     {
+      /* Restore the previous execution state.  */
+      set_executing (tp->ptid, executing);
+
       xfree (btinfo->replay);
       btinfo->replay = NULL;
 
@@ -1682,6 +1679,9 @@ record_btrace_start_replaying (struct thread_info *tp)
     }
   END_CATCH
 
+  /* Restore the previous execution state.  */
+  set_executing (tp->ptid, executing);
+
   return replay;
 }
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 14/36] Do not do arithmetic on enum types
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (31 preceding siblings ...)
  2015-02-09 23:51 ` [PATCH 07/36] Make array object extern Pedro Alves
@ 2015-02-09 23:51 ` Pedro Alves
  2015-02-09 23:53 ` [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it Pedro Alves
                   ` (7 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:51 UTC (permalink / raw)
  To: gdb-patches

From: Tom Tromey <tromey@redhat.com>

In C++, we can't do arithmetic on enums.  This patch fixes build errors like:

 src/gdb/i386-tdep.c: In function ‘int i386_stap_parse_special_token(gdbarch*, stap_parse_info*)’:
 src/gdb/i386-tdep.c:4309:7: error: no match for ‘operator++’ (operand type is ‘i386_stap_parse_special_token(gdbarch*, stap_parse_info*)::<anonymous enum>’)
	++current_state;
	^
 ...
 src/gdb/rs6000-tdep.c:4265:18: error: no match for ‘operator++’ (operand type is ‘powerpc_vector_abi’)
 src/gdb/arm-tdep.c:9428:71: error: no match for ‘operator++’ (operand type is ‘arm_float_model’)
 src/gdb/arm-tdep.c:9465:64: error: no match for ‘operator++’ (operand type is ‘arm_abi_kind’)
 ...

gdb/ChangeLog:
2015-02-09  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves <palves@redhat.com>

	* arm-tdep.c (set_fp_model_sfunc, arm_set_abi): Use 'int' for
	local used to iterate over enums.
	* completer.c (signal_completer): Likewise.
	* i386-tdep.c (i386_stap_parse_special_token): Likewise.
	* rs6000-tdep.c (powerpc_set_vector_abi): Likewise.
	* tui/tui-data.c (tui_next_win, tui_prev_win): Likewise.
	* tui/tui-layout.c (next_layout, prev_layout): Likewise.
	* tui/tui-win.c (tui_refresh_all_win, tui_rehighlight_all)
	(tui_resize_all, tui_set_focus_command, tui_all_windows_info): Likewise.
	* tui-wingeneral.c (tui_refresh_all):  Likewise.
---
 gdb/arm-tdep.c           | 4 ++--
 gdb/completer.c          | 4 ++--
 gdb/i386-tdep.c          | 3 ++-
 gdb/rs6000-tdep.c        | 2 +-
 gdb/tui/tui-data.c       | 4 ++--
 gdb/tui/tui-layout.c     | 8 ++++----
 gdb/tui/tui-win.c        | 8 ++++----
 gdb/tui/tui-wingeneral.c | 2 +-
 8 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 8e9552a..49b4c07 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9388,7 +9388,7 @@ static void
 set_fp_model_sfunc (char *args, int from_tty,
 		    struct cmd_list_element *c)
 {
-  enum arm_float_model fp_model;
+  int fp_model;
 
   for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++)
     if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0)
@@ -9425,7 +9425,7 @@ static void
 arm_set_abi (char *args, int from_tty,
 	     struct cmd_list_element *c)
 {
-  enum arm_abi_kind arm_abi;
+  int arm_abi;
 
   for (arm_abi = ARM_ABI_AUTO; arm_abi != ARM_ABI_LAST; arm_abi++)
     if (strcmp (arm_abi_string, arm_abi_strings[arm_abi]) == 0)
diff --git a/gdb/completer.c b/gdb/completer.c
index 774fb31..2a0dca9 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -951,7 +951,7 @@ signal_completer (struct cmd_list_element *ignore,
 {
   VEC (char_ptr) *return_val = NULL;
   size_t len = strlen (word);
-  enum gdb_signal signum;
+  int signum;
   const char *signame;
 
   for (signum = GDB_SIGNAL_FIRST; signum != GDB_SIGNAL_LAST; ++signum)
@@ -960,7 +960,7 @@ signal_completer (struct cmd_list_element *ignore,
       if (signum == GDB_SIGNAL_0)
 	continue;
 
-      signame = gdb_signal_to_name (signum);
+      signame = gdb_signal_to_name ((enum gdb_signal) signum);
 
       /* Ignore the unknown signal case.  */
       if (!signame || strcmp (signame, "?") == 0)
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 1c8842c..8c08f8b 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4270,7 +4270,8 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
       TRIPLET,
       THREE_ARG_DISPLACEMENT,
       DONE
-    } current_state;
+    };
+  int current_state;
 
   current_state = TRIPLET;
 
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index ef94bba..46f6e41 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -6049,7 +6049,7 @@ powerpc_set_vector_abi (char *args, int from_tty,
 			struct cmd_list_element *c)
 {
   struct gdbarch_info info;
-  enum powerpc_vector_abi vector_abi;
+  int vector_abi;
 
   for (vector_abi = POWERPC_VEC_AUTO;
        vector_abi != POWERPC_VEC_LAST;
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 3c5bce1..3eff9fd 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -319,7 +319,7 @@ tui_set_current_layout_to (enum tui_layout_type new_layout)
 struct tui_win_info *
 tui_next_win (struct tui_win_info *cur_win)
 {
-  enum tui_win_type type = cur_win->generic.type;
+  int type = cur_win->generic.type;
   struct tui_win_info *next_win = (struct tui_win_info *) NULL;
 
   if (cur_win->generic.type == CMD_WIN)
@@ -349,7 +349,7 @@ tui_next_win (struct tui_win_info *cur_win)
 struct tui_win_info *
 tui_prev_win (struct tui_win_info *cur_win)
 {
-  enum tui_win_type type = cur_win->generic.type;
+  int type = cur_win->generic.type;
   struct tui_win_info *prev = (struct tui_win_info *) NULL;
 
   if (cur_win->generic.type == SRC_WIN)
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 56cc026..6547404 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -616,7 +616,7 @@ tui_layout_command (char *arg, int from_tty)
 static enum tui_layout_type
 next_layout (void)
 {
-  enum tui_layout_type new_layout;
+  int new_layout;
 
   new_layout = tui_current_layout ();
   if (new_layout == UNDEFINED_LAYOUT)
@@ -628,7 +628,7 @@ next_layout (void)
 	new_layout = SRC_COMMAND;
     }
 
-  return new_layout;
+  return (enum tui_layout_type) new_layout;
 }
 
 
@@ -636,7 +636,7 @@ next_layout (void)
 static enum tui_layout_type
 prev_layout (void)
 {
-  enum tui_layout_type new_layout;
+  int new_layout;
 
   new_layout = tui_current_layout ();
   if (new_layout == SRC_COMMAND)
@@ -648,7 +648,7 @@ prev_layout (void)
 	new_layout = DISASSEM_DATA_COMMAND;
     }
 
-  return new_layout;
+  return (enum tui_layout_type) new_layout;
 }
 
 
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 1a12cc6..6a36d48 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -626,7 +626,7 @@ tui_scroll (enum tui_scroll_direction direction,
 void
 tui_refresh_all_win (void)
 {
-  enum tui_win_type type;
+  int type;
 
   clearok (curscr, TRUE);
   tui_refresh_all (tui_win_list);
@@ -658,7 +658,7 @@ tui_refresh_all_win (void)
 void
 tui_rehighlight_all (void)
 {
-  enum tui_win_type type;
+  int type;
 
   for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
     tui_check_and_display_highlight_if_needed (tui_win_list[type]);
@@ -682,7 +682,7 @@ tui_resize_all (void)
       struct tui_win_info *first_win;
       struct tui_win_info *second_win;
       struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
-      enum tui_win_type win_type;
+      int win_type;
       int new_height, split_diff, cmd_split_diff, num_wins_displayed = 2;
 
 #ifdef HAVE_RESIZE_TERM
@@ -978,7 +978,7 @@ tui_set_focus_command (char *arg, int from_tty)
 static void
 tui_all_windows_info (char *arg, int from_tty)
 {
-  enum tui_win_type type;
+  int type;
   struct tui_win_info *win_with_focus = tui_win_with_focus ();
 
   for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 72d8cd9..b95da49 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -252,7 +252,7 @@ tui_make_all_invisible (void)
 void
 tui_refresh_all (struct tui_win_info **list)
 {
-  enum tui_win_type type;
+  int type;
   struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
 
   for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 07/36] Make array object extern
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (30 preceding siblings ...)
  2015-02-09 23:50 ` [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks Pedro Alves
@ 2015-02-09 23:51 ` Pedro Alves
  2015-02-27 22:47   ` Simon Marchi
  2015-02-09 23:51 ` [PATCH 14/36] Do not do arithmetic on enum types Pedro Alves
                   ` (8 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:51 UTC (permalink / raw)
  To: gdb-patches

Compiling python.c in C++ mode, we get:

  ...src/gdb/python/python.c: At global scope:
  ...src/gdb/python/python.c:106:31: error: storage size of ‘GdbMethods’ isn’t known
   static PyMethodDef GdbMethods[];
				 ^

Fix it by making the affected array objects extern.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* python/python.c (GdbMethods): Rename to ...
	(python_GdbMethods): ... this and make extern.
	(GdbModuleDef): Rename to ...
	(python_GdbModuleDef): ... this and make extern.
---
 gdb/python/python.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 9854c79..a13638f 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -103,10 +103,10 @@ const struct extension_language_defn extension_language_python =
 
 int gdb_python_initialized;
 
-static PyMethodDef GdbMethods[];
+extern PyMethodDef python_GdbMethods[];
 
 #ifdef IS_PY3K
-static struct PyModuleDef GdbModuleDef;
+extern struct PyModuleDef python_GdbModuleDef;
 #endif
 
 PyObject *gdb_module;
@@ -1712,11 +1712,11 @@ message == an error message without a stack will be printed."),
   PyEval_InitThreads ();
 
 #ifdef IS_PY3K
-  gdb_module = PyModule_Create (&GdbModuleDef);
+  gdb_module = PyModule_Create (&python_GdbModuleDef);
   /* Add _gdb module to the list of known built-in modules.  */
   _PyImport_FixupBuiltin (gdb_module, "_gdb");
 #else
-  gdb_module = Py_InitModule ("_gdb", GdbMethods);
+  gdb_module = Py_InitModule ("_gdb", python_GdbMethods);
 #endif
   if (gdb_module == NULL)
     goto fail;
@@ -1932,7 +1932,7 @@ gdbpy_initialized (const struct extension_language_defn *extlang)
 
 #ifdef HAVE_PYTHON
 
-static PyMethodDef GdbMethods[] =
+PyMethodDef python_GdbMethods[] =
 {
   { "history", gdbpy_history, METH_VARARGS,
     "Get a value from history" },
@@ -2044,7 +2044,7 @@ Return a tuple containing all inferiors." },
 };
 
 #ifdef IS_PY3K
-static struct PyModuleDef GdbModuleDef =
+struct PyModuleDef python_GdbModuleDef =
 {
   PyModuleDef_HEAD_INIT,
   "_gdb",
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (32 preceding siblings ...)
  2015-02-09 23:51 ` [PATCH 14/36] Do not do arithmetic on enum types Pedro Alves
@ 2015-02-09 23:53 ` Pedro Alves
  2015-02-09 23:35   ` Pedro Alves
  2015-02-27 16:23   ` Pedro Alves
  2015-02-09 23:54 ` [PATCH 10/36] Add extern "C" to declarations of C symbols Pedro Alves
                   ` (6 subsequent siblings)
  40 siblings, 2 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: GCC Patches

Converting GDB to be a C++ program, I stumbled on 'basename' issues,
like:

 src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’
 /usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’

which I believe led to this bit in gold's configure.ac:

 dnl We have to check these in C, not C++, because autoconf generates
 dnl tests which have no type information, and current glibc provides
 dnl multiple declarations of functions like basename when compiling
 dnl with C++.
 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])

These checks IIUC intend to generate all the HAVE_DECL_FOO symbols
that libiberty.h and ansidecl.h check.

GDB is missing these checks currently, which results in the conflict
shown above.

I could just copy gold's bits over to GDB.  But, since libiberty's
ansidecl.h and libiberty.h check HAVE_DECL_XXX symbols, ISTM that all
programs that use these headers should be doing the exact same
corresponding AC_CHECK_DECLS autoconf checks, and that there's good
potential for bit rot here.

So I thought of adding a m4 file that projects that use libiberty can
source to pull in the autoconf checks that libiberty needs done in
order to use its public headers.

Turns out that this has already happened.  Since I first wrote this a
few months back, libiberty gained more HAVE_DECL_FOO checks even, for
the strtol & friends replacements.

Are the libiberty changes OK?

libiberty/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* libiberty.m4: New file.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* acinclude.m4: Include libiberty.m4.
	* config.in, configure: Regenerate.
	* configure.ac: Call libiberty_INIT.

gdb/gdbserver/
2015-02-09  Pedro Alves  <palves@redhat.com>

	* acinclude.m4: Include libiberty.m4.
	* config.in, configure: Regenerate.
	* configure.ac: Call libiberty_INIT.
---
 gdb/acinclude.m4           |   3 +
 gdb/config.in              |  45 ++++++
 gdb/configure              | 266 +++++++++++++++++++++++++++--------
 gdb/configure.ac           |   2 +
 gdb/gdbserver/acinclude.m4 |   3 +
 gdb/gdbserver/config.in    |  41 ++++++
 gdb/gdbserver/configure    | 338 +++++++++++++++++++++++++++++++++++++++++++++
 gdb/gdbserver/configure.ac |   2 +
 libiberty/libiberty.m4     |  33 +++++
 9 files changed, 679 insertions(+), 54 deletions(-)
 create mode 100644 libiberty/libiberty.m4

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 6f71486..ff4aff0 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -54,6 +54,9 @@ sinclude([../config/zlib.m4])
 
 m4_include([common/common.m4])
 
+dnl For libiberty_INIT.
+m4_include(../libiberty/libiberty.m4)
+
 ## ----------------------------------------- ##
 ## ANSIfy the C compiler whenever possible.  ##
 ## From Franc,ois Pinard                     ##
diff --git a/gdb/config.in b/gdb/config.in
index 806cbac..6a8df15 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -85,6 +85,17 @@
    you don't. */
 #undef HAVE_DECL_ADDR_NO_RANDOMIZE
 
+/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_ASPRINTF
+
+/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BASENAME
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
+
 /* Define to 1 if you have the declaration of `free', and to 0 if you don't.
    */
 #undef HAVE_DECL_FREE
@@ -117,6 +128,34 @@
    */
 #undef HAVE_DECL_STRSTR
 
+/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRTOL
+
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOLL
+
+/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOUL
+
+/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOULL
+
+/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRVERSCMP
+
+/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VASPRINTF
+
+/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VSNPRINTF
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
@@ -225,6 +264,9 @@
 /* Define to 1 if the compiler supports long double. */
 #undef HAVE_LONG_DOUBLE
 
+/* Define if you have the `long long' type. */
+#undef HAVE_LONG_LONG
+
 /* Define if <sys/procfs.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
@@ -635,6 +677,9 @@
 /* The size of `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
 /* The size of `unsigned long', as computed by sizeof. */
 #undef SIZEOF_UNSIGNED_LONG
 
diff --git a/gdb/configure b/gdb/configure
index 9632f9a..05e355c 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -2184,6 +2184,60 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+
 # ac_fn_c_check_decl LINENO SYMBOL VAR
 # ------------------------------------
 # Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
@@ -2285,60 +2339,6 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_member
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=no"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof ($2))
-	 return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
-	    return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-
-} # ac_fn_c_check_type
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -9584,6 +9584,164 @@ done
 # Checks for declarations.  #
 # ------------------------- #
 
+
+  # Check for presence of long long.
+  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = x""yes; then :
+
+$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+fi
+
+
+  ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
+if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
+if test "x$ac_cv_have_decl_ffs" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FFS $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_asprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ASPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vasprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VASPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_snprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SNPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VSNPRINTF $ac_have_decl
+_ACEOF
+
+  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtol" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoul" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOUL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoll" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOLL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoull" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOULL $ac_have_decl
+_ACEOF
+
+  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strverscmp" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRVERSCMP $ac_have_decl
+_ACEOF
+
+
+
 ac_fn_c_check_decl "$LINENO" "free" "ac_cv_have_decl_free" "$ac_includes_default"
 if test "x$ac_cv_have_decl_free" = x""yes; then :
   ac_have_decl=1
diff --git a/gdb/configure.ac b/gdb/configure.ac
index dfc6947..920e580 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1283,6 +1283,8 @@ AC_CHECK_HEADERS(term.h, [], [],
 # Checks for declarations.  #
 # ------------------------- #
 
+libiberty_INIT
+
 AC_CHECK_DECLS([free, malloc, realloc, snprintf])
 AM_LC_MESSAGES
 
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index 744871a..ba4a21f 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -20,6 +20,9 @@ dnl anything else in gdbserver.
 m4_include(../../config/codeset.m4)
 m4_include(../common/common.m4)
 
+dnl For libiberty_INIT.
+m4_include(../../libiberty/libiberty.m4)
+
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
 
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 8f68ed2..cf8e59d 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -22,10 +22,25 @@
    you don't. */
 #undef HAVE_DECL_ADDR_NO_RANDOMIZE
 
+/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_ASPRINTF
+
+/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BASENAME
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
+
 /* Define to 1 if you have the declaration of `perror', and to 0 if you don't.
    */
 #undef HAVE_DECL_PERROR
 
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_SNPRINTF
+
 /* Define to 1 if you have the declaration of `strerror', and to 0 if you
    don't. */
 #undef HAVE_DECL_STRERROR
@@ -34,6 +49,26 @@
    */
 #undef HAVE_DECL_STRSTR
 
+/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRTOL
+
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOLL
+
+/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOUL
+
+/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOULL
+
+/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRVERSCMP
+
 /* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_VASPRINTF
@@ -96,6 +131,9 @@
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
+/* Define if you have the `long long' type. */
+#undef HAVE_LONG_LONG
+
 /* Define if <thread_db.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
@@ -253,6 +291,9 @@
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at runtime.
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 2240b78..5623746 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1882,6 +1882,184 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_compute_int
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -5338,6 +5516,166 @@ done
 
 LIBS="$old_LIBS"
 
+
+
+  # Check for presense of long long
+  ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = x""yes; then :
+
+$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+fi
+
+
+  ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default"
+if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BASENAME $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "$ac_includes_default"
+if test "x$ac_cv_have_decl_ffs" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FFS $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_asprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ASPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vasprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VASPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_snprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SNPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VSNPRINTF $ac_have_decl
+_ACEOF
+
+  ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtol" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strtoul" "ac_cv_have_decl_strtoul" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoul" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOUL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoll" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOLL $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoull" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOULL $ac_have_decl
+_ACEOF
+
+  ac_fn_c_check_decl "$LINENO" "strverscmp" "ac_cv_have_decl_strverscmp" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strverscmp" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRVERSCMP $ac_have_decl
+_ACEOF
+
+
+
+
 ac_fn_c_check_decl "$LINENO" "strerror" "ac_cv_have_decl_strerror" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strerror" = x""yes; then :
   ac_have_decl=1
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index f883adc..60636f7 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -193,6 +193,8 @@ LIBS="$LIBS -ldl"
 AC_CHECK_FUNCS(dladdr)
 LIBS="$old_LIBS"
 
+libiberty_INIT
+
 AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
 
 AC_CHECK_TYPES(socklen_t, [], [],
diff --git a/libiberty/libiberty.m4 b/libiberty/libiberty.m4
new file mode 100644
index 0000000..6d9fd05
--- /dev/null
+++ b/libiberty/libiberty.m4
@@ -0,0 +1,33 @@
+dnl Bits libiberty clients must do on their autoconf step.
+dnl
+dnl   Copyright (C) 2012-2015 Free Software Foundation, Inc.
+dnl
+dnl This file 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; see the file COPYING3.  If not see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+dnl Checks for declarations ansidecl.h and libiberty.h themselves
+dnl check with HAVE_DECL_XXX, etc.
+
+AC_DEFUN([libiberty_INIT],
+[
+  # Check for presence of long long.
+  AC_CHECK_TYPE([long long],
+    [AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the `long long' type.]) AC_CHECK_SIZEOF([long long])],
+    [])
+
+  AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
+  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
+  AC_CHECK_DECLS([strverscmp])
+])
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (34 preceding siblings ...)
  2015-02-09 23:54 ` [PATCH 10/36] Add extern "C" to declarations of C symbols Pedro Alves
@ 2015-02-09 23:54 ` Pedro Alves
  2015-02-10  0:21 ` [PATCH 24/36] breakpoint.h: move enum ‘print_stop_action’ Pedro Alves
                   ` (4 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:54 UTC (permalink / raw)
  To: gdb-patches

From: Tom Tromey <tromey@redhat.com>

More preparation for running the TRY_CATCH->TRY/CATCH conversion
script.

gdb/ChangeLog:
2014-05-12  Tom Tromey  <tromey@redhat.com>

	* top.c (quit_force): Inline and delete DO_TRY, DO_PRINT_EX.
---
 gdb/top.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/gdb/top.c b/gdb/top.c
index 55c6896..699a399 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1481,47 +1481,43 @@ quit_force (char *args, int from_tty)
   qt.args = args;
   qt.from_tty = from_tty;
 
-  /* Wrappers to make the code below a bit more readable.  */
-#define DO_TRY \
-  TRY_CATCH (ex, RETURN_MASK_ALL)
-
-#define DO_PRINT_EX \
-  if (ex.reason < 0) \
-    exception_print (gdb_stderr, ex)
-
   /* We want to handle any quit errors and exit regardless.  */
 
   /* Get out of tfind mode, and kill or detach all inferiors.  */
-  DO_TRY
+  TRY_CATCH (ex, RETURN_MASK_ALL)
     {
       disconnect_tracing ();
       iterate_over_inferiors (kill_or_detach, &qt);
     }
-  DO_PRINT_EX;
+  if (ex.reason < 0)
+    exception_print (gdb_stderr, ex);
 
   /* Give all pushed targets a chance to do minimal cleanup, and pop
      them all out.  */
-  DO_TRY
+  TRY_CATCH (ex, RETURN_MASK_ALL)
     {
       pop_all_targets ();
     }
-  DO_PRINT_EX;
+  if (ex.reason < 0)
+    exception_print (gdb_stderr, ex);
 
   /* Save the history information if it is appropriate to do so.  */
-  DO_TRY
+  TRY_CATCH (ex, RETURN_MASK_ALL)
     {
       if (write_history_p && history_filename
 	  && input_from_terminal_p ())
 	gdb_safe_append_history ();
     }
-  DO_PRINT_EX;
+  if (ex.reason < 0)
+    exception_print (gdb_stderr, ex);
 
   /* Do any final cleanups before exiting.  */
-  DO_TRY
+  TRY_CATCH (ex, RETURN_MASK_ALL)
     {
       do_final_cleanups (all_cleanups ());
     }
-  DO_PRINT_EX;
+  if (ex.reason < 0)
+    exception_print (gdb_stderr, ex);
 
   exit (exit_code);
 }
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 10/36] Add extern "C" to declarations of C symbols
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (33 preceding siblings ...)
  2015-02-09 23:53 ` [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it Pedro Alves
@ 2015-02-09 23:54 ` Pedro Alves
  2015-02-11 11:51   ` Pedro Alves
  2015-02-09 23:54 ` [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros Pedro Alves
                   ` (5 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-09 23:54 UTC (permalink / raw)
  To: gdb-patches

These symbols are defined in C code, so in C++ mode we need to use
extern "C" to declare them.  As extern "C" can't be used inside a
function's scope, we move the declarations to the global scope at the
same time.

As for the linux-tdep.c change: elf-bfd.h wraps itself in extern "C"
already, while elf/common.h does not.  Since elf/common.h is already
included by "elf-bfd.h", simply remove the explicit elf/common.h
include.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* cli-out.c (_rl_erase_entire_line): Move declaration out of
	cli_mld_erase_entire_line, and make it extern "C".
	* common/common-defs.h (EXTERN_C): New.
	* completer.c (_rl_completion_prefix_display_length)
	(_rl_print_completions_horizontally, QSFUNC): Move declarations
	out of gdb_display_match_list_1.
	(_rl_qsort_string_compare): Move declaration out of
	gdb_display_match_list_1, and make it extern "C".
	* defs.h (re_comp): Use EXTERN_C.
	* linux-tdep.c: Don't include elf/common.h.
	* maint.c (_mcleanup): Move declaration out of mcleanup_wrapper,
	and make it extern "C".
	(monstartup): Move declaration out of maintenance_set_profile_cmd,
	and make it extern "C".
	(main): Move declaration out of maintenance_set_profile_cmd.
	* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string): Use
	EXTERN_C.
---
 gdb/cli-out.c            |  4 ++--
 gdb/common/common-defs.h |  6 ++++++
 gdb/completer.c          | 10 ++++++----
 gdb/defs.h               |  2 +-
 gdb/linux-tdep.c         |  1 -
 gdb/maint.c              | 10 +++++-----
 gdb/nat/linux-ptrace.c   |  2 +-
 7 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 48f2a04..2a83169 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -452,13 +452,13 @@ cli_mld_flush (const struct match_list_displayer *displayer)
   fflush (rl_outstream);
 }
 
+EXTERN_C void _rl_erase_entire_line (void);
+
 /* CLI version of displayer.erase_entire_line.  */
 
 static void
 cli_mld_erase_entire_line (const struct match_list_displayer *displayer)
 {
-  extern void _rl_erase_entire_line (void);
-
   _rl_erase_entire_line ();
 }
 
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index e80d332..3020bd8 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -50,4 +50,10 @@
 #include "cleanups.h"
 #include "common-exceptions.h"
 
+#ifdef __cplusplus
+# define EXTERN_C extern "C"
+#else
+# define EXTERN_C extern
+#endif
+
 #endif /* COMMON_DEFS_H */
diff --git a/gdb/completer.c b/gdb/completer.c
index bfd2788..774fb31 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1555,6 +1555,12 @@ gdb_complete_get_screenwidth (const struct match_list_displayer *displayer)
   return displayer->width;
 }
 
+extern int _rl_completion_prefix_display_length;
+extern int _rl_print_completions_horizontally;
+
+EXTERN_C int _rl_qsort_string_compare (const void *, const void *);
+typedef int QSFUNC (const void *, const void *);
+
 /* GDB version of readline/complete.c:rl_display_match_list.
    See gdb_display_match_list for a description of MATCHES, LEN, MAX.
    Returns non-zero if all matches are displayed.  */
@@ -1567,10 +1573,6 @@ gdb_display_match_list_1 (char **matches, int len, int max,
   int i, j, k, l, common_length, sind;
   char *temp, *t;
   int page_completions = displayer->height != INT_MAX && pagination_enabled;
-  extern int _rl_completion_prefix_display_length;
-  extern int _rl_qsort_string_compare (const void *, const void *);
-  extern int _rl_print_completions_horizontally;
-  typedef int QSFUNC (const void *, const void *);
 
   /* Find the length of the prefix common to all items: length as displayed
      characters (common_length) and as a byte index into the matches (sind) */
diff --git a/gdb/defs.h b/gdb/defs.h
index a1cd45f..72512f6 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -249,7 +249,7 @@ extern int annotation_level;	/* in stack.c */
    "const char *" in unistd.h, so we can't declare the argument
    as "char *".  */
 
-extern char *re_comp (const char *);
+EXTERN_C char *re_comp (const char *);
 
 /* From symfile.c */
 
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index d9884f3..64684d0 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -26,7 +26,6 @@
 #include "gdbcore.h"
 #include "regcache.h"
 #include "regset.h"
-#include "elf/common.h"
 #include "elf-bfd.h"            /* for elfcore_write_* */
 #include "inferior.h"
 #include "cli/cli-utils.h"
diff --git a/gdb/maint.c b/gdb/maint.c
index be18a32..1adea2f 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -683,15 +683,18 @@ extern char etext;
 
 static int profiling_state;
 
+EXTERN_C void _mcleanup (void);
+
 static void
 mcleanup_wrapper (void)
 {
-  extern void _mcleanup (void);
-
   if (profiling_state)
     _mcleanup ();
 }
 
+EXTERN_C void monstartup (unsigned long, unsigned long);
+extern int main ();
+
 static void
 maintenance_set_profile_cmd (char *args, int from_tty,
 			     struct cmd_list_element *c)
@@ -705,9 +708,6 @@ maintenance_set_profile_cmd (char *args, int from_tty,
     {
       static int profiling_initialized;
 
-      extern void monstartup (unsigned long, unsigned long);
-      extern int main();
-
       if (!profiling_initialized)
 	{
 	  atexit (mcleanup_wrapper);
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 0ce258f..e36864c 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -84,7 +84,7 @@ linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err)
 #if defined __i386__ || defined __x86_64__
 
 /* Address of the 'ret' instruction in asm code block below.  */
-extern void (linux_ptrace_test_ret_to_nx_instr) (void);
+EXTERN_C void linux_ptrace_test_ret_to_nx_instr (void);
 
 #include <sys/reg.h>
 #include <sys/mman.h>
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 24/36] breakpoint.h: move enum ‘print_stop_action’
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (35 preceding siblings ...)
  2015-02-09 23:54 ` [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros Pedro Alves
@ 2015-02-10  0:21 ` Pedro Alves
  2015-02-11 12:28   ` Yao Qi
  2015-02-10 15:07 ` [PATCH 00/36] Support building GDB as a C++ program Michael Eager
                   ` (3 subsequent siblings)
  40 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-10  0:21 UTC (permalink / raw)
  To: gdb-patches

Building GDB in C++, we get:

  src/gdb/breakpoint.h:529:8: error: use of enum ‘print_stop_action’ without previous declaration

We can forward declare enums in C++.

gdb/ChangeLog:
2015-02-09  Pedro Alves  <palves@redhat.com>

	* breakpoint.h (enum print_stop_action): Move further up in the
	file.
---
 gdb/breakpoint.h | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 100d4f2..ad91102 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -471,6 +471,26 @@ struct bp_location
   struct symtab *symtab;
 };
 
+/* The possible return values for print_bpstat, print_it_normal,
+   print_it_done, print_it_noop.  */
+enum print_stop_action
+{
+  /* We printed nothing or we need to do some more analysis.  */
+  PRINT_UNKNOWN = -1,
+
+  /* We printed something, and we *do* desire that something to be
+     followed by a location.  */
+  PRINT_SRC_AND_LOC,
+
+  /* We printed something, and we do *not* desire that something to be
+     followed by a location.  */
+  PRINT_SRC_ONLY,
+
+  /* We already printed all we needed to print, don't print anything
+     else.  */
+  PRINT_NOTHING
+};
+
 /* This structure is a collection of function pointers that, if available,
    will be called instead of the performing the default action for this
    bptype.  */
@@ -966,26 +986,6 @@ struct bpstat_what
     int is_longjmp;
   };
 
-/* The possible return values for print_bpstat, print_it_normal,
-   print_it_done, print_it_noop.  */
-enum print_stop_action
-  {
-    /* We printed nothing or we need to do some more analysis.  */
-    PRINT_UNKNOWN = -1,
-
-    /* We printed something, and we *do* desire that something to be
-       followed by a location.  */
-    PRINT_SRC_AND_LOC,
-
-    /* We printed something, and we do *not* desire that something to
-       be followed by a location.  */
-    PRINT_SRC_ONLY,
-
-    /* We already printed all we needed to print, don't print anything
-       else.  */
-    PRINT_NOTHING
-  };
-
 /* Tell what to do about this bpstat.  */
 struct bpstat_what bpstat_what (bpstat);
 \f
-- 
1.9.3

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH v2] Wrap BFD headers in extern "C"
  2015-02-09 23:33   ` Andrew Pinski
@ 2015-02-10 12:05     ` Pedro Alves
  2015-02-11  0:36       ` Alan Modra
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-10 12:05 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gdb-patches, Binutils Development

On 02/09/2015 11:33 PM, Andrew Pinski wrote:

>> --- a/bfd/elf-bfd.h
>> +++ b/bfd/elf-bfd.h
>> @@ -22,6 +22,10 @@
>>  #ifndef _LIBELF_H_
>>  #define _LIBELF_H_ 1
>>
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>>  #include "elf/common.h"
>>  #include "elf/external.h"
>>  #include "elf/internal.h"
> 
> This is bad form to wrap header files also.

Thanks.  I admit I was a bit lazy here.

Here's a better patch.  The posted version of the GDB
series didn't link with --enable-targets=all yet (more extern "C"
issues), but with this one, along with a similar opcodes patch,
it will.

OK to apply?

---------------
From: Pedro Alves <palves@redhat.com>
Subject: [PATCH] Wrap BFD headers in extern "C"

These were the BFD changes needed for building a C++ GDB with
--enable-targets=all, on x86_64 Fedora 20.

For libbfd.h and libcoff.h, this does same as already done when
generating bfd.h: open extern "C" in the -in.h header, and close it
from the Makefile.

bfd/doc/ChangeLog:
2015-02-10  Pedro Alves  <palves@redhat.com>

	* Makefile.am (libbfd.h, libcoff.h): Close extern "C" scope.
	* Makefile.in: Regenerate.

bfd/ChangeLog:
2015-02-10  Pedro Alves  <palves@redhat.com>

	* libbfd-in.h [__cplusplus]: Open extern "C" scope.
	* libcoff-in.h [__cplusplus]: Open extern "C" scope.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.

	* elf-bfd.h [__cplusplus]: Wrap in extern "C".
	* mach-o.h [__cplusplus]: Wrap in extern "C".
	* som.h [__cplusplus]: Wrap in extern "C".
---
 bfd/doc/Makefile.am | 6 ++++++
 bfd/doc/Makefile.in | 6 ++++++
 bfd/elf-bfd.h       | 7 +++++++
 bfd/libbfd-in.h     | 4 ++++
 bfd/libbfd.h        | 7 +++++++
 bfd/libcoff-in.h    | 4 ++++
 bfd/libcoff.h       | 7 +++++++
 bfd/mach-o.h        | 8 ++++++++
 bfd/som.h           | 7 +++++++
 9 files changed, 56 insertions(+)

diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index 779f361..52da14e 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -275,6 +275,9 @@ libbfd.h: $(LIBBFD_H_DEP)
 		./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
 	  esac; \
 	done
+	echo "#ifdef __cplusplus" >> $@
+	echo "}" >> $@
+	echo "#endif" >> $@
 
 LIBCOFF_H_DEP = \
 	$(srcdir)/../libcoff-in.h	\
@@ -294,6 +297,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
 		./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
 	  esac; \
 	done
+	echo "#ifdef __cplusplus" >> $@
+	echo "}" >> $@
+	echo "#endif" >> $@
 
 BFD_H_DEP = \
 	$(srcdir)/../bfd-in.h 		\
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 78d8ec0..72099f1 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -960,6 +960,9 @@ libbfd.h: $(LIBBFD_H_DEP)
 		./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
 	  esac; \
 	done
+	echo "#ifdef __cplusplus" >> $@
+	echo "}" >> $@
+	echo "#endif" >> $@
 
 libcoff.h: $(LIBCOFF_H_DEP)
 	echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
@@ -972,6 +975,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
 		./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
 	  esac; \
 	done
+	echo "#ifdef __cplusplus" >> $@
+	echo "}" >> $@
+	echo "#endif" >> $@
 
 bfd.h: $(BFD_H_DEP)
 	echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 49ffe79..495053d 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -27,6 +27,10 @@
 #include "elf/internal.h"
 #include "bfdlink.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The number of entries in a section is its size divided by the size
    of a single entry.  This is normally only applicable to reloc and
    symbol table sections.
@@ -2540,4 +2544,7 @@ extern asection _bfd_elf_large_com_section;
     (!(H)->unique_global \
      && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)))
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _LIBELF_H_ */
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index cb7805f..7c661e3 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -24,6 +24,10 @@
 
 #include "hashtab.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Align an address upward to a boundary, expressed as a number of bytes.
    E.g. align to an 8-byte boundary with argument of 8.  Take care never
    to wrap around if the address is within boundary-1 of the end of the
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index a1c0a01..bd56afb 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -29,6 +29,10 @@
 
 #include "hashtab.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Align an address upward to a boundary, expressed as a number of bytes.
    E.g. align to an 8-byte boundary with argument of 8.  Take care never
    to wrap around if the address is within boundary-1 of the end of the
@@ -3015,3 +3019,6 @@ void *bfd_arch_default_fill (bfd_size_type count,
     bfd_boolean code);
 
 /* Extracted from elf.c.  */
+#ifdef __cplusplus
+}
+#endif
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 6d00db0..34e71a8 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -22,6 +22,10 @@
 #include "bfdlink.h"
 #include "coff-bfd.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Object file tdata; access macros.  */
 
 #define coff_data(bfd)		      ((bfd)->tdata.coff_obj_data)
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index df0e00f..ee72de3 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -26,6 +26,10 @@
 #include "bfdlink.h"
 #include "coff-bfd.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Object file tdata; access macros.  */
 
 #define coff_data(bfd)		      ((bfd)->tdata.coff_obj_data)
@@ -951,3 +955,6 @@ typedef struct
    PE object file.  */
 #define bfd_pei_p(abfd) \
   (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
+#ifdef __cplusplus
+}
+#endif
diff --git a/bfd/mach-o.h b/bfd/mach-o.h
index bc694ba..0445398 100644
--- a/bfd/mach-o.h
+++ b/bfd/mach-o.h
@@ -24,6 +24,10 @@
 #include "bfd.h"
 #include "mach-o/loader.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct bfd_mach_o_header
 {
   unsigned long magic;
@@ -746,4 +750,8 @@ bfd_mach_o_backend_data;
 #define SYM_MACHO_FIELDS_UNSET ((bfd_vma) -1)
 #define SYM_MACHO_FIELDS_NOT_VALIDATED ((bfd_vma) -2)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _BFD_MACH_O_H_ */
diff --git a/bfd/som.h b/bfd/som.h
index a300104..7f8a5ba 100644
--- a/bfd/som.h
+++ b/bfd/som.h
@@ -40,6 +40,10 @@
 #include <dl.h>
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #if defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
 /* BSD uses a completely different scheme for object file identification.
    so for now, define _PA_RISC_ID to accept any random value for a model
@@ -235,4 +239,7 @@ int **       hppa_som_gen_reloc_type           (bfd *, int, int, enum hppa_reloc
 bfd_boolean  bfd_som_attach_compilation_unit   (bfd *, const char *, const char *, const char *, const char *);
 asection *   bfd_section_from_som_symbol       (bfd *abfd, struct som_external_symbol_dictionary_record *symbol);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _SOM_H */
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
  2015-02-09 23:21 ` [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict Pedro Alves
@ 2015-02-10 15:05   ` Michael Eager
  2015-02-10 18:11     ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Michael Eager @ 2015-02-10 15:05 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 02/09/15 15:20, Pedro Alves wrote:
> Building GDB as a C++ program, we see:
>
>    In file included from gdb/microblaze-tdep.c:37:0:
>    gdb/../opcodes/../opcodes/microblaze-opcm.h: At global scope:
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected identifier before ‘or’ token
>       ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
> 						     ^
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected ‘}’ before ‘or’ token
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected unqualified-id before ‘or’ token
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:60:1: error: expected declaration before ‘}’ token
>     };
>     ^
>
> opcodes/ChangeLog:
> 2015-10-20  Pedro Alves  <palves@redhat.com>
> 	    Tom Tromey  <tromey@redhat.com>
>
> 	* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
> 	microblaze_and, microblaze_xor.
> 	* microblaze-opc.h (struct op_code_struct): Adjust.

OK.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (36 preceding siblings ...)
  2015-02-10  0:21 ` [PATCH 24/36] breakpoint.h: move enum ‘print_stop_action’ Pedro Alves
@ 2015-02-10 15:07 ` Michael Eager
  2015-02-11 17:15 ` Yao Qi
                   ` (2 subsequent siblings)
  40 siblings, 0 replies; 100+ messages in thread
From: Michael Eager @ 2015-02-10 15:07 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 02/09/15 15:20, Pedro Alves wrote:
> I'm glad to announce that the global maintainers have reached
> consensus on converting GDB to use C++ as implementation language.
>
> See the project page here: https://sourceware.org/gdb/wiki/cxx-conversion

Outstanding!


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
  2015-02-10 15:05   ` Michael Eager
@ 2015-02-10 18:11     ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-10 18:11 UTC (permalink / raw)
  To: Michael Eager, gdb-patches

On 02/10/2015 03:05 PM, Michael Eager wrote:

>> opcodes/ChangeLog:
>> 2015-10-20  Pedro Alves  <palves@redhat.com>
>> 	    Tom Tromey  <tromey@redhat.com>
>>
>> 	* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
>> 	microblaze_and, microblaze_xor.
>> 	* microblaze-opc.h (struct op_code_struct): Adjust.
> 
> OK.
> 

Thanks, pushed.

Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 02/36] Add --enable-build-with-cxx configure switch
  2015-02-09 23:20 ` [PATCH 02/36] Add --enable-build-with-cxx configure switch Pedro Alves
@ 2015-02-10 22:11   ` Yao Qi
  2015-02-27 13:24     ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Yao Qi @ 2015-02-10 22:11 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 02/09/2015 11:20 PM, Pedro Alves wrote:
> so that the compiler carries on compiling the file.  -Werror still
> catches the warnings, so nothing is lost, only our lifes are made
> easier by concentrating on getting other other more important things
> out of the way first.

Yes, I agree on this.

> @@ -172,11 +186,17 @@ then
>      for w in ${build_warnings}; do
>  	case $w in
>  	-Werr*) WERROR_CFLAGS=-Werror ;;
> -	*) # Check that GCC accepts it
> +	*)
> +	    # Check whether GCC accepts it.  Append -Werror to CFLAGS

s/CFLAGS/CXXFLAGS/ ?  Since you want to catch cc1plus warnings, so
option should be append CXXFLAGS.

> +	    # so that configure can catch warnings like:
> +	    #  cc1plus: warning: command line option '-Wpointer-sign' is valid for C/ObjC but not for C++ [enabled by default]
>  	    saved_CFLAGS="$CFLAGS"
> -	    CFLAGS="$CFLAGS $w"
> +	    CFLAGS="$CFLAGS -Werror $w"
> +	    saved_CXXFLAGS="$CXXFLAGS"
> +	    CXXFLAGS="$CXXFLAGS -Werror $w"
>  	    AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
>  	    CFLAGS="$saved_CFLAGS"
> +	    CXXFLAGS="$saved_CXXFLAGS"
>  	esac
>      done
>      AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})

-- 
Yao

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH v2] Wrap BFD headers in extern "C"
  2015-02-10 12:05     ` [PATCH v2] Wrap BFD headers " Pedro Alves
@ 2015-02-11  0:36       ` Alan Modra
  2015-02-11 10:08         ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Alan Modra @ 2015-02-11  0:36 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Andrew Pinski, gdb-patches, Binutils Development

On Tue, Feb 10, 2015 at 12:05:03PM +0000, Pedro Alves wrote:
> bfd/doc/ChangeLog:
> 2015-02-10  Pedro Alves  <palves@redhat.com>
> 
> 	* Makefile.am (libbfd.h, libcoff.h): Close extern "C" scope.
> 	* Makefile.in: Regenerate.
> 
> bfd/ChangeLog:
> 2015-02-10  Pedro Alves  <palves@redhat.com>
> 
> 	* libbfd-in.h [__cplusplus]: Open extern "C" scope.
> 	* libcoff-in.h [__cplusplus]: Open extern "C" scope.
> 	* libbfd.h: Regenerate.
> 	* libcoff.h: Regenerate.
> 
> 	* elf-bfd.h [__cplusplus]: Wrap in extern "C".
> 	* mach-o.h [__cplusplus]: Wrap in extern "C".
> 	* som.h [__cplusplus]: Wrap in extern "C".

Looks fine to me.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-09 23:21 ` [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated Pedro Alves
@ 2015-02-11  7:57   ` Joel Brobecker
  2015-02-11  8:52     ` Phil Muldoon
  2015-02-11 10:27     ` Pedro Alves
  0 siblings, 2 replies; 100+ messages in thread
From: Joel Brobecker @ 2015-02-11  7:57 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Mon, Feb 09, 2015 at 11:20:13PM +0000, Pedro Alves wrote:
> This patch renames symbols that happen to have names which are
> reserved keywords in C++.
> 
> Most of this was generated with Tromey's cxx-conversion.el script.
> Some places where later hand massaged a bit, to fix formatting, etc.
> And this was rebased several times meanwhile, along with re-running
> the script, so re-running the script from scratch probably does not
> result in the exact same output.  I don't think that matters anyway.
> 
> gdb/
> 2015-02-09  Tom Tromey  <tromey@redhat.com>
> 	    Pedro Alves  <palves@redhat.com>
> 
> 	Rename symbols whose names are reserved C++ keywords throughout.

*if* this is reasonably easy to do, can we rename "namespace" into
"domain" instead of "the_namespace"? "namespace" comes from our old
terminology, I think, and we've been using "enum_domain" since, so
if we're going to have to change the variable/parameter names also,
might as well use "domain" instead?

-- 
Joel

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-11  7:57   ` Joel Brobecker
@ 2015-02-11  8:52     ` Phil Muldoon
  2015-02-11 10:27     ` Pedro Alves
  1 sibling, 0 replies; 100+ messages in thread
From: Phil Muldoon @ 2015-02-11  8:52 UTC (permalink / raw)
  To: Joel Brobecker, Pedro Alves; +Cc: gdb-patches

On 11/02/15 07:57, Joel Brobecker wrote:
> On Mon, Feb 09, 2015 at 11:20:13PM +0000, Pedro Alves wrote:
>> This patch renames symbols that happen to have names which are
>> reserved keywords in C++.
>>
>> Most of this was generated with Tromey's cxx-conversion.el script.
>> Some places where later hand massaged a bit, to fix formatting, etc.
>> And this was rebased several times meanwhile, along with re-running
>> the script, so re-running the script from scratch probably does not
>> result in the exact same output.  I don't think that matters anyway.
>>
>> gdb/
>> 2015-02-09  Tom Tromey  <tromey@redhat.com>
>>         Pedro Alves  <palves@redhat.com>
>>
>>     Rename symbols whose names are reserved C++ keywords throughout.
>
> *if* this is reasonably easy to do, can we rename "namespace" into
> "domain" instead of "the_namespace"? "namespace" comes from our old
> terminology, I think, and we've been using "enum_domain" since, so
> if we're going to have to change the variable/parameter names also,
> might as well use "domain" instead?

I agree, I think this would be a good idea. "domain" makes more
sense. Same caveats apply as Joel stated; I'll happily accept
"the_namespace" if "domain" delays the patch-set overly.

Cheers

Phil


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH v2] Wrap BFD headers in extern "C"
  2015-02-11  0:36       ` Alan Modra
@ 2015-02-11 10:08         ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-11 10:08 UTC (permalink / raw)
  To: Andrew Pinski, gdb-patches, Binutils Development

On 02/11/2015 12:36 AM, Alan Modra wrote:
> On Tue, Feb 10, 2015 at 12:05:03PM +0000, Pedro Alves wrote:
>> bfd/doc/ChangeLog:
>> 2015-02-10  Pedro Alves  <palves@redhat.com>
>>
>> 	* Makefile.am (libbfd.h, libcoff.h): Close extern "C" scope.
>> 	* Makefile.in: Regenerate.
>>
>> bfd/ChangeLog:
>> 2015-02-10  Pedro Alves  <palves@redhat.com>
>>
>> 	* libbfd-in.h [__cplusplus]: Open extern "C" scope.
>> 	* libcoff-in.h [__cplusplus]: Open extern "C" scope.
>> 	* libbfd.h: Regenerate.
>> 	* libcoff.h: Regenerate.
>>
>> 	* elf-bfd.h [__cplusplus]: Wrap in extern "C".
>> 	* mach-o.h [__cplusplus]: Wrap in extern "C".
>> 	* som.h [__cplusplus]: Wrap in extern "C".
> 
> Looks fine to me.

Thanks, pushed.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/36] Fix redefinition errors in C++ mode
  2015-02-09 23:21 ` [PATCH 05/36] Fix redefinition errors in C++ mode Pedro Alves
@ 2015-02-11 10:09   ` Yao Qi
  2015-02-11 11:30     ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Yao Qi @ 2015-02-11 10:09 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On 09/02/15 23:20, Pedro Alves wrote:

> The intent of static here is naturally to avoid making these objects
> visible outside the compilation unit.  The equivalent in C++ would be
> to instead define the objects in the anonymous namespace.  But given
> that it's desirable to leave the codebase compiling as both C and C++
> for a while, this just makes the objects extern.

It is a little pity to do so, but I don't know any other better way.
The patch looks good to me.

> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 2804453..006acef 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -299,7 +299,7 @@ static int strace_marker_p (struct breakpoint *b);
>
>   /* The abstract base class all breakpoint_ops structures inherit
>      from.  */
> -struct breakpoint_ops base_breakpoint_ops;
> +extern struct breakpoint_ops base_breakpoint_ops;
>

looks base_breakpoint_ops has been declared in breakpoint.h, so we can
just remove it here.

--
Yao

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-11  7:57   ` Joel Brobecker
  2015-02-11  8:52     ` Phil Muldoon
@ 2015-02-11 10:27     ` Pedro Alves
  2015-02-11 10:51       ` Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-11 10:27 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 02/11/2015 07:57 AM, Joel Brobecker wrote:
> On Mon, Feb 09, 2015 at 11:20:13PM +0000, Pedro Alves wrote:
>> This patch renames symbols that happen to have names which are
>> reserved keywords in C++.
>>
>> Most of this was generated with Tromey's cxx-conversion.el script.
>> Some places where later hand massaged a bit, to fix formatting, etc.
>> And this was rebased several times meanwhile, along with re-running
>> the script, so re-running the script from scratch probably does not
>> result in the exact same output.  I don't think that matters anyway.
>>
>> gdb/
>> 2015-02-09  Tom Tromey  <tromey@redhat.com>
>> 	    Pedro Alves  <palves@redhat.com>
>>
>> 	Rename symbols whose names are reserved C++ keywords throughout.
> 
> *if* this is reasonably easy to do, can we rename "namespace" into
> "domain" instead of "the_namespace"? "namespace" comes from our old
> terminology, I think, and we've been using "enum_domain" since, so
> if we're going to have to change the variable/parameter names also,
> might as well use "domain" instead?
> 

Agreed.  Even in the common/filestuff.* stuff it makes sense to use
"domain" instead, as socketpair's and socket's man pages call the
first argument "domain".

Below's the patch that I plan on folding in.  Builds in C and C++ modes.
Regtesting in progress.

"git grep the_namespace" now shows:

block.h:      struct block_namespace_info *the_namespace;
block.h:#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.the_namespace
cp-namespace.c:cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
cp-namespace.c:  if (the_namespace[0] != '\0')
cp-namespace.c:      concatenated_name = alloca (strlen (the_namespace) + 2
cp-namespace.c:      strcpy (concatenated_name, the_namespace);
cp-namespace.c:    = the_namespace[0] != '\0' && cp_is_in_anonymous (the_namespace);
cp-namespace.c:  char *the_namespace;
cp-namespace.c:  the_namespace = alloca (scope_len + 1);
cp-namespace.c:  strncpy (the_namespace, scope, scope_len);
cp-namespace.c:  the_namespace[scope_len] = '\0';
cp-namespace.c:  return cp_lookup_symbol_in_namespace (the_namespace, name,
cp-support.c:                                        const char *the_namespace);
cp-support.c:                      const char *the_namespace)
cp-support.c:  make_symbol_overload_list_using (func_name, the_namespace);
cp-support.c:  if (the_namespace[0] == '\0')
cp-support.c:   = alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
cp-support.c:      strcpy (concatenated_name, the_namespace);
cp-support.c:                                     const char *the_namespace)
cp-support.c:  if (the_namespace[0] == '\0')
cp-support.c:   = alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
cp-support.c:      strcpy (concatenated_name, the_namespace);
cp-support.c:  char *the_namespace;
cp-support.c:      the_namespace = alloca (prefix_len + 1);
cp-support.c:      strncpy (the_namespace, type_name, prefix_len);
cp-support.c:      the_namespace[prefix_len] = '\0';
cp-support.c:      make_symbol_overload_list_namespace (func_name, the_namespace);
cp-support.c:                            const char *the_namespace)
cp-support.c:        if (strcmp (the_namespace, current->import_dest) == 0)
cp-support.c:  make_symbol_overload_list_namespace (func_name, the_namespace);
cp-support.h:extern struct symbol *cp_lookup_symbol_namespace (const char *the_namespace,


These are C++ specific bits that are referring to C++ namespaces, and not
using enum_domain, so I thought we didn't want to call those "domain".  I
left them as "the_namespace", but I can rename them to whatever people
prefer.

---
From 097d44b66b2aea4ad5f15796f2d33db4cbbb58bc Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Wed, 11 Feb 2015 10:09:29 +0000
Subject: [PATCH] the_namespace -> domain

---
 gdb/ada-lang.c         | 46 +++++++++++++++++++++++-----------------------
 gdb/ada-lang.h         |  2 +-
 gdb/common/filestuff.c |  8 ++++----
 gdb/common/filestuff.h |  4 ++--
 gdb/dwarf2read.c       |  2 +-
 gdb/psymtab.c          | 12 ++++++------
 gdb/symfile-debug.c    |  6 +++---
 gdb/symfile.h          |  4 ++--
 8 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b9887ec..f15864e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -274,7 +274,7 @@ struct cache_entry
   /* The name used to perform the lookup.  */
   const char *name;
   /* The namespace used during the lookup.  */
-  domain_enum the_namespace;
+  domain_enum domain;
   /* The symbol returned by the lookup, or NULL if no matching symbol
      was found.  */
   struct symbol *sym;
@@ -4426,11 +4426,11 @@ ada_clear_symbol_cache (void)
   ada_init_symbol_cache (sym_cache);
 }
 
-/* Search our cache for an entry matching NAME and NAMESPACE.
+/* Search our cache for an entry matching NAME and DOMAIN.
    Return it if found, or NULL otherwise.  */
 
 static struct cache_entry **
-find_entry (const char *name, domain_enum the_namespace)
+find_entry (const char *name, domain_enum domain)
 {
   struct ada_symbol_cache *sym_cache
     = ada_get_symbol_cache (current_program_space);
@@ -4439,23 +4439,23 @@ find_entry (const char *name, domain_enum the_namespace)
 
   for (e = &sym_cache->root[h]; *e != NULL; e = &(*e)->next)
     {
-      if (the_namespace == (*e)->the_namespace && strcmp (name, (*e)->name) == 0)
+      if (domain == (*e)->domain && strcmp (name, (*e)->name) == 0)
         return e;
     }
   return NULL;
 }
 
-/* Search the symbol cache for an entry matching NAME and NAMESPACE.
+/* Search the symbol cache for an entry matching NAME and DOMAIN.
    Return 1 if found, 0 otherwise.
 
    If an entry was found and SYM is not NULL, set *SYM to the entry's
    SYM.  Same principle for BLOCK if not NULL.  */
 
 static int
-lookup_cached_symbol (const char *name, domain_enum the_namespace,
+lookup_cached_symbol (const char *name, domain_enum domain,
                       struct symbol **sym, const struct block **block)
 {
-  struct cache_entry **e = find_entry (name, the_namespace);
+  struct cache_entry **e = find_entry (name, domain);
 
   if (e == NULL)
     return 0;
@@ -4467,10 +4467,10 @@ lookup_cached_symbol (const char *name, domain_enum the_namespace,
 }
 
 /* Assuming that (SYM, BLOCK) is the result of the lookup of NAME
-   in domain NAMESPACE, save this result in our symbol cache.  */
+   in domain DOMAIN, save this result in our symbol cache.  */
 
 static void
-cache_symbol (const char *name, domain_enum the_namespace, struct symbol *sym,
+cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
               const struct block *block)
 {
   struct ada_symbol_cache *sym_cache
@@ -4503,7 +4503,7 @@ cache_symbol (const char *name, domain_enum the_namespace, struct symbol *sym,
   e->name = copy = obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
   strcpy (copy, name);
   e->sym = sym;
-  e->the_namespace = the_namespace;
+  e->domain = domain;
   e->block = block;
 }
 \f
@@ -4725,7 +4725,7 @@ ada_lookup_simple_minsym (const char *name)
 
 static void
 add_symbols_from_enclosing_procs (struct obstack *obstackp,
-                                  const char *name, domain_enum the_namespace,
+                                  const char *name, domain_enum domain,
                                   int wild_match_p)
 {
 }
@@ -5404,7 +5404,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
 
 static int
 ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
-			       domain_enum the_namespace,
+			       domain_enum domain,
 			       struct ada_symbol_info **results,
 			       int full_search)
 {
@@ -5443,7 +5443,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
       if (full_search)
 	{
 	  ada_add_local_symbols (&symbol_list_obstack, name, block,
-				 the_namespace, wild_match_p);
+				 domain, wild_match_p);
 	}
       else
 	{
@@ -5451,7 +5451,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 	     ada_iterate_over_symbols, and we don't want to search
 	     superblocks.  */
 	  ada_add_block_symbols (&symbol_list_obstack, block, name,
-				 the_namespace, NULL, wild_match_p);
+				 domain, NULL, wild_match_p);
 	}
       if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search)
 	goto done;
@@ -5461,7 +5461,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
      already performed this search before.  If we have, then return
      the same result.  */
 
-  if (lookup_cached_symbol (name0, the_namespace, &sym, &block))
+  if (lookup_cached_symbol (name0, domain, &sym, &block))
     {
       if (sym != NULL)
         add_defn_to_vec (&symbol_list_obstack, sym, block);
@@ -5472,14 +5472,14 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 
   /* Search symbols from all global blocks.  */
  
-  add_nonlocal_symbols (&symbol_list_obstack, name, the_namespace, 1,
+  add_nonlocal_symbols (&symbol_list_obstack, name, domain, 1,
 			wild_match_p);
 
   /* Now add symbols from all per-file blocks if we've gotten no hits
      (not strictly correct, but perhaps better than an error).  */
 
   if (num_defns_collected (&symbol_list_obstack) == 0)
-    add_nonlocal_symbols (&symbol_list_obstack, name, the_namespace, 0,
+    add_nonlocal_symbols (&symbol_list_obstack, name, domain, 0,
 			  wild_match_p);
 
 done:
@@ -5489,10 +5489,10 @@ done:
   ndefns = remove_extra_symbols (*results, ndefns);
 
   if (ndefns == 0 && full_search && syms_from_global_search)
-    cache_symbol (name0, the_namespace, NULL, NULL);
+    cache_symbol (name0, domain, NULL, NULL);
 
   if (ndefns == 1 && full_search && syms_from_global_search)
-    cache_symbol (name0, the_namespace, (*results)[0].sym, (*results)[0].block);
+    cache_symbol (name0, domain, (*results)[0].sym, (*results)[0].block);
 
   ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
 
@@ -5564,7 +5564,7 @@ ada_name_for_lookup (const char *name)
 
 void
 ada_lookup_encoded_symbol (const char *name, const struct block *block,
-			   domain_enum the_namespace,
+			   domain_enum domain,
 			   struct ada_symbol_info *info)
 {
   struct ada_symbol_info *candidates;
@@ -5573,7 +5573,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
   gdb_assert (info != NULL);
   memset (info, 0, sizeof (struct ada_symbol_info));
 
-  n_candidates = ada_lookup_symbol_list (name, block, the_namespace, &candidates);
+  n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates);
   if (n_candidates == 0)
     return;
 
@@ -5589,7 +5589,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
 
 struct symbol *
 ada_lookup_symbol (const char *name, const struct block *block0,
-                   domain_enum the_namespace, int *is_a_field_of_this)
+                   domain_enum domain, int *is_a_field_of_this)
 {
   struct ada_symbol_info info;
 
@@ -5597,7 +5597,7 @@ ada_lookup_symbol (const char *name, const struct block *block0,
     *is_a_field_of_this = 0;
 
   ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
-			     block0, the_namespace, &info);
+			     block0, domain, &info);
   return info.sym;
 }
 
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index d2fed3f..12761bf 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -244,7 +244,7 @@ extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
                                          domain_enum, int *);
 
 extern void ada_lookup_encoded_symbol
-  (const char *name, const struct block *block, domain_enum the_namespace,
+  (const char *name, const struct block *block, domain_enum domain,
    struct ada_symbol_info *symbol_info);
 
 extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index bfdcd8b..0257220 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -343,11 +343,11 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
 /* See filestuff.h.  */
 
 int
-gdb_socketpair_cloexec (int the_namespace, int style, int protocol,
+gdb_socketpair_cloexec (int domain, int style, int protocol,
 			int filedes[2])
 {
 #ifdef HAVE_SOCKETPAIR
-  int result = socketpair (the_namespace, style | SOCK_CLOEXEC,
+  int result = socketpair (domain, style | SOCK_CLOEXEC,
 			   protocol, filedes);
 
   if (result != -1)
@@ -365,9 +365,9 @@ gdb_socketpair_cloexec (int the_namespace, int style, int protocol,
 /* See filestuff.h.  */
 
 int
-gdb_socket_cloexec (int the_namespace, int style, int protocol)
+gdb_socket_cloexec (int domain, int style, int protocol)
 {
-  int result = socket (the_namespace, style | SOCK_CLOEXEC, protocol);
+  int result = socket (domain, style | SOCK_CLOEXEC, protocol);
 
   if (result != -1)
     socket_mark_cloexec (result);
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index 9be6376..98522a6 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -54,13 +54,13 @@ extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
 /* Like 'socketpair', but ensures that the returned file descriptors
    have the close-on-exec flag set.  */
 
-extern int gdb_socketpair_cloexec (int the_namespace, int style, int protocol,
+extern int gdb_socketpair_cloexec (int domain, int style, int protocol,
 				   int filedes[2]);
 
 /* Like 'socket', but ensures that the returned file descriptor has
    the close-on-exec flag set.  */
 
-extern int gdb_socket_cloexec (int the_namespace, int style, int protocol);
+extern int gdb_socket_cloexec (int domain, int style, int protocol);
 
 /* Like 'pipe', but ensures that the returned file descriptors have
    the close-on-exec flag set.  */
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index cd07466..01b7647 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3816,7 +3816,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 dw2_map_matching_symbols (struct objfile *objfile,
-			  const char * name, domain_enum the_namespace,
+			  const char * name, domain_enum domain,
 			  int global,
 			  int (*callback) (struct block *,
 					   struct symbol *, void *),
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 53740e8..b3c2f44 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1247,13 +1247,13 @@ psymtab_to_fullname (struct partial_symtab *ps)
   return ps->fullname;
 }
 
-/*  For all symbols, s, in BLOCK that are in NAMESPACE and match NAME
+/*  For all symbols, s, in BLOCK that are in DOMAIN and match NAME
     according to the function MATCH, call CALLBACK(BLOCK, s, DATA).
     BLOCK is assumed to come from OBJFILE.  Returns 1 iff CALLBACK
     ever returns non-zero, and otherwise returns 0.  */
 
 static int
-map_block (const char *name, domain_enum the_namespace, struct objfile *objfile,
+map_block (const char *name, domain_enum domain, struct objfile *objfile,
 	   struct block *block,
 	   int (*callback) (struct block *, struct symbol *, void *),
 	   void *data, symbol_compare_ftype *match)
@@ -1265,7 +1265,7 @@ map_block (const char *name, domain_enum the_namespace, struct objfile *objfile,
        sym != NULL; sym = block_iter_match_next (name, match, &iter))
     {
       if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), 
-				 SYMBOL_DOMAIN (sym), the_namespace))
+				 SYMBOL_DOMAIN (sym), domain))
 	{
 	  if (callback (block, sym, data))
 	    return 1;
@@ -1280,7 +1280,7 @@ map_block (const char *name, domain_enum the_namespace, struct objfile *objfile,
 
 static void
 psym_map_matching_symbols (struct objfile *objfile,
-			   const char *name, domain_enum the_namespace,
+			   const char *name, domain_enum domain,
 			   int global,
 			   int (*callback) (struct block *,
 					    struct symbol *, void *),
@@ -1295,7 +1295,7 @@ psym_map_matching_symbols (struct objfile *objfile,
     {
       QUIT;
       if (ps->readin
-	  || match_partial_symbol (objfile, ps, global, name, the_namespace, match,
+	  || match_partial_symbol (objfile, ps, global, name, domain, match,
 				   ordered_compare))
 	{
 	  struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
@@ -1304,7 +1304,7 @@ psym_map_matching_symbols (struct objfile *objfile,
 	  if (cust == NULL)
 	    continue;
 	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
-	  if (map_block (name, the_namespace, objfile, block,
+	  if (map_block (name, domain, objfile, block,
 			 callback, data, match))
 	    return;
 	  if (callback (block, NULL, data))
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 57b2d35..6a3351a 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -249,7 +249,7 @@ debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 debug_qf_map_matching_symbols (struct objfile *objfile,
-			       const char *name, domain_enum the_namespace,
+			       const char *name, domain_enum domain,
 			       int global,
 			       int (*callback) (struct block *,
 						struct symbol *, void *),
@@ -263,14 +263,14 @@ debug_qf_map_matching_symbols (struct objfile *objfile,
   fprintf_filtered (gdb_stdlog,
 		    "qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s, %s, %s)\n",
 		    objfile_debug_name (objfile), name,
-		    domain_name (the_namespace), global,
+		    domain_name (domain), global,
 		    host_address_to_string (callback),
 		    host_address_to_string (data),
 		    host_address_to_string (match),
 		    host_address_to_string (ordered_compare));
 
   debug_data->real_sf->qf->map_matching_symbols (objfile, name,
-						 the_namespace, global,
+						 domain, global,
 						 callback, data,
 						 match,
 						 ordered_compare);
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 2e5269b..7b66c62 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -240,7 +240,7 @@ struct quick_symbol_functions
   void (*expand_symtabs_with_fullname) (struct objfile *objfile,
 					const char *fullname);
 
-  /* Find global or static symbols in all tables that are in NAMESPACE 
+  /* Find global or static symbols in all tables that are in DOMAIN
      and for which MATCH (symbol name, NAME) == 0, passing each to 
      CALLBACK, reading in partial symbol tables as needed.  Look
      through global symbols if GLOBAL and otherwise static symbols.
@@ -258,7 +258,7 @@ struct quick_symbol_functions
      non-zero to indicate that the scan should be terminated.  */
 
   void (*map_matching_symbols) (struct objfile *,
-				const char *name, domain_enum the_namespace,
+				const char *name, domain_enum domain,
 				int global,
 				int (*callback) (struct block *,
 						 struct symbol *, void *),
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-11 10:27     ` Pedro Alves
@ 2015-02-11 10:51       ` Pedro Alves
  2015-02-12 12:19         ` Joel Brobecker
  2015-02-27 17:41         ` Pedro Alves
  0 siblings, 2 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-11 10:51 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 02/11/2015 10:27 AM, Pedro Alves wrote:

> Below's the patch that I plan on folding in.  Builds in C and C++ modes.
> Regtesting in progress.

Regtesting successful.  Here's the current version of the patch.

-----
Subject: [PATCH] C++ keyword cleanliness, mostly auto-generated

This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-11  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-11  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.
---
 gdb/ada-lang.c                    |  58 +++++++++---------
 gdb/ada-lang.h                    |   2 +-
 gdb/addrmap.c                     |  56 ++++++++---------
 gdb/aix-thread.c                  |  32 +++++-----
 gdb/amd64-tdep.c                  |  76 +++++++++++------------
 gdb/bcache.c                      |  14 ++---
 gdb/block.c                       |  10 +--
 gdb/block.h                       |   6 +-
 gdb/break-catch-throw.c           |  14 ++---
 gdb/buildsym.c                    |  18 +++---
 gdb/c-exp.y                       |  42 ++++++-------
 gdb/cli/cli-decode.c              | 110 ++++++++++++++++-----------------
 gdb/cli/cli-decode.h              |   2 +-
 gdb/cli/cli-script.c              |  10 +--
 gdb/cli/cli-setshow.c             |  20 +++---
 gdb/coffread.c                    |  38 ++++++------
 gdb/command.h                     |  24 ++++----
 gdb/common/cleanups.c             |  12 ++--
 gdb/common/filestuff.c            |  10 +--
 gdb/common/filestuff.h            |   4 +-
 gdb/continuations.c               |  12 ++--
 gdb/cp-name-parser.y              |  20 +++---
 gdb/cp-namespace.c                |  63 +++++++++----------
 gdb/cp-support.c                  |  48 +++++++--------
 gdb/cp-support.h                  |   2 +-
 gdb/cp-valprint.c                 |   4 +-
 gdb/d-exp.y                       |   8 +--
 gdb/darwin-nat-info.c             |  22 +++----
 gdb/darwin-nat.c                  | 124 +++++++++++++++++++-------------------
 gdb/dbxread.c                     |  41 +++++++------
 gdb/dwarf2read.c                  |  42 ++++++-------
 gdb/environ.c                     |   6 +-
 gdb/f-exp.y                       |  16 ++---
 gdb/frame.c                       |   6 +-
 gdb/gdbarch.c                     |  22 +++----
 gdb/gdbarch.sh                    |  22 +++----
 gdb/gdbserver/inferiors.h         |   2 +-
 gdb/gdbserver/linux-aarch64-low.c |   4 +-
 gdb/gdbserver/linux-arm-low.c     |  10 +--
 gdb/gdbserver/linux-low.c         |  20 +++---
 gdb/gdbserver/linux-mips-low.c    |  58 +++++++++---------
 gdb/gdbserver/linux-x86-low.c     |  10 +--
 gdb/gdbserver/lynx-low.c          |  12 ++--
 gdb/gdbserver/thread-db.c         |  42 ++++++-------
 gdb/gdbthread.h                   |   2 +-
 gdb/gdbtypes.c                    |  32 +++++-----
 gdb/gnu-v3-abi.c                  |  26 ++++----
 gdb/go-exp.y                      |   8 +--
 gdb/guile/guile-internal.h        |   6 +-
 gdb/guile/scm-symbol.c            |  22 +++----
 gdb/guile/scm-utils.c             |  12 ++--
 gdb/hppa-linux-tdep.c             |  14 ++---
 gdb/ia64-tdep.c                   |  30 ++++-----
 gdb/inf-ttrace.c                  |  32 +++++-----
 gdb/inferior.c                    |   2 +-
 gdb/inferior.h                    |   2 +-
 gdb/jit.c                         |  16 ++---
 gdb/jv-exp.y                      |  24 ++++----
 gdb/linux-thread-db.c             |  50 +++++++--------
 gdb/macrotab.c                    |  14 ++---
 gdb/mdebugread.c                  |  54 ++++++++---------
 gdb/memattr.c                     |  24 ++++----
 gdb/mi/mi-cmd-var.c               |  14 ++---
 gdb/minsyms.c                     |  20 +++---
 gdb/nat/x86-dregs.c               |   4 +-
 gdb/nto-procfs.c                  |  16 ++---
 gdb/nto-tdep.c                    |   6 +-
 gdb/objc-lang.c                   |  68 ++++++++++-----------
 gdb/p-exp.y                       |  10 +--
 gdb/p-valprint.c                  |   6 +-
 gdb/parse.c                       |  10 +--
 gdb/parser-defs.h                 |   2 +-
 gdb/printcmd.c                    |  24 ++++----
 gdb/psymtab.c                     |  24 ++++----
 gdb/python/py-symbol.c            |  22 +++----
 gdb/remote-mips.c                 |   4 +-
 gdb/remote.c                      |  18 +++---
 gdb/solib-darwin.c                |  20 +++---
 gdb/solib-ia64-hpux.c             |   6 +-
 gdb/solib-pa64.c                  |  28 ++++-----
 gdb/solib-som.c                   |  58 +++++++++---------
 gdb/solib-spu.c                   |  24 ++++----
 gdb/solib-svr4.c                  |  86 +++++++++++++-------------
 gdb/stabsread.c                   |  62 +++++++++----------
 gdb/symfile-debug.c               |   6 +-
 gdb/symfile.h                     |   4 +-
 gdb/symtab.c                      |  46 +++++++-------
 gdb/thread.c                      |  10 +--
 gdb/top.c                         |   2 +-
 gdb/tui/tui-windata.c             |   2 +-
 gdb/typeprint.c                   |  14 ++---
 gdb/ui-file.h                     |   2 +-
 gdb/valarith.c                    |   6 +-
 gdb/value.c                       |   8 +--
 gdb/varobj.c                      |  44 +++++++-------
 gdb/varobj.h                      |   4 +-
 gdb/xcoffread.c                   |  30 ++++-----
 97 files changed, 1129 insertions(+), 1125 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 562627a..b016723 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -274,7 +274,7 @@ struct cache_entry
   /* The name used to perform the lookup.  */
   const char *name;
   /* The namespace used during the lookup.  */
-  domain_enum namespace;
+  domain_enum domain;
   /* The symbol returned by the lookup, or NULL if no matching symbol
      was found.  */
   struct symbol *sym;
@@ -4426,11 +4426,11 @@ ada_clear_symbol_cache (void)
   ada_init_symbol_cache (sym_cache);
 }
 
-/* Search our cache for an entry matching NAME and NAMESPACE.
+/* Search our cache for an entry matching NAME and DOMAIN.
    Return it if found, or NULL otherwise.  */
 
 static struct cache_entry **
-find_entry (const char *name, domain_enum namespace)
+find_entry (const char *name, domain_enum domain)
 {
   struct ada_symbol_cache *sym_cache
     = ada_get_symbol_cache (current_program_space);
@@ -4439,23 +4439,23 @@ find_entry (const char *name, domain_enum namespace)
 
   for (e = &sym_cache->root[h]; *e != NULL; e = &(*e)->next)
     {
-      if (namespace == (*e)->namespace && strcmp (name, (*e)->name) == 0)
+      if (domain == (*e)->domain && strcmp (name, (*e)->name) == 0)
         return e;
     }
   return NULL;
 }
 
-/* Search the symbol cache for an entry matching NAME and NAMESPACE.
+/* Search the symbol cache for an entry matching NAME and DOMAIN.
    Return 1 if found, 0 otherwise.
 
    If an entry was found and SYM is not NULL, set *SYM to the entry's
    SYM.  Same principle for BLOCK if not NULL.  */
 
 static int
-lookup_cached_symbol (const char *name, domain_enum namespace,
+lookup_cached_symbol (const char *name, domain_enum domain,
                       struct symbol **sym, const struct block **block)
 {
-  struct cache_entry **e = find_entry (name, namespace);
+  struct cache_entry **e = find_entry (name, domain);
 
   if (e == NULL)
     return 0;
@@ -4467,10 +4467,10 @@ lookup_cached_symbol (const char *name, domain_enum namespace,
 }
 
 /* Assuming that (SYM, BLOCK) is the result of the lookup of NAME
-   in domain NAMESPACE, save this result in our symbol cache.  */
+   in domain DOMAIN, save this result in our symbol cache.  */
 
 static void
-cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
               const struct block *block)
 {
   struct ada_symbol_cache *sym_cache
@@ -4503,7 +4503,7 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
   e->name = copy = obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
   strcpy (copy, name);
   e->sym = sym;
-  e->namespace = namespace;
+  e->domain = domain;
   e->block = block;
 }
 \f
@@ -4725,7 +4725,7 @@ ada_lookup_simple_minsym (const char *name)
 
 static void
 add_symbols_from_enclosing_procs (struct obstack *obstackp,
-                                  const char *name, domain_enum namespace,
+                                  const char *name, domain_enum domain,
                                   int wild_match_p)
 {
 }
@@ -5404,7 +5404,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
 
 static int
 ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
-			       domain_enum namespace,
+			       domain_enum domain,
 			       struct ada_symbol_info **results,
 			       int full_search)
 {
@@ -5443,7 +5443,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
       if (full_search)
 	{
 	  ada_add_local_symbols (&symbol_list_obstack, name, block,
-				 namespace, wild_match_p);
+				 domain, wild_match_p);
 	}
       else
 	{
@@ -5451,7 +5451,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 	     ada_iterate_over_symbols, and we don't want to search
 	     superblocks.  */
 	  ada_add_block_symbols (&symbol_list_obstack, block, name,
-				 namespace, NULL, wild_match_p);
+				 domain, NULL, wild_match_p);
 	}
       if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search)
 	goto done;
@@ -5461,7 +5461,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
      already performed this search before.  If we have, then return
      the same result.  */
 
-  if (lookup_cached_symbol (name0, namespace, &sym, &block))
+  if (lookup_cached_symbol (name0, domain, &sym, &block))
     {
       if (sym != NULL)
         add_defn_to_vec (&symbol_list_obstack, sym, block);
@@ -5472,14 +5472,14 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 
   /* Search symbols from all global blocks.  */
  
-  add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1,
+  add_nonlocal_symbols (&symbol_list_obstack, name, domain, 1,
 			wild_match_p);
 
   /* Now add symbols from all per-file blocks if we've gotten no hits
      (not strictly correct, but perhaps better than an error).  */
 
   if (num_defns_collected (&symbol_list_obstack) == 0)
-    add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 0,
+    add_nonlocal_symbols (&symbol_list_obstack, name, domain, 0,
 			  wild_match_p);
 
 done:
@@ -5489,10 +5489,10 @@ done:
   ndefns = remove_extra_symbols (*results, ndefns);
 
   if (ndefns == 0 && full_search && syms_from_global_search)
-    cache_symbol (name0, namespace, NULL, NULL);
+    cache_symbol (name0, domain, NULL, NULL);
 
   if (ndefns == 1 && full_search && syms_from_global_search)
-    cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);
+    cache_symbol (name0, domain, (*results)[0].sym, (*results)[0].block);
 
   ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
 
@@ -5564,7 +5564,7 @@ ada_name_for_lookup (const char *name)
 
 void
 ada_lookup_encoded_symbol (const char *name, const struct block *block,
-			   domain_enum namespace,
+			   domain_enum domain,
 			   struct ada_symbol_info *info)
 {
   struct ada_symbol_info *candidates;
@@ -5573,7 +5573,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
   gdb_assert (info != NULL);
   memset (info, 0, sizeof (struct ada_symbol_info));
 
-  n_candidates = ada_lookup_symbol_list (name, block, namespace, &candidates);
+  n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates);
   if (n_candidates == 0)
     return;
 
@@ -5589,7 +5589,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
 
 struct symbol *
 ada_lookup_symbol (const char *name, const struct block *block0,
-                   domain_enum namespace, int *is_a_field_of_this)
+                   domain_enum domain, int *is_a_field_of_this)
 {
   struct ada_symbol_info info;
 
@@ -5597,7 +5597,7 @@ ada_lookup_symbol (const char *name, const struct block *block0,
     *is_a_field_of_this = 0;
 
   ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
-			     block0, namespace, &info);
+			     block0, domain, &info);
   return info.sym;
 }
 
@@ -7790,17 +7790,17 @@ struct type *
 ada_find_parallel_type (struct type *type, const char *suffix)
 {
   char *name;
-  const char *typename = ada_type_name (type);
+  const char *type_name = ada_type_name (type);
   int len;
 
-  if (typename == NULL)
+  if (type_name == NULL)
     return NULL;
 
-  len = strlen (typename);
+  len = strlen (type_name);
 
   name = (char *) alloca (len + strlen (suffix) + 1);
 
-  strcpy (name, typename);
+  strcpy (name, type_name);
   strcpy (name + len, suffix);
 
   return ada_find_parallel_type_with_name (type, name);
@@ -7863,9 +7863,9 @@ variant_field_index (struct type *type)
 /* A record type with no fields.  */
 
 static struct type *
-empty_record (struct type *template)
+empty_record (struct type *templ)
 {
-  struct type *type = alloc_type_copy (template);
+  struct type *type = alloc_type_copy (templ);
 
   TYPE_CODE (type) = TYPE_CODE_STRUCT;
   TYPE_NFIELDS (type) = 0;
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 29409e6..12761bf 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -244,7 +244,7 @@ extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
                                          domain_enum, int *);
 
 extern void ada_lookup_encoded_symbol
-  (const char *name, const struct block *block, domain_enum namespace,
+  (const char *name, const struct block *block, domain_enum domain,
    struct ada_symbol_info *symbol_info);
 
 extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 9bfcc96..4eb08cd 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -29,14 +29,14 @@
    implementation.  */
 struct addrmap_funcs
 {
-  void (*set_empty) (struct addrmap *this,
+  void (*set_empty) (struct addrmap *self,
                      CORE_ADDR start, CORE_ADDR end_inclusive,
                      void *obj);
-  void *(*find) (struct addrmap *this, CORE_ADDR addr);
-  struct addrmap *(*create_fixed) (struct addrmap *this,
+  void *(*find) (struct addrmap *self, CORE_ADDR addr);
+  struct addrmap *(*create_fixed) (struct addrmap *self,
                                    struct obstack *obstack);
-  void (*relocate) (struct addrmap *this, CORE_ADDR offset);
-  int (*foreach) (struct addrmap *this, addrmap_foreach_fn fn, void *data);
+  void (*relocate) (struct addrmap *self, CORE_ADDR offset);
+  int (*foreach) (struct addrmap *self, addrmap_foreach_fn fn, void *data);
 };
 
 
@@ -113,7 +113,7 @@ struct addrmap_fixed
 
 
 static void
-addrmap_fixed_set_empty (struct addrmap *this,
+addrmap_fixed_set_empty (struct addrmap *self,
                    CORE_ADDR start, CORE_ADDR end_inclusive,
                    void *obj)
 {
@@ -124,9 +124,9 @@ addrmap_fixed_set_empty (struct addrmap *this,
 
 
 static void *
-addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_fixed_find (struct addrmap *self, CORE_ADDR addr)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   struct addrmap_transition *bottom = &map->transitions[0];
   struct addrmap_transition *top = &map->transitions[map->num_transitions - 1];
 
@@ -157,7 +157,7 @@ addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
 
 
 static struct addrmap *
-addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_fixed_create_fixed (struct addrmap *self, struct obstack *obstack)
 {
   internal_error (__FILE__, __LINE__,
                   _("addrmap_create_fixed is not implemented yet "
@@ -166,9 +166,9 @@ addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
 
 
 static void
-addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_fixed_relocate (struct addrmap *self, CORE_ADDR offset)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   size_t i;
 
   for (i = 0; i < map->num_transitions; i++)
@@ -177,10 +177,10 @@ addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
 
 
 static int
-addrmap_fixed_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_fixed_foreach (struct addrmap *self, addrmap_foreach_fn fn,
 		       void *data)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   size_t i;
 
   for (i = 0; i < map->num_transitions; i++)
@@ -315,26 +315,26 @@ addrmap_splay_tree_insert (struct addrmap_mutable *map,
    tree node at ADDR, even if it would represent a "transition" from
    one value to the same value.  */
 static void
-force_transition (struct addrmap_mutable *this, CORE_ADDR addr)
+force_transition (struct addrmap_mutable *self, CORE_ADDR addr)
 {
   splay_tree_node n
-    = addrmap_splay_tree_lookup (this, addr);
+    = addrmap_splay_tree_lookup (self, addr);
 
   if (! n)
     {
-      n = addrmap_splay_tree_predecessor (this, addr);
-      addrmap_splay_tree_insert (this, addr,
+      n = addrmap_splay_tree_predecessor (self, addr);
+      addrmap_splay_tree_insert (self, addr,
                                  n ? addrmap_node_value (n) : NULL);
     }
 }
 
 
 static void
-addrmap_mutable_set_empty (struct addrmap *this,
+addrmap_mutable_set_empty (struct addrmap *self,
                            CORE_ADDR start, CORE_ADDR end_inclusive,
                            void *obj)
 {
-  struct addrmap_mutable *map = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *map = (struct addrmap_mutable *) self;
   splay_tree_node n, next;
   void *prior_value;
 
@@ -384,7 +384,7 @@ addrmap_mutable_set_empty (struct addrmap *this,
 
 
 static void *
-addrmap_mutable_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_mutable_find (struct addrmap *self, CORE_ADDR addr)
 {
   /* Not needed yet.  */
   internal_error (__FILE__, __LINE__,
@@ -422,15 +422,15 @@ splay_foreach_copy (splay_tree_node n, void *closure)
 
 
 static struct addrmap *
-addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
 {
-  struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
   struct addrmap_fixed *fixed;
   size_t num_transitions;
 
   /* Count the number of transitions in the tree.  */
   num_transitions = 0;
-  splay_tree_foreach (mutable->tree, splay_foreach_count, &num_transitions);
+  splay_tree_foreach (mutable_obj->tree, splay_foreach_count, &num_transitions);
 
   /* Include an extra entry for the transition at zero (which fixed
      maps have, but mutable maps do not.)  */
@@ -447,7 +447,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
 
   /* Copy all entries from the splay tree to the array, in order 
      of increasing address.  */
-  splay_tree_foreach (mutable->tree, splay_foreach_copy, fixed);
+  splay_tree_foreach (mutable_obj->tree, splay_foreach_copy, fixed);
 
   /* We should have filled the array.  */
   gdb_assert (fixed->num_transitions == num_transitions);
@@ -457,7 +457,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
 
 
 static void
-addrmap_mutable_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_mutable_relocate (struct addrmap *self, CORE_ADDR offset)
 {
   /* Not needed yet.  */
   internal_error (__FILE__, __LINE__,
@@ -488,15 +488,15 @@ addrmap_mutable_foreach_worker (splay_tree_node node, void *data)
 
 
 static int
-addrmap_mutable_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_mutable_foreach (struct addrmap *self, addrmap_foreach_fn fn,
 			 void *data)
 {
-  struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
   struct mutable_foreach_data foreach_data;
 
   foreach_data.fn = fn;
   foreach_data.data = data;
-  return splay_tree_foreach (mutable->tree, addrmap_mutable_foreach_worker,
+  return splay_tree_foreach (mutable_obj->tree, addrmap_mutable_foreach_worker,
 			     &foreach_data);
 }
 
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c187ea0..b03716b 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -757,9 +757,9 @@ sync_threadlists (void)
       else if (gi == gcount)
 	{
 	  thread = add_thread (ptid_build (infpid, 0, pbuf[pi].pthid));
-	  thread->private = xmalloc (sizeof (struct private_thread_info));
-	  thread->private->pdtid = pbuf[pi].pdtid;
-	  thread->private->tid = pbuf[pi].tid;
+	  thread->priv = xmalloc (sizeof (struct private_thread_info));
+	  thread->priv->pdtid = pbuf[pi].pdtid;
+	  thread->priv->tid = pbuf[pi].tid;
 	  pi++;
 	}
       else
@@ -776,8 +776,8 @@ sync_threadlists (void)
 
 	  if (cmp_result == 0)
 	    {
-	      gbuf[gi]->private->pdtid = pdtid;
-	      gbuf[gi]->private->tid = tid;
+	      gbuf[gi]->priv->pdtid = pdtid;
+	      gbuf[gi]->priv->tid = tid;
 	      pi++;
 	      gi++;
 	    }
@@ -789,9 +789,9 @@ sync_threadlists (void)
 	  else
 	    {
 	      thread = add_thread (pptid);
-	      thread->private = xmalloc (sizeof (struct private_thread_info));
-	      thread->private->pdtid = pdtid;
-	      thread->private->tid = tid;
+	      thread->priv = xmalloc (sizeof (struct private_thread_info));
+	      thread->priv->pdtid = pdtid;
+	      thread->priv->tid = tid;
 	      pi++;
 	    }
 	}
@@ -809,7 +809,7 @@ iter_tid (struct thread_info *thread, void *tidp)
 {
   const pthdb_tid_t tid = *(pthdb_tid_t *)tidp;
 
-  return (thread->private->tid == tid);
+  return (thread->priv->tid == tid);
 }
 
 /* Synchronize libpthdebug's state with the inferior and with GDB,
@@ -999,7 +999,7 @@ aix_thread_resume (struct target_ops *ops,
 	error (_("aix-thread resume: unknown pthread %ld"),
 	       ptid_get_lwp (ptid));
 
-      tid[0] = thread->private->tid;
+      tid[0] = thread->priv->tid;
       if (tid[0] == PTHDB_INVALID_TID)
 	error (_("aix-thread resume: no tid for pthread %ld"),
 	       ptid_get_lwp (ptid));
@@ -1313,10 +1313,10 @@ aix_thread_fetch_registers (struct target_ops *ops,
   else
     {
       thread = find_thread_ptid (inferior_ptid);
-      tid = thread->private->tid;
+      tid = thread->priv->tid;
 
       if (tid == PTHDB_INVALID_TID)
-	fetch_regs_user_thread (regcache, thread->private->pdtid);
+	fetch_regs_user_thread (regcache, thread->priv->pdtid);
       else
 	fetch_regs_kernel_thread (regcache, regno, tid);
     }
@@ -1667,10 +1667,10 @@ aix_thread_store_registers (struct target_ops *ops,
   else
     {
       thread = find_thread_ptid (inferior_ptid);
-      tid = thread->private->tid;
+      tid = thread->priv->tid;
 
       if (tid == PTHDB_INVALID_TID)
-	store_regs_user_thread (regcache, thread->private->pdtid);
+	store_regs_user_thread (regcache, thread->priv->pdtid);
       else
 	store_regs_kernel_thread (regcache, regno, tid);
     }
@@ -1764,8 +1764,8 @@ aix_thread_extra_thread_info (struct target_ops *self,
 
   buf = mem_fileopen ();
 
-  pdtid = thread->private->pdtid;
-  tid = thread->private->tid;
+  pdtid = thread->priv->pdtid;
+  tid = thread->priv->tid;
 
   if (tid != PTHDB_INVALID_TID)
     /* i18n: Like "thread-identifier %d, [state] running, suspended" */
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index a661b88..e9de0f6 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -508,7 +508,7 @@ amd64_merge_classes (enum amd64_reg_class class1, enum amd64_reg_class class2)
   return AMD64_SSE;
 }
 
-static void amd64_classify (struct type *type, enum amd64_reg_class class[2]);
+static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]);
 
 /* Return non-zero if TYPE is a non-POD structure or union type.  */
 
@@ -527,19 +527,19 @@ amd64_non_pod_p (struct type *type)
    arrays) and union types, and store the result in CLASS.  */
 
 static void
-amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
+amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
 {
   /* 1. If the size of an object is larger than two eightbytes, or in
         C++, is a non-POD structure or union type, or contains
         unaligned fields, it has class memory.  */
   if (TYPE_LENGTH (type) > 16 || amd64_non_pod_p (type))
     {
-      class[0] = class[1] = AMD64_MEMORY;
+      theclass[0] = theclass[1] = AMD64_MEMORY;
       return;
     }
 
   /* 2. Both eightbytes get initialized to class NO_CLASS.  */
-  class[0] = class[1] = AMD64_NO_CLASS;
+  theclass[0] = theclass[1] = AMD64_NO_CLASS;
 
   /* 3. Each field of an object is classified recursively so that
         always two fields are considered. The resulting class is
@@ -551,9 +551,9 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
       struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type));
 
       /* All fields in an array have the same type.  */
-      amd64_classify (subtype, class);
-      if (TYPE_LENGTH (type) > 8 && class[1] == AMD64_NO_CLASS)
-	class[1] = class[0];
+      amd64_classify (subtype, theclass);
+      if (TYPE_LENGTH (type) > 8 && theclass[1] == AMD64_NO_CLASS)
+	theclass[1] = theclass[0];
     }
   else
     {
@@ -582,7 +582,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 	  gdb_assert (pos == 0 || pos == 1);
 
 	  amd64_classify (subtype, subclass);
-	  class[pos] = amd64_merge_classes (class[pos], subclass[0]);
+	  theclass[pos] = amd64_merge_classes (theclass[pos], subclass[0]);
 	  if (bitsize <= 64 && pos == 0 && endpos == 1)
 	    /* This is a bit of an odd case:  We have a field that would
 	       normally fit in one of the two eightbytes, except that
@@ -606,9 +606,9 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 	       use up all 16 bytes of the aggregate, and are already
 	       handled just fine (because each portion sits on its own
 	       8-byte).  */
-	    class[1] = amd64_merge_classes (class[1], subclass[0]);
+	    theclass[1] = amd64_merge_classes (theclass[1], subclass[0]);
 	  if (pos == 0)
-	    class[1] = amd64_merge_classes (class[1], subclass[1]);
+	    theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
 	}
     }
 
@@ -616,26 +616,26 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 
   /* Rule (a): If one of the classes is MEMORY, the whole argument is
      passed in memory.  */
-  if (class[0] == AMD64_MEMORY || class[1] == AMD64_MEMORY)
-    class[0] = class[1] = AMD64_MEMORY;
+  if (theclass[0] == AMD64_MEMORY || theclass[1] == AMD64_MEMORY)
+    theclass[0] = theclass[1] = AMD64_MEMORY;
 
   /* Rule (b): If SSEUP is not preceded by SSE, it is converted to
      SSE.  */
-  if (class[0] == AMD64_SSEUP)
-    class[0] = AMD64_SSE;
-  if (class[1] == AMD64_SSEUP && class[0] != AMD64_SSE)
-    class[1] = AMD64_SSE;
+  if (theclass[0] == AMD64_SSEUP)
+    theclass[0] = AMD64_SSE;
+  if (theclass[1] == AMD64_SSEUP && theclass[0] != AMD64_SSE)
+    theclass[1] = AMD64_SSE;
 }
 
 /* Classify TYPE, and store the result in CLASS.  */
 
 static void
-amd64_classify (struct type *type, enum amd64_reg_class class[2])
+amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
 {
   enum type_code code = TYPE_CODE (type);
   int len = TYPE_LENGTH (type);
 
-  class[0] = class[1] = AMD64_NO_CLASS;
+  theclass[0] = theclass[1] = AMD64_NO_CLASS;
 
   /* Arguments of types (signed and unsigned) _Bool, char, short, int,
      long, long long, and pointers are in the INTEGER class.  Similarly,
@@ -646,28 +646,28 @@ amd64_classify (struct type *type, enum amd64_reg_class class[2])
        || code == TYPE_CODE_CHAR
        || code == TYPE_CODE_PTR || code == TYPE_CODE_REF)
       && (len == 1 || len == 2 || len == 4 || len == 8))
-    class[0] = AMD64_INTEGER;
+    theclass[0] = AMD64_INTEGER;
 
   /* Arguments of types float, double, _Decimal32, _Decimal64 and __m64
      are in class SSE.  */
   else if ((code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
 	   && (len == 4 || len == 8))
     /* FIXME: __m64 .  */
-    class[0] = AMD64_SSE;
+    theclass[0] = AMD64_SSE;
 
   /* Arguments of types __float128, _Decimal128 and __m128 are split into
      two halves.  The least significant ones belong to class SSE, the most
      significant one to class SSEUP.  */
   else if (code == TYPE_CODE_DECFLOAT && len == 16)
     /* FIXME: __float128, __m128.  */
-    class[0] = AMD64_SSE, class[1] = AMD64_SSEUP;
+    theclass[0] = AMD64_SSE, theclass[1] = AMD64_SSEUP;
 
   /* The 64-bit mantissa of arguments of type long double belongs to
      class X87, the 16-bit exponent plus 6 bytes of padding belongs to
      class X87UP.  */
   else if (code == TYPE_CODE_FLT && len == 16)
     /* Class X87 and X87UP.  */
-    class[0] = AMD64_X87, class[1] = AMD64_X87UP;
+    theclass[0] = AMD64_X87, theclass[1] = AMD64_X87UP;
 
   /* Arguments of complex T where T is one of the types float or
      double get treated as if they are implemented as:
@@ -679,19 +679,19 @@ amd64_classify (struct type *type, enum amd64_reg_class class[2])
 
   */
   else if (code == TYPE_CODE_COMPLEX && len == 8)
-    class[0] = AMD64_SSE;
+    theclass[0] = AMD64_SSE;
   else if (code == TYPE_CODE_COMPLEX && len == 16)
-    class[0] = class[1] = AMD64_SSE;
+    theclass[0] = theclass[1] = AMD64_SSE;
 
   /* A variable of type complex long double is classified as type
      COMPLEX_X87.  */
   else if (code == TYPE_CODE_COMPLEX && len == 32)
-    class[0] = AMD64_COMPLEX_X87;
+    theclass[0] = AMD64_COMPLEX_X87;
 
   /* Aggregates.  */
   else if (code == TYPE_CODE_ARRAY || code == TYPE_CODE_STRUCT
 	   || code == TYPE_CODE_UNION)
-    amd64_classify_aggregate (type, class);
+    amd64_classify_aggregate (type, theclass);
 }
 
 static enum return_value_convention
@@ -699,7 +699,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 		    struct type *type, struct regcache *regcache,
 		    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
-  enum amd64_reg_class class[2];
+  enum amd64_reg_class theclass[2];
   int len = TYPE_LENGTH (type);
   static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM };
   static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM };
@@ -710,7 +710,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
   gdb_assert (!(readbuf && writebuf));
 
   /* 1. Classify the return type with the classification algorithm.  */
-  amd64_classify (type, class);
+  amd64_classify (type, theclass);
 
   /* 2. If the type has class MEMORY, then the caller provides space
      for the return value and passes the address of this storage in
@@ -719,7 +719,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 
      On return %rax will contain the address that has been passed in
      by the caller in %rdi.  */
-  if (class[0] == AMD64_MEMORY)
+  if (theclass[0] == AMD64_MEMORY)
     {
       /* As indicated by the comment above, the ABI guarantees that we
          can always find the return value just after the function has
@@ -738,7 +738,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 
   /* 8. If the class is COMPLEX_X87, the real part of the value is
         returned in %st0 and the imaginary part in %st1.  */
-  if (class[0] == AMD64_COMPLEX_X87)
+  if (theclass[0] == AMD64_COMPLEX_X87)
     {
       if (readbuf)
 	{
@@ -760,7 +760,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
 
-  gdb_assert (class[1] != AMD64_MEMORY);
+  gdb_assert (theclass[1] != AMD64_MEMORY);
   gdb_assert (len <= 16);
 
   for (i = 0; len > 0; i++, len -= 8)
@@ -768,7 +768,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
       int regnum = -1;
       int offset = 0;
 
-      switch (class[i])
+      switch (theclass[i])
 	{
 	case AMD64_INTEGER:
 	  /* 3. If the class is INTEGER, the next available register
@@ -801,7 +801,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 	case AMD64_X87UP:
 	  /* 7. If the class is X87UP, the value is returned together
              with the previous X87 value in %st0.  */
-	  gdb_assert (i > 0 && class[0] == AMD64_X87);
+	  gdb_assert (i > 0 && theclass[0] == AMD64_X87);
 	  regnum = AMD64_ST0_REGNUM;
 	  offset = 8;
 	  len = 2;
@@ -865,21 +865,21 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
     {
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
-      enum amd64_reg_class class[2];
+      enum amd64_reg_class theclass[2];
       int needed_integer_regs = 0;
       int needed_sse_regs = 0;
       int j;
 
       /* Classify argument.  */
-      amd64_classify (type, class);
+      amd64_classify (type, theclass);
 
       /* Calculate the number of integer and SSE registers needed for
          this argument.  */
       for (j = 0; j < 2; j++)
 	{
-	  if (class[j] == AMD64_INTEGER)
+	  if (theclass[j] == AMD64_INTEGER)
 	    needed_integer_regs++;
-	  else if (class[j] == AMD64_SSE)
+	  else if (theclass[j] == AMD64_SSE)
 	    needed_sse_regs++;
 	}
 
@@ -906,7 +906,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
 	      int regnum = -1;
 	      int offset = 0;
 
-	      switch (class[j])
+	      switch (theclass[j])
 		{
 		case AMD64_INTEGER:
 		  regnum = integer_regnum[integer_reg++];
diff --git a/gdb/bcache.c b/gdb/bcache.c
index 78c6d5d..f3abc12 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -264,14 +264,14 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
 
   /* The user's string isn't in the list.  Insert it after *ps.  */
   {
-    struct bstring *new
+    struct bstring *newobj
       = obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
 
-    memcpy (&new->d.data, addr, length);
-    new->length = length;
-    new->next = bcache->bucket[hash_index];
-    new->half_hash = half_hash;
-    bcache->bucket[hash_index] = new;
+    memcpy (&newobj->d.data, addr, length);
+    newobj->length = length;
+    newobj->next = bcache->bucket[hash_index];
+    newobj->half_hash = half_hash;
+    bcache->bucket[hash_index] = newobj;
 
     bcache->unique_count++;
     bcache->unique_size += length;
@@ -280,7 +280,7 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
     if (added)
       *added = 1;
 
-    return &new->d.data;
+    return &newobj->d.data;
   }
 }
 \f
diff --git a/gdb/block.c b/gdb/block.c
index 4175672..00a7012 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -34,7 +34,7 @@
 struct block_namespace_info
 {
   const char *scope;
-  struct using_direct *using;
+  struct using_direct *using_decl;
 };
 
 static void block_initialize_namespace (struct block *block,
@@ -326,7 +326,7 @@ block_using (const struct block *block)
   if (block == NULL || BLOCK_NAMESPACE (block) == NULL)
     return NULL;
   else
-    return BLOCK_NAMESPACE (block)->using;
+    return BLOCK_NAMESPACE (block)->using_decl;
 }
 
 /* Set BLOCK's using member to USING; if needed, allocate memory via
@@ -335,12 +335,12 @@ block_using (const struct block *block)
 
 void
 block_set_using (struct block *block,
-		 struct using_direct *using,
+		 struct using_direct *using_decl,
 		 struct obstack *obstack)
 {
   block_initialize_namespace (block, obstack);
 
-  BLOCK_NAMESPACE (block)->using = using;
+  BLOCK_NAMESPACE (block)->using_decl = using_decl;
 }
 
 /* If BLOCK_NAMESPACE (block) is NULL, allocate it via OBSTACK and
@@ -354,7 +354,7 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
       BLOCK_NAMESPACE (block)
 	= obstack_alloc (obstack, sizeof (struct block_namespace_info));
       BLOCK_NAMESPACE (block)->scope = NULL;
-      BLOCK_NAMESPACE (block)->using = NULL;
+      BLOCK_NAMESPACE (block)->using_decl = NULL;
     }
 }
 
diff --git a/gdb/block.h b/gdb/block.h
index e45f445..bdc5888 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -92,7 +92,7 @@ struct block
 	 this block: using directives and the current namespace
 	 scope.  */
       
-      struct block_namespace_info *namespace;
+      struct block_namespace_info *the_namespace;
     }
     cplus_specific;
   }
@@ -118,7 +118,7 @@ struct global_block
 #define BLOCK_FUNCTION(bl)	(bl)->function
 #define BLOCK_SUPERBLOCK(bl)	(bl)->superblock
 #define BLOCK_DICT(bl)		(bl)->dict
-#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.namespace
+#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.the_namespace
 
 struct blockvector
 {
@@ -176,7 +176,7 @@ extern void block_set_scope (struct block *block, const char *scope,
 extern struct using_direct *block_using (const struct block *block);
 
 extern void block_set_using (struct block *block,
-			     struct using_direct *using,
+			     struct using_direct *using_decl,
 			     struct obstack *obstack);
 
 extern const struct block *block_static_block (const struct block *block);
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index fb04932..2baf506 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -162,7 +162,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
 {
   struct exception_catchpoint *self
     = (struct exception_catchpoint *) bs->breakpoint_at;
-  char *typename = NULL;
+  char *type_name = NULL;
   volatile struct gdb_exception e;
 
   bkpt_breakpoint_ops.check_status (bs);
@@ -178,22 +178,22 @@ check_status_exception_catchpoint (struct bpstats *bs)
       char *canon;
 
       fetch_probe_arguments (NULL, &typeinfo_arg);
-      typename = cplus_typename_from_type_info (typeinfo_arg);
+      type_name = cplus_typename_from_type_info (typeinfo_arg);
 
-      canon = cp_canonicalize_string (typename);
+      canon = cp_canonicalize_string (type_name);
       if (canon != NULL)
 	{
-	  xfree (typename);
-	  typename = canon;
+	  xfree (type_name);
+	  type_name = canon;
 	}
     }
 
   if (e.reason < 0)
     exception_print (gdb_stderr, e);
-  else if (regexec (self->pattern, typename, 0, NULL, 0) != 0)
+  else if (regexec (self->pattern, type_name, 0, NULL, 0) != 0)
     bs->stop = 0;
 
-  xfree (typename);
+  xfree (type_name);
 }
 
 /* Implement the 're_set' method.  */
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index bb3ee26..2a24a25 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1622,7 +1622,7 @@ augment_type_symtab (void)
 struct context_stack *
 push_context (int desc, CORE_ADDR valu)
 {
-  struct context_stack *new;
+  struct context_stack *newobj;
 
   if (context_stack_depth == context_stack_size)
     {
@@ -1632,18 +1632,18 @@ push_context (int desc, CORE_ADDR valu)
 		  (context_stack_size * sizeof (struct context_stack)));
     }
 
-  new = &context_stack[context_stack_depth++];
-  new->depth = desc;
-  new->locals = local_symbols;
-  new->old_blocks = pending_blocks;
-  new->start_addr = valu;
-  new->using_directives = using_directives;
-  new->name = NULL;
+  newobj = &context_stack[context_stack_depth++];
+  newobj->depth = desc;
+  newobj->locals = local_symbols;
+  newobj->old_blocks = pending_blocks;
+  newobj->start_addr = valu;
+  newobj->using_directives = using_directives;
+  newobj->name = NULL;
 
   local_symbols = NULL;
   using_directives = NULL;
 
-  return new;
+  return newobj;
 }
 
 /* Pop a context block.  Returns the address of the context block just
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index e6de803..84f3a33 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -164,7 +164,7 @@ static int type_aggregate_p (struct type *);
 
     struct type_stack *type_stack;
 
-    struct objc_class_str class;
+    struct objc_class_str theclass;
   }
 
 %{
@@ -215,11 +215,11 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token <ssym> UNKNOWN_CPP_NAME
 %token <voidval> COMPLETE
 %token <tsym> TYPENAME
-%token <class> CLASSNAME	/* ObjC Class name */
+%token <theclass> CLASSNAME	/* ObjC Class name */
 %type <sval> name
 %type <svec> string_exp
 %type <ssym> name_not_typename
-%type <tsym> typename
+%type <tsym> type_name
 
  /* This is like a '[' token, but is only generated when parsing
     Objective C.  This lets us reuse the same parser without
@@ -238,7 +238,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token TEMPLATE
 %token ERROR
 %token NEW DELETE
-%type <sval> operator
+%type <sval> oper
 %token REINTERPRET_CAST DYNAMIC_CAST STATIC_CAST CONST_CAST
 %token ENTRY
 %token TYPEOF
@@ -479,17 +479,17 @@ exp	:	exp OBJC_LBRAC exp1 ']'
 
 exp	: 	OBJC_LBRAC TYPENAME
 			{
-			  CORE_ADDR class;
+			  CORE_ADDR theclass;
 
-			  class = lookup_objc_class (parse_gdbarch (pstate),
+			  theclass = lookup_objc_class (parse_gdbarch (pstate),
 						     copy_name ($2.stoken));
-			  if (class == 0)
+			  if (theclass == 0)
 			    error (_("%s is not an ObjC Class"),
 				   copy_name ($2.stoken));
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate,
 					    parse_type (pstate)->builtin_int);
-			  write_exp_elt_longcst (pstate, (LONGEST) class);
+			  write_exp_elt_longcst (pstate, (LONGEST) theclass);
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  start_msglist();
 			}
@@ -505,7 +505,7 @@ exp	:	OBJC_LBRAC CLASSNAME
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate,
 					    parse_type (pstate)->builtin_int);
-			  write_exp_elt_longcst (pstate, (LONGEST) $2.class);
+			  write_exp_elt_longcst (pstate, (LONGEST) $2.theclass);
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  start_msglist();
 			}
@@ -1390,7 +1390,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 					       $2.length);
 			  $$ = NULL;
 			}
-	|	UNSIGNED typename
+	|	UNSIGNED type_name
 			{ $$ = lookup_unsigned_typename (parse_language (pstate),
 							 parse_gdbarch (pstate),
 							 TYPE_NAME($2.type)); }
@@ -1398,7 +1398,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 			{ $$ = lookup_unsigned_typename (parse_language (pstate),
 							 parse_gdbarch (pstate),
 							 "int"); }
-	|	SIGNED_KEYWORD typename
+	|	SIGNED_KEYWORD type_name
 			{ $$ = lookup_signed_typename (parse_language (pstate),
 						       parse_gdbarch (pstate),
 						       TYPE_NAME($2.type)); }
@@ -1419,7 +1419,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 			{ $$ = follow_types ($1); }
 	;
 
-typename:	TYPENAME
+type_name:	TYPENAME
 	|	INT_KEYWORD
 		{
 		  $$.stoken.ptr = "int";
@@ -1501,7 +1501,7 @@ const_or_volatile_noopt:  	const_and_volatile
 			{ insert_type (tp_volatile); }
 	;
 
-operator:	OPERATOR NEW
+oper:	OPERATOR NEW
 			{ $$ = operator_stoken (" new"); }
 	|	OPERATOR DELETE
 			{ $$ = operator_stoken (" delete"); }
@@ -1632,7 +1632,7 @@ name	:	NAME { $$ = $1.stoken; }
 	|	TYPENAME { $$ = $1.stoken; }
 	|	NAME_OR_INT  { $$ = $1.stoken; }
 	|	UNKNOWN_CPP_NAME  { $$ = $1.stoken; }
-	|	operator { $$ = $1; }
+	|	oper { $$ = $1; }
 	;
 
 name_not_typename :	NAME
@@ -1644,7 +1644,7 @@ name_not_typename :	NAME
    context where only a name could occur, this might be useful.
   	|	NAME_OR_INT
  */
-	|	operator
+	|	oper
 			{
 			  struct field_of_this_result is_a_field_of_this;
 
@@ -2274,7 +2274,7 @@ enum token_flags
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
   enum token_flags flags;
@@ -2493,7 +2493,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	if ((tokentab3[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2506,7 +2506,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	if ((tokentab2[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2803,7 +2803,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	if ((ident_tokens[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2946,10 +2946,10 @@ classify_name (struct parser_state *par_state, const struct block *block,
       CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy);
       if (Class)
 	{
-	  yylval.class.class = Class;
+	  yylval.theclass.theclass = Class;
 	  sym = lookup_struct_typedef (copy, expression_context_block, 1);
 	  if (sym)
-	    yylval.class.type = SYMBOL_TYPE (sym);
+	    yylval.theclass.type = SYMBOL_TYPE (sym);
 	  return CLASSNAME;
 	}
     }
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4ec6ec0..2ee2ae0 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -189,7 +189,7 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
    of *LIST).  */
 
 struct cmd_list_element *
-add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
+add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 	 const char *doc, struct cmd_list_element **list)
 {
   struct cmd_list_element *c
@@ -228,7 +228,7 @@ add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
     }
 
   c->name = name;
-  c->class = class;
+  c->theclass = theclass;
   set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
@@ -283,7 +283,7 @@ deprecate_cmd (struct cmd_list_element *cmd, const char *replacement)
 }
 
 struct cmd_list_element *
-add_alias_cmd (const char *name, const char *oldname, enum command_class class,
+add_alias_cmd (const char *name, const char *oldname, enum command_class theclass,
 	       int abbrev_flag, struct cmd_list_element **list)
 {
   const char *tmp;
@@ -306,7 +306,7 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
       return 0;
     }
 
-  c = add_cmd (name, class, NULL, old->doc, list);
+  c = add_cmd (name, theclass, NULL, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
   if (old->doc_allocated)
@@ -335,13 +335,13 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
    containing that list.  */
 
 struct cmd_list_element *
-add_prefix_cmd (const char *name, enum command_class class,
+add_prefix_cmd (const char *name, enum command_class theclass,
 		cmd_cfunc_ftype *fun,
 		const char *doc, struct cmd_list_element **prefixlist,
 		const char *prefixname, int allow_unknown,
 		struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
   struct cmd_list_element *p;
 
   c->prefixlist = prefixlist;
@@ -363,13 +363,13 @@ add_prefix_cmd (const char *name, enum command_class class,
 /* Like add_prefix_cmd but sets the abbrev_flag on the new command.  */
 
 struct cmd_list_element *
-add_abbrev_prefix_cmd (const char *name, enum command_class class,
+add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
 		       cmd_cfunc_ftype *fun, const char *doc,
 		       struct cmd_list_element **prefixlist,
 		       const char *prefixname,
 		       int allow_unknown, struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
 
   c->prefixlist = prefixlist;
   c->prefixname = prefixname;
@@ -403,13 +403,13 @@ empty_sfunc (char *args, int from_tty, struct cmd_list_element *c)
 static struct cmd_list_element *
 add_set_or_show_cmd (const char *name,
 		     enum cmd_types type,
-		     enum command_class class,
+		     enum command_class theclass,
 		     var_types var_type,
 		     void *var,
 		     const char *doc,
 		     struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, NULL, doc, list);
 
   gdb_assert (type == set_cmd || type == show_cmd);
   c->type = type;
@@ -432,7 +432,7 @@ add_set_or_show_cmd (const char *name,
 
 static void
 add_setshow_cmd_full (const char *name,
-		      enum command_class class,
+		      enum command_class theclass,
 		      var_types var_type, void *var,
 		      const char *set_doc, const char *show_doc,
 		      const char *help_doc,
@@ -458,7 +458,7 @@ add_setshow_cmd_full (const char *name,
       full_set_doc = xstrdup (set_doc);
       full_show_doc = xstrdup (show_doc);
     }
-  set = add_set_or_show_cmd (name, set_cmd, class, var_type, var,
+  set = add_set_or_show_cmd (name, set_cmd, theclass, var_type, var,
 			     full_set_doc, set_list);
   set->doc_allocated = 1;
 
@@ -467,7 +467,7 @@ add_setshow_cmd_full (const char *name,
 
   set_cmd_prefix (set, set_list);
 
-  show = add_set_or_show_cmd (name, show_cmd, class, var_type, var,
+  show = add_set_or_show_cmd (name, show_cmd, theclass, var_type, var,
 			      full_show_doc, show_list);
   show->doc_allocated = 1;
   show->show_value_func = show_func;
@@ -485,7 +485,7 @@ add_setshow_cmd_full (const char *name,
 
 void
 add_setshow_enum_cmd (const char *name,
-		      enum command_class class,
+		      enum command_class theclass,
 		      const char *const *enumlist,
 		      const char **var,
 		      const char *set_doc,
@@ -498,7 +498,7 @@ add_setshow_enum_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_enum, var,
+  add_setshow_cmd_full (name, theclass, var_enum, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -514,7 +514,7 @@ const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
    string.  FUNC is the corresponding callback.  */
 void
 add_setshow_auto_boolean_cmd (const char *name,
-			      enum command_class class,
+			      enum command_class theclass,
 			      enum auto_boolean *var,
 			      const char *set_doc, const char *show_doc,
 			      const char *help_doc,
@@ -525,7 +525,7 @@ add_setshow_auto_boolean_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_auto_boolean, var,
+  add_setshow_cmd_full (name, theclass, var_auto_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -538,7 +538,7 @@ add_setshow_auto_boolean_cmd (const char *name,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
+add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var,
 			 const char *set_doc, const char *show_doc,
 			 const char *help_doc,
 			 cmd_sfunc_ftype *set_func,
@@ -549,7 +549,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
   static const char *boolean_enums[] = { "on", "off", NULL };
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_boolean, var,
+  add_setshow_cmd_full (name, theclass, var_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -560,7 +560,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_filename_cmd (const char *name, enum command_class class,
+add_setshow_filename_cmd (const char *name, enum command_class theclass,
 			  char **var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -571,7 +571,7 @@ add_setshow_filename_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_result;
 
-  add_setshow_cmd_full (name, class, var_filename, var,
+  add_setshow_cmd_full (name, theclass, var_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -582,7 +582,7 @@ add_setshow_filename_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_string_cmd (const char *name, enum command_class class,
+add_setshow_string_cmd (const char *name, enum command_class theclass,
 			char **var,
 			const char *set_doc, const char *show_doc,
 			const char *help_doc,
@@ -591,7 +591,7 @@ add_setshow_string_cmd (const char *name, enum command_class class,
 			struct cmd_list_element **set_list,
 			struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_string, var,
+  add_setshow_cmd_full (name, theclass, var_string, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -601,7 +601,7 @@ add_setshow_string_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 struct cmd_list_element *
-add_setshow_string_noescape_cmd (const char *name, enum command_class class,
+add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
 				 char **var,
 				 const char *set_doc, const char *show_doc,
 				 const char *help_doc,
@@ -612,7 +612,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_cmd;
 
-  add_setshow_cmd_full (name, class, var_string_noescape, var,
+  add_setshow_cmd_full (name, theclass, var_string_noescape, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -623,7 +623,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_optional_filename_cmd (const char *name, enum command_class class,
+add_setshow_optional_filename_cmd (const char *name, enum command_class theclass,
 				   char **var,
 				   const char *set_doc, const char *show_doc,
 				   const char *help_doc,
@@ -634,7 +634,7 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_result;
  
-  add_setshow_cmd_full (name, class, var_optional_filename, var,
+  add_setshow_cmd_full (name, theclass, var_optional_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -666,7 +666,7 @@ integer_unlimited_completer (struct cmd_list_element *ignore,
    value.  SET_DOC and SHOW_DOC are the documentation strings.  This
    function is only used in Python API.  Please don't use it elsewhere.  */
 void
-add_setshow_integer_cmd (const char *name, enum command_class class,
+add_setshow_integer_cmd (const char *name, enum command_class theclass,
 			 int *var,
 			 const char *set_doc, const char *show_doc,
 			 const char *help_doc,
@@ -677,7 +677,7 @@ add_setshow_integer_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_integer, var,
+  add_setshow_cmd_full (name, theclass, var_integer, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -691,7 +691,7 @@ add_setshow_integer_cmd (const char *name, enum command_class class,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_uinteger_cmd (const char *name, enum command_class class,
+add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
 			  unsigned int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -702,7 +702,7 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_uinteger, var,
+  add_setshow_cmd_full (name, theclass, var_uinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -716,7 +716,7 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_zinteger_cmd (const char *name, enum command_class class,
+add_setshow_zinteger_cmd (const char *name, enum command_class theclass,
 			  int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -725,7 +725,7 @@ add_setshow_zinteger_cmd (const char *name, enum command_class class,
 			  struct cmd_list_element **set_list,
 			  struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_zinteger, var,
+  add_setshow_cmd_full (name, theclass, var_zinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -734,7 +734,7 @@ add_setshow_zinteger_cmd (const char *name, enum command_class class,
 
 void
 add_setshow_zuinteger_unlimited_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
@@ -746,7 +746,7 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_zuinteger_unlimited, var,
+  add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -760,7 +760,7 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_zuinteger_cmd (const char *name, enum command_class class,
+add_setshow_zuinteger_cmd (const char *name, enum command_class theclass,
 			   unsigned int *var,
 			   const char *set_doc, const char *show_doc,
 			   const char *help_doc,
@@ -769,7 +769,7 @@ add_setshow_zuinteger_cmd (const char *name, enum command_class class,
 			   struct cmd_list_element **set_list,
 			   struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_zuinteger, var,
+  add_setshow_cmd_full (name, theclass, var_zuinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -870,19 +870,19 @@ add_info_alias (const char *name, const char *oldname, int abbrev_flag)
 /* Add an element to the list of commands.  */
 
 struct cmd_list_element *
-add_com (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
+add_com (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 	 const char *doc)
 {
-  return add_cmd (name, class, fun, doc, &cmdlist);
+  return add_cmd (name, theclass, fun, doc, &cmdlist);
 }
 
 /* Add an alias or abbreviation command to the list of commands.  */
 
 struct cmd_list_element *
-add_com_alias (const char *name, const char *oldname, enum command_class class,
+add_com_alias (const char *name, const char *oldname, enum command_class theclass,
 	       int abbrev_flag)
 {
-  return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
+  return add_alias_cmd (name, oldname, theclass, abbrev_flag, &cmdlist);
 }
 \f
 /* Recursively walk the commandlist structures, and print out the
@@ -991,7 +991,7 @@ help_cmd (const char *command, struct ui_file *stream)
 
   /* If this is a class name, print all of the commands in the class.  */
   if (c->func == NULL)
-    help_list (cmdlist, "", c->class, stream);
+    help_list (cmdlist, "", c->theclass, stream);
 
   if (c->hook_pre || c->hook_post)
     fprintf_filtered (stream,
@@ -1021,7 +1021,7 @@ help_cmd (const char *command, struct ui_file *stream)
  */
 void
 help_list (struct cmd_list_element *list, const char *cmdtype,
-	   enum command_class class, struct ui_file *stream)
+	   enum command_class theclass, struct ui_file *stream)
 {
   int len;
   char *cmdtype1, *cmdtype2;
@@ -1042,14 +1042,14 @@ help_list (struct cmd_list_element *list, const char *cmdtype,
       strcpy (cmdtype2 + len - 1, " sub");
     }
 
-  if (class == all_classes)
+  if (theclass == all_classes)
     fprintf_filtered (stream, "List of classes of %scommands:\n\n", cmdtype2);
   else
     fprintf_filtered (stream, "List of %scommands:\n\n", cmdtype2);
 
-  help_cmd_list (list, class, cmdtype, (int) class >= 0, stream);
+  help_cmd_list (list, theclass, cmdtype, (int) theclass >= 0, stream);
 
-  if (class == all_classes)
+  if (theclass == all_classes)
     {
       fprintf_filtered (stream, "\n\
 Type \"help%s\" followed by a class name for a list of commands in ",
@@ -1091,7 +1091,7 @@ help_all (struct ui_file *stream)
       if (c->func == NULL)
 	{
 	  fprintf_filtered (stream, "\nCommand class: %s\n\n", c->name);
-	  help_cmd_list (cmdlist, c->class, "", 1, stream);
+	  help_cmd_list (cmdlist, c->theclass, "", 1, stream);
 	}
     }
 
@@ -1104,7 +1104,7 @@ help_all (struct ui_file *stream)
       if (c->abbrev_flag)
         continue;
 
-      if (c->class == no_class)
+      if (c->theclass == no_class)
 	{
 	  if (!seen_unclassified)
 	    {
@@ -1187,7 +1187,7 @@ print_help_for_command (struct cmd_list_element *c, const char *prefix,
  * is at the low level, not the high-level).
  */
 void
-help_cmd_list (struct cmd_list_element *list, enum command_class class,
+help_cmd_list (struct cmd_list_element *list, enum command_class theclass,
 	       const char *prefix, int recurse, struct ui_file *stream)
 {
   struct cmd_list_element *c;
@@ -1195,16 +1195,16 @@ help_cmd_list (struct cmd_list_element *list, enum command_class class,
   for (c = list; c; c = c->next)
     {      
       if (c->abbrev_flag == 0
-	  && (class == all_commands
-	      || (class == all_classes && c->func == NULL)
-	      || (class == c->class && c->func != NULL)))
+	  && (theclass == all_commands
+	      || (theclass == all_classes && c->func == NULL)
+	      || (theclass == c->theclass && c->func != NULL)))
 	{
 	  print_help_for_command (c, prefix, recurse, stream);
 	}
       else if (c->abbrev_flag == 0 && recurse
-	       && class == class_user && c->prefixlist != NULL)
+	       && theclass == class_user && c->prefixlist != NULL)
 	/* User-defined commands may be subcommands.  */
-	help_cmd_list (*c->prefixlist, class, c->prefixname, 
+	help_cmd_list (*c->prefixlist, theclass, c->prefixname,
 		       recurse, stream);
     }
 }
@@ -1898,6 +1898,6 @@ cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
 int
 cli_user_command_p (struct cmd_list_element *cmd)
 {
-  return (cmd->class == class_user
+  return (cmd->theclass == class_user
 	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
 }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index ec89325..a669ba6 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -53,7 +53,7 @@ struct cmd_list_element
     const char *name;
 
     /* Command class; class values are chosen by application program.  */
-    enum command_class class;
+    enum command_class theclass;
 
     /* When 1 indicated that this command is deprecated.  It may be
        removed from gdb's command set in the future.  */
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 2989b05..65232da 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1532,7 +1532,7 @@ define_command (char *comname, int from_tty)
     {
       int q;
 
-      if (c->class == class_user || c->class == class_alias)
+      if (c->theclass == class_user || c->theclass == class_alias)
 	q = query (_("Redefine command \"%s\"? "), c->name);
       else
 	q = query (_("Really redefine built-in command \"%s\"? "), c->name);
@@ -1584,11 +1584,11 @@ define_command (char *comname, int from_tty)
 	     "Type commands for definition of \"%s\".", comfull);
   cmds = read_command_lines (tmpbuf, from_tty, 1, 0, 0);
 
-  if (c && c->class == class_user)
+  if (c && c->theclass == class_user)
     free_command_lines (&c->user_commands);
 
   newc = add_cmd (comname, class_user, user_defined_command,
-		  (c && c->class == class_user)
+		  (c && c->theclass == class_user)
 		  ? c->doc : xstrdup ("User-defined."), list);
   newc->user_commands = cmds;
 
@@ -1629,7 +1629,7 @@ document_command (char *comname, int from_tty)
   tem = comname;
   c = lookup_cmd (&tem, *list, "", 0, 1);
 
-  if (c->class != class_user)
+  if (c->theclass != class_user)
     error (_("Command \"%s\" is built-in."), comfull);
 
   xsnprintf (tmpbuf, sizeof (tmpbuf), "Type documentation for \"%s\".",
@@ -1739,7 +1739,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
       const char *prefixname = c->prefixname;
 
       for (c = *c->prefixlist; c != NULL; c = c->next)
-	if (c->class == class_user || c->prefixlist != NULL)
+	if (c->theclass == class_user || c->prefixlist != NULL)
 	  show_user_1 (c, prefixname, c->name, gdb_stdout);
       return;
     }
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 09bf28d..8d01b52 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -37,8 +37,8 @@ notify_command_param_changed_p (int param_changed, struct cmd_list_element *c)
   if (param_changed == 0)
     return 0;
 
-  if (c->class == class_maintenance || c->class == class_deprecated
-      || c->class == class_obscure)
+  if (c->theclass == class_maintenance || c->theclass == class_deprecated
+      || c->theclass == class_obscure)
     return 0;
 
   return 1;
@@ -158,16 +158,16 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
     {
     case var_string:
       {
-	char *new;
+	char *newobj;
 	const char *p;
 	char *q;
 	int ch;
 
 	if (arg == NULL)
 	  arg = "";
-	new = (char *) xmalloc (strlen (arg) + 2);
+	newobj = (char *) xmalloc (strlen (arg) + 2);
 	p = arg;
-	q = new;
+	q = newobj;
 	while ((ch = *p++) != '\000')
 	  {
 	    if (ch == '\\')
@@ -195,18 +195,18 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  *q++ = ' ';
 #endif
 	*q++ = '\0';
-	new = (char *) xrealloc (new, q - new);
+	newobj = (char *) xrealloc (newobj, q - newobj);
 
 	if (*(char **) c->var == NULL
-	    || strcmp (*(char **) c->var, new) != 0)
+	    || strcmp (*(char **) c->var, newobj) != 0)
 	  {
 	    xfree (*(char **) c->var);
-	    *(char **) c->var = new;
+	    *(char **) c->var = newobj;
 
 	    option_changed = 1;
 	  }
 	else
-	  xfree (new);
+	  xfree (newobj);
       }
       break;
     case var_string_noescape:
@@ -693,7 +693,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix)
 	}
       else
 	{
-	  if (list->class != no_set_class)
+	  if (list->theclass != no_set_class)
 	    {
 	      struct cleanup *option_chain
 		= make_cleanup_ui_out_tuple_begin_end (uiout, "option");
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 20c8c5e..366d828 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -773,7 +773,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   struct coff_symbol coff_symbol;
   struct coff_symbol *cs = &coff_symbol;
   static struct internal_syment main_sym;
@@ -1067,9 +1067,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 	         context_stack_depth is zero, and complain if not.  */
 
 	      depth = 0;
-	      new = push_context (depth, fcn_start_addr);
+	      newobj = push_context (depth, fcn_start_addr);
 	      fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
-	      new->name =
+	      newobj->name =
 		process_coff_symbol (&fcn_cs_saved, 
 				     &fcn_aux_saved, objfile);
 	    }
@@ -1092,9 +1092,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  break;
 		}
 
-	      new = pop_context ();
+	      newobj = pop_context ();
 	      /* Stack must be empty now.  */
-	      if (context_stack_depth > 0 || new == NULL)
+	      if (context_stack_depth > 0 || newobj == NULL)
 		{
 		  complaint (&symfile_complaints,
 			     _("Unmatched .ef symbol(s) ignored "
@@ -1129,8 +1129,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		enter_linenos (fcn_line_ptr, fcn_first_line,
 			       fcn_last_line, objfile);
 
-	      finish_block (new->name, &local_symbols,
-			    new->old_blocks, new->start_addr,
+	      finish_block (newobj->name, &local_symbols,
+			    newobj->old_blocks, newobj->start_addr,
 			    fcn_cs_saved.c_value
 			    + fcn_aux_saved.x_sym.x_misc.x_fsize
 			    + ANOFFSET (objfile->section_offsets,
@@ -1158,8 +1158,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  break;
 		}
 
-	      new = pop_context ();
-	      if (depth-- != new->depth)
+	      newobj = pop_context ();
+	      if (depth-- != newobj->depth)
 		{
 		  complaint (&symfile_complaints,
 			     _("Mismatched .eb symbol ignored "
@@ -1173,11 +1173,11 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		    cs->c_value + ANOFFSET (objfile->section_offsets,
 					    SECT_OFF_TEXT (objfile));
 		  /* Make a block for the local symbols within.  */
-		  finish_block (0, &local_symbols, new->old_blocks,
-				new->start_addr, tmpaddr);
+		  finish_block (0, &local_symbols, newobj->old_blocks,
+				newobj->start_addr, tmpaddr);
 		}
 	      /* Now pop locals of block just finished.  */
-	      local_symbols = new->locals;
+	      local_symbols = newobj->locals;
 	    }
 	  break;
 
@@ -2060,7 +2060,7 @@ coff_read_struct_type (int index, int length, int lastsym,
 
   struct type *type;
   struct nextfield *list = 0;
-  struct nextfield *new;
+  struct nextfield *newobj;
   int nfields = 0;
   int n;
   char *name;
@@ -2087,9 +2087,9 @@ coff_read_struct_type (int index, int length, int lastsym,
 	case C_MOU:
 
 	  /* Get space to record the next field's data.  */
-	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
-	  new->next = list;
-	  list = new;
+	  newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+	  newobj->next = list;
+	  list = newobj;
 
 	  /* Save the data.  */
 	  list->field.name = obstack_copy0 (&objfile->objfile_obstack,
@@ -2104,9 +2104,9 @@ coff_read_struct_type (int index, int length, int lastsym,
 	case C_FIELD:
 
 	  /* Get space to record the next field's data.  */
-	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
-	  new->next = list;
-	  list = new;
+	  newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+	  newobj->next = list;
+	  list = newobj;
 
 	  /* Save the data.  */
 	  list->field.name = obstack_copy0 (&objfile->objfile_obstack,
diff --git a/gdb/command.h b/gdb/command.h
index 956eeaa..bdf625b 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -248,7 +248,7 @@ typedef void (show_value_ftype) (struct ui_file *file,
 extern show_value_ftype deprecated_show_value_hack;
 
 extern void add_setshow_enum_cmd (const char *name,
-				  enum command_class class,
+				  enum command_class theclass,
 				  const char *const *enumlist,
 				  const char **var,
 				  const char *set_doc,
@@ -260,7 +260,7 @@ extern void add_setshow_enum_cmd (const char *name,
 				  struct cmd_list_element **show_list);
 
 extern void add_setshow_auto_boolean_cmd (const char *name,
-					  enum command_class class,
+					  enum command_class theclass,
 					  enum auto_boolean *var,
 					  const char *set_doc,
 					  const char *show_doc,
@@ -271,7 +271,7 @@ extern void add_setshow_auto_boolean_cmd (const char *name,
 					  struct cmd_list_element **show_list);
 
 extern void add_setshow_boolean_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc, const char *show_doc,
 				     const char *help_doc,
@@ -281,7 +281,7 @@ extern void add_setshow_boolean_cmd (const char *name,
 				     struct cmd_list_element **show_list);
 
 extern void add_setshow_filename_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      char **var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -292,7 +292,7 @@ extern void add_setshow_filename_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_string_cmd (const char *name,
-				    enum command_class class,
+				    enum command_class theclass,
 				    char **var,
 				    const char *set_doc,
 				    const char *show_doc,
@@ -304,7 +304,7 @@ extern void add_setshow_string_cmd (const char *name,
 
 extern struct cmd_list_element *add_setshow_string_noescape_cmd
 		      (const char *name,
-		       enum command_class class,
+		       enum command_class theclass,
 		       char **var,
 		       const char *set_doc,
 		       const char *show_doc,
@@ -315,7 +315,7 @@ extern struct cmd_list_element *add_setshow_string_noescape_cmd
 		       struct cmd_list_element **show_list);
 
 extern void add_setshow_optional_filename_cmd (const char *name,
-					       enum command_class class,
+					       enum command_class theclass,
 					       char **var,
 					       const char *set_doc,
 					       const char *show_doc,
@@ -326,7 +326,7 @@ extern void add_setshow_optional_filename_cmd (const char *name,
 					       struct cmd_list_element **show_list);
 
 extern void add_setshow_integer_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
@@ -337,7 +337,7 @@ extern void add_setshow_integer_cmd (const char *name,
 				     struct cmd_list_element **show_list);
 
 extern void add_setshow_uinteger_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      unsigned int *var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -348,7 +348,7 @@ extern void add_setshow_uinteger_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_zinteger_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      int *var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -359,7 +359,7 @@ extern void add_setshow_zinteger_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_zuinteger_cmd (const char *name,
-				       enum command_class class,
+				       enum command_class theclass,
 				       unsigned int *var,
 				       const char *set_doc,
 				       const char *show_doc,
@@ -371,7 +371,7 @@ extern void add_setshow_zuinteger_cmd (const char *name,
 
 extern void
   add_setshow_zuinteger_unlimited_cmd (const char *name,
-				       enum command_class class,
+				       enum command_class theclass,
 				       int *var,
 				       const char *set_doc,
 				       const char *show_doc,
diff --git a/gdb/common/cleanups.c b/gdb/common/cleanups.c
index 964df7a..e57e4cc 100644
--- a/gdb/common/cleanups.c
+++ b/gdb/common/cleanups.c
@@ -79,15 +79,15 @@ static struct cleanup *
 make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
 		  void *arg,  void (*free_arg) (void *))
 {
-  struct cleanup *new
+  struct cleanup *newobj
     = (struct cleanup *) xmalloc (sizeof (struct cleanup));
   struct cleanup *old_chain = *pmy_chain;
 
-  new->next = *pmy_chain;
-  new->function = function;
-  new->free_arg = free_arg;
-  new->arg = arg;
-  *pmy_chain = new;
+  newobj->next = *pmy_chain;
+  newobj->function = function;
+  newobj->free_arg = free_arg;
+  newobj->arg = arg;
+  *pmy_chain = newobj;
 
   gdb_assert (old_chain != NULL);
   return old_chain;
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index ef12821..0257220 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -343,10 +343,12 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
 /* See filestuff.h.  */
 
 int
-gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
+gdb_socketpair_cloexec (int domain, int style, int protocol,
+			int filedes[2])
 {
 #ifdef HAVE_SOCKETPAIR
-  int result = socketpair (namespace, style | SOCK_CLOEXEC, protocol, filedes);
+  int result = socketpair (domain, style | SOCK_CLOEXEC,
+			   protocol, filedes);
 
   if (result != -1)
     {
@@ -363,9 +365,9 @@ gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
 /* See filestuff.h.  */
 
 int
-gdb_socket_cloexec (int namespace, int style, int protocol)
+gdb_socket_cloexec (int domain, int style, int protocol)
 {
-  int result = socket (namespace, style | SOCK_CLOEXEC, protocol);
+  int result = socket (domain, style | SOCK_CLOEXEC, protocol);
 
   if (result != -1)
     socket_mark_cloexec (result);
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index f44f3b1..98522a6 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -54,13 +54,13 @@ extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
 /* Like 'socketpair', but ensures that the returned file descriptors
    have the close-on-exec flag set.  */
 
-extern int gdb_socketpair_cloexec (int namespace, int style, int protocol,
+extern int gdb_socketpair_cloexec (int domain, int style, int protocol,
 				   int filedes[2]);
 
 /* Like 'socket', but ensures that the returned file descriptor has
    the close-on-exec flag set.  */
 
-extern int gdb_socket_cloexec (int namespace, int style, int protocol);
+extern int gdb_socket_cloexec (int domain, int style, int protocol);
 
 /* Like 'pipe', but ensures that the returned file descriptors have
    the close-on-exec flag set.  */
diff --git a/gdb/continuations.c b/gdb/continuations.c
index 412a085..e753dc1 100644
--- a/gdb/continuations.c
+++ b/gdb/continuations.c
@@ -39,13 +39,13 @@ make_continuation (struct continuation **pmy_chain,
 		   continuation_ftype *function,
 		   void *arg,  void (*free_arg) (void *))
 {
-  struct continuation *new = XNEW (struct continuation);
+  struct continuation *newobj = XNEW (struct continuation);
 
-  new->next = *pmy_chain;
-  new->function = function;
-  new->free_arg = free_arg;
-  new->arg = arg;
-  *pmy_chain = new;
+  newobj->next = *pmy_chain;
+  newobj->function = function;
+  newobj->free_arg = free_arg;
+  newobj->arg = arg;
+  *pmy_chain = newobj;
 }
 
 static void
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index c1e7951..b4690ea 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -277,9 +277,9 @@ make_name (const char *name, int len)
     const char *opname;
   }
 
-%type <comp> exp exp1 type start start_opt operator colon_name
+%type <comp> exp exp1 type start start_opt oper colon_name
 %type <comp> unqualified_name colon_ext_name
-%type <comp> template template_arg
+%type <comp> templ template_arg
 %type <comp> builtin_type
 %type <comp> typespec_2 array_indicator
 %type <comp> colon_ext_only ext_only_name
@@ -439,7 +439,7 @@ demangler_special
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, $2, $4); }
 		;
 
-operator	:	OPERATOR NEW
+oper	:	OPERATOR NEW
 			{
 			  /* Match the whitespacing of cplus_demangle_operators.
 			     It would abort on unrecognized string otherwise.  */
@@ -554,8 +554,8 @@ conversion_op_name
 
 /* DEMANGLE_COMPONENT_NAME */
 /* This accepts certain invalid placements of '~'.  */
-unqualified_name:	operator
-		|	operator '<' template_params '>'
+unqualified_name:	oper
+		|	oper '<' template_params '>'
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
 		|	'~' NAME
 			{ $$ = make_dtor (gnu_v3_complete_object_dtor, $2); }
@@ -579,9 +579,9 @@ colon_name	:	name
 name		:	nested_name NAME %prec NAME
 			{ $$ = $1.comp; d_right ($1.last) = $2; }
 		|	NAME %prec NAME
-		|	nested_name template %prec NAME
+		|	nested_name templ %prec NAME
 			{ $$ = $1.comp; d_right ($1.last) = $2; }
-		|	template %prec NAME
+		|	templ %prec NAME
 		;
 
 colon_ext_name	:	colon_name
@@ -611,13 +611,13 @@ nested_name	:	NAME COLONCOLON
 			  d_left ($$.last) = $2;
 			  d_right ($$.last) = NULL;
 			}
-		|	template COLONCOLON
+		|	templ COLONCOLON
 			{ $$.comp = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
 			  d_left ($$.comp) = $1;
 			  d_right ($$.comp) = NULL;
 			  $$.last = $$.comp;
 			}
-		|	nested_name template COLONCOLON
+		|	nested_name templ COLONCOLON
 			{ $$.comp = $1.comp;
 			  d_right ($1.last) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
 			  $$.last = d_right ($1.last);
@@ -628,7 +628,7 @@ nested_name	:	NAME COLONCOLON
 
 /* DEMANGLE_COMPONENT_TEMPLATE */
 /* DEMANGLE_COMPONENT_TEMPLATE_ARGLIST */
-template	:	NAME '<' template_params '>'
+templ	:	NAME '<' template_params '>'
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
 		;
 
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 4bec821..34d9d05 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -126,7 +126,7 @@ cp_add_using_directive (const char *dest,
                         struct obstack *obstack)
 {
   struct using_direct *current;
-  struct using_direct *new;
+  struct using_direct *newobj;
 
   /* Has it already been added?  */
 
@@ -163,39 +163,39 @@ cp_add_using_directive (const char *dest,
       return;
     }
 
-  new = obstack_alloc (obstack, (sizeof (*new)
+  newobj = obstack_alloc (obstack, (sizeof (*newobj)
 				 + (VEC_length (const_char_ptr, excludes)
-				    * sizeof (*new->excludes))));
-  memset (new, 0, sizeof (*new));
+				    * sizeof (*newobj->excludes))));
+  memset (newobj, 0, sizeof (*newobj));
 
   if (copy_names)
     {
-      new->import_src = obstack_copy0 (obstack, src, strlen (src));
-      new->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
+      newobj->import_src = obstack_copy0 (obstack, src, strlen (src));
+      newobj->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
     }
   else
     {
-      new->import_src = src;
-      new->import_dest = dest;
+      newobj->import_src = src;
+      newobj->import_dest = dest;
     }
 
   if (alias != NULL && copy_names)
-    new->alias = obstack_copy0 (obstack, alias, strlen (alias));
+    newobj->alias = obstack_copy0 (obstack, alias, strlen (alias));
   else
-    new->alias = alias;
+    newobj->alias = alias;
 
   if (declaration != NULL && copy_names)
-    new->declaration = obstack_copy0 (obstack,
+    newobj->declaration = obstack_copy0 (obstack,
 				      declaration, strlen (declaration));
   else
-    new->declaration = declaration;
+    newobj->declaration = declaration;
 
-  memcpy (new->excludes, VEC_address (const_char_ptr, excludes),
-	  VEC_length (const_char_ptr, excludes) * sizeof (*new->excludes));
-  new->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
+  memcpy (newobj->excludes, VEC_address (const_char_ptr, excludes),
+	  VEC_length (const_char_ptr, excludes) * sizeof (*newobj->excludes));
+  newobj->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
 
-  new->next = using_directives;
-  using_directives = new;
+  newobj->next = using_directives;
+  using_directives = newobj;
 }
 
 /* Test whether or not NAMESPACE looks like it mentions an anonymous
@@ -293,14 +293,14 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
 
   if (search)
     {
-      struct symbol *this;
+      struct symbol *lang_this;
       struct type *type;
 
-      this = lookup_language_this (language_def (language_cplus), block);
-      if (this == NULL)
+      lang_this = lookup_language_this (language_def (language_cplus), block);
+      if (lang_this == NULL)
 	return NULL;
 
-      type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
+      type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this)));
       /* If TYPE_NAME is NULL, abandon trying to find this symbol.
 	 This can happen for lambda functions compiled with clang++,
 	 which outputs no name for the container class.  */
@@ -382,7 +382,7 @@ cp_search_static_and_baseclasses (const char *name,
    "this" if we can compute it.  */
 
 static struct symbol *
-cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
+cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
 			       const struct block *block,
 			       const domain_enum domain, int search)
 {
@@ -391,11 +391,11 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
   unsigned int prefix_len;
   struct symbol *sym;
 
-  if (namespace[0] != '\0')
+  if (the_namespace[0] != '\0')
     {
-      concatenated_name = alloca (strlen (namespace) + 2
+      concatenated_name = alloca (strlen (the_namespace) + 2
 				  + strlen (name) + 1);
-      strcpy (concatenated_name, namespace);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, name);
       name = concatenated_name;
@@ -410,7 +410,8 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
      class/namespace.  Since we're only searching static and global blocks
      there's often no need to first do that lookup.  */
 
-  is_in_anonymous = namespace[0] != '\0' && cp_is_in_anonymous (namespace);
+  is_in_anonymous
+    = the_namespace[0] != '\0' && cp_is_in_anonymous (the_namespace);
   sym = cp_basic_lookup_symbol (name, block, domain, is_in_anonymous);
   if (sym != NULL)
     return sym;
@@ -785,7 +786,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
 			const char *scope,
 			int scope_len)
 {
-  char *namespace;
+  char *the_namespace;
 
   if (scope[scope_len] != '\0')
     {
@@ -821,10 +822,10 @@ lookup_namespace_scope (const struct language_defn *langdef,
   if (scope_len == 0 && strchr (name, ':') == NULL)
     return cp_lookup_bare_symbol (langdef, name, block, domain, 1);
 
-  namespace = alloca (scope_len + 1);
-  strncpy (namespace, scope, scope_len);
-  namespace[scope_len] = '\0';
-  return cp_lookup_symbol_in_namespace (namespace, name,
+  the_namespace = alloca (scope_len + 1);
+  strncpy (the_namespace, scope, scope_len);
+  the_namespace[scope_len] = '\0';
+  return cp_lookup_symbol_in_namespace (the_namespace, name,
 					block, domain, 1);
 }
 
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 59463e3..260601f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -56,7 +56,7 @@ static void overload_list_add_symbol (struct symbol *sym,
 				      const char *oload_name);
 
 static void make_symbol_overload_list_using (const char *func_name,
-					     const char *namespace);
+					     const char *the_namespace);
 
 static void make_symbol_overload_list_qualified (const char *func_name);
 
@@ -326,15 +326,15 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
     {
       if (d_left (comp)->type == DEMANGLE_COMPONENT_NAME)
 	{
-	  struct demangle_component new;
+	  struct demangle_component newobj;
 
 	  ui_file_write (buf, d_left (comp)->u.s_name.s,
 			 d_left (comp)->u.s_name.len);
 	  name = ui_file_obsavestring (buf, &info->obstack, &len);
-	  new.type = DEMANGLE_COMPONENT_NAME;
-	  new.u.s_name.s = name;
-	  new.u.s_name.len = len;
-	  if (inspect_type (info, &new, finder, data))
+	  newobj.type = DEMANGLE_COMPONENT_NAME;
+	  newobj.u.s_name.s = name;
+	  newobj.u.s_name.len = len;
+	  if (inspect_type (info, &newobj, finder, data))
 	    {
 	      char *n, *s;
 	      long slen;
@@ -344,7 +344,7 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
 		 node.  */
 
 	      ui_file_rewind (buf);
-	      n = cp_comp_to_string (&new, 100);
+	      n = cp_comp_to_string (&newobj, 100);
 	      if (n == NULL)
 		{
 		  /* If something went astray, abort typedef substitutions.  */
@@ -1174,7 +1174,7 @@ overload_list_add_symbol (struct symbol *sym,
 
 struct symbol **
 make_symbol_overload_list (const char *func_name,
-			   const char *namespace)
+			   const char *the_namespace)
 {
   struct cleanup *old_cleanups;
   const char *name;
@@ -1187,15 +1187,15 @@ make_symbol_overload_list (const char *func_name,
 
   old_cleanups = make_cleanup (xfree, sym_return_val);
 
-  make_symbol_overload_list_using (func_name, namespace);
+  make_symbol_overload_list_using (func_name, the_namespace);
 
-  if (namespace[0] == '\0')
+  if (the_namespace[0] == '\0')
     name = func_name;
   else
     {
       char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
-      strcpy (concatenated_name, namespace);
+	= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, func_name);
       name = concatenated_name;
@@ -1226,19 +1226,19 @@ make_symbol_overload_list_block (const char *name,
 
 static void
 make_symbol_overload_list_namespace (const char *func_name,
-                                     const char *namespace)
+                                     const char *the_namespace)
 {
   const char *name;
   const struct block *block = NULL;
 
-  if (namespace[0] == '\0')
+  if (the_namespace[0] == '\0')
     name = func_name;
   else
     {
       char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+	= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
 
-      strcpy (concatenated_name, namespace);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, func_name);
       name = concatenated_name;
@@ -1263,7 +1263,7 @@ static void
 make_symbol_overload_list_adl_namespace (struct type *type,
                                          const char *func_name)
 {
-  char *namespace;
+  char *the_namespace;
   const char *type_name;
   int i, prefix_len;
 
@@ -1287,11 +1287,11 @@ make_symbol_overload_list_adl_namespace (struct type *type,
 
   if (prefix_len != 0)
     {
-      namespace = alloca (prefix_len + 1);
-      strncpy (namespace, type_name, prefix_len);
-      namespace[prefix_len] = '\0';
+      the_namespace = alloca (prefix_len + 1);
+      strncpy (the_namespace, type_name, prefix_len);
+      the_namespace[prefix_len] = '\0';
 
-      make_symbol_overload_list_namespace (func_name, namespace);
+      make_symbol_overload_list_namespace (func_name, the_namespace);
     }
 
   /* Check public base type */
@@ -1340,7 +1340,7 @@ reset_directive_searched (void *data)
 
 static void
 make_symbol_overload_list_using (const char *func_name,
-				 const char *namespace)
+				 const char *the_namespace)
 {
   struct using_direct *current;
   const struct block *block;
@@ -1365,7 +1365,7 @@ make_symbol_overload_list_using (const char *func_name,
         if (current->alias != NULL || current->declaration != NULL)
           continue;
 
-        if (strcmp (namespace, current->import_dest) == 0)
+        if (strcmp (the_namespace, current->import_dest) == 0)
 	  {
 	    /* Mark this import as searched so that the recursive call
 	       does not search it again.  */
@@ -1383,7 +1383,7 @@ make_symbol_overload_list_using (const char *func_name,
       }
 
   /* Now, add names for this namespace.  */
-  make_symbol_overload_list_namespace (func_name, namespace);
+  make_symbol_overload_list_namespace (func_name, the_namespace);
 }
 
 /* This does the bulk of the work of finding overloaded symbols.
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 407da62..cbff610 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -198,7 +198,7 @@ extern struct symbol *cp_lookup_symbol_nonlocal
       const struct block *block,
       const domain_enum domain);
 
-extern struct symbol *cp_lookup_symbol_namespace (const char *namespace,
+extern struct symbol *cp_lookup_symbol_namespace (const char *the_namespace,
 						  const char *name,
 						  const struct block *block,
 						  const domain_enum domain);
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 624976b..93f4c1b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -96,9 +96,9 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
 int
 cp_is_vtbl_ptr_type (struct type *type)
 {
-  const char *typename = type_name_no_tag (type);
+  const char *type_name = type_name_no_tag (type);
 
-  return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
+  return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
 }
 
 /* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index c6543ca..9936b6b 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -946,7 +946,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1330,7 +1330,7 @@ yylex (void)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -1339,7 +1339,7 @@ yylex (void)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1565,7 +1565,7 @@ yylex (void)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	/* It is ok to always set this, even though we don't always
 	   strictly need to.  */
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 53ca1ea..90e61da 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -118,7 +118,7 @@ get_task_from_args (char *args)
     {
       if (ptid_equal (inferior_ptid, null_ptid))
 	printf_unfiltered (_("No inferior running\n"));
-      return current_inferior ()->private->task;
+      return current_inferior ()->priv->task;
     }
   if (strcmp (args, "gdb") == 0)
     return mach_task_self ();
@@ -258,32 +258,32 @@ info_mach_ports_command (char *args, int from_tty)
 	    {
 	      struct inferior *inf = current_inferior ();
 
-	      if (port == inf->private->task)
+	      if (port == inf->priv->task)
 		printf_unfiltered (_(" inferior-task"));
-	      else if (port == inf->private->notify_port)
+	      else if (port == inf->priv->notify_port)
 		printf_unfiltered (_(" inferior-notify"));
 	      else
 		{
 		  int k;
 		  darwin_thread_t *t;
 
-		  for (k = 0; k < inf->private->exception_info.count; k++)
-		    if (port == inf->private->exception_info.ports[k])
+		  for (k = 0; k < inf->priv->exception_info.count; k++)
+		    if (port == inf->priv->exception_info.ports[k])
 		      {
 			printf_unfiltered (_(" inferior-excp-port"));
 			break;
 		      }
 
-		  if (inf->private->threads)
+		  if (inf->priv->threads)
 		    {
 		      for (k = 0;
 			   VEC_iterate(darwin_thread_t,
-				       inf->private->threads, k, t);
+				       inf->priv->threads, k, t);
 			   k++)
 			if (port == t->gdb_port)
 			  {
 			    printf_unfiltered (_(" inferior-thread for 0x%x"),
-					       inf->private->task);
+					       inf->priv->task);
 			    break;
 			  }
 		    }
@@ -742,7 +742,7 @@ info_mach_region_command (char *exp, int from_tty)
     error (_("Inferior not available"));
 
   inf = current_inferior ();
-  darwin_debug_region (inf->private->task, address);
+  darwin_debug_region (inf->priv->task, address);
 }
 
 static void
@@ -811,7 +811,7 @@ info_mach_exceptions_command (char *args, int from_tty)
 	{
 	  if (ptid_equal (inferior_ptid, null_ptid))
 	    printf_unfiltered (_("No inferior running\n"));
-	  disp_exception (&current_inferior ()->private->exception_info);
+	  disp_exception (&current_inferior ()->priv->exception_info);
 	  return;
 	}
       else if (strcmp (args, "host") == 0)
@@ -835,7 +835,7 @@ info_mach_exceptions_command (char *args, int from_tty)
       inf = current_inferior ();
       
       kret = task_get_exception_ports
-	(inf->private->task, EXC_MASK_ALL, info.masks,
+	(inf->priv->task, EXC_MASK_ALL, info.masks,
 	 &info.count, info.ports, info.behaviors, info.flavors);
       MACH_CHECK_ERROR (kret);
       disp_exception (&info);
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index f9481c7..630748a 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -274,7 +274,7 @@ darwin_check_new_threads (struct inferior *inf)
   unsigned int new_nbr;
   unsigned int old_nbr;
   unsigned int new_ix, old_ix;
-  darwin_inferior *darwin_inf = inf->private;
+  darwin_inferior *darwin_inf = inf->priv;
   VEC (darwin_thread_t) *thread_vec;
 
   /* Get list of threads.  */
@@ -369,7 +369,7 @@ darwin_check_new_threads (struct inferior *inf)
 	    {
 	      tp = find_thread_ptid (ptid_build (inf->pid, 0, 0));
 	      gdb_assert (tp);
-	      tp->private = pti;
+	      tp->priv = pti;
 	    }
 	  VEC_safe_push (darwin_thread_t, thread_vec, pti);
 	  new_ix++;
@@ -400,13 +400,13 @@ darwin_check_new_threads (struct inferior *inf)
 static int
 find_inferior_task_it (struct inferior *inf, void *port_ptr)
 {
-  return inf->private->task == *(task_t*)port_ptr;
+  return inf->priv->task == *(task_t*)port_ptr;
 }
 
 static int
 find_inferior_notify_it (struct inferior *inf, void *port_ptr)
 {
-  return inf->private->notify_port == *(task_t*)port_ptr;
+  return inf->priv->notify_port == *(task_t*)port_ptr;
 }
 
 /* Return an inferior by task port.  */
@@ -431,7 +431,7 @@ darwin_find_thread (struct inferior *inf, thread_t thread)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     if (t->gdb_port == thread)
       return t;
@@ -443,14 +443,14 @@ darwin_find_thread (struct inferior *inf, thread_t thread)
 static void
 darwin_suspend_inferior (struct inferior *inf)
 {
-  if (!inf->private->suspended)
+  if (!inf->priv->suspended)
     {
       kern_return_t kret;
 
-      kret = task_suspend (inf->private->task);
+      kret = task_suspend (inf->priv->task);
       MACH_CHECK_ERROR (kret);
 
-      inf->private->suspended = 1;
+      inf->priv->suspended = 1;
     }
 }
 
@@ -459,14 +459,14 @@ darwin_suspend_inferior (struct inferior *inf)
 static void
 darwin_resume_inferior (struct inferior *inf)
 {
-  if (inf->private->suspended)
+  if (inf->priv->suspended)
     {
       kern_return_t kret;
 
-      kret = task_resume (inf->private->task);
+      kret = task_resume (inf->priv->task);
       MACH_CHECK_ERROR (kret);
 
-      inf->private->suspended = 0;
+      inf->priv->suspended = 0;
     }
 }
 
@@ -703,7 +703,7 @@ darwin_send_reply (struct inferior *inf, darwin_thread_t *thread)
 		   MACH_PORT_NULL);
   MACH_CHECK_ERROR (kret);
 
-  inf->private->pending_messages--;
+  inf->priv->pending_messages--;
 }
 
 static void
@@ -773,7 +773,7 @@ darwin_resume_inferior_threads (struct inferior *inf, int step, int nsignal)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, thread);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, thread);
        k++)
     darwin_resume_thread (inf, thread, step, nsignal);
 }
@@ -805,7 +805,7 @@ darwin_suspend_inferior_threads (struct inferior *inf)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, thread);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, thread);
        k++)
     switch (thread->msg_state)
       {
@@ -925,7 +925,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
 	}
       *pinf = inf;
       *pthread = thread;
-      inf->private->pending_messages++;
+      inf->priv->pending_messages++;
 
       status->kind = TARGET_WAITKIND_STOPPED;
       thread->msg_state = DARWIN_MESSAGE;
@@ -992,7 +992,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
       inf = darwin_find_inferior_by_notify (hdr->msgh_local_port);
       if (inf != NULL)
 	{
-	  if (!inf->private->no_ptrace)
+	  if (!inf->priv->no_ptrace)
 	    {
 	      pid_t res;
 	      int wstatus;
@@ -1096,7 +1096,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 
       status->kind = TARGET_WAITKIND_STOPPED;
       status->value.sig = GDB_SIGNAL_TRAP;
-      thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+      thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
       thread->msg_state = DARWIN_STOPPED;
       return ptid_build (inf->pid, 0, thread->gdb_port);
     }
@@ -1200,7 +1200,7 @@ darwin_stop (struct target_ops *self, ptid_t t)
   struct inferior *inf = current_inferior ();
 
   /* FIXME: handle in no_ptrace mode.  */
-  gdb_assert (!inf->private->no_ptrace);
+  gdb_assert (!inf->priv->no_ptrace);
   kill (inf->pid, SIGINT);
 }
 
@@ -1213,33 +1213,33 @@ darwin_mourn_inferior (struct target_ops *ops)
   int i;
 
   /* Deallocate threads.  */
-  if (inf->private->threads)
+  if (inf->priv->threads)
     {
       int k;
       darwin_thread_t *t;
       for (k = 0;
-	   VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+	   VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
 	   k++)
 	{
 	  kret = mach_port_deallocate (gdb_task, t->gdb_port);
 	  MACH_CHECK_ERROR (kret);
 	}
-      VEC_free (darwin_thread_t, inf->private->threads);
-      inf->private->threads = NULL;
+      VEC_free (darwin_thread_t, inf->priv->threads);
+      inf->priv->threads = NULL;
     }
 
   kret = mach_port_move_member (gdb_task,
-				inf->private->notify_port, MACH_PORT_NULL);
+				inf->priv->notify_port, MACH_PORT_NULL);
   MACH_CHECK_ERROR (kret);
 
-  kret = mach_port_request_notification (gdb_task, inf->private->task,
+  kret = mach_port_request_notification (gdb_task, inf->priv->task,
 					 MACH_NOTIFY_DEAD_NAME, 0,
 					 MACH_PORT_NULL,
 					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
 					 &prev);
   /* This can fail if the task is dead.  */
   inferior_debug (4, "task=0x%x, prev=0x%x, notify_port=0x%x\n",
-		  inf->private->task, prev, inf->private->notify_port);
+		  inf->priv->task, prev, inf->priv->notify_port);
 
   if (kret == KERN_SUCCESS)
     {
@@ -1247,24 +1247,24 @@ darwin_mourn_inferior (struct target_ops *ops)
       MACH_CHECK_ERROR (kret);
     }
 
-  kret = mach_port_destroy (gdb_task, inf->private->notify_port);
+  kret = mach_port_destroy (gdb_task, inf->priv->notify_port);
   MACH_CHECK_ERROR (kret);
 
 
   /* Deallocate saved exception ports.  */
-  for (i = 0; i < inf->private->exception_info.count; i++)
+  for (i = 0; i < inf->priv->exception_info.count; i++)
     {
       kret = mach_port_deallocate
-	(gdb_task, inf->private->exception_info.ports[i]);
+	(gdb_task, inf->priv->exception_info.ports[i]);
       MACH_CHECK_ERROR (kret);
     }
-  inf->private->exception_info.count = 0;
+  inf->priv->exception_info.count = 0;
 
-  kret = mach_port_deallocate (gdb_task, inf->private->task);
+  kret = mach_port_deallocate (gdb_task, inf->priv->task);
   MACH_CHECK_ERROR (kret);
 
-  xfree (inf->private);
-  inf->private = NULL;
+  xfree (inf->priv);
+  inf->priv = NULL;
 
   inf_child_mourn_inferior (ops);
 }
@@ -1276,7 +1276,7 @@ darwin_reply_to_all_pending_messages (struct inferior *inf)
   darwin_thread_t *t;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     {
       if (t->msg_state == DARWIN_MESSAGE)
@@ -1299,7 +1299,7 @@ darwin_stop_inferior (struct inferior *inf)
 
   darwin_reply_to_all_pending_messages (inf);
 
-  if (inf->private->no_ptrace)
+  if (inf->priv->no_ptrace)
     return;
 
   res = kill (inf->pid, SIGSTOP);
@@ -1364,7 +1364,7 @@ darwin_kill_inferior (struct target_ops *ops)
 
   gdb_assert (inf != NULL);
 
-  kret = darwin_restore_exception_ports (inf->private);
+  kret = darwin_restore_exception_ports (inf->priv);
   MACH_CHECK_ERROR (kret);
 
   darwin_reply_to_all_pending_messages (inf);
@@ -1393,9 +1393,9 @@ darwin_attach_pid (struct inferior *inf)
   mach_port_t prev_not;
   exception_mask_t mask;
 
-  inf->private = XCNEW (darwin_inferior);
+  inf->priv = XCNEW (darwin_inferior);
 
-  kret = task_for_pid (gdb_task, inf->pid, &inf->private->task);
+  kret = task_for_pid (gdb_task, inf->pid, &inf->priv->task);
   if (kret != KERN_SUCCESS)
     {
       int status;
@@ -1412,7 +1412,7 @@ darwin_attach_pid (struct inferior *inf)
     }
 
   inferior_debug (2, _("inferior task: 0x%x, pid: %d\n"),
-		  inf->private->task, inf->pid);
+		  inf->priv->task, inf->pid);
 
   if (darwin_ex_port == MACH_PORT_NULL)
     {
@@ -1449,23 +1449,23 @@ darwin_attach_pid (struct inferior *inf)
 
   /* Create a port to be notified when the child task terminates.  */
   kret = mach_port_allocate (gdb_task, MACH_PORT_RIGHT_RECEIVE,
-			     &inf->private->notify_port);
+			     &inf->priv->notify_port);
   if (kret != KERN_SUCCESS)
     error (_("Unable to create notification port, mach_port_allocate "
 	     "returned: %d"),
 	   kret);
 
   kret = mach_port_move_member (gdb_task,
-				inf->private->notify_port, darwin_port_set);
+				inf->priv->notify_port, darwin_port_set);
   if (kret != KERN_SUCCESS)
     error (_("Unable to move notification port into new port set, "
 	     "mach_port_move_member\n"
 	     "returned: %d"),
 	   kret);
 
-  kret = mach_port_request_notification (gdb_task, inf->private->task,
+  kret = mach_port_request_notification (gdb_task, inf->priv->task,
 					 MACH_NOTIFY_DEAD_NAME, 0,
-					 inf->private->notify_port,
+					 inf->priv->notify_port,
 					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
 					 &prev_not);
   if (kret != KERN_SUCCESS)
@@ -1484,7 +1484,7 @@ its own.  This is unexpected, but should otherwise not have any actual\n\
 impact on the debugging session."));
     }
 
-  kret = darwin_save_exception_ports (inf->private);
+  kret = darwin_save_exception_ports (inf->priv);
   if (kret != KERN_SUCCESS)
     error (_("Unable to save exception ports, task_get_exception_ports"
 	     "returned: %d"),
@@ -1495,7 +1495,7 @@ impact on the debugging session."));
     mask = EXC_MASK_ALL;
   else
     mask = EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT;
-  kret = task_set_exception_ports (inf->private->task, mask, darwin_ex_port,
+  kret = task_set_exception_ports (inf->priv->task, mask, darwin_ex_port,
 				   EXCEPTION_DEFAULT, THREAD_STATE_NONE);
   if (kret != KERN_SUCCESS)
     error (_("Unable to set exception ports, task_set_exception_ports"
@@ -1514,9 +1514,9 @@ darwin_init_thread_list (struct inferior *inf)
 
   darwin_check_new_threads (inf);
 
-  gdb_assert (inf->private->threads
-	      && VEC_length (darwin_thread_t, inf->private->threads) > 0);
-  thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+  gdb_assert (inf->priv->threads
+	      && VEC_length (darwin_thread_t, inf->priv->threads) > 0);
+  thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
 
   /* Note: fork_inferior automatically add a thead but it uses a wrong ptid.
      Fix up.  */
@@ -1662,7 +1662,7 @@ darwin_setup_fake_stop_event (struct inferior *inf)
      as well.  Otherwise, we'll try resuming it when resuming the
      inferior, and get a warning because the thread's suspend count
      is already zero, making the resume request useless.  */
-  thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+  thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
   kret = thread_suspend (thread->gdb_port);
   MACH_CHECK_ERROR (kret);
 }
@@ -1716,11 +1716,11 @@ darwin_attach (struct target_ops *ops, const char *args, int from_tty)
 
   darwin_init_thread_list (inf);
 
-  darwin_check_osabi (inf->private, ptid_get_tid (inferior_ptid));
+  darwin_check_osabi (inf->priv, ptid_get_tid (inferior_ptid));
 
   darwin_setup_fake_stop_event (inf);
 
-  inf->private->no_ptrace = 1;
+  inf->priv->no_ptrace = 1;
 }
 
 /* Take a program previously attached to and detaches it.
@@ -1750,13 +1750,13 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
     }
 
   /* If ptrace() is in use, stop the process.  */
-  if (!inf->private->no_ptrace)
+  if (!inf->priv->no_ptrace)
     darwin_stop_inferior (inf);
 
-  kret = darwin_restore_exception_ports (inf->private);
+  kret = darwin_restore_exception_ports (inf->priv);
   MACH_CHECK_ERROR (kret);
 
-  if (!inf->private->no_ptrace)
+  if (!inf->priv->no_ptrace)
     {
       res = PTRACE (PT_DETACH, inf->pid, 0, 0);
       if (res != 0)
@@ -1769,7 +1769,7 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
   /* When using ptrace, we have just performed a PT_DETACH, which
      resumes the inferior.  On the other hand, when we are not using
      ptrace, we need to resume its execution ourselves.  */
-  if (inf->private->no_ptrace)
+  if (inf->priv->no_ptrace)
     darwin_resume_inferior (inf);
 
   darwin_mourn_inferior (ops);
@@ -1987,7 +1987,7 @@ darwin_xfer_partial (struct target_ops *ops,
     {
     case TARGET_OBJECT_MEMORY:
       {
-	int l = darwin_read_write_inferior (inf->private->task, offset,
+	int l = darwin_read_write_inferior (inf->priv->task, offset,
 					    readbuf, writebuf, len);
 
 	if (l == 0)
@@ -2006,7 +2006,7 @@ darwin_xfer_partial (struct target_ops *ops,
           /* Support only read.  */
           return TARGET_XFER_E_IO;
         }
-      return darwin_read_dyld_info (inf->private->task, offset, readbuf, len,
+      return darwin_read_dyld_info (inf->priv->task, offset, readbuf, len,
 				    xfered_len);
 #endif
     default:
@@ -2029,10 +2029,10 @@ set_enable_mach_exceptions (char *args, int from_tty,
 	mask = EXC_MASK_ALL;
       else
 	{
-	  darwin_restore_exception_ports (inf->private);
+	  darwin_restore_exception_ports (inf->priv);
 	  mask = EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT;
 	}
-      kret = task_set_exception_ports (inf->private->task, mask, darwin_ex_port,
+      kret = task_set_exception_ports (inf->priv->task, mask, darwin_ex_port,
 				       EXCEPTION_DEFAULT, THREAD_STATE_NONE);
       MACH_CHECK_ERROR (kret);
     }
@@ -2067,7 +2067,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
 
   /* First linear search.  */
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     if (t->inf_port == lwp)
       return ptid_build (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
@@ -2075,7 +2075,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
   /* Maybe the port was never extract.  Do it now.  */
 
   /* First get inferior port names.  */
-  kret = mach_port_names (inf->private->task, &names, &names_count, &types,
+  kret = mach_port_names (inf->priv->task, &names, &names_count, &types,
 			  &types_count);
   MACH_CHECK_ERROR (kret);
   if (kret != KERN_SUCCESS)
@@ -2091,7 +2091,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
 
       /* We just need to know the corresponding name in gdb name space.
 	 So extract and deallocate the right.  */
-      kret = mach_port_extract_right (inf->private->task, names[i],
+      kret = mach_port_extract_right (inf->priv->task, names[i],
 				      MACH_MSG_TYPE_COPY_SEND,
 				      &local_name, &local_type);
       if (kret != KERN_SUCCESS)
@@ -2099,7 +2099,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
       mach_port_deallocate (gdb_task, local_name);
 
       for (k = 0;
-	   VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+	   VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
 	   k++)
 	if (t->gdb_port == local_name)
 	  {
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 6d9bacc..4f60e10 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2702,7 +2702,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		    struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   /* This remembers the address of the start of a function.  It is
      used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries
      are relative to the current function's start address.  On systems
@@ -2779,15 +2779,16 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	    }
 
 	  within_function = 0;
-	  new = pop_context ();
+	  newobj = pop_context ();
 
 	  /* Make a block for the local symbols within.  */
-	  block = finish_block (new->name, &local_symbols, new->old_blocks,
-				new->start_addr, new->start_addr + valu);
+	  block = finish_block (newobj->name, &local_symbols,
+				newobj->old_blocks,
+				newobj->start_addr, newobj->start_addr + valu);
 
 	  /* For C++, set the block's scope.  */
-	  if (SYMBOL_LANGUAGE (new->name) == language_cplus)
-	    cp_set_block_scope (new->name, block, &objfile->objfile_obstack);
+	  if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
+	    cp_set_block_scope (newobj->name, block, &objfile->objfile_obstack);
 
 	  /* May be switching to an assembler file which may not be using
 	     block relative stabs, so reset the offset.  */
@@ -2847,8 +2848,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	  break;
 	}
 
-      new = pop_context ();
-      if (desc != new->depth)
+      newobj = pop_context ();
+      if (desc != newobj->depth)
 	lbrac_mismatch_complaint (symnum);
 
       if (local_symbols != NULL)
@@ -2861,7 +2862,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		     _("misplaced N_LBRAC entry; discarding local "
 		       "symbols which have no enclosing block"));
 	}
-      local_symbols = new->locals;
+      local_symbols = newobj->locals;
 
       if (context_stack_depth > 1)
 	{
@@ -2876,15 +2877,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	      /* Muzzle a compiler bug that makes end < start.
 
 		 ??? Which compilers?  Is this ever harmful?.  */
-	      if (new->start_addr > valu)
+	      if (newobj->start_addr > valu)
 		{
 		  complaint (&symfile_complaints,
 			     _("block start larger than block end"));
-		  new->start_addr = valu;
+		  newobj->start_addr = valu;
 		}
 	      /* Make a block for the local symbols within.  */
-	      finish_block (0, &local_symbols, new->old_blocks,
-			    new->start_addr, valu);
+	      finish_block (0, &local_symbols, newobj->old_blocks,
+			    newobj->start_addr, valu);
 	    }
 	}
       else
@@ -3183,20 +3184,20 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		{
 		  struct block *block;
 
-		  new = pop_context ();
+		  newobj = pop_context ();
 		  /* Make a block for the local symbols within.  */
-		  block = finish_block (new->name, &local_symbols,
-					new->old_blocks, new->start_addr,
+		  block = finish_block (newobj->name, &local_symbols,
+					newobj->old_blocks, newobj->start_addr,
 					valu);
 
 		  /* For C++, set the block's scope.  */
-		  if (SYMBOL_LANGUAGE (new->name) == language_cplus)
-		    cp_set_block_scope (new->name, block,
+		  if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
+		    cp_set_block_scope (newobj->name, block,
 					&objfile->objfile_obstack);
 		}
 
-	      new = push_context (0, valu);
-	      new->name = define_symbol (valu, name, desc, type, objfile);
+	      newobj = push_context (0, valu);
+	      newobj->name = define_symbol (valu, name, desc, type, objfile);
 	      break;
 
 	    default:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a764389..ebb8130 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3808,7 +3808,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 dw2_map_matching_symbols (struct objfile *objfile,
-			  const char * name, domain_enum namespace,
+			  const char * name, domain_enum domain,
 			  int global,
 			  int (*callback) (struct block *,
 					   struct symbol *, void *),
@@ -11275,7 +11275,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   CORE_ADDR lowpc;
   CORE_ADDR highpc;
   struct die_info *child_die;
@@ -11343,15 +11343,15 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
 
-  new = push_context (0, lowpc);
-  new->name = new_symbol_full (die, read_type_die (die, cu), cu,
+  newobj = push_context (0, lowpc);
+  newobj->name = new_symbol_full (die, read_type_die (die, cu), cu,
 			       (struct symbol *) templ_func);
 
   /* If there is a location expression for DW_AT_frame_base, record
      it.  */
   attr = dwarf2_attr (die, DW_AT_frame_base, cu);
   if (attr)
-    dwarf2_symbol_mark_computed (attr, new->name, cu, 1);
+    dwarf2_symbol_mark_computed (attr, newobj->name, cu, 1);
 
   cu->list_in_scope = &local_symbols;
 
@@ -11401,9 +11401,9 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
 
-  new = pop_context ();
+  newobj = pop_context ();
   /* Make a block for the local symbols within.  */
-  block = finish_block (new->name, &local_symbols, new->old_blocks,
+  block = finish_block (newobj->name, &local_symbols, newobj->old_blocks,
                         lowpc, highpc);
 
   /* For C++, set the block's scope.  */
@@ -11415,7 +11415,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
   /* If we have address ranges, record them.  */
   dwarf2_record_block_ranges (die, block, baseaddr, cu);
 
-  gdbarch_make_symbol_special (gdbarch, new->name, objfile);
+  gdbarch_make_symbol_special (gdbarch, newobj->name, objfile);
 
   /* Attach template arguments to function.  */
   if (! VEC_empty (symbolp, template_args))
@@ -11437,8 +11437,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
      a function declares a class that has methods).  This means that
      when we finish processing a function scope, we may need to go
      back to building a containing block's symbol lists.  */
-  local_symbols = new->locals;
-  using_directives = new->using_directives;
+  local_symbols = newobj->locals;
+  using_directives = newobj->using_directives;
 
   /* If we've finished processing a top-level function, subsequent
      symbols go in the file symbol list.  */
@@ -11454,7 +11454,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   CORE_ADDR lowpc, highpc;
   struct die_info *child_die;
   CORE_ADDR baseaddr;
@@ -11481,13 +11481,13 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  child_die = sibling_die (child_die);
 	}
     }
-  new = pop_context ();
+  newobj = pop_context ();
 
   if (local_symbols != NULL || using_directives != NULL)
     {
       struct block *block
-        = finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
-                        highpc);
+        = finish_block (0, &local_symbols, newobj->old_blocks,
+			newobj->start_addr, highpc);
 
       /* Note that recording ranges after traversing children, as we
          do here, means that recording a parent's ranges entails
@@ -11501,8 +11501,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
          to do.  */
       dwarf2_record_block_ranges (die, block, baseaddr, cu);
     }
-  local_symbols = new->locals;
-  using_directives = new->using_directives;
+  local_symbols = newobj->locals;
+  using_directives = newobj->using_directives;
 }
 
 /* Read in DW_TAG_GNU_call_site and insert it to CU->call_site_htab.  */
@@ -12715,7 +12715,7 @@ static int
 dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
 {
   const char *fieldname;
-  const char *typename;
+  const char *type_name;
   int len;
 
   if (die->parent == NULL)
@@ -12727,13 +12727,13 @@ dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
     return 0;
 
   fieldname = dwarf2_name (die, cu);
-  typename = dwarf2_name (die->parent, cu);
-  if (fieldname == NULL || typename == NULL)
+  type_name = dwarf2_name (die->parent, cu);
+  if (fieldname == NULL || type_name == NULL)
     return 0;
 
   len = strlen (fieldname);
-  return (strncmp (fieldname, typename, len) == 0
-	  && (typename[len] == '\0' || typename[len] == '<'));
+  return (strncmp (fieldname, type_name, len) == 0
+	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
 /* Add a member function to the proper fieldlist.  */
diff --git a/gdb/environ.c b/gdb/environ.c
index 88dd834..824a6f5 100644
--- a/gdb/environ.c
+++ b/gdb/environ.c
@@ -78,10 +78,10 @@ init_environ (struct gdb_environ *e)
   while (--i >= 0)
     {
       int len = strlen (e->vector[i]);
-      char *new = (char *) xmalloc (len + 1);
+      char *newobj = (char *) xmalloc (len + 1);
 
-      memcpy (new, e->vector[i], len + 1);
-      e->vector[i] = new;
+      memcpy (newobj, e->vector[i], len + 1);
+      e->vector[i] = newobj;
     }
 }
 
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 896296d..144e17f 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -830,7 +830,7 @@ parse_number (struct parser_state *par_state,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1006,11 +1006,11 @@ yylex (void)
   
   /* See if it is a special .foo. operator.  */
   
-  for (i = 0; dot_ops[i].operator != NULL; i++)
-    if (strncmp (tokstart, dot_ops[i].operator,
-		 strlen (dot_ops[i].operator)) == 0)
+  for (i = 0; dot_ops[i].oper != NULL; i++)
+    if (strncmp (tokstart, dot_ops[i].oper,
+		 strlen (dot_ops[i].oper)) == 0)
       {
-	lexptr += strlen (dot_ops[i].operator);
+	lexptr += strlen (dot_ops[i].oper);
 	yylval.opcode = dot_ops[i].opcode;
 	return dot_ops[i].token;
       }
@@ -1175,9 +1175,9 @@ yylex (void)
   
   /* Catch specific keywords.  */
   
-  for (i = 0; f77_keywords[i].operator != NULL; i++)
-    if (strlen (f77_keywords[i].operator) == namelen
-	&& strncmp (tokstart, f77_keywords[i].operator, namelen) == 0)
+  for (i = 0; f77_keywords[i].oper != NULL; i++)
+    if (strlen (f77_keywords[i].oper) == namelen
+	&& strncmp (tokstart, f77_keywords[i].oper, namelen) == 0)
       {
 	/* 	lexptr += strlen(f77_keywords[i].operator); */ 
 	yylval.opcode = f77_keywords[i].opcode;
diff --git a/gdb/frame.c b/gdb/frame.c
index 5b1a8d9..6b1be94 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -753,9 +753,9 @@ frame_find_by_id (struct frame_id id)
 
   for (frame = get_current_frame (); ; frame = prev_frame)
     {
-      struct frame_id this = get_frame_id (frame);
+      struct frame_id self = get_frame_id (frame);
 
-      if (frame_id_eq (id, this))
+      if (frame_id_eq (id, self))
 	/* An exact match.  */
 	return frame;
 
@@ -769,7 +769,7 @@ frame_find_by_id (struct frame_id id)
 	 frame in the current frame chain can have this ID.  See the
 	 comment at frame_id_inner for details.   */
       if (get_frame_type (frame) == NORMAL_FRAME
-	  && !frame_id_inner (get_frame_arch (frame), id, this)
+	  && !frame_id_inner (get_frame_arch (frame), id, self)
 	  && frame_id_inner (get_frame_arch (prev_frame), id,
 			     get_frame_id (prev_frame)))
 	return NULL;
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index b35da35..637ee1f 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4901,7 +4901,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
   if (new_gdbarch->initialized_p)
     {
       struct gdbarch_list **list;
-      struct gdbarch_list *this;
+      struct gdbarch_list *self;
       if (gdbarch_debug)
 	fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
 			    "Previous architecture %s (%s) selected\n",
@@ -4913,12 +4913,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
-      /* Unlink THIS.  */
-      this = (*list);
-      (*list) = this->next;
-      /* Insert THIS at the front.  */
-      this->next = rego->arches;
-      rego->arches = this;
+      /* Unlink SELF.  */
+      self = (*list);
+      (*list) = self->next;
+      /* Insert SELF at the front.  */
+      self->next = rego->arches;
+      rego->arches = self;
       /* Return it.  */
       return new_gdbarch;
     }
@@ -4933,10 +4933,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
   /* Insert the new architecture into the front of the architecture
      list (keep the list sorted Most Recently Used).  */
   {
-    struct gdbarch_list *this = XNEW (struct gdbarch_list);
-    this->next = rego->arches;
-    this->gdbarch = new_gdbarch;
-    rego->arches = this;
+    struct gdbarch_list *self = XNEW (struct gdbarch_list);
+    self->next = rego->arches;
+    self->gdbarch = new_gdbarch;
+    rego->arches = self;
   }    
 
   /* Check that the newly installed architecture is valid.  Plug in
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index cffefc5..dde976a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -2350,7 +2350,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
   if (new_gdbarch->initialized_p)
     {
       struct gdbarch_list **list;
-      struct gdbarch_list *this;
+      struct gdbarch_list *self;
       if (gdbarch_debug)
 	fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
 			    "Previous architecture %s (%s) selected\n",
@@ -2362,12 +2362,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
-      /* Unlink THIS.  */
-      this = (*list);
-      (*list) = this->next;
-      /* Insert THIS at the front.  */
-      this->next = rego->arches;
-      rego->arches = this;
+      /* Unlink SELF.  */
+      self = (*list);
+      (*list) = self->next;
+      /* Insert SELF at the front.  */
+      self->next = rego->arches;
+      rego->arches = self;
       /* Return it.  */
       return new_gdbarch;
     }
@@ -2382,10 +2382,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
   /* Insert the new architecture into the front of the architecture
      list (keep the list sorted Most Recently Used).  */
   {
-    struct gdbarch_list *this = XNEW (struct gdbarch_list);
-    this->next = rego->arches;
-    this->gdbarch = new_gdbarch;
-    rego->arches = this;
+    struct gdbarch_list *self = XNEW (struct gdbarch_list);
+    self->next = rego->arches;
+    self->gdbarch = new_gdbarch;
+    rego->arches = self;
   }    
 
   /* Check that the newly installed architecture is valid.  Plug in
diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h
index c75499d..0569586 100644
--- a/gdb/gdbserver/inferiors.h
+++ b/gdb/gdbserver/inferiors.h
@@ -69,7 +69,7 @@ struct process_info
   const struct target_desc *tdesc;
 
   /* Private target data.  */
-  struct process_info_private *private;
+  struct process_info_private *priv;
 };
 
 #define ptid_of(inf) ((inf)->entry.id)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 6b84042..a34fe5d 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -721,7 +721,7 @@ aarch64_get_debug_reg_state ()
   struct process_info *proc;
 
   proc = current_process ();
-  return &proc->private->arch_private->debug_reg_state;
+  return &proc->priv->arch_private->debug_reg_state;
 }
 
 /* Record the insertion of one breakpoint/watchpoint, as represented
@@ -1151,7 +1151,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       int tid = ptid_get_lwp (ptid);
       struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
       struct aarch64_debug_reg_state *state
-	= &proc->private->arch_private->debug_reg_state;
+	= &proc->priv->arch_private->debug_reg_state;
 
       if (show_debug_regs)
 	fprintf (stderr, "prepare_to_resume thread %ld\n", lwpid_of (thread));
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 303d9c8..2cd1668 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -590,12 +590,12 @@ arm_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   if (watch)
     {
       count = arm_linux_get_hw_watchpoint_count ();
-      pts = proc->private->arch_private->wpts;
+      pts = proc->priv->arch_private->wpts;
     }
   else
     {
       count = arm_linux_get_hw_breakpoint_count ();
-      pts = proc->private->arch_private->bpts;
+      pts = proc->priv->arch_private->bpts;
     }
 
   for (i = 0; i < count; i++)
@@ -630,12 +630,12 @@ arm_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   if (watch)
     {
       count = arm_linux_get_hw_watchpoint_count ();
-      pts = proc->private->arch_private->wpts;
+      pts = proc->priv->arch_private->wpts;
     }
   else
     {
       count = arm_linux_get_hw_breakpoint_count ();
-      pts = proc->private->arch_private->bpts;
+      pts = proc->priv->arch_private->bpts;
     }
 
   for (i = 0; i < count; i++)
@@ -725,7 +725,7 @@ arm_prepare_to_resume (struct lwp_info *lwp)
   struct thread_info *thread = get_lwp_thread (lwp);
   int pid = lwpid_of (thread);
   struct process_info *proc = find_process_pid (pid_of (thread));
-  struct arch_process_info *proc_info = proc->private->arch_private;
+  struct arch_process_info *proc_info = proc->priv->arch_private;
   struct arch_lwp_info *lwp_info = lwp->arch_private;
   int i;
 
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index eff940d..083f49f 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -357,13 +357,13 @@ linux_add_process (int pid, int attached)
   struct process_info *proc;
 
   proc = add_process (pid, attached);
-  proc->private = xcalloc (1, sizeof (*proc->private));
+  proc->priv = xcalloc (1, sizeof (*proc->priv));
 
   /* Set the arch when the first LWP stops.  */
-  proc->private->new_inferior = 1;
+  proc->priv->new_inferior = 1;
 
   if (the_low_target.new_process != NULL)
-    proc->private->arch_private = the_low_target.new_process ();
+    proc->priv->arch_private = the_low_target.new_process ();
 
   return proc;
 }
@@ -1173,10 +1173,10 @@ linux_mourn (struct process_info *process)
   find_inferior (&all_threads, delete_lwp_callback, process);
 
   /* Freeing all private data.  */
-  priv = process->private;
+  priv = process->priv;
   free (priv->arch_private);
   free (priv);
-  process->private = NULL;
+  process->priv = NULL;
 
   remove_process (process);
 }
@@ -1862,7 +1862,7 @@ linux_low_filter_event (int lwpid, int wstat)
 	 is stopped for the first time, but before we access any
 	 inferior registers.  */
       proc = find_process_pid (pid_of (thread));
-      if (proc->private->new_inferior)
+      if (proc->priv->new_inferior)
 	{
 	  struct thread_info *saved_thread;
 
@@ -1873,7 +1873,7 @@ linux_low_filter_event (int lwpid, int wstat)
 
 	  current_thread = saved_thread;
 
-	  proc->private->new_inferior = 0;
+	  proc->priv->new_inferior = 0;
 	}
     }
 
@@ -2746,7 +2746,7 @@ linux_wait_1 (ptid_t ptid,
       && current_thread->last_resume_kind != resume_step
       && (
 #if defined (USE_THREAD_DB) && !defined (__ANDROID__)
-	  (current_process ()->private->thread_db != NULL
+	  (current_process ()->priv->thread_db != NULL
 	   && (WSTOPSIG (w) == __SIGRTMIN
 	       || WSTOPSIG (w) == __SIGRTMIN + 1))
 	  ||
@@ -4809,7 +4809,7 @@ linux_look_up_symbols (void)
 #ifdef USE_THREAD_DB
   struct process_info *proc = current_process ();
 
-  if (proc->private->thread_db != NULL)
+  if (proc->priv->thread_db != NULL)
     return;
 
   /* If the kernel supports tracing clones, then we don't need to
@@ -5729,7 +5729,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
 {
   char *document;
   unsigned document_len;
-  struct process_info_private *const priv = current_process ()->private;
+  struct process_info_private *const priv = current_process ()->priv;
   char filename[PATH_MAX];
   int pid, is_elf64;
 
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 478bb6e..f081dda 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -353,19 +353,19 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
 {
   ptid_t ptid = ptid_of (get_lwp_thread (lwp));
   struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
 
   if (lwp->arch_private->watch_registers_changed)
     {
       /* Only update the watch registers if we have set or unset a
 	 watchpoint already.  */
-      if (mips_linux_watch_get_num_valid (&private->watch_mirror) > 0)
+      if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
 	{
 	  /* Write the mirrored watch register values.  */
 	  int tid = ptid_get_lwp (ptid);
 
 	  if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
-			    &private->watch_mirror))
+			    &priv->watch_mirror))
 	    perror_with_name ("Couldn't write watch register");
 	}
 
@@ -395,7 +395,7 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 		   int len, struct raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   struct pt_watch_regs regs;
   struct mips_watchpoint *new_watch;
   struct mips_watchpoint **pw;
@@ -406,17 +406,17 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 
   lwpid = lwpid_of (current_thread);
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					0))
     return -1;
 
   if (len <= 0)
     return -1;
 
-  regs = private->watch_readback;
+  regs = priv->watch_readback;
   /* Add the current watches.  */
-  mips_linux_watch_populate_regs (private->current_watches, &regs);
+  mips_linux_watch_populate_regs (priv->current_watches, &regs);
 
   /* Now try to add the new watch.  */
   watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
@@ -431,12 +431,12 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   new_watch->type = watch_type;
   new_watch->next = NULL;
 
-  pw = &private->current_watches;
+  pw = &priv->current_watches;
   while (*pw != NULL)
     pw = &(*pw)->next;
   *pw = new_watch;
 
-  private->watch_mirror = regs;
+  priv->watch_mirror = regs;
 
   /* Only update the threads of this process.  */
   pid = pid_of (proc);
@@ -453,7 +453,7 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 		   int len, struct raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
 
   int deleted_one;
   int pid;
@@ -465,7 +465,7 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   /* Search for a known watch that matches.  Then unlink and free it.  */
   watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
   deleted_one = 0;
-  pw = &private->current_watches;
+  pw = &priv->current_watches;
   while ((w = *pw))
     {
       if (w->addr == addr && w->len == len && w->type == watch_type)
@@ -483,11 +483,11 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 
   /* At this point watch_readback is known to be valid because we
      could not have added the watch without reading it.  */
-  gdb_assert (private->watch_readback_valid == 1);
+  gdb_assert (priv->watch_readback_valid == 1);
 
-  private->watch_mirror = private->watch_readback;
-  mips_linux_watch_populate_regs (private->current_watches,
-				  &private->watch_mirror);
+  priv->watch_mirror = priv->watch_readback;
+  mips_linux_watch_populate_regs (priv->current_watches,
+				  &priv->watch_mirror);
 
   /* Only update the threads of this process.  */
   pid = pid_of (proc);
@@ -503,21 +503,21 @@ static int
 mips_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   int n;
   int num_valid;
   long lwpid = lwpid_of (current_thread);
 
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					1))
     return 0;
 
-  num_valid = mips_linux_watch_get_num_valid (&private->watch_readback);
+  num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
 
   for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
-    if (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+    if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 	& (R_MASK | W_MASK))
       return 1;
 
@@ -531,7 +531,7 @@ static CORE_ADDR
 mips_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   int n;
   int num_valid;
   long lwpid = lwpid_of (current_thread);
@@ -543,28 +543,28 @@ mips_stopped_data_address (void)
      triggered.  */
 
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					0))
     return 0;
 
-  num_valid = mips_linux_watch_get_num_valid (&private->watch_readback);
+  num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
 
   for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
-    if (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+    if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 	& (R_MASK | W_MASK))
       {
 	CORE_ADDR t_low, t_hi;
 	int t_irw;
 	struct mips_watchpoint *watch;
 
-	t_low = mips_linux_watch_get_watchlo (&private->watch_readback, n);
+	t_low = mips_linux_watch_get_watchlo (&priv->watch_readback, n);
 	t_irw = t_low & IRW_MASK;
-	t_hi = (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+	t_hi = (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 		| IRW_MASK);
 	t_low &= ~(CORE_ADDR)t_hi;
 
-	for (watch = private->current_watches;
+	for (watch = priv->current_watches;
 	     watch != NULL;
 	     watch = watch->next)
 	  {
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 2c3fccc..eff2847 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -687,7 +687,7 @@ x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 	struct x86_debug_reg_state *state
-	  = &proc->private->arch_private->debug_reg_state;
+	  = &proc->priv->arch_private->debug_reg_state;
 
 	return x86_dr_insert_watchpoint (state, hw_type, addr, size);
       }
@@ -716,7 +716,7 @@ x86_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 	struct x86_debug_reg_state *state
-	  = &proc->private->arch_private->debug_reg_state;
+	  = &proc->priv->arch_private->debug_reg_state;
 
 	return x86_dr_remove_watchpoint (state, hw_type, addr, size);
       }
@@ -730,7 +730,7 @@ static int
 x86_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  return x86_dr_stopped_by_watchpoint (&proc->private->arch_private->debug_reg_state);
+  return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state);
 }
 
 static CORE_ADDR
@@ -738,7 +738,7 @@ x86_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
   CORE_ADDR addr;
-  if (x86_dr_stopped_data_address (&proc->private->arch_private->debug_reg_state,
+  if (x86_dr_stopped_data_address (&proc->priv->arch_private->debug_reg_state,
 				   &addr))
     return addr;
   return 0;
@@ -783,7 +783,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
       int pid = ptid_get_pid (ptid);
       struct process_info *proc = find_process_pid (pid);
       struct x86_debug_reg_state *state
-	= &proc->private->arch_private->debug_reg_state;
+	= &proc->priv->arch_private->debug_reg_state;
 
       x86_linux_dr_set (ptid, DR_CONTROL, 0);
 
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 98797ba..460346c 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -218,8 +218,8 @@ lynx_add_process (int pid, int attached)
 
   proc = add_process (pid, attached);
   proc->tdesc = lynx_tdesc;
-  proc->private = xcalloc (1, sizeof (*proc->private));
-  proc->private->last_wait_event_ptid = null_ptid;
+  proc->priv = xcalloc (1, sizeof (*proc->priv));
+  proc->priv->last_wait_event_ptid = null_ptid;
 
   return proc;
 }
@@ -334,7 +334,7 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
      unexpected signals (Eg SIG61) when we resume the inferior
      using a different thread.  */
   if (ptid_equal (ptid, minus_one_ptid))
-    ptid = current_process()->private->last_wait_event_ptid;
+    ptid = current_process()->priv->last_wait_event_ptid;
 
   /* The ptid might still be minus_one_ptid; this can happen between
      the moment we create the inferior or attach to a process, and
@@ -422,7 +422,7 @@ retry:
 
   ret = lynx_waitpid (pid, &wstat);
   new_ptid = lynx_ptid_build (ret, ((union wait *) &wstat)->w_tid);
-  find_process_pid (ret)->private->last_wait_event_ptid = new_ptid;
+  find_process_pid (ret)->priv->last_wait_event_ptid = new_ptid;
 
   /* If this is a new thread, then add it now.  The reason why we do
      this here instead of when handling new-thread events is because
@@ -552,8 +552,8 @@ static void
 lynx_mourn (struct process_info *proc)
 {
   /* Free our private data.  */
-  free (proc->private);
-  proc->private = NULL;
+  free (proc->priv);
+  proc->priv = NULL;
 
   clear_inferiors ();
 }
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 2185245..72b9e65 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -191,7 +191,7 @@ thread_db_create_event (CORE_ADDR where)
   td_event_msg_t msg;
   td_err_e err;
   struct lwp_info *lwp;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   gdb_assert (thread_db->td_ta_event_getmsg_p != NULL);
 
@@ -227,7 +227,7 @@ thread_db_enable_reporting (void)
   td_thr_events_t events;
   td_notify_t notify;
   td_err_e err;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   if (thread_db->td_ta_set_event_p == NULL
       || thread_db->td_ta_event_addr_p == NULL
@@ -271,7 +271,7 @@ find_one_thread (ptid_t ptid)
   td_err_e err;
   struct thread_info *inferior;
   struct lwp_info *lwp;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int lwpid = ptid_get_lwp (ptid);
 
   inferior = (struct thread_info *) find_inferior_id (&all_threads, ptid);
@@ -351,7 +351,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
   if (thread_db_use_events)
     {
       td_err_e err;
-      struct thread_db *thread_db = proc->private->thread_db;
+      struct thread_db *thread_db = proc->priv->thread_db;
 
       err = thread_db->td_thr_event_enable_p (th_p, 1);
       if (err != TD_OK)
@@ -390,7 +390,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 {
   td_thrinfo_t ti;
   td_err_e err;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   err = thread_db->td_thr_get_info_p (th_p, &ti);
   if (err != TD_OK)
@@ -429,7 +429,7 @@ thread_db_find_new_threads (void)
 {
   td_err_e err;
   ptid_t ptid = current_ptid;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int loop, iteration;
 
   /* This function is only called when we first initialize thread_db.
@@ -475,7 +475,7 @@ thread_db_find_new_threads (void)
 static void
 thread_db_look_up_symbols (void)
 {
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   const char **sym_list;
   CORE_ADDR unused;
 
@@ -490,7 +490,7 @@ thread_db_look_up_symbols (void)
 int
 thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp)
 {
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int may_ask_gdb = !thread_db->all_symbols_looked_up;
 
   /* If we've passed the call to thread_db_look_up_symbols, then
@@ -513,7 +513,7 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
   struct thread_db *thread_db;
 
   proc = get_thread_process (thread);
-  thread_db = proc->private->thread_db;
+  thread_db = proc->priv->thread_db;
 
   /* If the thread layer is not (yet) initialized, fail.  */
   if (thread_db == NULL || !thread_db->all_symbols_looked_up)
@@ -574,10 +574,10 @@ thread_db_load_search (void)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  gdb_assert (proc->private->thread_db == NULL);
+  gdb_assert (proc->priv->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
-  proc->private->thread_db = tdb;
+  proc->priv->thread_db = tdb;
 
   tdb->td_ta_new_p = &td_ta_new;
 
@@ -588,7 +588,7 @@ thread_db_load_search (void)
       if (debug_threads)
 	debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
       free (tdb);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
       return 0;
     }
 
@@ -619,10 +619,10 @@ try_thread_db_load_1 (void *handle)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  gdb_assert (proc->private->thread_db == NULL);
+  gdb_assert (proc->priv->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
-  proc->private->thread_db = tdb;
+  proc->priv->thread_db = tdb;
 
   tdb->handle = handle;
 
@@ -639,7 +639,7 @@ try_thread_db_load_1 (void *handle)
 	  if (required)						\
 	    {							\
 	      free (tdb);					\
-	      proc->private->thread_db = NULL;			\
+	      proc->priv->thread_db = NULL;			\
 	      return 0;						\
 	    }							\
 	}							\
@@ -655,7 +655,7 @@ try_thread_db_load_1 (void *handle)
       if (debug_threads)
 	debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
       free (tdb);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
       return 0;
     }
 
@@ -893,7 +893,7 @@ switch_to_process (struct process_info *proc)
 static void
 disable_thread_event_reporting (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
   if (thread_db)
     {
       td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
@@ -925,7 +925,7 @@ disable_thread_event_reporting (struct process_info *proc)
 static void
 remove_thread_event_breakpoints (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
 
   if (thread_db->td_create_bp != NULL)
     {
@@ -943,7 +943,7 @@ remove_thread_event_breakpoints (struct process_info *proc)
 void
 thread_db_detach (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
 
   if (thread_db)
     {
@@ -957,7 +957,7 @@ thread_db_detach (struct process_info *proc)
 void
 thread_db_mourn (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
   if (thread_db)
     {
       td_err_e (*td_ta_delete_p) (td_thragent_t *);
@@ -976,7 +976,7 @@ thread_db_mourn (struct process_info *proc)
 #endif  /* USE_LIBTHREAD_DB_DIRECTLY  */
 
       free (thread_db);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
     }
 }
 
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index a2f378a..e9ae47d 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -261,7 +261,7 @@ struct thread_info
   struct frame_id initiating_frame;
 
   /* Private data used by the target vector implementation.  */
-  struct private_thread_info *private;
+  struct private_thread_info *priv;
 
   /* Function that is called to free PRIVATE.  If this is NULL, then
      xfree will be called on PRIVATE.  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a80151c..8ab1db2 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1519,7 +1519,7 @@ struct type *
 lookup_struct_elt_type (struct type *type, const char *name, int noerr)
 {
   int i;
-  char *typename;
+  char *type_name;
 
   for (;;)
     {
@@ -1533,9 +1533,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT 
       && TYPE_CODE (type) != TYPE_CODE_UNION)
     {
-      typename = type_to_string (type);
-      make_cleanup (xfree, typename);
-      error (_("Type %s is not a structure or union type."), typename);
+      type_name = type_to_string (type);
+      make_cleanup (xfree, type_name);
+      error (_("Type %s is not a structure or union type."), type_name);
     }
 
 #if 0
@@ -1544,10 +1544,10 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
      I.e. when doing "ptype bell->bar" for "struct foo { int bar; int
      foo; } bell;" Disabled by fnf.  */
   {
-    char *typename;
+    char *type_name;
 
-    typename = type_name_no_tag (type);
-    if (typename != NULL && strcmp (typename, name) == 0)
+    type_name = type_name_no_tag (type);
+    if (type_name != NULL && strcmp (type_name, name) == 0)
       return type;
   }
 #endif
@@ -1587,9 +1587,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
       return NULL;
     }
 
-  typename = type_to_string (type);
-  make_cleanup (xfree, typename);
-  error (_("Type %s has no component named %s."), typename, name);
+  type_name = type_to_string (type);
+  make_cleanup (xfree, type_name);
+  error (_("Type %s has no component named %s."), type_name, name);
 }
 
 /* Store in *MAX the largest number representable by unsigned integer type
@@ -2715,7 +2715,7 @@ class_types_same_p (const struct type *a, const struct type *b)
    distance_to_ancestor (A, D, 1) = -1.  */
 
 static int
-distance_to_ancestor (struct type *base, struct type *dclass, int public)
+distance_to_ancestor (struct type *base, struct type *dclass, int is_public)
 {
   int i;
   int d;
@@ -2728,10 +2728,10 @@ distance_to_ancestor (struct type *base, struct type *dclass, int public)
 
   for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
     {
-      if (public && ! BASETYPE_VIA_PUBLIC (dclass, i))
+      if (is_public && ! BASETYPE_VIA_PUBLIC (dclass, i))
 	continue;
 
-      d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), public);
+      d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), is_public);
       if (d >= 0)
 	return 1 + d;
     }
@@ -4186,7 +4186,7 @@ recursive_dump_type (struct type *type, int spaces)
 
 struct type_pair
 {
-  struct type *old, *new;
+  struct type *old, *newobj;
 };
 
 static hashval_t
@@ -4242,7 +4242,7 @@ copy_type_recursive (struct objfile *objfile,
   pair.old = type;
   slot = htab_find_slot (copied_types, &pair, INSERT);
   if (*slot != NULL)
-    return ((struct type_pair *) *slot)->new;
+    return ((struct type_pair *) *slot)->newobj;
 
   new_type = alloc_type_arch (get_type_arch (type));
 
@@ -4251,7 +4251,7 @@ copy_type_recursive (struct objfile *objfile,
   stored
     = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair));
   stored->old = type;
-  stored->new = new_type;
+  stored->newobj = new_type;
   *slot = stored;
 
   /* Copy the common fields of types.  For the main type, we simply
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index cdcb354..f65b4ec 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1076,7 +1076,7 @@ gnuv3_get_typeid (struct value *value)
   struct gdbarch *gdbarch;
   struct cleanup *cleanup;
   struct value *result;
-  char *typename, *canonical;
+  char *type_name, *canonical;
 
   /* We have to handle values a bit trickily here, to allow this code
      to work properly with non_lvalue values that are really just
@@ -1095,20 +1095,20 @@ gnuv3_get_typeid (struct value *value)
   type = make_cv_type (0, 0, type, NULL);
   gdbarch = get_type_arch (type);
 
-  typename = type_to_string (type);
-  if (typename == NULL)
+  type_name = type_to_string (type);
+  if (type_name == NULL)
     error (_("cannot find typeinfo for unnamed type"));
-  cleanup = make_cleanup (xfree, typename);
+  cleanup = make_cleanup (xfree, type_name);
 
   /* We need to canonicalize the type name here, because we do lookups
      using the demangled name, and so we must match the format it
      uses.  E.g., GDB tends to use "const char *" as a type name, but
      the demangler uses "char const *".  */
-  canonical = cp_canonicalize_string (typename);
+  canonical = cp_canonicalize_string (type_name);
   if (canonical != NULL)
     {
       make_cleanup (xfree, canonical);
-      typename = canonical;
+      type_name = canonical;
     }
 
   typeinfo_type = gnuv3_get_typeid_type (gdbarch);
@@ -1124,7 +1124,7 @@ gnuv3_get_typeid (struct value *value)
 
       vtable = gnuv3_get_vtable (gdbarch, type, address);
       if (vtable == NULL)
-	error (_("cannot find typeinfo for object of type '%s'"), typename);
+	error (_("cannot find typeinfo for object of type '%s'"), type_name);
       typeinfo_value = value_field (vtable, vtable_field_type_info);
       result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
 				      typeinfo_value));
@@ -1134,12 +1134,12 @@ gnuv3_get_typeid (struct value *value)
       char *sym_name;
       struct bound_minimal_symbol minsym;
 
-      sym_name = concat ("typeinfo for ", typename, (char *) NULL);
+      sym_name = concat ("typeinfo for ", type_name, (char *) NULL);
       make_cleanup (xfree, sym_name);
       minsym = lookup_minimal_symbol (sym_name, NULL, NULL);
 
       if (minsym.minsym == NULL)
-	error (_("could not find typeinfo symbol for '%s'"), typename);
+	error (_("could not find typeinfo symbol for '%s'"), type_name);
 
       result = value_at_lazy (typeinfo_type, BMSYMBOL_VALUE_ADDRESS (minsym));
     }
@@ -1187,21 +1187,21 @@ gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
 static struct type *
 gnuv3_get_type_from_type_info (struct value *type_info_ptr)
 {
-  char *typename;
+  char *type_name;
   struct cleanup *cleanup;
   struct value *type_val;
   struct expression *expr;
   struct type *result;
 
-  typename = gnuv3_get_typename_from_type_info (type_info_ptr);
-  cleanup = make_cleanup (xfree, typename);
+  type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
+  cleanup = make_cleanup (xfree, type_name);
 
   /* We have to parse the type name, since in general there is not a
      symbol for a type.  This is somewhat bogus since there may be a
      mis-parse.  Another approach might be to re-use the demangler's
      internal form to reconstruct the type somehow.  */
 
-  expr = parse_expression (typename);
+  expr = parse_expression (type_name);
   make_cleanup (xfree, expr);
 
   type_val = evaluate_type (expr);
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 2443983..bada4cf 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -988,7 +988,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1075,7 +1075,7 @@ lex_one_token (struct parser_state *par_state)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -1084,7 +1084,7 @@ lex_one_token (struct parser_state *par_state)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1315,7 +1315,7 @@ lex_one_token (struct parser_state *par_state)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	/* It is ok to always set this, even though we don't always
 	   strictly need to.  */
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 9a8ef68..5c0f2d7 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -139,12 +139,12 @@ extern SCM gdbscm_string_string;
 \f
 /* scm-utils.c */
 
-extern void gdbscm_define_variables (const scheme_variable *, int public);
+extern void gdbscm_define_variables (const scheme_variable *, int is_public);
 
-extern void gdbscm_define_functions (const scheme_function *, int public);
+extern void gdbscm_define_functions (const scheme_function *, int is_public);
 
 extern void gdbscm_define_integer_constants (const scheme_integer_constant *,
-					     int public);
+					     int is_public);
 
 extern void gdbscm_printf (SCM port, const char *format, ...);
 
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 829143e..1891237 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -434,11 +434,11 @@ gdbscm_symbol_constant_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return scm_from_bool (class == LOC_CONST || class == LOC_CONST_BYTES);
+  return scm_from_bool (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
 }
 
 /* (symbol-function? <gdb:symbol>) -> boolean */
@@ -449,11 +449,11 @@ gdbscm_symbol_function_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return scm_from_bool (class == LOC_BLOCK);
+  return scm_from_bool (theclass == LOC_BLOCK);
 }
 
 /* (symbol-variable? <gdb:symbol>) -> boolean */
@@ -464,14 +464,14 @@ gdbscm_symbol_variable_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
   return scm_from_bool (!SYMBOL_IS_ARGUMENT (symbol)
-			&& (class == LOC_LOCAL || class == LOC_REGISTER
-			    || class == LOC_STATIC || class == LOC_COMPUTED
-			    || class == LOC_OPTIMIZED_OUT));
+			&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
+			    || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+			    || theclass == LOC_OPTIMIZED_OUT));
 }
 
 /* (symbol-needs-frame? <gdb:symbol>) -> boolean
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index 023097f..59d8b52 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -27,14 +27,14 @@
 /* Define VARIABLES in the gdb module.  */
 
 void
-gdbscm_define_variables (const scheme_variable *variables, int public)
+gdbscm_define_variables (const scheme_variable *variables, int is_public)
 {
   const scheme_variable *sv;
 
   for (sv = variables; sv->name != NULL; ++sv)
     {
       scm_c_define (sv->name, sv->value);
-      if (public)
+      if (is_public)
 	scm_c_export (sv->name, NULL);
     }
 }
@@ -42,7 +42,7 @@ gdbscm_define_variables (const scheme_variable *variables, int public)
 /* Define FUNCTIONS in the gdb module.  */
 
 void
-gdbscm_define_functions (const scheme_function *functions, int public)
+gdbscm_define_functions (const scheme_function *functions, int is_public)
 {
   const scheme_function *sf;
 
@@ -53,7 +53,7 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
       scm_set_procedure_property_x (proc, gdbscm_documentation_symbol,
 				    gdbscm_scm_from_c_string (sf->doc_string));
-      if (public)
+      if (is_public)
 	scm_c_export (sf->name, NULL);
     }
 }
@@ -62,14 +62,14 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
 void
 gdbscm_define_integer_constants (const scheme_integer_constant *constants,
-				 int public)
+				 int is_public)
 {
   const scheme_integer_constant *sc;
 
   for (sc = constants; sc->name != NULL; ++sc)
     {
       scm_c_define (sc->name, scm_from_int (sc->value));
-      if (public)
+      if (is_public)
 	scm_c_export (sc->name, NULL);
     }
 }
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 55fcd23..6dc2e84 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -136,7 +136,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   unsigned int dummy[HPPA_MAX_INSN_PATTERN_LEN];
   int offs = 0;
-  int try;
+  int attempt;
   /* offsets to try to find the trampoline */
   static int pcoffs[] = { 0, 4*4, 5*4 };
   /* offsets to the rt_sigframe structure */
@@ -154,12 +154,12 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
      e4008200 be,l 0x100(%sr2, %r0), %sr0, %r31
      08000240 nop  */
 
-  for (try = 0; try < ARRAY_SIZE (pcoffs); try++)
+  for (attempt = 0; attempt < ARRAY_SIZE (pcoffs); attempt++)
     {
-      if (insns_match_pattern (gdbarch, sp + pcoffs[try],
+      if (insns_match_pattern (gdbarch, sp + pcoffs[attempt],
 			       hppa_sigtramp, dummy))
 	{
-          offs = sfoffs[try];
+          offs = sfoffs[attempt];
 	  break;
 	}
     }
@@ -171,8 +171,8 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
 	  /* sigaltstack case: we have no way of knowing which offset to 
 	     use in this case; default to new kernel handling.  If this is
 	     wrong the unwinding will fail.  */
-	  try = 2;
-	  sp = pc - pcoffs[try];
+	  attempt = 2;
+	  sp = pc - pcoffs[attempt];
 	}
       else
       {
@@ -186,7 +186,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
      bad we cannot include system specific headers :-(.
      sizeof(struct siginfo) == 128
      offsetof(struct ucontext, uc_mcontext) == 24.  */
-  return sp + sfoffs[try] + 128 + 24;
+  return sp + sfoffs[attempt] + 128 + 24;
 }
 
 struct hppa_linux_sigtramp_unwind_cache
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 89f7ae3..c237aaa 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -512,7 +512,7 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
 {
   gdb_byte bundle[BUNDLE_LEN];
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
-  long long template;
+  long long templ;
   int val;
 
   /* Warn about slot numbers greater than 2.  We used to generate
@@ -543,8 +543,8 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
     return 0;
 
   *instr = slotN_contents (bundle, slotnum);
-  template = extract_bit_field (bundle, 0, 5);
-  *it = template_encoding_table[(int)template][slotnum];
+  templ = extract_bit_field (bundle, 0, 5);
+  *it = template_encoding_table[(int)templ][slotnum];
 
   if (slotnum == 2 || (slotnum == 1 && *it == L))
     addr += 16;
@@ -642,7 +642,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_breakpoint;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   if (slotnum > 2)
@@ -671,8 +671,8 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
      a breakpoint on an L-X instruction.  */
   bp_tgt->shadow_len = BUNDLE_LEN - shadow_slotnum;
 
-  template = extract_bit_field (bundle, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       /* X unit types can only be used in slot 2, and are actually
 	 part of a 2-slot L-X instruction.  We cannot break at this
@@ -681,7 +681,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
       gdb_assert (slotnum == 2);
       error (_("Can't insert breakpoint for non-existing slot X"));
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       /* L unit types can only be used in slot 1.  But the associated
 	 opcode for that instruction is in slot 2, so bump the slot number
@@ -739,7 +739,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
   int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_breakpoint, instr_saved;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   addr &= ~0x0f;
@@ -761,8 +761,8 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
      for addressing the SHADOW_CONTENTS placement.  */
   shadow_slotnum = slotnum;
 
-  template = extract_bit_field (bundle_mem, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle_mem, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       /* X unit types can only be used in slot 2, and are actually
 	 part of a 2-slot L-X instruction.  We refuse to insert
@@ -776,7 +776,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
       do_cleanups (cleanup);
       return -1;
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       /* L unit types can only be used in slot 1.  But the breakpoint
 	 was actually saved using slot 2, so update the slot number
@@ -829,7 +829,7 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
   int slotnum = (int) (*pcptr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_fetched;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   if (slotnum > 2)
@@ -857,13 +857,13 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
 
   /* Check for L type instruction in slot 1, if present then bump up the slot
      number to the slot 2.  */
-  template = extract_bit_field (bundle, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       gdb_assert (slotnum == 2);
       error (_("Can't insert breakpoint for non-existing slot X"));
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       gdb_assert (slotnum == 1);
       slotnum = 2;
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 080e167..8957ca2 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -424,9 +424,9 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child,
       inf_ttrace_num_lwps_in_syscall = 0;
 
       ti = inferior_thread ();
-      ti->private =
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
     }
   else
@@ -610,7 +610,7 @@ inf_ttrace_create_threads_after_attach (int pid)
   /* Add the stopped thread.  */
   ptid = ptid_build (pid, tts.tts_lwpid, 0);
   ti = add_thread (ptid);
-  ti->private = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
+  ti->priv = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
   inf_ttrace_num_lwps++;
 
   /* We use the "first stopped thread" as the currently active thread.  */
@@ -631,7 +631,7 @@ inf_ttrace_create_threads_after_attach (int pid)
 
       ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
       ti = add_thread (ptid);
-      ti->private = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
+      ti->priv = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
       inf_ttrace_num_lwps++;
     }
 }
@@ -750,7 +750,7 @@ inf_ttrace_delete_dead_threads_callback (struct thread_info *info, void *arg)
     return 0;
 
   lwpid = ptid_get_lwp (info->ptid);
-  p = (struct inf_ttrace_private_thread_info *) info->private;
+  p = (struct inf_ttrace_private_thread_info *) info->priv;
 
   /* Check if an lwp that was dying is still there or not.  */
   if (p->dying && (kill (lwpid, 0) == -1))
@@ -772,7 +772,7 @@ inf_ttrace_resume_lwp (struct thread_info *info, ttreq_t request, int sig)
   if (ttrace (request, pid, lwpid, TT_NOPC, sig, 0) == -1)
     {
       struct inf_ttrace_private_thread_info *p
-	= (struct inf_ttrace_private_thread_info *) info->private;
+	= (struct inf_ttrace_private_thread_info *) info->priv;
       if (p->dying && errno == EPROTO)
 	/* This is expected, it means the dying lwp is really gone
 	   by now.  If ttrace had an event to inform the debugger
@@ -872,10 +872,10 @@ inf_ttrace_wait (struct target_ops *ops,
       /* We haven't set the private member on the main thread yet.  Do
 	 it now.  */
       ti = find_thread_ptid (inferior_ptid);
-      gdb_assert (ti != NULL && ti->private == NULL);
-      ti->private =
+      gdb_assert (ti != NULL && ti->priv == NULL);
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
 
       /* Notify the core that this ptid changed.  This changes
@@ -955,9 +955,9 @@ inf_ttrace_wait (struct target_ops *ops,
       lwpid = tts.tts_u.tts_thread.tts_target_lwpid;
       ptid = ptid_build (tts.tts_pid, lwpid, 0);
       ti = add_thread (ptid);
-      ti->private =
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
       inf_ttrace_num_lwps++;
       ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
@@ -973,7 +973,7 @@ inf_ttrace_wait (struct target_ops *ops,
 	printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (ptid));
       ti = find_thread_ptid (ptid);
       gdb_assert (ti != NULL);
-      ((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
+      ((struct inf_ttrace_private_thread_info *)ti->priv)->dying = 1;
       inf_ttrace_num_lwps--;
       /* Let the thread really exit.  */
       ttrace (TT_LWP_CONTINUE, ptid_get_pid (ptid),
@@ -990,7 +990,7 @@ inf_ttrace_wait (struct target_ops *ops,
 			  target_pid_to_str (ptid));
       ti = find_thread_ptid (ptid);
       gdb_assert (ti != NULL);
-      ((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
+      ((struct inf_ttrace_private_thread_info *)ti->priv)->dying = 1;
       inf_ttrace_num_lwps--;
 
       /* Resume the lwp_terminate-caller thread.  */
@@ -1146,10 +1146,10 @@ static char *
 inf_ttrace_extra_thread_info (struct target_ops *self,
 			      struct thread_info *info)
 {
-  struct inf_ttrace_private_thread_info* private =
-    (struct inf_ttrace_private_thread_info *) info->private;
+  struct inf_ttrace_private_thread_info* priv =
+    (struct inf_ttrace_private_thread_info *) info->priv;
 
-  if (private != NULL && private->dying)
+  if (priv != NULL && priv->dying)
     return "Exiting";
 
   return NULL;
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 6b4f65f..ba320b5 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -101,7 +101,7 @@ free_inferior (struct inferior *inf)
   xfree (inf->terminal);
   free_environ (inf->environment);
   target_desc_info_free (inf->tdesc_info);
-  xfree (inf->private);
+  xfree (inf->priv);
   xfree (inf);
 }
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 4463de6..2530777 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -381,7 +381,7 @@ struct inferior
   struct continuation *continuations;
 
   /* Private data used by the target vector implementation.  */
-  struct private_inferior *private;
+  struct private_inferior *priv;
 
   /* HAS_EXIT_CODE is true if the inferior exited with an exit code.
      In this case, the EXIT_CODE field is also valid.  */
diff --git a/gdb/jit.c b/gdb/jit.c
index 712d1e2..32a3fc7 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -532,15 +532,15 @@ jit_symtab_open_impl (struct gdb_symbol_callbacks *cb,
 
 static int
 compare_block (const struct gdb_block *const old,
-               const struct gdb_block *const new)
+               const struct gdb_block *const newobj)
 {
   if (old == NULL)
     return 1;
-  if (old->begin < new->begin)
+  if (old->begin < newobj->begin)
     return 1;
-  else if (old->begin == new->begin)
+  else if (old->begin == newobj->begin)
     {
-      if (old->end > new->end)
+      if (old->end > newobj->end)
         return 1;
       else
         return 0;
@@ -1220,20 +1220,20 @@ static void
 jit_frame_this_id (struct frame_info *this_frame, void **cache,
                    struct frame_id *this_id)
 {
-  struct jit_unwind_private private;
+  struct jit_unwind_private priv;
   struct gdb_frame_id frame_id;
   struct gdb_reader_funcs *funcs;
   struct gdb_unwind_callbacks callbacks;
 
-  private.registers = NULL;
-  private.this_frame = this_frame;
+  priv.registers = NULL;
+  priv.this_frame = this_frame;
 
   /* We don't expect the frame_id function to set any registers, so we
      set reg_set to NULL.  */
   callbacks.reg_get = jit_unwind_reg_get_impl;
   callbacks.reg_set = NULL;
   callbacks.target_read = jit_target_read_impl;
-  callbacks.priv_data = &private;
+  callbacks.priv_data = &priv;
 
   gdb_assert (loaded_jit_reader);
   funcs = loaded_jit_reader->functions;
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 653eb81..2ed1c17 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -842,7 +842,7 @@ parse_number (struct parser_state *par_state,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -896,7 +896,7 @@ yylex (void)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -905,7 +905,7 @@ yylex (void)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1461,21 +1461,21 @@ static struct expression *
 copy_exp (struct expression *expr, int endpos)
 {
   int len = length_of_subexp (expr, endpos);
-  struct expression *new
-    = (struct expression *) malloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
+  struct expression *newobj
+    = (struct expression *) malloc (sizeof (*newobj) + EXP_ELEM_TO_BYTES (len));
 
-  new->nelts = len;
-  memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
-  new->language_defn = 0;
+  newobj->nelts = len;
+  memcpy (newobj->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
+  newobj->language_defn = 0;
 
-  return new;
+  return newobj;
 }
 
 /* Insert the expression NEW into the current expression (expout) at POS.  */
 static void
-insert_exp (struct parser_state *par_state, int pos, struct expression *new)
+insert_exp (struct parser_state *par_state, int pos, struct expression *newobj)
 {
-  int newlen = new->nelts;
+  int newlen = newobj->nelts;
   int i;
 
   /* Grow expout if necessary.  In this function's only use at present,
@@ -1485,7 +1485,7 @@ insert_exp (struct parser_state *par_state, int pos, struct expression *new)
   for (i = par_state->expout_ptr - 1; i >= pos; i--)
     par_state->expout->elts[i + newlen] = par_state->expout->elts[i];
   
-  memcpy (par_state->expout->elts + pos, new->elts,
+  memcpy (par_state->expout->elts + pos, newobj->elts,
 	  EXP_ELEM_TO_BYTES (newlen));
   par_state->expout_ptr += newlen;
 }
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 6b525a0..7ce4991 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -387,7 +387,7 @@ have_threads_callback (struct thread_info *thread, void *args)
   if (ptid_get_pid (thread->ptid) != pid)
     return 0;
 
-  return thread->private != NULL;
+  return thread->priv != NULL;
 }
 
 static int
@@ -1279,10 +1279,10 @@ thread_db_inferior_created (struct target_ops *target, int from_tty)
    from libthread_db thread state information.  */
 
 static void
-update_thread_state (struct private_thread_info *private,
+update_thread_state (struct private_thread_info *priv,
 		     const td_thrinfo_t *ti_p)
 {
-  private->dying = (ti_p->ti_state == TD_THR_UNKNOWN
+  priv->dying = (ti_p->ti_state == TD_THR_UNKNOWN
 		    || ti_p->ti_state == TD_THR_ZOMBIE);
 }
 
@@ -1294,7 +1294,7 @@ static int
 attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
 	       const td_thrinfo_t *ti_p)
 {
-  struct private_thread_info *private;
+  struct private_thread_info *priv;
   struct thread_info *tp;
   td_err_e err;
   struct thread_db_info *info;
@@ -1319,9 +1319,9 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
 	 PTRACE_EVENT_CLONE); assume the same mechanism notices thread
 	 exit, so this can not be a stale thread recreated with the
 	 same ID.  */
-      if (tp->private != NULL)
+      if (tp->priv != NULL)
 	{
-	  if (!tp->private->dying)
+	  if (!tp->priv->dying)
 	    return 0;
 
 	  delete_thread (ptid);
@@ -1356,8 +1356,8 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
     }
 
   /* Construct the thread's private data.  */
-  private = xmalloc (sizeof (struct private_thread_info));
-  memset (private, 0, sizeof (struct private_thread_info));
+  priv = xmalloc (sizeof (struct private_thread_info));
+  memset (priv, 0, sizeof (struct private_thread_info));
 
   /* A thread ID of zero may mean the thread library has not initialized
      yet.  But we shouldn't even get here if that's the case.  FIXME:
@@ -1365,15 +1365,15 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
      list this will have to go somewhere else; maybe private == NULL
      until the thread_db target claims it.  */
   gdb_assert (ti_p->ti_tid != 0);
-  private->th = *th_p;
-  private->tid = ti_p->ti_tid;
-  update_thread_state (private, ti_p);
+  priv->th = *th_p;
+  priv->tid = ti_p->ti_tid;
+  update_thread_state (priv, ti_p);
 
   /* Add the thread to GDB's thread list.  */
   if (tp == NULL)
-    add_thread_with_info (ptid, private);
+    add_thread_with_info (ptid, priv);
   else
-    tp->private = private;
+    tp->priv = priv;
 
   info = get_thread_db_info (ptid_get_pid (ptid));
 
@@ -1404,8 +1404,8 @@ detach_thread (ptid_t ptid)
      something re-uses its thread ID.  We'll report the thread exit
      when the underlying LWP dies.  */
   thread_info = find_thread_ptid (ptid);
-  gdb_assert (thread_info != NULL && thread_info->private != NULL);
-  thread_info->private->dying = 1;
+  gdb_assert (thread_info != NULL && thread_info->priv != NULL);
+  thread_info->priv->dying = 1;
 }
 
 static void
@@ -1682,7 +1682,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 
   ptid = ptid_build (info->pid, ti.ti_lid, 0);
   tp = find_thread_ptid (ptid);
-  if (tp == NULL || tp->private == NULL)
+  if (tp == NULL || tp->priv == NULL)
     {
       if (attach_thread (ptid, th_p, &ti))
 	cb_data->new_threads += 1;
@@ -1699,7 +1699,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
     {
       /* Need to update this if not using the libthread_db events
 	 (particularly, the TD_DEATH event).  */
-      update_thread_state (tp->private, &ti);
+      update_thread_state (tp->priv, &ti);
     }
 
   return 0;
@@ -1834,12 +1834,12 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
   struct thread_info *thread_info = find_thread_ptid (ptid);
   struct target_ops *beneath;
 
-  if (thread_info != NULL && thread_info->private != NULL)
+  if (thread_info != NULL && thread_info->priv != NULL)
     {
       static char buf[64];
       thread_t tid;
 
-      tid = thread_info->private->tid;
+      tid = thread_info->priv->tid;
       snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
 		tid, ptid_get_lwp (ptid));
 
@@ -1857,10 +1857,10 @@ static char *
 thread_db_extra_thread_info (struct target_ops *self,
 			     struct thread_info *info)
 {
-  if (info->private == NULL)
+  if (info->priv == NULL)
     return NULL;
 
-  if (info->private->dying)
+  if (info->priv->dying)
     return "Exiting";
 
   return NULL;
@@ -1885,7 +1885,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
   /* Find the matching thread.  */
   thread_info = find_thread_ptid (ptid);
 
-  if (thread_info != NULL && thread_info->private != NULL)
+  if (thread_info != NULL && thread_info->priv != NULL)
     {
       td_err_e err;
       psaddr_t address;
@@ -1904,7 +1904,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 	  /* Note the cast through uintptr_t: this interface only works if
 	     a target address fits in a psaddr_t, which is a host pointer.
 	     So a 32-bit debugger can not access 64-bit TLS through this.  */
-	  err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
+	  err = info->td_thr_tls_get_addr_p (&thread_info->priv->th,
 					     (psaddr_t)(uintptr_t) lm,
 					     offset, &address);
 	}
@@ -1922,7 +1922,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 	     PR libc/16831 due to GDB PR threads/16954 LOAD_MODULE is also NULL.
 	     The constant number 1 depends on GNU __libc_setup_tls
 	     initialization of l_tls_modid to 1.  */
-	  err = info->td_thr_tlsbase_p (&thread_info->private->th,
+	  err = info->td_thr_tlsbase_p (&thread_info->priv->th,
 					1, &address);
 	  address = (char *) address + offset;
 	}
@@ -1962,7 +1962,7 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
 {
   long *tid = (long *) data;
 
-  if (thread->private->tid == *tid)
+  if (thread->priv->tid == *tid)
     return 1;
 
   return 0;
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 4c50e66..4c5341e 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -450,7 +450,7 @@ macro_include (struct macro_source_file *source,
                int line,
                const char *included)
 {
-  struct macro_source_file *new;
+  struct macro_source_file *newobj;
   struct macro_source_file **link;
 
   /* Find the right position in SOURCE's `includes' list for the new
@@ -496,13 +496,13 @@ macro_include (struct macro_source_file *source,
   /* At this point, we know that LINE is an unused line number, and
      *LINK points to the entry an #inclusion at that line should
      precede.  */
-  new = new_source_file (source->table, included);
-  new->included_by = source;
-  new->included_at_line = line;
-  new->next_included = *link;
-  *link = new;
+  newobj = new_source_file (source->table, included);
+  newobj->included_by = source;
+  newobj->included_at_line = line;
+  newobj->next_included = *link;
+  *link = newobj;
 
-  return new;
+  return newobj;
 }
 
 
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 5965761..058bb7c 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -430,24 +430,24 @@ static struct parse_stack
 static void
 push_parse_stack (void)
 {
-  struct parse_stack *new;
+  struct parse_stack *newobj;
 
   /* Reuse frames if possible.  */
   if (top_stack && top_stack->prev)
-    new = top_stack->prev;
+    newobj = top_stack->prev;
   else
-    new = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
+    newobj = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
   /* Initialize new frame with previous content.  */
   if (top_stack)
     {
-      struct parse_stack *prev = new->prev;
+      struct parse_stack *prev = newobj->prev;
 
-      *new = *top_stack;
-      top_stack->prev = new;
-      new->prev = prev;
-      new->next = top_stack;
+      *newobj = *top_stack;
+      top_stack->prev = newobj;
+      newobj->prev = prev;
+      newobj->next = top_stack;
     }
-  top_stack = new;
+  top_stack = newobj;
 }
 
 /* Exit a lexical context.  */
@@ -559,7 +559,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
   struct type *t;
   struct field *f;
   int count = 1;
-  enum address_class class;
+  enum address_class theclass;
   TIR tir;
   long svalue = sh->value;
   int bitsize;
@@ -600,7 +600,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       break;
 
     case stGlobal:		/* External symbol, goes into global block.  */
-      class = LOC_STATIC;
+      theclass = LOC_STATIC;
       b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
 			     GLOBAL_BLOCK);
       s = new_symbol (name);
@@ -608,7 +608,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       goto data;
 
     case stStatic:		/* Static data, goes into current block.  */
-      class = LOC_STATIC;
+      theclass = LOC_STATIC;
       b = top_stack->cur_block;
       s = new_symbol (name);
       if (SC_IS_COMMON (sh->sc))
@@ -629,13 +629,13 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       s = new_symbol (name);
       SYMBOL_VALUE (s) = svalue;
       if (sh->sc == scRegister)
-	class = mdebug_register_index;
+	theclass = mdebug_register_index;
       else
-	class = LOC_LOCAL;
+	theclass = LOC_LOCAL;
 
     data:			/* Common code for symbols describing data.  */
       SYMBOL_DOMAIN (s) = VAR_DOMAIN;
-      SYMBOL_ACLASS_INDEX (s) = class;
+      SYMBOL_ACLASS_INDEX (s) = theclass;
       add_symbol (s, top_stack->cur_st, b);
 
       /* Type could be missing if file is compiled without debugging info.  */
@@ -3416,7 +3416,7 @@ parse_partial_symbols (struct objfile *objfile)
 	  for (cur_sdx = 0; cur_sdx < fh->csym;)
 	    {
 	      char *name;
-	      enum address_class class;
+	      enum address_class theclass;
 	      CORE_ADDR minsym_value;
 
 	      (*swap_sym_in) (cur_bfd,
@@ -3572,7 +3572,7 @@ parse_partial_symbols (struct objfile *objfile)
 							 mst_file_bss,
 							 SECT_OFF_BSS (objfile),
 							 objfile);
-		  class = LOC_STATIC;
+		  theclass = LOC_STATIC;
 		  break;
 
 		case stIndirect:	/* Irix5 forward declaration */
@@ -3584,11 +3584,11 @@ parse_partial_symbols (struct objfile *objfile)
 		     structs from alpha and mips cc.  */
 		  if (sh.iss == 0 || has_opaque_xref (fh, &sh))
 		    goto skip;
-		  class = LOC_TYPEDEF;
+		  theclass = LOC_TYPEDEF;
 		  break;
 
 		case stConstant:	/* Constant decl */
-		  class = LOC_CONST;
+		  theclass = LOC_CONST;
 		  break;
 
 		case stUnion:
@@ -3644,7 +3644,7 @@ parse_partial_symbols (struct objfile *objfile)
 		}
 	      /* Use this gdb symbol.  */
 	      add_psymbol_to_list (name, strlen (name), 1,
-				   VAR_DOMAIN, class,
+				   VAR_DOMAIN, theclass,
 				   &objfile->static_psymbols,
 				   0, sh.value, psymtab_language, objfile);
 	    skip:
@@ -3658,7 +3658,7 @@ parse_partial_symbols (struct objfile *objfile)
 	  PST_PRIVATE (save_pst)->extern_tab = ext_ptr;
 	  for (; --cur_sdx >= 0; ext_ptr++)
 	    {
-	      enum address_class class;
+	      enum address_class theclass;
 	      SYMR *psh;
 	      char *name;
 	      CORE_ADDR svalue;
@@ -3708,7 +3708,7 @@ parse_partial_symbols (struct objfile *objfile)
 		     Ignore them, as parse_external will ignore them too.  */
 		  continue;
 		case stLabel:
-		  class = LOC_LABEL;
+		  theclass = LOC_LABEL;
 		  break;
 		default:
 		  unknown_ext_complaint (debug_info->ssext + psh->iss);
@@ -3719,12 +3719,12 @@ parse_partial_symbols (struct objfile *objfile)
 		  if (SC_IS_COMMON (psh->sc))
 		    continue;
 
-		  class = LOC_STATIC;
+		  theclass = LOC_STATIC;
 		  break;
 		}
 	      name = debug_info->ssext + psh->iss;
 	      add_psymbol_to_list (name, strlen (name), 1,
-				   VAR_DOMAIN, class,
+				   VAR_DOMAIN, theclass,
 				   &objfile->global_psymbols,
 				   0, svalue,
 				   psymtab_language, objfile);
@@ -4568,7 +4568,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 
 static struct symbol *
 mylookup_symbol (char *name, const struct block *block,
-		 domain_enum domain, enum address_class class)
+		 domain_enum domain, enum address_class theclass)
 {
   struct block_iterator iter;
   int inc;
@@ -4579,14 +4579,14 @@ mylookup_symbol (char *name, const struct block *block,
     {
       if (SYMBOL_LINKAGE_NAME (sym)[0] == inc
 	  && SYMBOL_DOMAIN (sym) == domain
-	  && SYMBOL_CLASS (sym) == class
+	  && SYMBOL_CLASS (sym) == theclass
 	  && strcmp (SYMBOL_LINKAGE_NAME (sym), name) == 0)
 	return sym;
     }
 
   block = BLOCK_SUPERBLOCK (block);
   if (block)
-    return mylookup_symbol (name, block, domain, class);
+    return mylookup_symbol (name, block, domain, theclass);
   return 0;
 }
 
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e6a98f6..a2aac07 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -112,11 +112,11 @@ mem_region_cmp (const void *untyped_lhs, const void *untyped_rhs)
 /* Allocate a new memory region, with default settings.  */
 
 void
-mem_region_init (struct mem_region *new)
+mem_region_init (struct mem_region *newobj)
 {
-  memset (new, 0, sizeof (struct mem_region));
-  new->enabled_p = 1;
-  new->attrib = default_mem_attrib;
+  memset (newobj, 0, sizeof (struct mem_region));
+  newobj->enabled_p = 1;
+  newobj->attrib = default_mem_attrib;
 }
 
 /* This function should be called before any command which would
@@ -174,7 +174,7 @@ static void
 create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 		   const struct mem_attrib *attrib)
 {
-  struct mem_region new;
+  struct mem_region newobj;
   int i, ix;
 
   /* lo == hi is a useless empty region.  */
@@ -184,11 +184,11 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
       return;
     }
 
-  mem_region_init (&new);
-  new.lo = lo;
-  new.hi = hi;
+  mem_region_init (&newobj);
+  newobj.lo = lo;
+  newobj.hi = hi;
 
-  ix = VEC_lower_bound (mem_region_s, mem_region_list, &new,
+  ix = VEC_lower_bound (mem_region_s, mem_region_list, &newobj,
 			mem_region_lessthan);
 
   /* Check for an overlapping memory region.  We only need to check
@@ -214,9 +214,9 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 	}
     }
 
-  new.number = ++mem_number;
-  new.attrib = *attrib;
-  VEC_safe_insert (mem_region_s, mem_region_list, ix, &new);
+  newobj.number = ++mem_number;
+  newobj.attrib = *attrib;
+  VEC_safe_insert (mem_region_s, mem_region_list, ix, &newobj);
 }
 
 /*
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index d9b37f8..ee0bbc6 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -35,7 +35,7 @@ extern unsigned int varobjdebug;		/* defined in varobj.c.  */
 
 static void varobj_update_one (struct varobj *var,
 			       enum print_values print_values,
-			       int explicit);
+			       int is_explicit);
 
 static int mi_print_value_p (struct varobj *var,
 			     enum print_values print_values);
@@ -730,14 +730,14 @@ mi_cmd_var_update (char *command, char **argv, int argc)
 
 static void
 varobj_update_one (struct varobj *var, enum print_values print_values,
-		   int explicit)
+		   int is_explicit)
 {
   struct ui_out *uiout = current_uiout;
   VEC (varobj_update_result) *changes;
   varobj_update_result *r;
   int i;
   
-  changes = varobj_update (&var, explicit);
+  changes = varobj_update (&var, is_explicit);
   
   for (i = 0; VEC_iterate (varobj_update_result, changes, i, r); ++i)
     {
@@ -803,14 +803,14 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
       ui_out_field_int (uiout, "has_more",
 			varobj_has_more (r->varobj, to));
 
-      if (r->new)
+      if (r->newobj)
 	{
 	  int j;
 	  varobj_p child;
 	  struct cleanup *cleanup;
 
 	  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children");
-	  for (j = 0; VEC_iterate (varobj_p, r->new, j, child); ++j)
+	  for (j = 0; VEC_iterate (varobj_p, r->newobj, j, child); ++j)
 	    {
 	      struct cleanup *cleanup_child;
 
@@ -821,8 +821,8 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
 	    }
 
 	  do_cleanups (cleanup);
-	  VEC_free (varobj_p, r->new);
-	  r->new = NULL;	/* Paranoia.  */
+	  VEC_free (varobj_p, r->newobj);
+	  r->newobj = NULL;	/* Paranoia.  */
 	}
 
       do_cleanups (cleanup);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 83b2070..f8985e8 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -550,7 +550,7 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc_in,
 {
   int lo;
   int hi;
-  int new;
+  int newobj;
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
   struct minimal_symbol *best_symbol = NULL;
@@ -617,15 +617,15 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc_in,
 		{
 		  /* pc is still strictly less than highest address.  */
 		  /* Note "new" will always be >= lo.  */
-		  new = (lo + hi) / 2;
-		  if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[new]) >= pc)
-		      || (lo == new))
+		  newobj = (lo + hi) / 2;
+		  if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[newobj]) >= pc)
+		      || (lo == newobj))
 		    {
-		      hi = new;
+		      hi = newobj;
 		    }
 		  else
 		    {
-		      lo = new;
+		      lo = newobj;
 		    }
 		}
 
@@ -975,7 +975,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
 				 struct objfile *objfile)
 {
   struct obj_section *obj_section;
-  struct msym_bunch *new;
+  struct msym_bunch *newobj;
   struct minimal_symbol *msymbol;
 
   /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
@@ -1001,10 +1001,10 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
 
   if (msym_bunch_index == BUNCH_SIZE)
     {
-      new = XCNEW (struct msym_bunch);
+      newobj = XCNEW (struct msym_bunch);
       msym_bunch_index = 0;
-      new->next = msym_bunch;
-      msym_bunch = new;
+      newobj->next = msym_bunch;
+      msym_bunch = newobj;
     }
   msymbol = &msym_bunch->contents[msym_bunch_index];
   MSYMBOL_SET_LANGUAGE (msymbol, language_auto,
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 37d1ff1..b1fae73 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -407,8 +407,8 @@ x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state,
       int align = addr % max_wp_len;
       /* Four (eight on AMD64) is the maximum length a debug register
 	 can watch.  */
-      int try = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
-      int size = size_try_array[try][align];
+      int attempt = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
+      int size = size_try_array[attempt][align];
 
       if (what == WP_COUNT)
 	{
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 323d614..7312060 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -247,24 +247,24 @@ update_thread_private_data_name (struct thread_info *new_thread,
   gdb_assert (newname != NULL);
   gdb_assert (new_thread != NULL);
   newnamelen = strlen (newname);
-  if (!new_thread->private)
+  if (!new_thread->priv)
     {
-      new_thread->private = xmalloc (offsetof (struct private_thread_info,
+      new_thread->priv = xmalloc (offsetof (struct private_thread_info,
 					       name)
 				     + newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
-  else if (strcmp (newname, new_thread->private->name) != 0)
+  else if (strcmp (newname, new_thread->priv->name) != 0)
     {
       /* Reallocate if neccessary.  */
-      int oldnamelen = strlen (new_thread->private->name);
+      int oldnamelen = strlen (new_thread->priv->name);
 
       if (oldnamelen < newnamelen)
-	new_thread->private = xrealloc (new_thread->private,
+	new_thread->priv = xrealloc (new_thread->priv,
 					offsetof (struct private_thread_info,
 						  name)
 					+ newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
 }
 
@@ -299,7 +299,7 @@ update_thread_private_data (struct thread_info *new_thread,
 
   update_thread_private_data_name (new_thread, tn->name_buf);
 
-  pti = (struct private_thread_info *) new_thread->private;
+  pti = (struct private_thread_info *) new_thread->priv;
   pti->tid = tid;
   pti->state = state;
   pti->flags = flags;
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index b6e8600..93c230c 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -364,9 +364,9 @@ static const char *nto_thread_state_str[] =
 char *
 nto_extra_thread_info (struct target_ops *self, struct thread_info *ti)
 {
-  if (ti && ti->private
-      && ti->private->state < ARRAY_SIZE (nto_thread_state_str))
-    return (char *)nto_thread_state_str [ti->private->state];
+  if (ti && ti->priv
+      && ti->priv->state < ARRAY_SIZE (nto_thread_state_str))
+    return (char *)nto_thread_state_str [ti->priv->state];
   return "";
 }
 
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 979ba01..0d1d96b 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -65,7 +65,7 @@ struct objc_class {
 
 struct objc_super {
   CORE_ADDR receiver;
-  CORE_ADDR class;
+  CORE_ADDR theclass;
 };
 
 struct objc_method {
@@ -413,16 +413,16 @@ static char *msglist_sel;
 void
 start_msglist(void)
 {
-  struct selname *new = 
+  struct selname *newobj =
     (struct selname *) xmalloc (sizeof (struct selname));
 
-  new->next = selname_chain;
-  new->msglist_len = msglist_len;
-  new->msglist_sel = msglist_sel;
+  newobj->next = selname_chain;
+  newobj->msglist_len = msglist_len;
+  newobj->msglist_sel = msglist_sel;
   msglist_len = 0;
   msglist_sel = (char *)xmalloc(1);
   *msglist_sel = 0;
-  selname_chain = new;
+  selname_chain = newobj;
 }
 
 void
@@ -856,7 +856,7 @@ parse_selector (char *method, char **selector)
 }
 
 static char * 
-parse_method (char *method, char *type, char **class, 
+parse_method (char *method, char *type, char **theclass,
 	      char **category, char **selector)
 {
   char *s1 = NULL;
@@ -869,7 +869,7 @@ parse_method (char *method, char *type, char **class,
   char *nselector = NULL;
 
   gdb_assert (type != NULL);
-  gdb_assert (class != NULL);
+  gdb_assert (theclass != NULL);
   gdb_assert (category != NULL);
   gdb_assert (selector != NULL);
   
@@ -941,8 +941,8 @@ parse_method (char *method, char *type, char **class,
 
   if (type != NULL)
     *type = ntype;
-  if (class != NULL)
-    *class = nclass;
+  if (theclass != NULL)
+    *theclass = nclass;
   if (category != NULL)
     *category = ncategory;
   if (selector != NULL)
@@ -952,7 +952,7 @@ parse_method (char *method, char *type, char **class,
 }
 
 static void
-find_methods (char type, const char *class, const char *category, 
+find_methods (char type, const char *theclass, const char *category, 
 	      const char *selector,
 	      VEC (const_char_ptr) **symbol_names)
 {
@@ -1018,8 +1018,8 @@ find_methods (char type, const char *class, const char *category,
 	  if ((type != '\0') && (ntype != type))
 	    continue;
 
-	  if ((class != NULL) 
-	      && ((nclass == NULL) || (strcmp (class, nclass) != 0)))
+	  if ((theclass != NULL)
+	      && ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
 	    continue;
 
 	  if ((category != NULL) && 
@@ -1112,7 +1112,7 @@ const char *
 find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
 {
   char type = '\0';
-  char *class = NULL;
+  char *theclass = NULL;
   char *category = NULL;
   char *selector = NULL;
 
@@ -1125,7 +1125,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
 
   buf = (char *) alloca (strlen (method) + 1);
   strcpy (buf, method);
-  tmp = parse_method (buf, &type, &class, &category, &selector);
+  tmp = parse_method (buf, &type, &theclass, &category, &selector);
 
   if (tmp == NULL)
     {
@@ -1138,7 +1138,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
       selector_case = 1;
     }
 
-  find_methods (type, class, category, selector, symbol_names);
+  find_methods (type, theclass, category, selector, symbol_names);
 
   /* If we hit the "selector" case, and we found some methods, then
      add the selector itself as a symbol, if it exists.  */
@@ -1417,34 +1417,34 @@ read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   super->receiver = read_memory_unsigned_integer (addr, 4, byte_order);
-  super->class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+  super->theclass = read_memory_unsigned_integer (addr + 4, 4, byte_order);
 };
 
 static void 
 read_objc_class (struct gdbarch *gdbarch, CORE_ADDR addr,
-		 struct objc_class *class)
+		 struct objc_class *theclass)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
-  class->isa = read_memory_unsigned_integer (addr, 4, byte_order);
-  class->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
-  class->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
-  class->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
-  class->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
-  class->instance_size = read_memory_unsigned_integer (addr + 18, 4,
+  theclass->isa = read_memory_unsigned_integer (addr, 4, byte_order);
+  theclass->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+  theclass->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
+  theclass->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
+  theclass->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
+  theclass->instance_size = read_memory_unsigned_integer (addr + 18, 4,
 						       byte_order);
-  class->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
-  class->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
-  class->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
-  class->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
+  theclass->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
+  theclass->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
+  theclass->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
+  theclass->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
 }
 
 static CORE_ADDR
 find_implementation_from_class (struct gdbarch *gdbarch,
-				CORE_ADDR class, CORE_ADDR sel)
+				CORE_ADDR theclass, CORE_ADDR sel)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  CORE_ADDR subclass = class;
+  CORE_ADDR subclass = theclass;
 
   while (subclass != 0) 
     {
@@ -1563,10 +1563,10 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
   sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
 
   read_objc_super (gdbarch, super, &sstr);
-  if (sstr.class == 0)
+  if (sstr.theclass == 0)
     return 0;
   
-  res = find_implementation_from_class (gdbarch, sstr.class, sel);
+  res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
   if (new_pc != 0)
     *new_pc = res;
   if (res == 0)
@@ -1591,10 +1591,10 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
   sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
 
   read_objc_super (gdbarch, super, &sstr);
-  if (sstr.class == 0)
+  if (sstr.theclass == 0)
     return 0;
   
-  res = find_implementation_from_class (gdbarch, sstr.class, sel);
+  res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
   if (new_pc != 0)
     *new_pc = res;
   if (res == 0)
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..c214cf1 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1103,7 +1103,7 @@ pop_current_type (void)
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1173,8 +1173,8 @@ yylex (void)
   /* See if it is a special token of length 3.  */
   if (explen > 2)
     for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-      if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
-          && (!isalpha (tokentab3[i].operator[0]) || explen == 3
+      if (strncasecmp (tokstart, tokentab3[i].oper, 3) == 0
+          && (!isalpha (tokentab3[i].oper[0]) || explen == 3
               || (!isalpha (tokstart[3])
 		  && !isdigit (tokstart[3]) && tokstart[3] != '_')))
         {
@@ -1186,8 +1186,8 @@ yylex (void)
   /* See if it is a special token of length 2.  */
   if (explen > 1)
   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-      if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
-          && (!isalpha (tokentab2[i].operator[0]) || explen == 2
+      if (strncasecmp (tokstart, tokentab2[i].oper, 2) == 0
+          && (!isalpha (tokentab2[i].oper[0]) || explen == 2
               || (!isalpha (tokstart[2])
 		  && !isdigit (tokstart[2]) && tokstart[2] != '_')))
         {
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index ead0ac2..f7e2aae 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -483,10 +483,10 @@ const char pascal_vtbl_ptr_name[] =
 int
 pascal_object_is_vtbl_ptr_type (struct type *type)
 {
-  const char *typename = type_name_no_tag (type);
+  const char *type_name = type_name_no_tag (type);
 
-  return (typename != NULL
-	  && strcmp (typename, pascal_vtbl_ptr_name) == 0);
+  return (type_name != NULL
+	  && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
 }
 
 /* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/parse.c b/gdb/parse.c
index ce60d69..af01947 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -140,13 +140,13 @@ static struct funcall *funcall_chain;
 void
 start_arglist (void)
 {
-  struct funcall *new;
+  struct funcall *newobj;
 
-  new = (struct funcall *) xmalloc (sizeof (struct funcall));
-  new->next = funcall_chain;
-  new->arglist_len = arglist_len;
+  newobj = (struct funcall *) xmalloc (sizeof (struct funcall));
+  newobj->next = funcall_chain;
+  newobj->arglist_len = arglist_len;
   arglist_len = 0;
-  funcall_chain = new;
+  funcall_chain = newobj;
 }
 
 /* Return the number of arguments in a function call just terminated,
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index abf5a2c..a377ec3 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -114,7 +114,7 @@ struct objc_class_str
   {
     struct stoken stoken;
     struct type *type;
-    int class;
+    int theclass;
   };
 
 typedef struct type *type_ptr;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 88a07d1..cdbed30 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1496,7 +1496,7 @@ display_command (char *arg, int from_tty)
 {
   struct format_data fmt;
   struct expression *expr;
-  struct display *new;
+  struct display *newobj;
   int display_it = 1;
   const char *exp = arg;
 
@@ -1535,20 +1535,20 @@ display_command (char *arg, int from_tty)
       innermost_block = NULL;
       expr = parse_expression (exp);
 
-      new = (struct display *) xmalloc (sizeof (struct display));
+      newobj = (struct display *) xmalloc (sizeof (struct display));
 
-      new->exp_string = xstrdup (exp);
-      new->exp = expr;
-      new->block = innermost_block;
-      new->pspace = current_program_space;
-      new->next = display_chain;
-      new->number = ++display_number;
-      new->format = fmt;
-      new->enabled_p = 1;
-      display_chain = new;
+      newobj->exp_string = xstrdup (exp);
+      newobj->exp = expr;
+      newobj->block = innermost_block;
+      newobj->pspace = current_program_space;
+      newobj->next = display_chain;
+      newobj->number = ++display_number;
+      newobj->format = fmt;
+      newobj->enabled_p = 1;
+      display_chain = newobj;
 
       if (from_tty)
-	do_one_display (new);
+	do_one_display (newobj);
 
       dont_repeat ();
     }
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 4ee9dc1..b3c2f44 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1247,13 +1247,13 @@ psymtab_to_fullname (struct partial_symtab *ps)
   return ps->fullname;
 }
 
-/*  For all symbols, s, in BLOCK that are in NAMESPACE and match NAME
+/*  For all symbols, s, in BLOCK that are in DOMAIN and match NAME
     according to the function MATCH, call CALLBACK(BLOCK, s, DATA).
     BLOCK is assumed to come from OBJFILE.  Returns 1 iff CALLBACK
     ever returns non-zero, and otherwise returns 0.  */
 
 static int
-map_block (const char *name, domain_enum namespace, struct objfile *objfile,
+map_block (const char *name, domain_enum domain, struct objfile *objfile,
 	   struct block *block,
 	   int (*callback) (struct block *, struct symbol *, void *),
 	   void *data, symbol_compare_ftype *match)
@@ -1265,7 +1265,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
        sym != NULL; sym = block_iter_match_next (name, match, &iter))
     {
       if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), 
-				 SYMBOL_DOMAIN (sym), namespace))
+				 SYMBOL_DOMAIN (sym), domain))
 	{
 	  if (callback (block, sym, data))
 	    return 1;
@@ -1280,7 +1280,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
 
 static void
 psym_map_matching_symbols (struct objfile *objfile,
-			   const char *name, domain_enum namespace,
+			   const char *name, domain_enum domain,
 			   int global,
 			   int (*callback) (struct block *,
 					    struct symbol *, void *),
@@ -1295,7 +1295,7 @@ psym_map_matching_symbols (struct objfile *objfile,
     {
       QUIT;
       if (ps->readin
-	  || match_partial_symbol (objfile, ps, global, name, namespace, match,
+	  || match_partial_symbol (objfile, ps, global, name, domain, match,
 				   ordered_compare))
 	{
 	  struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
@@ -1304,7 +1304,7 @@ psym_map_matching_symbols (struct objfile *objfile,
 	  if (cust == NULL)
 	    continue;
 	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
-	  if (map_block (name, namespace, objfile, block,
+	  if (map_block (name, domain, objfile, block,
 			 callback, data, match))
 	    return;
 	  if (callback (block, NULL, data))
@@ -1550,12 +1550,12 @@ psymbol_hash (const void *addr, int length)
   struct partial_symbol *psymbol = (struct partial_symbol *) addr;
   unsigned int lang = psymbol->ginfo.language;
   unsigned int domain = PSYMBOL_DOMAIN (psymbol);
-  unsigned int class = PSYMBOL_CLASS (psymbol);
+  unsigned int theclass = PSYMBOL_CLASS (psymbol);
 
   h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
   h = hash_continue (&lang, sizeof (unsigned int), h);
   h = hash_continue (&domain, sizeof (unsigned int), h);
-  h = hash_continue (&class, sizeof (unsigned int), h);
+  h = hash_continue (&theclass, sizeof (unsigned int), h);
   h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h);
 
   return h;
@@ -1633,7 +1633,7 @@ psymbol_bcache_full (struct partial_symbol *sym,
 static const struct partial_symbol *
 add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
 		       domain_enum domain,
-		       enum address_class class,
+		       enum address_class theclass,
 		       long val,	/* Value as a long */
 		       CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
 		       enum language language, struct objfile *objfile,
@@ -1658,7 +1658,7 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
   SYMBOL_SECTION (&psymbol) = -1;
   SYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
   PSYMBOL_DOMAIN (&psymbol) = domain;
-  PSYMBOL_CLASS (&psymbol) = class;
+  PSYMBOL_CLASS (&psymbol) = theclass;
 
   SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
 
@@ -1718,7 +1718,7 @@ append_psymbol_to_list (struct psymbol_allocation_list *list,
 void
 add_psymbol_to_list (const char *name, int namelength, int copy_name,
 		     domain_enum domain,
-		     enum address_class class,
+		     enum address_class theclass,
 		     struct psymbol_allocation_list *list, 
 		     long val,	/* Value as a long */
 		     CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
@@ -1729,7 +1729,7 @@ add_psymbol_to_list (const char *name, int namelength, int copy_name,
   int added;
 
   /* Stash the partial symbol away in the cache.  */
-  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
+  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, theclass,
 				val, coreaddr, language, objfile, &added);
 
   /* Do not duplicate global partial symbols.  */
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 696935b..729bc64 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -147,42 +147,42 @@ static PyObject *
 sympy_is_constant (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return PyBool_FromLong (class == LOC_CONST || class == LOC_CONST_BYTES);
+  return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
 }
 
 static PyObject *
 sympy_is_function (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return PyBool_FromLong (class == LOC_BLOCK);
+  return PyBool_FromLong (theclass == LOC_BLOCK);
 }
 
 static PyObject *
 sympy_is_variable (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
   return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (symbol)
-			  && (class == LOC_LOCAL || class == LOC_REGISTER
-			      || class == LOC_STATIC || class == LOC_COMPUTED
-			      || class == LOC_OPTIMIZED_OUT));
+			  && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
+			      || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+			      || theclass == LOC_OPTIMIZED_OUT));
 }
 
 /* Implementation of gdb.Symbol.needs_frame -> Boolean.
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 7a2fd1a..143e5fd 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -846,7 +846,7 @@ mips_send_packet (const char *s, int get_ack)
   /* unsigned */ int len;
   unsigned char *packet;
   int cksum;
-  int try;
+  int attempt;
 
   len = strlen (s);
   if (len > DATA_MAXLEN)
@@ -873,7 +873,7 @@ mips_send_packet (const char *s, int get_ack)
   /* We can only have one outstanding data packet, so we just wait for
      the acknowledgement here.  Keep retransmitting the packet until
      we get one, or until we've tried too many times.  */
-  for (try = 0; try < mips_send_retries; try++)
+  for (attempt = 0; attempt < mips_send_retries; attempt++)
     {
       int garbage;
       int ch;
diff --git a/gdb/remote.c b/gdb/remote.c
index dbfc10b..8c8085c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1659,15 +1659,15 @@ demand_private_info (ptid_t ptid)
 
   gdb_assert (info);
 
-  if (!info->private)
+  if (!info->priv)
     {
-      info->private = xmalloc (sizeof (*(info->private)));
+      info->priv = xmalloc (sizeof (*(info->priv)));
       info->private_dtor = free_private_thread_info;
-      info->private->core = -1;
-      info->private->extra = 0;
+      info->priv->core = -1;
+      info->priv->extra = 0;
     }
 
-  return info->private;
+  return info->priv;
 }
 
 /* Call this function as a result of
@@ -2910,8 +2910,8 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
     {
       struct thread_info *info = find_thread_ptid (tp->ptid);
 
-      if (info && info->private)
-	return info->private->extra;
+      if (info && info->priv)
+	return info->priv->extra;
       else
 	return NULL;
     }
@@ -11157,8 +11157,8 @@ remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
 {
   struct thread_info *info = find_thread_ptid (ptid);
 
-  if (info && info->private)
-    return info->private->core;
+  if (info && info->priv)
+    return info->priv->core;
   return -1;
 }
 
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index d742f82..f96841f 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -271,7 +271,7 @@ darwin_current_sos (void)
       char *file_path;
       int errcode;
       struct darwin_so_list *dnew;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
 
       /* Read image info from inferior.  */
@@ -302,22 +302,22 @@ darwin_current_sos (void)
 
       /* Create and fill the new so_list element.  */
       dnew = XCNEW (struct darwin_so_list);
-      new = &dnew->sl;
+      newobj = &dnew->sl;
       old_chain = make_cleanup (xfree, dnew);
 
-      new->lm_info = &dnew->li;
+      newobj->lm_info = &dnew->li;
 
-      strncpy (new->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
       xfree (file_path);
-      new->lm_info->lm_addr = load_addr;
+      newobj->lm_info->lm_addr = load_addr;
 
       if (head == NULL)
-	head = new;
+	head = newobj;
       else
-	tail->next = new;
-      tail = new;
+	tail->next = newobj;
+      tail = newobj;
 
       discard_cleanups (old_chain);
     }
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index cca6892..3b0bf48 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -119,7 +119,7 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
   struct regcache *regcache = get_thread_regcache (ptid);
   CORE_ADDR pc = regcache_read_pc (regcache);
   struct address_space *aspace = get_regcache_aspace (regcache);
-  ia64_insn t0, t1, slot[3], template, insn;
+  ia64_insn t0, t1, slot[3], templ, insn;
   int slotnum;
   bfd_byte bundle[16];
 
@@ -139,12 +139,12 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
   /* bundles are always in little-endian byte order */
   t0 = bfd_getl64 (bundle);
   t1 = bfd_getl64 (bundle + 8);
-  template = (t0 >> 1) & 0xf;
+  templ = (t0 >> 1) & 0xf;
   slot[0] = (t0 >>  5) & 0x1ffffffffffLL;
   slot[1] = ((t0 >> 46) & 0x3ffff) | ((t1 & 0x7fffff) << 18);
   slot[2] = (t1 >> 23) & 0x1ffffffffffLL;
 
-  if (template == 2 && slotnum == 1)
+  if (templ == 2 && slotnum == 1)
     {
       /* skip L slot in MLI template: */
       slotnum = 2;
diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index 64c3d7f..b7214f1 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -426,7 +426,7 @@ pa64_current_sos (void)
     {
       struct load_module_desc dll_desc;
       char *dll_path;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
 
       if (dll_index == 0)
@@ -443,22 +443,22 @@ pa64_current_sos (void)
 			    pa64_target_read_memory,
 			    0, dld_cache.load_map);
 
-      new = (struct so_list *) xmalloc (sizeof (struct so_list));
-      memset (new, 0, sizeof (struct so_list));
-      new->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
-      memset (new->lm_info, 0, sizeof (struct lm_info));
+      newobj = (struct so_list *) xmalloc (sizeof (struct so_list));
+      memset (newobj, 0, sizeof (struct so_list));
+      newobj->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
+      memset (newobj->lm_info, 0, sizeof (struct lm_info));
 
-      strncpy (new->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
 
-      memcpy (&new->lm_info->desc, &dll_desc, sizeof (dll_desc));
+      memcpy (&newobj->lm_info->desc, &dll_desc, sizeof (dll_desc));
 
 #ifdef SOLIB_PA64_DBG
       {
-        struct load_module_desc *d = &new->lm_info->desc;
+        struct load_module_desc *d = &newobj->lm_info->desc;
 
-	printf ("\n+ library \"%s\" is described at index %d\n", new->so_name, 
+	printf ("\n+ library \"%s\" is described at index %d\n", newobj->so_name, 
 		dll_index);
 	printf ("    text_base = %s\n", hex_string (d->text_base));
 	printf ("    text_size = %s\n", hex_string (d->text_size));
@@ -475,9 +475,9 @@ pa64_current_sos (void)
 #endif
 
       /* Link the new object onto the list.  */
-      new->next = NULL;
-      *link_ptr = new;
-      link_ptr = &new->next;
+      newobj->next = NULL;
+      *link_ptr = newobj;
+      link_ptr = &newobj->next;
     }
 
   return head;
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index deb1d17..27e39a7 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -585,18 +585,18 @@ som_current_sos (void)
     {
       char *namebuf;
       CORE_ADDR addr;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
       int errcode;
       struct dld_list dbuf;
       gdb_byte tsdbuf[4];
 
-      new = (struct so_list *) xmalloc (sizeof (struct so_list));
-      old_chain = make_cleanup (xfree, new);
+      newobj = (struct so_list *) xmalloc (sizeof (struct so_list));
+      old_chain = make_cleanup (xfree, newobj);
 
-      memset (new, 0, sizeof (*new));
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      make_cleanup (xfree, new->lm_info);
+      memset (newobj, 0, sizeof (*newobj));
+      newobj->lm_info = xmalloc (sizeof (struct lm_info));
+      make_cleanup (xfree, newobj->lm_info);
 
       read_memory (lm, (gdb_byte *)&dbuf, sizeof (struct dld_list));
 
@@ -608,15 +608,15 @@ som_current_sos (void)
 		 safe_strerror (errcode));
       else
 	{
-	  strncpy (new->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
-	  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+	  strncpy (newobj->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
+	  newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
 	  xfree (namebuf);
-	  strcpy (new->so_original_name, new->so_name);
+	  strcpy (newobj->so_original_name, newobj->so_name);
 	}
 
-	if (new->so_name[0] && !match_main (new->so_name))
+	if (newobj->so_name[0] && !match_main (newobj->so_name))
 	  {
-	    struct lm_info *lmi = new->lm_info;
+	    struct lm_info *lmi = newobj->lm_info;
 	    unsigned int tmp;
 
 	    lmi->lm_addr = lm;
@@ -642,41 +642,41 @@ som_current_sos (void)
 	      = extract_unsigned_integer (tsdbuf, 4, byte_order);
 
 #ifdef SOLIB_SOM_DBG
-	    printf ("\n+ library \"%s\" is described at %s\n", new->so_name,
+	    printf ("\n+ library \"%s\" is described at %s\n", newobj->so_name,
 	    	    paddress (target_gdbarch (), lm));
-	    printf ("  'version' is %d\n", new->lm_info->struct_version);
-	    printf ("  'bind_mode' is %d\n", new->lm_info->bind_mode);
+	    printf ("  'version' is %d\n", newobj->lm_info->struct_version);
+	    printf ("  'bind_mode' is %d\n", newobj->lm_info->bind_mode);
 	    printf ("  'library_version' is %d\n", 
-	    	    new->lm_info->library_version);
+		    newobj->lm_info->library_version);
 	    printf ("  'text_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->text_addr));
 	    printf ("  'text_link_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_link_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->text_link_addr));
 	    printf ("  'text_end' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_end));
+		    paddress (target_gdbarch (), newobj->lm_info->text_end));
 	    printf ("  'data_start' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->data_start));
+		    paddress (target_gdbarch (), newobj->lm_info->data_start));
 	    printf ("  'bss_start' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->bss_start));
+		    paddress (target_gdbarch (), newobj->lm_info->bss_start));
 	    printf ("  'data_end' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->data_end));
+		    paddress (target_gdbarch (), newobj->lm_info->data_end));
 	    printf ("  'got_value' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->got_value));
+		    paddress (target_gdbarch (), newobj->lm_info->got_value));
 	    printf ("  'tsd_start_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->tsd_start_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->tsd_start_addr));
 #endif
 
-	    new->addr_low = lmi->text_addr;
-	    new->addr_high = lmi->text_end;
+	    newobj->addr_low = lmi->text_addr;
+	    newobj->addr_high = lmi->text_end;
 
 	    /* Link the new object onto the list.  */
-	    new->next = NULL;
-	    *link_ptr = new;
-	    link_ptr = &new->next;
+	    newobj->next = NULL;
+	    *link_ptr = newobj;
+	    link_ptr = &newobj->next;
 	  }
  	else
 	  {
-	    free_so (new);
+	    free_so (newobj);
 	  }
 
       lm = EXTRACT (next);
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 6145112..3c8cd1a 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -119,19 +119,19 @@ append_ocl_sos (struct so_list **link_ptr)
 					      byte_order);
 	      if (data != 0x0)
 		{
-		  struct so_list *new;
+		  struct so_list *newobj;
 
 		  /* Allocate so_list structure.  */
-		  new = XCNEW (struct so_list);
+		  newobj = XCNEW (struct so_list);
 
 		  /* Encode FD and object ID in path name.  */
-		  xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
+		  xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>",
 			     hex_string (data),
 			     SPUADDR_SPU (*ocl_program_addr_base));
-		  strcpy (new->so_original_name, new->so_name);
+		  strcpy (newobj->so_original_name, newobj->so_name);
 
-		  *link_ptr = new;
-		  link_ptr = &new->next;
+		  *link_ptr = newobj;
+		  link_ptr = &newobj->next;
 		}
 	    }
 	  if (ex.reason < 0)
@@ -195,7 +195,7 @@ spu_current_sos (void)
   for (i = 0; i < size; i += 4)
     {
       int fd = extract_unsigned_integer (buf + i, 4, byte_order);
-      struct so_list *new;
+      struct so_list *newobj;
 
       unsigned long long addr;
       char annex[32], id[100];
@@ -214,16 +214,16 @@ spu_current_sos (void)
 	continue;
 
       /* Allocate so_list structure.  */
-      new = XCNEW (struct so_list);
+      newobj = XCNEW (struct so_list);
 
       /* Encode FD and object ID in path name.  Choose the name so as not
 	 to conflict with any (normal) SVR4 library path name.  */
-      xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
+      xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>",
 		 hex_string (addr), fd);
-      strcpy (new->so_original_name, new->so_name);
+      strcpy (newobj->so_original_name, newobj->so_name);
 
-      *link_ptr = new;
-      link_ptr = &new->next;
+      *link_ptr = newobj;
+      link_ptr = &newobj->next;
     }
 
   /* Append OpenCL sos.  */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 849c452..2143021 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -932,7 +932,7 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 {
   struct svr4_info *info;
   CORE_ADDR ldsomap;
-  struct so_list *new;
+  struct so_list *newobj;
   struct cleanup *old_chain;
   CORE_ADDR name_lm;
 
@@ -947,11 +947,11 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
   if (!ldsomap)
     return 0;
 
-  new = XCNEW (struct so_list);
-  old_chain = make_cleanup (xfree, new);
-  new->lm_info = lm_info_read (ldsomap);
-  make_cleanup (xfree, new->lm_info);
-  name_lm = new->lm_info ? new->lm_info->l_name : 0;
+  newobj = XCNEW (struct so_list);
+  old_chain = make_cleanup (xfree, newobj);
+  newobj->lm_info = lm_info_read (ldsomap);
+  make_cleanup (xfree, newobj->lm_info);
+  name_lm = newobj->lm_info ? newobj->lm_info->l_name : 0;
   do_cleanups (old_chain);
 
   return (name_lm >= vaddr && name_lm < vaddr + size);
@@ -1087,17 +1087,17 @@ svr4_copy_library_list (struct so_list *src)
 
   while (src != NULL)
     {
-      struct so_list *new;
+      struct so_list *newobj;
 
-      new = xmalloc (sizeof (struct so_list));
-      memcpy (new, src, sizeof (struct so_list));
+      newobj = xmalloc (sizeof (struct so_list));
+      memcpy (newobj, src, sizeof (struct so_list));
 
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      memcpy (new->lm_info, src->lm_info, sizeof (struct lm_info));
+      newobj->lm_info = xmalloc (sizeof (struct lm_info));
+      memcpy (newobj->lm_info, src->lm_info, sizeof (struct lm_info));
 
-      new->next = NULL;
-      *link = new;
-      link = &new->next;
+      newobj->next = NULL;
+      *link = newobj;
+      link = &newobj->next;
 
       src = src->next;
     }
@@ -1272,24 +1272,24 @@ static struct so_list *
 svr4_default_sos (void)
 {
   struct svr4_info *info = get_svr4_info ();
-  struct so_list *new;
+  struct so_list *newobj;
 
   if (!info->debug_loader_offset_p)
     return NULL;
 
-  new = XCNEW (struct so_list);
+  newobj = XCNEW (struct so_list);
 
-  new->lm_info = xzalloc (sizeof (struct lm_info));
+  newobj->lm_info = xzalloc (sizeof (struct lm_info));
 
   /* Nothing will ever check the other fields if we set l_addr_p.  */
-  new->lm_info->l_addr = info->debug_loader_offset;
-  new->lm_info->l_addr_p = 1;
+  newobj->lm_info->l_addr = info->debug_loader_offset;
+  newobj->lm_info->l_addr_p = 1;
 
-  strncpy (new->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
-  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-  strcpy (new->so_original_name, new->so_name);
+  strncpy (newobj->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
+  newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+  strcpy (newobj->so_original_name, newobj->so_name);
 
-  return new;
+  return newobj;
 }
 
 /* Read the whole inferior libraries chain starting at address LM.
@@ -1309,28 +1309,28 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 
   for (; lm != 0; prev_lm = lm, lm = next_lm)
     {
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
       int errcode;
       char *buffer;
 
-      new = XCNEW (struct so_list);
-      old_chain = make_cleanup_free_so (new);
+      newobj = XCNEW (struct so_list);
+      old_chain = make_cleanup_free_so (newobj);
 
-      new->lm_info = lm_info_read (lm);
-      if (new->lm_info == NULL)
+      newobj->lm_info = lm_info_read (lm);
+      if (newobj->lm_info == NULL)
 	{
 	  do_cleanups (old_chain);
 	  return 0;
 	}
 
-      next_lm = new->lm_info->l_next;
+      next_lm = newobj->lm_info->l_next;
 
-      if (new->lm_info->l_prev != prev_lm)
+      if (newobj->lm_info->l_prev != prev_lm)
 	{
 	  warning (_("Corrupted shared library list: %s != %s"),
 		   paddress (target_gdbarch (), prev_lm),
-		   paddress (target_gdbarch (), new->lm_info->l_prev));
+		   paddress (target_gdbarch (), newobj->lm_info->l_prev));
 	  do_cleanups (old_chain);
 	  return 0;
 	}
@@ -1340,18 +1340,18 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
          SVR4, it has no name.  For others (Solaris 2.3 for example), it
          does have a name, so we can no longer use a missing name to
          decide when to ignore it.  */
-      if (ignore_first && new->lm_info->l_prev == 0)
+      if (ignore_first && newobj->lm_info->l_prev == 0)
 	{
 	  struct svr4_info *info = get_svr4_info ();
 
-	  first_l_name = new->lm_info->l_name;
-	  info->main_lm_addr = new->lm_info->lm_addr;
+	  first_l_name = newobj->lm_info->l_name;
+	  info->main_lm_addr = newobj->lm_info->lm_addr;
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
       /* Extract this shared object's name.  */
-      target_read_string (new->lm_info->l_name, &buffer,
+      target_read_string (newobj->lm_info->l_name, &buffer,
 			  SO_NAME_MAX_PATH_SIZE - 1, &errcode);
       if (errcode != 0)
 	{
@@ -1359,30 +1359,30 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 	     inferior executable, then this is not a normal shared
 	     object, but (most likely) a vDSO.  In this case, silently
 	     skip it; otherwise emit a warning. */
-	  if (first_l_name == 0 || new->lm_info->l_name != first_l_name)
+	  if (first_l_name == 0 || newobj->lm_info->l_name != first_l_name)
 	    warning (_("Can't read pathname for load map: %s."),
 		     safe_strerror (errcode));
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
-      strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
       xfree (buffer);
 
       /* If this entry has no name, or its name matches the name
 	 for the main executable, don't include it in the list.  */
-      if (! new->so_name[0] || match_main (new->so_name))
+      if (! newobj->so_name[0] || match_main (newobj->so_name))
 	{
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
       discard_cleanups (old_chain);
-      new->next = 0;
-      **link_ptr_ptr = new;
-      *link_ptr_ptr = &new->next;
+      newobj->next = 0;
+      **link_ptr_ptr = newobj;
+      *link_ptr_ptr = &newobj->next;
     }
 
   return 1;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 2a160c5..a0e6388 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1807,10 +1807,10 @@ again:
         while (**pp && **pp != '#')
           {
             struct type *arg_type = read_type (pp, objfile);
-            struct type_list *new = alloca (sizeof (*new));
-            new->type = arg_type;
-            new->next = arg_types;
-            arg_types = new;
+            struct type_list *newobj = alloca (sizeof (*newobj));
+            newobj->type = arg_type;
+            newobj->next = arg_types;
+            arg_types = newobj;
             num_args++;
           }
         if (**pp == '#')
@@ -2999,7 +2999,7 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
 		    struct objfile *objfile)
 {
   char *p;
-  struct nextfield *new;
+  struct nextfield *newobj;
 
   /* We better set p right now, in case there are no fields at all...    */
 
@@ -3015,11 +3015,11 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
     {
       STABS_CONTINUE (pp, objfile);
       /* Get space to record the next field's data.  */
-      new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (xfree, new);
-      memset (new, 0, sizeof (struct nextfield));
-      new->next = fip->list;
-      fip->list = new;
+      newobj = (struct nextfield *) xmalloc (sizeof (struct nextfield));
+      make_cleanup (xfree, newobj);
+      memset (newobj, 0, sizeof (struct nextfield));
+      newobj->next = fip->list;
+      fip->list = newobj;
 
       /* Get the field name.  */
       p = *pp;
@@ -3097,7 +3097,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 		  struct objfile *objfile)
 {
   int i;
-  struct nextfield *new;
+  struct nextfield *newobj;
 
   if (**pp != '!')
     {
@@ -3137,12 +3137,12 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
-      new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (xfree, new);
-      memset (new, 0, sizeof (struct nextfield));
-      new->next = fip->list;
-      fip->list = new;
-      FIELD_BITSIZE (new->field) = 0;	/* This should be an unpacked
+      newobj = (struct nextfield *) xmalloc (sizeof (struct nextfield));
+      make_cleanup (xfree, newobj);
+      memset (newobj, 0, sizeof (struct nextfield));
+      newobj->next = fip->list;
+      fip->list = newobj;
+      FIELD_BITSIZE (newobj->field) = 0;	/* This should be an unpacked
 					   field!  */
 
       STABS_CONTINUE (pp, objfile);
@@ -3164,8 +3164,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	}
       ++(*pp);
 
-      new->visibility = *(*pp)++;
-      switch (new->visibility)
+      newobj->visibility = *(*pp)++;
+      switch (newobj->visibility)
 	{
 	case VISIBILITY_PRIVATE:
 	case VISIBILITY_PROTECTED:
@@ -3177,8 +3177,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	  {
 	    complaint (&symfile_complaints,
 		       _("Unknown visibility `%c' for baseclass"),
-		       new->visibility);
-	    new->visibility = VISIBILITY_PUBLIC;
+		       newobj->visibility);
+	    newobj->visibility = VISIBILITY_PUBLIC;
 	  }
 	}
 
@@ -3189,7 +3189,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	   corresponding to this baseclass.  Always zero in the absence of
 	   multiple inheritance.  */
 
-	SET_FIELD_BITPOS (new->field, read_huge_number (pp, ',', &nbits, 0));
+	SET_FIELD_BITPOS (newobj->field, read_huge_number (pp, ',', &nbits, 0));
 	if (nbits != 0)
 	  return 0;
       }
@@ -3198,8 +3198,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
          base class.  Read it, and remember it's type name as this
          field's name.  */
 
-      new->field.type = read_type (pp, objfile);
-      new->field.name = type_name_no_tag (new->field.type);
+      newobj->field.type = read_type (pp, objfile);
+      newobj->field.name = type_name_no_tag (newobj->field.type);
 
       /* Skip trailing ';' and bump count of number of fields seen.  */
       if (**pp == ';')
@@ -4350,7 +4350,7 @@ common_block_end (struct objfile *objfile)
      symbol for the common block name for later fixup.  */
   int i;
   struct symbol *sym;
-  struct pending *new = 0;
+  struct pending *newobj = 0;
   struct pending *next;
   int j;
 
@@ -4373,7 +4373,7 @@ common_block_end (struct objfile *objfile)
        next = next->next)
     {
       for (j = 0; j < next->nsyms; j++)
-	add_symbol_to_list (next->symbol[j], &new);
+	add_symbol_to_list (next->symbol[j], &newobj);
     }
 
   /* Copy however much of COMMON_BLOCK we need.  If COMMON_BLOCK is
@@ -4382,9 +4382,9 @@ common_block_end (struct objfile *objfile)
 
   if (common_block != NULL)
     for (j = common_block_i; j < common_block->nsyms; j++)
-      add_symbol_to_list (common_block->symbol[j], &new);
+      add_symbol_to_list (common_block->symbol[j], &newobj);
 
-  SYMBOL_TYPE (sym) = (struct type *) new;
+  SYMBOL_TYPE (sym) = (struct type *) newobj;
 
   /* Should we be putting local_symbols back to what it was?
      Does it matter?  */
@@ -4554,9 +4554,9 @@ cleanup_undefined_types_1 (void)
 		struct pending *ppt;
 		int i;
 		/* Name of the type, without "struct" or "union".  */
-		const char *typename = TYPE_TAG_NAME (*type);
+		const char *type_name = TYPE_TAG_NAME (*type);
 
-		if (typename == NULL)
+		if (type_name == NULL)
 		  {
 		    complaint (&symfile_complaints, _("need a type name"));
 		    break;
@@ -4574,7 +4574,7 @@ cleanup_undefined_types_1 (void)
 			    && (TYPE_INSTANCE_FLAGS (*type) ==
 				TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
 			    && strcmp (SYMBOL_LINKAGE_NAME (sym),
-				       typename) == 0)
+				       type_name) == 0)
                           replace_type (*type, SYMBOL_TYPE (sym));
 		      }
 		  }
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index e0600a9..6a3351a 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -249,7 +249,7 @@ debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 debug_qf_map_matching_symbols (struct objfile *objfile,
-			       const char *name, domain_enum namespace,
+			       const char *name, domain_enum domain,
 			       int global,
 			       int (*callback) (struct block *,
 						struct symbol *, void *),
@@ -263,14 +263,14 @@ debug_qf_map_matching_symbols (struct objfile *objfile,
   fprintf_filtered (gdb_stdlog,
 		    "qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s, %s, %s)\n",
 		    objfile_debug_name (objfile), name,
-		    domain_name (namespace), global,
+		    domain_name (domain), global,
 		    host_address_to_string (callback),
 		    host_address_to_string (data),
 		    host_address_to_string (match),
 		    host_address_to_string (ordered_compare));
 
   debug_data->real_sf->qf->map_matching_symbols (objfile, name,
-						 namespace, global,
+						 domain, global,
 						 callback, data,
 						 match,
 						 ordered_compare);
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 0bf40c1..1f5fa9a 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -238,7 +238,7 @@ struct quick_symbol_functions
   void (*expand_symtabs_with_fullname) (struct objfile *objfile,
 					const char *fullname);
 
-  /* Find global or static symbols in all tables that are in NAMESPACE 
+  /* Find global or static symbols in all tables that are in DOMAIN
      and for which MATCH (symbol name, NAME) == 0, passing each to 
      CALLBACK, reading in partial symbol tables as needed.  Look
      through global symbols if GLOBAL and otherwise static symbols.
@@ -256,7 +256,7 @@ struct quick_symbol_functions
      non-zero to indicate that the scan should be terminated.  */
 
   void (*map_matching_symbols) (struct objfile *,
-				const char *name, domain_enum namespace,
+				const char *name, domain_enum domain,
 				int global,
 				int (*callback) (struct block *,
 						 struct symbol *, void *),
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 84e2680..5302c0e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5028,43 +5028,43 @@ completion_list_add_name (const char *symname,
      of matches.  Note that the name is moved to freshly malloc'd space.  */
 
   {
-    char *new;
+    char *newobj;
     enum maybe_add_completion_enum add_status;
 
     if (word == sym_text)
       {
-	new = xmalloc (strlen (symname) + 5);
-	strcpy (new, symname);
+	newobj = xmalloc (strlen (symname) + 5);
+	strcpy (newobj, symname);
       }
     else if (word > sym_text)
       {
 	/* Return some portion of symname.  */
-	new = xmalloc (strlen (symname) + 5);
-	strcpy (new, symname + (word - sym_text));
+	newobj = xmalloc (strlen (symname) + 5);
+	strcpy (newobj, symname + (word - sym_text));
       }
     else
       {
 	/* Return some of SYM_TEXT plus symname.  */
-	new = xmalloc (strlen (symname) + (sym_text - word) + 5);
-	strncpy (new, word, sym_text - word);
-	new[sym_text - word] = '\0';
-	strcat (new, symname);
+	newobj = xmalloc (strlen (symname) + (sym_text - word) + 5);
+	strncpy (newobj, word, sym_text - word);
+	newobj[sym_text - word] = '\0';
+	strcat (newobj, symname);
       }
 
-    add_status = maybe_add_completion (completion_tracker, new);
+    add_status = maybe_add_completion (completion_tracker, newobj);
 
     switch (add_status)
       {
       case MAYBE_ADD_COMPLETION_OK:
-	VEC_safe_push (char_ptr, return_val, new);
+	VEC_safe_push (char_ptr, return_val, newobj);
 	break;
       case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	VEC_safe_push (char_ptr, return_val, new);
+	VEC_safe_push (char_ptr, return_val, newobj);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_MAX_REACHED:
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_DUPLICATE:
-	xfree (new);
+	xfree (newobj);
 	break;
       }
   }
@@ -5664,30 +5664,30 @@ static void
 add_filename_to_list (const char *fname, const char *text, const char *word,
 		      VEC (char_ptr) **list)
 {
-  char *new;
+  char *newobj;
   size_t fnlen = strlen (fname);
 
   if (word == text)
     {
       /* Return exactly fname.  */
-      new = xmalloc (fnlen + 5);
-      strcpy (new, fname);
+      newobj = xmalloc (fnlen + 5);
+      strcpy (newobj, fname);
     }
   else if (word > text)
     {
       /* Return some portion of fname.  */
-      new = xmalloc (fnlen + 5);
-      strcpy (new, fname + (word - text));
+      newobj = xmalloc (fnlen + 5);
+      strcpy (newobj, fname + (word - text));
     }
   else
     {
       /* Return some of TEXT plus fname.  */
-      new = xmalloc (fnlen + (text - word) + 5);
-      strncpy (new, word, text - word);
-      new[text - word] = '\0';
-      strcat (new, fname);
+      newobj = xmalloc (fnlen + (text - word) + 5);
+      strncpy (newobj, word, text - word);
+      newobj[text - word] = '\0';
+      strcat (newobj, fname);
     }
-  VEC_safe_push (char_ptr, *list, new);
+  VEC_safe_push (char_ptr, *list, newobj);
 }
 
 static int
diff --git a/gdb/thread.c b/gdb/thread.c
index a2a5a9b..01eb2ba 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -182,12 +182,12 @@ clear_thread_inferior_resources (struct thread_info *tp)
 static void
 free_thread (struct thread_info *tp)
 {
-  if (tp->private)
+  if (tp->priv)
     {
       if (tp->private_dtor)
-	tp->private_dtor (tp->private);
+	tp->private_dtor (tp->priv);
       else
-	xfree (tp->private);
+	xfree (tp->priv);
     }
 
   xfree (tp->name);
@@ -288,11 +288,11 @@ add_thread_silent (ptid_t ptid)
 }
 
 struct thread_info *
-add_thread_with_info (ptid_t ptid, struct private_thread_info *private)
+add_thread_with_info (ptid_t ptid, struct private_thread_info *priv)
 {
   struct thread_info *result = add_thread_silent (ptid);
 
-  result->private = private;
+  result->priv = priv;
 
   if (print_thread_events)
     printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
diff --git a/gdb/top.c b/gdb/top.c
index 8242e12..55c6896 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -462,7 +462,7 @@ execute_command (char *p, int from_tty)
 	deprecated_cmd_warning (line);
 
       /* c->user_commands would be NULL in the case of a python command.  */
-      if (c->class == class_user && c->user_commands)
+      if (c->theclass == class_user && c->user_commands)
 	execute_user_command (c, arg);
       else if (c->type == set_cmd)
 	do_set_command (arg, from_tty, c);
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 602bddc..5271ee8 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -253,7 +253,7 @@ tui_check_data_values (struct frame_info *frame)
 	    has changed (data_element_ptr, frame, &new_value)
 	    {
 	      data_element_ptr->value = new_value;
-	      update the display with the new value, hiliting it.
+	      update the display with the newobj value, hiliting it.
 	    }
 #endif
 	}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index d39e2e3..234be7f 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -335,9 +335,9 @@ find_typedef_in_hash (const struct type_print_options *flags, struct type *t)
    NEW is the new name for a type TYPE.  */
 
 void
-typedef_print (struct type *type, struct symbol *new, struct ui_file *stream)
+typedef_print (struct type *type, struct symbol *newobj, struct ui_file *stream)
 {
-  LA_PRINT_TYPEDEF (type, new, stream);
+  LA_PRINT_TYPEDEF (type, newobj, stream);
 }
 
 /* The default way to print a typedef.  */
@@ -499,9 +499,9 @@ whatis_command (char *exp, int from_tty)
 /* TYPENAME is either the name of a type, or an expression.  */
 
 static void
-ptype_command (char *typename, int from_tty)
+ptype_command (char *type_name, int from_tty)
 {
-  whatis_exp (typename, 1);
+  whatis_exp (type_name, 1);
 }
 
 /* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
@@ -592,16 +592,16 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
    and whatis_command().  */
 
 void
-maintenance_print_type (char *typename, int from_tty)
+maintenance_print_type (char *type_name, int from_tty)
 {
   struct value *val;
   struct type *type;
   struct cleanup *old_chain;
   struct expression *expr;
 
-  if (typename != NULL)
+  if (type_name != NULL)
     {
-      expr = parse_expression (typename);
+      expr = parse_expression (type_name);
       old_chain = make_cleanup (free_current_contents, &expr);
       if (expr->elts[0].opcode == OP_TYPE)
 	{
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 24155f9..6673574 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -77,7 +77,7 @@ extern void set_ui_file_put (struct ui_file *stream, ui_file_put_ftype *put);
 
 typedef void (ui_file_delete_ftype) (struct ui_file * stream);
 extern void set_ui_file_data (struct ui_file *stream, void *data,
-			      ui_file_delete_ftype *delete);
+			      ui_file_delete_ftype *to_delete);
 
 typedef int (ui_file_fseek_ftype) (struct ui_file *stream, long offset,
 				   int whence);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index f33515c..fb9ec60 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -284,14 +284,14 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
    situations or combinations thereof.  */
 
 static struct value *
-value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
+value_user_defined_cpp_op (struct value **args, int nargs, char *oper,
                            int *static_memfuncp, enum noside noside)
 {
 
   struct symbol *symp = NULL;
   struct value *valp = NULL;
 
-  find_overload_match (args, nargs, operator, BOTH /* could be method */,
+  find_overload_match (args, nargs, oper, BOTH /* could be method */,
                        &args[0] /* objp */,
                        NULL /* pass NULL symbol since symbol is unknown */,
                        &valp, &symp, static_memfuncp, 0, noside);
@@ -308,7 +308,7 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
       return value_of_variable (symp, 0);
     }
 
-  error (_("Could not find %s."), operator);
+  error (_("Could not find %s."), oper);
 }
 
 /* Lookup user defined operator NAME.  Return a value representing the
diff --git a/gdb/value.c b/gdb/value.c
index 9445f25..06da269 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1790,13 +1790,13 @@ record_latest_value (struct value *val)
   i = value_history_count % VALUE_HISTORY_CHUNK;
   if (i == 0)
     {
-      struct value_history_chunk *new
+      struct value_history_chunk *newobj
 	= (struct value_history_chunk *)
 
       xmalloc (sizeof (struct value_history_chunk));
-      memset (new->values, 0, sizeof new->values);
-      new->next = value_history_chain;
-      value_history_chain = new;
+      memset (newobj->values, 0, sizeof newobj->values);
+      newobj->next = value_history_chain;
+      value_history_chain = newobj;
     }
 
   value_history_chain->values[i] = val;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 43ea96f..ce80bc7 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -702,7 +702,7 @@ static void
 install_dynamic_child (struct varobj *var,
 		       VEC (varobj_p) **changed,
 		       VEC (varobj_p) **type_changed,
-		       VEC (varobj_p) **new,
+		       VEC (varobj_p) **newobj,
 		       VEC (varobj_p) **unchanged,
 		       int *cchanged,
 		       int index,
@@ -713,9 +713,9 @@ install_dynamic_child (struct varobj *var,
       /* There's no child yet.  */
       struct varobj *child = varobj_add_child (var, item);
 
-      if (new)
+      if (newobj)
 	{
-	  VEC_safe_push (varobj_p, *new, child);
+	  VEC_safe_push (varobj_p, *newobj, child);
 	  *cchanged = 1;
 	}
     }
@@ -790,7 +790,7 @@ static int
 update_dynamic_varobj_children (struct varobj *var,
 				VEC (varobj_p) **changed,
 				VEC (varobj_p) **type_changed,
-				VEC (varobj_p) **new,
+				VEC (varobj_p) **newobj,
 				VEC (varobj_p) **unchanged,
 				int *cchanged,
 				int update_children,
@@ -851,7 +851,7 @@ update_dynamic_varobj_children (struct varobj *var,
 
 	  install_dynamic_child (var, can_mention ? changed : NULL,
 				 can_mention ? type_changed : NULL,
-				 can_mention ? new : NULL,
+				 can_mention ? newobj : NULL,
 				 can_mention ? unchanged : NULL,
 				 can_mention ? cchanged : NULL, i,
 				 item);
@@ -1622,11 +1622,11 @@ varobj_value_has_mutated (const struct varobj *var, struct value *new_value,
    to point to the new varobj.  */
 
 VEC(varobj_update_result) *
-varobj_update (struct varobj **varp, int explicit)
+varobj_update (struct varobj **varp, int is_explicit)
 {
   int type_changed = 0;
   int i;
-  struct value *new;
+  struct value *newobj;
   VEC (varobj_update_result) *stack = NULL;
   VEC (varobj_update_result) *result = NULL;
 
@@ -1635,7 +1635,7 @@ varobj_update (struct varobj **varp, int explicit)
      changing type.  One use case for frozen varobjs is
      retaining previously evaluated expressions, and we don't
      want them to be reevaluated at all.  */
-  if (!explicit && (*varp)->frozen)
+  if (!is_explicit && (*varp)->frozen)
     return result;
 
   if (!(*varp)->root->is_valid)
@@ -1660,15 +1660,15 @@ varobj_update (struct varobj **varp, int explicit)
 	 the frame in which a local existed.  We are letting the 
 	 value_of_root variable dispose of the varobj if the type
 	 has changed.  */
-      new = value_of_root (varp, &type_changed);
-      if (update_type_if_necessary(*varp, new))
+      newobj = value_of_root (varp, &type_changed);
+      if (update_type_if_necessary(*varp, newobj))
 	  type_changed = 1;
       r.varobj = *varp;
       r.type_changed = type_changed;
-      if (install_new_value ((*varp), new, type_changed))
+      if (install_new_value ((*varp), newobj, type_changed))
 	r.changed = 1;
       
-      if (new == NULL)
+      if (newobj == NULL)
 	r.status = VAROBJ_NOT_IN_SCOPE;
       r.value_installed = 1;
 
@@ -1703,15 +1703,15 @@ varobj_update (struct varobj **varp, int explicit)
 	{
 	  struct type *new_type;
 
-	  new = value_of_child (v->parent, v->index);
-	  if (update_type_if_necessary(v, new))
+	  newobj = value_of_child (v->parent, v->index);
+	  if (update_type_if_necessary(v, newobj))
 	    r.type_changed = 1;
-	  if (new)
-	    new_type = value_type (new);
+	  if (newobj)
+	    new_type = value_type (newobj);
 	  else
 	    new_type = v->root->lang_ops->type_of_child (v->parent, v->index);
 
-	  if (varobj_value_has_mutated (v, new, new_type))
+	  if (varobj_value_has_mutated (v, newobj, new_type))
 	    {
 	      /* The children are no longer valid; delete them now.
 	         Report the fact that its type changed as well.  */
@@ -1723,7 +1723,7 @@ varobj_update (struct varobj **varp, int explicit)
 	      r.type_changed = 1;
 	    }
 
-	  if (install_new_value (v, new, r.type_changed))
+	  if (install_new_value (v, newobj, r.type_changed))
 	    {
 	      r.changed = 1;
 	      v->updated = 0;
@@ -1735,7 +1735,7 @@ varobj_update (struct varobj **varp, int explicit)
       if (varobj_is_dynamic_p (v))
 	{
 	  VEC (varobj_p) *changed = 0, *type_changed = 0, *unchanged = 0;
-	  VEC (varobj_p) *new = 0;
+	  VEC (varobj_p) *newobj = 0;
 	  int i, children_changed = 0;
 
 	  if (v->frozen)
@@ -1767,14 +1767,14 @@ varobj_update (struct varobj **varp, int explicit)
 
 	  /* If update_dynamic_varobj_children returns 0, then we have
 	     a non-conforming pretty-printer, so we skip it.  */
-	  if (update_dynamic_varobj_children (v, &changed, &type_changed, &new,
+	  if (update_dynamic_varobj_children (v, &changed, &type_changed, &newobj,
 					      &unchanged, &children_changed, 1,
 					      v->from, v->to))
 	    {
-	      if (children_changed || new)
+	      if (children_changed || newobj)
 		{
 		  r.children_changed = 1;
-		  r.new = new;
+		  r.newobj = newobj;
 		}
 	      /* Push in reverse order so that the first child is
 		 popped from the work stack first, and so will be
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 6fe7009..8860526 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -75,7 +75,7 @@ typedef struct varobj_update_result_t
      It lists the new children (which must necessarily come at the end
      of the child list) added during an update.  The caller is
      responsible for freeing this vector.  */
-  VEC (varobj_p) *new;
+  VEC (varobj_p) *newobj;
 } varobj_update_result;
 
 DEF_VEC_O (varobj_update_result);
@@ -303,7 +303,7 @@ extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
 			      void *data);
 
 extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, 
-						 int explicit);
+						 int is_explicit);
 
 extern void varobj_invalidate (void);
 
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index dde9185..30135f0 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1033,7 +1033,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
   /* fcn_cs_saved is global because process_xcoff_symbol needs it.  */
   union internal_auxent fcn_aux_saved = main_aux;
-  struct context_stack *new;
+  struct context_stack *newobj;
 
   char *filestring = " _start_ ";	/* Name of the current file.  */
 
@@ -1360,13 +1360,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
 	      within_function = 1;
 
-	      new = push_context (0, fcn_start_addr + off);
+	      newobj = push_context (0, fcn_start_addr + off);
 
-	      new->name = define_symbol
+	      newobj->name = define_symbol
 		(fcn_cs_saved.c_value + off,
 		 fcn_stab_saved.c_name, 0, 0, objfile);
-	      if (new->name != NULL)
-		SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
+	      if (newobj->name != NULL)
+		SYMBOL_SECTION (newobj->name) = SECT_OFF_TEXT (objfile);
 	    }
 	  else if (strcmp (cs->c_name, ".ef") == 0)
 	    {
@@ -1384,17 +1384,17 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 		  within_function = 0;
 		  break;
 		}
-	      new = pop_context ();
+	      newobj = pop_context ();
 	      /* Stack must be empty now.  */
-	      if (context_stack_depth > 0 || new == NULL)
+	      if (context_stack_depth > 0 || newobj == NULL)
 		{
 		  ef_complaint (cs->c_symnum);
 		  within_function = 0;
 		  break;
 		}
 
-	      finish_block (new->name, &local_symbols, new->old_blocks,
-			    new->start_addr,
+	      finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+			    newobj->start_addr,
 			    (fcn_cs_saved.c_value
 			     + fcn_aux_saved.x_sym.x_misc.x_fsize
 			     + ANOFFSET (objfile->section_offsets,
@@ -1464,7 +1464,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	  if (strcmp (cs->c_name, ".bb") == 0)
 	    {
 	      depth++;
-	      new = push_context (depth,
+	      newobj = push_context (depth,
 				  (cs->c_value
 				   + ANOFFSET (objfile->section_offsets,
 					       SECT_OFF_TEXT (objfile))));
@@ -1476,8 +1476,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 		  eb_complaint (cs->c_symnum);
 		  break;
 		}
-	      new = pop_context ();
-	      if (depth-- != new->depth)
+	      newobj = pop_context ();
+	      if (depth-- != newobj->depth)
 		{
 		  eb_complaint (cs->c_symnum);
 		  break;
@@ -1485,13 +1485,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	      if (local_symbols && context_stack_depth > 0)
 		{
 		  /* Make a block for the local symbols within.  */
-		  finish_block (new->name, &local_symbols, new->old_blocks,
-				new->start_addr,
+		  finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+				newobj->start_addr,
 				(cs->c_value
 				 + ANOFFSET (objfile->section_offsets,
 					     SECT_OFF_TEXT (objfile))));
 		}
-	      local_symbols = new->locals;
+	      local_symbols = newobj->locals;
 	    }
 	  break;
 
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/36] Fix redefinition errors in C++ mode
  2015-02-11 10:09   ` Yao Qi
@ 2015-02-11 11:30     ` Pedro Alves
  2015-02-11 11:39       ` [PATCH] xcoffread.c: delete 'within_function' definition (Re: [PATCH 05/36] Fix redefinition errors in C++ mode) Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-11 11:30 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 02/11/2015 10:08 AM, Yao Qi wrote:
> On 09/02/15 23:20, Pedro Alves wrote:
> 
>> The intent of static here is naturally to avoid making these objects
>> visible outside the compilation unit.  The equivalent in C++ would be
>> to instead define the objects in the anonymous namespace.  But given
>> that it's desirable to leave the codebase compiling as both C and C++
>> for a while, this just makes the objects extern.
> 
> It is a little pity to do so, but I don't know any other better way.
> The patch looks good to me.

Yeah, we can revisit when we require C++.  We already tend to give
fairly unique names to these objects, and, GDB will fail to link
in C++ with multiple definition errors if there's a collision
we miss.

>> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
>> index 2804453..006acef 100644
>> --- a/gdb/breakpoint.c
>> +++ b/gdb/breakpoint.c
>> @@ -299,7 +299,7 @@ static int strace_marker_p (struct breakpoint *b);
>>
>>   /* The abstract base class all breakpoint_ops structures inherit
>>      from.  */
>> -struct breakpoint_ops base_breakpoint_ops;
>> +extern struct breakpoint_ops base_breakpoint_ops;
>>
> 
> looks base_breakpoint_ops has been declared in breakpoint.h, so we can
> just remove it here.

Indeed.  Good catch.  did that, and pushed, as below.  Nothing
else changed.

---------
From e36122e9d76b35474c49aa1873e50e12c7b722b6 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Wed, 11 Feb 2015 11:20:21 +0000
Subject: [PATCH] Fix redefinition errors in C++ mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In C, we can forward declare static structure instances.  That doesn't
work in C++ though.  C++ treats these as definitions.  So then the
compiler complains about symbol redefinition, like:

 src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’
 src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here

The intent of static here is naturally to avoid making these objects
visible outside the compilation unit.  The equivalent in C++ would be
to instead define the objects in the anonymous namespace.  But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.

(base_breakpoint_ops is already declared in breakpoint.h, so we can
just remove the forward declare from breakpoint.c)

gdb/ChangeLog:
2015-02-11  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves <palves@redhat.com>

	* breakpoint.c (base_breakpoint_ops): Delete.
	* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
	* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
	* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
	* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
	* python/py-arch.c (arch_object_type): Make extern.
	* python/py-block.c (block_syms_iterator_object_type): Make extern.
	* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
	* python/py-cmd.c (cmdpy_object_type): Make extern.
	* python/py-continueevent.c (continue_event_object_type)
	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
	parameter.  Update all callers.
	* python/py-evtregistry.c (eventregistry_object_type): Make extern.
	* python/py-exitedevent.c (exited_event_object_type): Make extern.
	* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
	* python/py-function.c (fnpy_object_type): Make extern.
	* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
	* python/py-infevents.c (call_pre_event_object_type)
	(inferior_call_post_event_object_type).
	(memory_changed_event_object_type): Make extern.
	* python/py-infthread.c (thread_object_type): Make extern.
	* python/py-lazy-string.c (lazy_string_object_type): Make extern.
	* python/py-linetable.c (linetable_entry_object_type)
	(linetable_object_type, ltpy_iterator_object_type): Make extern.
	* python/py-newobjfileevent.c (new_objfile_event_object_type)
	(clear_objfiles_event_object_type): Make extern.
	* python/py-objfile.c (objfile_object_type): Make extern.
	* python/py-param.c (parmpy_object_type): Make extern.
	* python/py-progspace.c (pspace_object_type): Make extern.
	* python/py-signalevent.c (signal_event_object_type): Make extern.
	* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
	* python/py-type.c (type_object_type, field_object_type)
	(type_iterator_object_type): Make extern.
	* python/python.c (python_extension_script_ops)
	(python_extension_ops): Make extern.
	* stap-probe.c (stap_probe_ops): Make extern.
---
 gdb/ChangeLog                    | 40 ++++++++++++++++++++++++++++++++++++++++
 gdb/breakpoint.c                 |  4 ----
 gdb/dwarf2loc.c                  |  4 ++--
 gdb/elfread.c                    |  8 ++++----
 gdb/guile/guile.c                |  8 ++++----
 gdb/ppcnbsd-tdep.c               |  4 ++--
 gdb/python/py-arch.c             |  4 ++--
 gdb/python/py-block.c            |  4 ++--
 gdb/python/py-bpevent.c          |  5 ++---
 gdb/python/py-cmd.c              |  4 ++--
 gdb/python/py-continueevent.c    |  5 ++---
 gdb/python/py-event.h            |  5 ++---
 gdb/python/py-evtregistry.c      |  4 ++--
 gdb/python/py-exitedevent.c      |  5 ++---
 gdb/python/py-finishbreakpoint.c |  4 ++--
 gdb/python/py-function.c         |  4 ++--
 gdb/python/py-inferior.c         |  8 ++++----
 gdb/python/py-infevents.c        | 20 ++++++++------------
 gdb/python/py-infthread.c        |  4 ++--
 gdb/python/py-lazy-string.c      |  4 ++--
 gdb/python/py-linetable.c        | 12 ++++++------
 gdb/python/py-newobjfileevent.c  | 10 ++++------
 gdb/python/py-objfile.c          |  4 ++--
 gdb/python/py-param.c            |  4 ++--
 gdb/python/py-progspace.c        |  4 ++--
 gdb/python/py-signalevent.c      |  5 ++---
 gdb/python/py-stopevent.c        |  3 +--
 gdb/python/py-symtab.c           |  8 ++++----
 gdb/python/py-threadevent.c      |  3 +--
 gdb/python/py-type.c             | 12 ++++++------
 gdb/python/python.c              |  8 ++++----
 gdb/stap-probe.c                 |  4 ++--
 32 files changed, 124 insertions(+), 101 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ac89f43..17a00a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,43 @@
+2015-02-11  Tom Tromey  <tromey@redhat.com>
+	    Pedro Alves <palves@redhat.com>
+
+	* breakpoint.c (base_breakpoint_ops): Delete.
+	* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
+	* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
+	* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
+	* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
+	* python/py-arch.c (arch_object_type): Make extern.
+	* python/py-block.c (block_syms_iterator_object_type): Make extern.
+	* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
+	* python/py-cmd.c (cmdpy_object_type): Make extern.
+	* python/py-continueevent.c (continue_event_object_type)
+	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
+	parameter.  Update all callers.
+	* python/py-evtregistry.c (eventregistry_object_type): Make extern.
+	* python/py-exitedevent.c (exited_event_object_type): Make extern.
+	* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
+	* python/py-function.c (fnpy_object_type): Make extern.
+	* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
+	* python/py-infevents.c (call_pre_event_object_type)
+	(inferior_call_post_event_object_type).
+	(memory_changed_event_object_type): Make extern.
+	* python/py-infthread.c (thread_object_type): Make extern.
+	* python/py-lazy-string.c (lazy_string_object_type): Make extern.
+	* python/py-linetable.c (linetable_entry_object_type)
+	(linetable_object_type, ltpy_iterator_object_type): Make extern.
+	* python/py-newobjfileevent.c (new_objfile_event_object_type)
+	(clear_objfiles_event_object_type): Make extern.
+	* python/py-objfile.c (objfile_object_type): Make extern.
+	* python/py-param.c (parmpy_object_type): Make extern.
+	* python/py-progspace.c (pspace_object_type): Make extern.
+	* python/py-signalevent.c (signal_event_object_type): Make extern.
+	* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
+	* python/py-type.c (type_object_type, field_object_type)
+	(type_iterator_object_type): Make extern.
+	* python/python.c (python_extension_script_ops)
+	(python_extension_ops): Make extern.
+	* stap-probe.c (stap_probe_ops): Make extern.
+
 2015-02-11  Pedro Alves  <pedro@codesourcery.com>
 
 	* infrun.c (adjust_pc_after_break): Don't adjust the PC just
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 2804453..a7cc6cb 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -297,10 +297,6 @@ static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
 
 static int strace_marker_p (struct breakpoint *b);
 
-/* The abstract base class all breakpoint_ops structures inherit
-   from.  */
-struct breakpoint_ops base_breakpoint_ops;
-
 /* The breakpoint_ops structure to be inherited by all breakpoint_ops
    that are implemented on top of software or hardware breakpoints
    (user breakpoints, internal and momentary breakpoints, etc.).  */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index fc0f112..aa569ee 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -41,7 +41,7 @@
 
 extern int dwarf2_always_disassemble;
 
-static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
+extern const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
 
 static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
 						    struct frame_info *frame,
@@ -2151,7 +2151,7 @@ static const struct lval_funcs pieced_value_funcs = {
 
 /* Virtual method table for dwarf2_evaluate_loc_desc_full below.  */
 
-static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
+const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
 {
   dwarf_expr_read_addr_from_reg,
   dwarf_expr_get_reg_value,
diff --git a/gdb/elfread.c b/gdb/elfread.c
index fbe3917..65c63f0 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -49,8 +49,8 @@
 extern void _initialize_elfread (void);
 
 /* Forward declarations.  */
-static const struct sym_fns elf_sym_fns_gdb_index;
-static const struct sym_fns elf_sym_fns_lazy_psyms;
+extern const struct sym_fns elf_sym_fns_gdb_index;
+extern const struct sym_fns elf_sym_fns_lazy_psyms;
 
 /* The struct elfinfo is available only during ELF symbol table and
    psymtab reading.  It is destroyed at the completion of psymtab-reading.
@@ -1566,7 +1566,7 @@ static const struct sym_fns elf_sym_fns =
 /* The same as elf_sym_fns, but not registered and lazily reads
    psymbols.  */
 
-static const struct sym_fns elf_sym_fns_lazy_psyms =
+const struct sym_fns elf_sym_fns_lazy_psyms =
 {
   elf_new_init,			/* init anything gbl to entire symtab */
   elf_symfile_init,		/* read initial info, setup for sym_read() */
@@ -1583,7 +1583,7 @@ static const struct sym_fns elf_sym_fns_lazy_psyms =
 
 /* The same as elf_sym_fns, but not registered and uses the
    DWARF-specific GNU index rather than psymtab.  */
-static const struct sym_fns elf_sym_fns_gdb_index =
+const struct sym_fns elf_sym_fns_gdb_index =
 {
   elf_new_init,			/* init anything gbl to entire symab */
   elf_symfile_init,		/* read initial info, setup for sym_red() */
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 319b583..3e0d11a 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -71,8 +71,8 @@ const char *gdbscm_print_excp = gdbscm_print_excp_message;
 
 #ifdef HAVE_GUILE
 /* Forward decls, these are defined later.  */
-static const struct extension_language_script_ops guile_extension_script_ops;
-static const struct extension_language_ops guile_extension_ops;
+extern const struct extension_language_script_ops guile_extension_script_ops;
+extern const struct extension_language_ops guile_extension_ops;
 #endif
 
 /* The main struct describing GDB's interface to the Guile
@@ -124,7 +124,7 @@ static const char boot_scm_filename[] = "boot.scm";
 
 /* The interface between gdb proper and loading of python scripts.  */
 
-static const struct extension_language_script_ops guile_extension_script_ops =
+const struct extension_language_script_ops guile_extension_script_ops =
 {
   gdbscm_source_script,
   gdbscm_source_objfile_script,
@@ -134,7 +134,7 @@ static const struct extension_language_script_ops guile_extension_script_ops =
 
 /* The interface between gdb proper and guile scripting.  */
 
-static const struct extension_language_ops guile_extension_ops =
+const struct extension_language_ops guile_extension_ops =
 {
   gdbscm_finish_initialization,
   gdbscm_initialized,
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 158cc95..76b6ea7 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -92,7 +92,7 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function,
 
 /* Signal trampolines.  */
 
-static const struct tramp_frame ppcnbsd2_sigtramp;
+extern const struct tramp_frame ppcnbsd2_sigtramp;
 
 static void
 ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
@@ -151,7 +151,7 @@ static const struct tramp_frame ppcnbsd_sigtramp =
 
 /* NetBSD 2.0 introduced a slightly different signal trampoline.  */
 
-static const struct tramp_frame ppcnbsd2_sigtramp =
+const struct tramp_frame ppcnbsd2_sigtramp =
 {
   SIGTRAMP_FRAME,
   4,
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index da6801e..49c654b 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -42,7 +42,7 @@ static struct gdbarch_data *arch_object_data = NULL;
       }								\
   } while (0)
 
-static PyTypeObject arch_object_type
+extern PyTypeObject arch_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
 
 /* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch
@@ -281,7 +281,7 @@ END_PC." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject arch_object_type = {
+PyTypeObject arch_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Architecture",                 /* tp_name */
   sizeof (arch_object),               /* tp_basicsize */
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 140c521..fb6a6b6 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -78,7 +78,7 @@ typedef struct {
       }									\
   } while (0)
 
-static PyTypeObject block_syms_iterator_object_type
+extern PyTypeObject block_syms_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
 static const struct objfile_data *blpy_objfile_data_key;
 
@@ -515,7 +515,7 @@ Return true if this block iterator is valid, false if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject block_syms_iterator_object_type = {
+PyTypeObject block_syms_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.BlockIterator",		  /*tp_name*/
   sizeof (block_syms_iterator_object),	      /*tp_basicsize*/
diff --git a/gdb/python/py-bpevent.c b/gdb/python/py-bpevent.c
index b1df64e..abc9dba 100644
--- a/gdb/python/py-bpevent.c
+++ b/gdb/python/py-bpevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-stopevent.h"
 
-static PyTypeObject breakpoint_event_object_type
+extern PyTypeObject breakpoint_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 /* Create and initialize a BreakpointEvent object.  This acquires new
@@ -55,5 +55,4 @@ GDBPY_NEW_EVENT_TYPE (breakpoint,
                       "gdb.BreakpointEvent",
                       "BreakpointEvent",
                       "GDB breakpoint stop event object",
-                      stop_event_object_type,
-                      static);
+                      stop_event_object_type);
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index c0b6464..a5e96d6 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -70,7 +70,7 @@ struct cmdpy_object
 
 typedef struct cmdpy_object cmdpy_object;
 
-static PyTypeObject cmdpy_object_type
+extern PyTypeObject cmdpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
 
 /* Constants used by this module.  */
@@ -746,7 +746,7 @@ static PyMethodDef cmdpy_object_methods[] =
   { 0 }
 };
 
-static PyTypeObject cmdpy_object_type =
+PyTypeObject cmdpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Command",		  /*tp_name*/
diff --git a/gdb/python/py-continueevent.c b/gdb/python/py-continueevent.c
index e5a384b..3ae5568 100644
--- a/gdb/python/py-continueevent.c
+++ b/gdb/python/py-continueevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject continue_event_object_type
+extern PyTypeObject continue_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -51,5 +51,4 @@ GDBPY_NEW_EVENT_TYPE (continue,
                       "gdb.ContinueEvent",
                       "ContinueEvent",
                       "GDB continue event object",
-                      thread_event_object_type,
-                      static);
+                      thread_event_object_type);
diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index a0b2f74..fcb555d 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -41,12 +41,11 @@
     python.
   DOC Python documentation for the new event type
   BASE the base event for this event usually just event_object_type.
-  QUAL qualification for the create event usually 'static'
 */
 
-#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base, qual) \
+#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base) \
 \
-    qual PyTypeObject name##_event_object_type \
+  PyTypeObject name##_event_object_type		    \
         CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
     = { \
       PyVarObject_HEAD_INIT (NULL, 0)				\
diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c
index 229a557..3a31441 100644
--- a/gdb/python/py-evtregistry.c
+++ b/gdb/python/py-evtregistry.c
@@ -23,7 +23,7 @@
 
 events_object gdb_py_events;
 
-static PyTypeObject eventregistry_object_type
+extern PyTypeObject eventregistry_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
 
 /* Implementation of EventRegistry.connect () -> NULL.
@@ -132,7 +132,7 @@ static PyMethodDef eventregistry_object_methods[] =
   { NULL } /* Sentinel.  */
 };
 
-static PyTypeObject eventregistry_object_type =
+PyTypeObject eventregistry_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.EventRegistry",                        /* tp_name */
diff --git a/gdb/python/py-exitedevent.c b/gdb/python/py-exitedevent.c
index 3d61443..d6ece3c 100644
--- a/gdb/python/py-exitedevent.c
+++ b/gdb/python/py-exitedevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject exited_event_object_type
+extern PyTypeObject exited_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -88,5 +88,4 @@ GDBPY_NEW_EVENT_TYPE (exited,
                       "gdb.ExitedEvent",
                       "ExitedEvent",
                       "GDB exited event object",
-                      event_object_type,
-                      static);
+                      event_object_type);
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 94f19e0..9b5e3c7 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -52,7 +52,7 @@ struct finish_breakpoint_object
   PyObject *return_value;
 };
 
-static PyTypeObject finish_breakpoint_object_type
+extern PyTypeObject finish_breakpoint_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
 
 /* Python function to get the 'return_value' attribute of
@@ -429,7 +429,7 @@ None otherwise.", NULL },
     { NULL }  /* Sentinel.  */
 };
 
-static PyTypeObject finish_breakpoint_object_type =
+PyTypeObject finish_breakpoint_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.FinishBreakpoint",         /*tp_name*/
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index 1513d8d..244bc61 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -28,7 +28,7 @@
 #include "expression.h"
 #include "language.h"
 
-static PyTypeObject fnpy_object_type
+extern PyTypeObject fnpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
 
 \f
@@ -212,7 +212,7 @@ gdbpy_initialize_functions (void)
 
 \f
 
-static PyTypeObject fnpy_object_type =
+PyTypeObject fnpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Function",		  /*tp_name*/
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index ae73040..5d13e07 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -50,7 +50,7 @@ typedef struct
   int nthreads;
 } inferior_object;
 
-static PyTypeObject inferior_object_type
+extern PyTypeObject inferior_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
 
 static const struct inferior_data *infpy_inf_data_key;
@@ -64,7 +64,7 @@ typedef struct {
   CORE_ADDR length;
 } membuf_object;
 
-static PyTypeObject membuf_object_type
+extern PyTypeObject membuf_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
 
 /* Require that INFERIOR be a valid inferior ID.  */
@@ -915,7 +915,7 @@ Return a long with the address of a match, or None." },
   { NULL }
 };
 
-static PyTypeObject inferior_object_type =
+PyTypeObject inferior_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Inferior",		  /* tp_name */
@@ -982,7 +982,7 @@ static PyBufferProcs buffer_procs = {
 };
 #endif	/* IS_PY3K */
 
-static PyTypeObject membuf_object_type = {
+PyTypeObject membuf_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Membuf",			  /*tp_name*/
   sizeof (membuf_object),	  /*tp_basicsize*/
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c
index 0715b15..3ded1b8 100644
--- a/gdb/python/py-infevents.c
+++ b/gdb/python/py-infevents.c
@@ -20,13 +20,13 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject inferior_call_pre_event_object_type
+extern PyTypeObject inferior_call_pre_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject inferior_call_post_event_object_type
+extern PyTypeObject inferior_call_post_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject register_changed_event_object_type
+extern PyTypeObject register_changed_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject memory_changed_event_object_type
+extern PyTypeObject memory_changed_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 /* Construct either a gdb.InferiorCallPreEvent or a
@@ -238,26 +238,22 @@ GDBPY_NEW_EVENT_TYPE (inferior_call_pre,
 		      "gdb.InferiorCallPreEvent",
 		      "InferiorCallPreEvent",
 		      "GDB inferior function pre-call event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (inferior_call_post,
 		      "gdb.InferiorCallPostEvent",
 		      "InferiorCallPostEvent",
 		      "GDB inferior function post-call event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (register_changed,
 		      "gdb.RegisterChangedEvent",
 		      "RegisterChangedEvent",
 		      "GDB register change event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (memory_changed,
 		      "gdb.MemoryChangedEvent",
 		      "MemoryChangedEvent",
 		      "GDB memory change event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index fa4cc25..9a9a2e6 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -22,7 +22,7 @@
 #include "inferior.h"
 #include "python-internal.h"
 
-static PyTypeObject thread_object_type
+extern PyTypeObject thread_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
 
 /* Require that INFERIOR be a valid inferior ID.  */
@@ -307,7 +307,7 @@ Return whether the thread is exited." },
   { NULL }
 };
 
-static PyTypeObject thread_object_type =
+PyTypeObject thread_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.InferiorThread",		  /*tp_name*/
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 7df6a9e..9c0f7a4 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -45,7 +45,7 @@ typedef struct {
   struct type *type;
 } lazy_string_object;
 
-static PyTypeObject lazy_string_object_type
+extern PyTypeObject lazy_string_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
 
 static PyObject *
@@ -215,7 +215,7 @@ static PyGetSetDef lazy_string_object_getset[] = {
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject lazy_string_object_type = {
+PyTypeObject lazy_string_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LazyString",	          /*tp_name*/
   sizeof (lazy_string_object),	  /*tp_basicsize*/
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index 49007ce..ff1716b 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -28,7 +28,7 @@ typedef struct {
   CORE_ADDR pc;
 } linetable_entry_object;
 
-static PyTypeObject linetable_entry_object_type
+extern PyTypeObject linetable_entry_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
 
 typedef struct {
@@ -39,7 +39,7 @@ typedef struct {
   PyObject *symtab;
 } linetable_object;
 
-static PyTypeObject linetable_object_type
+extern PyTypeObject linetable_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
 
 typedef struct {
@@ -52,7 +52,7 @@ typedef struct {
   PyObject *source;
 } ltpy_iterator_object;
 
-static PyTypeObject ltpy_iterator_object_type
+extern PyTypeObject ltpy_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
 
 /* Internal helper function to extract gdb.Symtab from a gdb.Linetable
@@ -493,7 +493,7 @@ Return True if this Linetable is valid, False if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject linetable_object_type = {
+PyTypeObject linetable_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTable",	          /*tp_name*/
   sizeof (linetable_object),	  /*tp_basicsize*/
@@ -540,7 +540,7 @@ Return True if this Linetable iterator is valid, False if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject ltpy_iterator_object_type = {
+PyTypeObject ltpy_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTableIterator",		  /*tp_name*/
   sizeof (ltpy_iterator_object),  /*tp_basicsize*/
@@ -580,7 +580,7 @@ static PyGetSetDef linetable_entry_object_getset[] = {
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject linetable_entry_object_type = {
+PyTypeObject linetable_entry_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTableEntry",	          /*tp_name*/
   sizeof (linetable_entry_object), /*tp_basicsize*/
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 2999b76..95c10e1 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -20,9 +20,9 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject new_objfile_event_object_type
+extern PyTypeObject new_objfile_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject clear_objfiles_event_object_type
+extern PyTypeObject clear_objfiles_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -72,8 +72,7 @@ GDBPY_NEW_EVENT_TYPE (new_objfile,
                       "gdb.NewObjFileEvent",
                       "NewObjFileEvent",
                       "GDB new object file event object",
-                      event_object_type,
-                      static);
+                      event_object_type);
 \f
 /* Subroutine of emit_clear_objfiles_event to simplify it.  */
 
@@ -125,5 +124,4 @@ GDBPY_NEW_EVENT_TYPE (clear_objfiles,
 		      "gdb.ClearObjFilesEvent",
 		      "ClearObjFilesEvent",
 		      "GDB clear object files event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 0aecaf6..0a10623 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -49,7 +49,7 @@ typedef struct
   PyObject *xmethods;
 } objfile_object;
 
-static PyTypeObject objfile_object_type
+extern PyTypeObject objfile_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
 
 static const struct objfile_data *objfpy_objfile_data_key;
@@ -652,7 +652,7 @@ static PyGetSetDef objfile_getset[] =
   { NULL }
 };
 
-static PyTypeObject objfile_object_type =
+PyTypeObject objfile_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Objfile",		  /*tp_name*/
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 48173c8..2fe5be6 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -88,7 +88,7 @@ struct parmpy_object
 
 typedef struct parmpy_object parmpy_object;
 
-static PyTypeObject parmpy_object_type
+extern PyTypeObject parmpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
 
 /* Some handy string constants.  */
@@ -779,7 +779,7 @@ gdbpy_initialize_parameters (void)
 
 \f
 
-static PyTypeObject parmpy_object_type =
+PyTypeObject parmpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Parameter",		  /*tp_name*/
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 29b9f96..93fbc14 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -48,7 +48,7 @@ typedef struct
   PyObject *xmethods;
 } pspace_object;
 
-static PyTypeObject pspace_object_type
+extern PyTypeObject pspace_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
 
 static const struct program_space_data *pspy_pspace_data_key;
@@ -352,7 +352,7 @@ static PyGetSetDef pspace_getset[] =
   { NULL }
 };
 
-static PyTypeObject pspace_object_type =
+PyTypeObject pspace_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Progspace",		  /*tp_name*/
diff --git a/gdb/python/py-signalevent.c b/gdb/python/py-signalevent.c
index 98a47f1..d5b1f27 100644
--- a/gdb/python/py-signalevent.c
+++ b/gdb/python/py-signalevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-stopevent.h"
 
-static PyTypeObject signal_event_object_type
+extern PyTypeObject signal_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 PyObject *
@@ -57,5 +57,4 @@ GDBPY_NEW_EVENT_TYPE (signal,
                       "gdb.SignalEvent",
                       "SignalEvent",
                       "GDB signal event object",
-                      stop_event_object_type,
-                      static);
+                      stop_event_object_type);
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c
index 0ec39ca..684edff 100644
--- a/gdb/python/py-stopevent.c
+++ b/gdb/python/py-stopevent.c
@@ -115,5 +115,4 @@ GDBPY_NEW_EVENT_TYPE (stop,
                       "gdb.StopEvent",
                       "StopEvent",
                       "GDB stop event object",
-                      thread_event_object_type,
-                      /*no qual*/);
+                      thread_event_object_type);
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 487dc87..796a7fc 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -37,7 +37,7 @@ typedef struct stpy_symtab_object {
   struct stpy_symtab_object *next;
 } symtab_object;
 
-static PyTypeObject symtab_object_type
+extern PyTypeObject symtab_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
 static const struct objfile_data *stpy_objfile_data_key;
 
@@ -68,7 +68,7 @@ typedef struct salpy_sal_object {
   struct salpy_sal_object *next;
 } sal_object;
 
-static PyTypeObject sal_object_type
+extern PyTypeObject sal_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
 static const struct objfile_data *salpy_objfile_data_key;
 
@@ -576,7 +576,7 @@ Return the Linetable associated with this symbol table" },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject symtab_object_type = {
+PyTypeObject symtab_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Symtab",			  /*tp_name*/
   sizeof (symtab_object),	  /*tp_basicsize*/
@@ -626,7 +626,7 @@ Return true if this symbol table and line is valid, false if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject sal_object_type = {
+PyTypeObject sal_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Symtab_and_line",	  /*tp_name*/
   sizeof (sal_object),		  /*tp_basicsize*/
diff --git a/gdb/python/py-threadevent.c b/gdb/python/py-threadevent.c
index 6932cd3..f78dc64 100644
--- a/gdb/python/py-threadevent.c
+++ b/gdb/python/py-threadevent.c
@@ -77,5 +77,4 @@ GDBPY_NEW_EVENT_TYPE (thread,
                       "gdb.ThreadEvent",
                       "ThreadEvent",
                       "GDB thread event object",
-                      event_object_type,
-                      /*no qual*/);
+                      event_object_type);
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index bf92363..a3da678 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -41,7 +41,7 @@ typedef struct pyty_type_object
   struct pyty_type_object *next;
 } type_object;
 
-static PyTypeObject type_object_type
+extern PyTypeObject type_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
 
 /* A Field object.  */
@@ -53,7 +53,7 @@ typedef struct pyty_field_object
   PyObject *dict;
 } field_object;
 
-static PyTypeObject field_object_type
+extern PyTypeObject field_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
 
 /* A type iterator object.  */
@@ -67,7 +67,7 @@ typedef struct {
   struct pyty_type_object *source;
 } typy_iterator_object;
 
-static PyTypeObject type_iterator_object_type
+extern PyTypeObject type_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
 
 /* This is used to initialize various gdb.TYPE_ constants.  */
@@ -1539,7 +1539,7 @@ static PyMappingMethods typy_mapping = {
   NULL				  /* no "set" method */
 };
 
-static PyTypeObject type_object_type =
+PyTypeObject type_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Type",			  /*tp_name*/
@@ -1588,7 +1588,7 @@ static PyGetSetDef field_object_getset[] =
   { NULL }
 };
 
-static PyTypeObject field_object_type =
+PyTypeObject field_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Field",			  /*tp_name*/
@@ -1630,7 +1630,7 @@ static PyTypeObject field_object_type =
   0,				  /* tp_new */
 };
 
-static PyTypeObject type_iterator_object_type = {
+PyTypeObject type_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.TypeIterator",		  /*tp_name*/
   sizeof (typy_iterator_object),  /*tp_basicsize*/
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 344d8d2..9854c79 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -57,8 +57,8 @@ static const char *gdbpy_should_print_stack = python_excp_message;
 
 #ifdef HAVE_PYTHON
 /* Forward decls, these are defined later.  */
-static const struct extension_language_script_ops python_extension_script_ops;
-static const struct extension_language_ops python_extension_ops;
+extern const struct extension_language_script_ops python_extension_script_ops;
+extern const struct extension_language_ops python_extension_ops;
 #endif
 
 /* The main struct describing GDB's interface to the Python
@@ -152,7 +152,7 @@ static enum ext_lang_rc gdbpy_before_prompt_hook
 
 /* The interface between gdb proper and loading of python scripts.  */
 
-static const struct extension_language_script_ops python_extension_script_ops =
+const struct extension_language_script_ops python_extension_script_ops =
 {
   gdbpy_source_script,
   gdbpy_source_objfile_script,
@@ -162,7 +162,7 @@ static const struct extension_language_script_ops python_extension_script_ops =
 
 /* The interface between gdb proper and python extensions.  */
 
-static const struct extension_language_ops python_extension_ops =
+const struct extension_language_ops python_extension_ops =
 {
   gdbpy_finish_initialization,
   gdbpy_initialized,
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index d7d9cf1..ffe4dd1 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -47,7 +47,7 @@
 
 /* Forward declaration. */
 
-static const struct probe_ops stap_probe_ops;
+extern const struct probe_ops stap_probe_ops;
 
 /* Should we display debug information for the probe's argument expression
    parsing?  */
@@ -1742,7 +1742,7 @@ stap_gen_info_probes_table_values (struct probe *probe_generic,
 
 /* SystemTap probe_ops.  */
 
-static const struct probe_ops stap_probe_ops =
+const struct probe_ops stap_probe_ops =
 {
   stap_probe_is_linespec,
   stap_get_probes,
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH] xcoffread.c: delete 'within_function' definition (Re: [PATCH 05/36] Fix redefinition errors in C++ mode)
  2015-02-11 11:30     ` Pedro Alves
@ 2015-02-11 11:39       ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-11 11:39 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 02/11/2015 11:30 AM, Pedro Alves wrote:
> On 02/11/2015 10:08 AM, Yao Qi wrote:
>> On 09/02/15 23:20, Pedro Alves wrote:
>>
>>> The intent of static here is naturally to avoid making these objects
>>> visible outside the compilation unit.  The equivalent in C++ would be
>>> to instead define the objects in the anonymous namespace.  But given
>>> that it's desirable to leave the codebase compiling as both C and C++
>>> for a while, this just makes the objects extern.
>>
>> It is a little pity to do so, but I don't know any other better way.
>> The patch looks good to me.
> 
> Yeah, we can revisit when we require C++.  We already tend to give
> fairly unique names to these objects, and, GDB will fail to link
> in C++ with multiple definition errors if there's a collision
> we miss.

Speaking of which, here's one that linking an --enable-targets=all
build in C++ mode found.  In C (-fcommon), the linker merges both instances
of within_function, so it's really one variable.

Pushed as obvious.

------------
From 18ad82c16379e7ed7daa3043abdacee1d934867d Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 10 Feb 2015 11:01:21 +0000
Subject: [PATCH] xcoffread.c: delete 'within_function' definition

Linking GDB as a C++ program, we get:

  src/gdb/buildsym.c:226: multiple definition of `within_function'
  xcoffread.o:src/gdb/xcoffread.c:181: first defined here

gdb/
2015-02-11  Pedro Alves  <palves@redhat.com>

	* xcoffread.c (within_function): Delete.
---
 gdb/ChangeLog   | 4 ++++
 gdb/xcoffread.c | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 17a00a0..02232a5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2015-02-11  Pedro Alves  <palves@redhat.com>
+
+	* xcoffread.c (within_function): Delete.
+
 2015-02-11  Tom Tromey  <tromey@redhat.com>
 	    Pedro Alves <palves@redhat.com>
 
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index dde9185..6015711 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -119,11 +119,6 @@ static CORE_ADDR first_object_file_end;
 
 #define	INITIAL_STABVECTOR_LENGTH	40
 
-/* Nonzero if within a function (so symbols should be local,
-   if nothing says specifically).  */
-
-int within_function;
-
 /* Size of a COFF symbol.  I think it is always 18, so I'm not sure
    there is any reason not to just use a #define, but might as well
    ask BFD for the size and store it here, I guess.  */
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 10/36] Add extern "C" to declarations of C symbols
  2015-02-09 23:54 ` [PATCH 10/36] Add extern "C" to declarations of C symbols Pedro Alves
@ 2015-02-11 11:51   ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-11 11:51 UTC (permalink / raw)
  To: gdb-patches

On 02/09/2015 11:20 PM, Pedro Alves wrote:

> As for the linux-tdep.c change: elf-bfd.h wraps itself in extern "C"
> already, while elf/common.h does not.  Since elf/common.h is already
> included by "elf-bfd.h", simply remove the explicit elf/common.h
> include.

Dunno what I was thinking here.  :-)  This wasn't necessary, not
even before revised BFD extern "C" patch that went in.

Here's the updated patch without that bit.

(I've been rebasing the series and force-pushing to my github branch,
as patches are updated or pushed to master:
  git@github.com:palves/gdb.git palves/cxx-conversion-attempt)

--------
From 76168c4f096717c5921fed547f561fd7e336fa36 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 9 Feb 2015 14:59:08 +0000
Subject: [PATCH] Add extern "C" to declarations of C symbols

These symbols are defined in C code, so in C++ mode we need to use
extern "C" to declare them.  As extern "C" can't be used inside a
function's scope, we move the declarations to the global scope at the
same time.

gdb/ChangeLog:
2015-02-11  Pedro Alves  <palves@redhat.com>

	* cli-out.c (_rl_erase_entire_line): Move declaration out of
	cli_mld_erase_entire_line, and make it extern "C".
	* common/common-defs.h (EXTERN_C): New.
	* completer.c (_rl_completion_prefix_display_length)
	(_rl_print_completions_horizontally, QSFUNC): Move declarations
	out of gdb_display_match_list_1.
	(_rl_qsort_string_compare): Move declaration out of
	gdb_display_match_list_1, and make it extern "C".
	* defs.h (re_comp): Use EXTERN_C.
	* maint.c (_mcleanup): Move declaration out of mcleanup_wrapper,
	and make it extern "C".
	(monstartup): Move declaration out of maintenance_set_profile_cmd,
	and make it extern "C".
	(main): Move declaration out of maintenance_set_profile_cmd.
	* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string): Use
	EXTERN_C.
---
 gdb/cli-out.c            |  4 ++--
 gdb/common/common-defs.h |  6 ++++++
 gdb/completer.c          | 10 ++++++----
 gdb/defs.h               |  2 +-
 gdb/maint.c              | 10 +++++-----
 gdb/nat/linux-ptrace.c   |  2 +-
 6 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 48f2a04..2a83169 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -452,13 +452,13 @@ cli_mld_flush (const struct match_list_displayer *displayer)
   fflush (rl_outstream);
 }
 
+EXTERN_C void _rl_erase_entire_line (void);
+
 /* CLI version of displayer.erase_entire_line.  */
 
 static void
 cli_mld_erase_entire_line (const struct match_list_displayer *displayer)
 {
-  extern void _rl_erase_entire_line (void);
-
   _rl_erase_entire_line ();
 }
 
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index e80d332..3020bd8 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -50,4 +50,10 @@
 #include "cleanups.h"
 #include "common-exceptions.h"
 
+#ifdef __cplusplus
+# define EXTERN_C extern "C"
+#else
+# define EXTERN_C extern
+#endif
+
 #endif /* COMMON_DEFS_H */
diff --git a/gdb/completer.c b/gdb/completer.c
index bfd2788..774fb31 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1555,6 +1555,12 @@ gdb_complete_get_screenwidth (const struct match_list_displayer *displayer)
   return displayer->width;
 }
 
+extern int _rl_completion_prefix_display_length;
+extern int _rl_print_completions_horizontally;
+
+EXTERN_C int _rl_qsort_string_compare (const void *, const void *);
+typedef int QSFUNC (const void *, const void *);
+
 /* GDB version of readline/complete.c:rl_display_match_list.
    See gdb_display_match_list for a description of MATCHES, LEN, MAX.
    Returns non-zero if all matches are displayed.  */
@@ -1567,10 +1573,6 @@ gdb_display_match_list_1 (char **matches, int len, int max,
   int i, j, k, l, common_length, sind;
   char *temp, *t;
   int page_completions = displayer->height != INT_MAX && pagination_enabled;
-  extern int _rl_completion_prefix_display_length;
-  extern int _rl_qsort_string_compare (const void *, const void *);
-  extern int _rl_print_completions_horizontally;
-  typedef int QSFUNC (const void *, const void *);
 
   /* Find the length of the prefix common to all items: length as displayed
      characters (common_length) and as a byte index into the matches (sind) */
diff --git a/gdb/defs.h b/gdb/defs.h
index a1cd45f..72512f6 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -249,7 +249,7 @@ extern int annotation_level;	/* in stack.c */
    "const char *" in unistd.h, so we can't declare the argument
    as "char *".  */
 
-extern char *re_comp (const char *);
+EXTERN_C char *re_comp (const char *);
 
 /* From symfile.c */
 
diff --git a/gdb/maint.c b/gdb/maint.c
index be18a32..1adea2f 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -683,15 +683,18 @@ extern char etext;
 
 static int profiling_state;
 
+EXTERN_C void _mcleanup (void);
+
 static void
 mcleanup_wrapper (void)
 {
-  extern void _mcleanup (void);
-
   if (profiling_state)
     _mcleanup ();
 }
 
+EXTERN_C void monstartup (unsigned long, unsigned long);
+extern int main ();
+
 static void
 maintenance_set_profile_cmd (char *args, int from_tty,
 			     struct cmd_list_element *c)
@@ -705,9 +708,6 @@ maintenance_set_profile_cmd (char *args, int from_tty,
     {
       static int profiling_initialized;
 
-      extern void monstartup (unsigned long, unsigned long);
-      extern int main();
-
       if (!profiling_initialized)
 	{
 	  atexit (mcleanup_wrapper);
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 0ce258f..e36864c 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -84,7 +84,7 @@ linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err)
 #if defined __i386__ || defined __x86_64__
 
 /* Address of the 'ret' instruction in asm code block below.  */
-extern void (linux_ptrace_test_ret_to_nx_instr) (void);
+EXTERN_C void linux_ptrace_test_ret_to_nx_instr (void);
 
 #include <sys/reg.h>
 #include <sys/mman.h>
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 24/36] breakpoint.h: move enum ‘print_stop_action’
  2015-02-10  0:21 ` [PATCH 24/36] breakpoint.h: move enum ‘print_stop_action’ Pedro Alves
@ 2015-02-11 12:28   ` Yao Qi
  0 siblings, 0 replies; 100+ messages in thread
From: Yao Qi @ 2015-02-11 12:28 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

Hi Pedro,

On 09/02/15 23:20, Pedro Alves wrote:
> Building GDB in C++, we get:
>
>    src/gdb/breakpoint.h:529:8: error: use of enum ‘print_stop_action’ without previous declaration
>
> We can forward declare enums in C++.

I think you meant "can't".  Patch is good to me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (37 preceding siblings ...)
  2015-02-10 15:07 ` [PATCH 00/36] Support building GDB as a C++ program Michael Eager
@ 2015-02-11 17:15 ` Yao Qi
  2015-02-12 11:34   ` Pedro Alves
  2015-02-17 23:19 ` Patrick Palka
  2015-02-27 18:19 ` Pedro Alves
  40 siblings, 1 reply; 100+ messages in thread
From: Yao Qi @ 2015-02-11 17:15 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

Hi Pedro,
Nice to see these patches for c++ conversion, and thanks very much
for doing this.  I went through the first 30 patches, and skimmed
the rest today.  Don't see anything wrong obviously.

On 09/02/15 23:20, Pedro Alves wrote:
> I'm glad to announce that the global maintainers have reached
> consensus on converting GDB to use C++ as implementation language.
>
> See the project page here:https://sourceware.org/gdb/wiki/cxx-conversion
>
> This series implements the first parts of the transition plan
> described in that page.  Namely:
>
>    - Add a --enable-build-with-cxx option (default: no) to compile GDB
>      and GDBserver with a C++ compiler, keeping the support for
>      building with a C compiler.
>
>    - Modify GDB and GDBserver so they can be compiled in C++ mode,
>      using G++'s '-fpermissive' option as shortcut.
>
>    - Split the TRY_CATCH macro into TRY/CATCH macros to better map to
>      C++'s 'throw'/'try...catch' in C++ mode, and eliminate all the
>      volatile gdb_exception objects.

To be clear, according to the transition plan on wiki, once this patch
set is pushed in, we'll be at step 8.1, except that step 6 is not
needed, and step 1 and 5 are skipped.  Is it a correct understanding?

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-11 17:15 ` Yao Qi
@ 2015-02-12 11:34   ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-12 11:34 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 02/11/2015 05:15 PM, Yao Qi wrote:
> Hi Pedro,
> Nice to see these patches for c++ conversion, and thanks very much
> for doing this.  I went through the first 30 patches, and skimmed
> the rest today.  Don't see anything wrong obviously.

Awesome!  Thanks for reading.

>> See the project page here:https://sourceware.org/gdb/wiki/cxx-conversion
>>
>> This series implements the first parts of the transition plan
>> described in that page.  Namely:
>>
>>    - Add a --enable-build-with-cxx option (default: no) to compile GDB
>>      and GDBserver with a C++ compiler, keeping the support for
>>      building with a C compiler.
>>
>>    - Modify GDB and GDBserver so they can be compiled in C++ mode,
>>      using G++'s '-fpermissive' option as shortcut.
>>
>>    - Split the TRY_CATCH macro into TRY/CATCH macros to better map to
>>      C++'s 'throw'/'try...catch' in C++ mode, and eliminate all the
>>      volatile gdb_exception objects.
> 
> To be clear, according to the transition plan on wiki, once this patch
> set is pushed in, we'll be at step 8.1, except that step 6 is not
> needed, and step 1 and 5 are skipped.  Is it a correct understanding?

I've now added pointers this thread, and to git branches, to the
transition plan in the wiki.

I'd rather say we've done up to 4, and done 8.1.  Not sure if we do need
to do anything special for step 1, other than just keeping it in mind
during reviews.  Step 5 still needs doing before we can consider flipping
the default to be C++ mode.

As for the patch for 8.1, as is, we'll be throwing C++ exception from
signal handlers.  I think we'll need to change GDB not to do that
before we can require a C++ compiler.  See also:

 https://sourceware.org/ml/gdb-patches/2015-02/msg00272.html

I haven't done anything on that front.  Help would be very much appreciated.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-09 23:49     ` Pedro Alves
@ 2015-02-12 11:49       ` Pedro Alves
  2015-02-18 19:55         ` Jakub Jelinek
  2015-02-14 17:29       ` Doug Evans
  1 sibling, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-12 11:49 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gdb-patches, GCC Patches

On 02/09/2015 11:49 PM, Pedro Alves wrote:
> On 02/09/2015 11:35 PM, Andrew Pinski wrote:
>> On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
>>> Just like libiberty.h.  So that C++ programs, such as GDB when built
>>> as a C++ program, can use it.
>>
>> Why is not needed for GCC building with C++ compiler?
> 
> Because it doesn't include it.
> 
> The header of the file claims it is part of GDB, though MAINTAINERS
> nowadays says that everything under include/ is owned by GCC.

Here's an update that moves the extern "C" below the #include.

OK to push to the GCC repo?

From: Pedro Alves <palves@redhat.com>
Subject: [PATCH] floatformat.h: Wrap in extern "C".

Just like libiberty.h.  So that C++ programs, such as GDB when built
as a C++ program, can use it.

include/ChangeLog:
2015-02-12  Pedro Alves  <palves@redhat.com>

	* floatformat.h [__cplusplus]: Wrap in extern "C".
---
 include/floatformat.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/floatformat.h b/include/floatformat.h
index 6b559864..af4d09c 100644
--- a/include/floatformat.h
+++ b/include/floatformat.h
@@ -22,6 +22,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.

 #include "ansidecl.h"

+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* A floatformat consists of a sign bit, an exponent and a mantissa.  Once the
    bytes are concatenated according to the byteorder flag, then each of those
    fields is contiguous.  We number the bits with 0 being the most significant
@@ -148,4 +152,8 @@ floatformat_from_double (const struct floatformat *, const double *, void *);
 extern int
 floatformat_is_valid (const struct floatformat *fmt, const void *from);

+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* defined (FLOATFORMAT_H) */
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-11 10:51       ` Pedro Alves
@ 2015-02-12 12:19         ` Joel Brobecker
  2015-02-12 13:14           ` Pedro Alves
  2015-02-27 17:41         ` Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: Joel Brobecker @ 2015-02-12 12:19 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> On 02/11/2015 10:27 AM, Pedro Alves wrote:
> 
> > Below's the patch that I plan on folding in.  Builds in C and C++ modes.
> > Regtesting in progress.
> 
> Regtesting successful.  Here's the current version of the patch.

Thanks a lot, Pedro, this is great.

I haven't had a chance to review all the patches, and I will admit
that I winced a little when seeing some of them (but accepted them),
but overall, I'm very impressed to see progress in this area.

Two comments:

  1. I personally am not ready for a full switch to C++ ;-)
     I know it's not what this patch does, but just sayin' :-).
     Will work on it, though, but if you had some ideas of how soon
     you'd like to do the switch, that might help me plan better.

  2. This is a fairly massive patch series, and in the interest
     of not making it inhuman for you to maintain it, I would be
     perfectly fine with a fairly quick process towards getting
     those patches pushed. Apart from the last few ones dealing
     with TRY_CATCH, it's fairly simple patches.

Cheers!
-- 
Joel

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-12 12:19         ` Joel Brobecker
@ 2015-02-12 13:14           ` Pedro Alves
  2015-02-12 14:43             ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-12 13:14 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 02/12/2015 12:19 PM, Joel Brobecker wrote:
>> On 02/11/2015 10:27 AM, Pedro Alves wrote:
>>
>>> Below's the patch that I plan on folding in.  Builds in C and C++ modes.
>>> Regtesting in progress.
>>
>> Regtesting successful.  Here's the current version of the patch.
> 
> Thanks a lot, Pedro, this is great.

Great, thanks.

> 
> I haven't had a chance to review all the patches, and I will admit
> that I winced a little when seeing some of them (but accepted them),

Not sure whether I want to ask which.  :-)

> but overall, I'm very impressed to see progress in this area.

Thanks.

> 
> Two comments:
> 
>   1. I personally am not ready for a full switch to C++ ;-)
>      I know it's not what this patch does, but just sayin' :-).
>      Will work on it, though, but if you had some ideas of how soon
>      you'd like to do the switch, that might help me plan better.

I don't have target dates in mind.  :-)  There's still work to do.

Before we start using C++ features, and thus stop supporting building
GDB as a C program, I think we should have a period where we'll
switch to C++ by default, while still leaving the C mode option
available as fallback.  Only when we're sure all supported
hosts / configurations build and work correctly, can we drop the
C mode and start using C++ features.

For fully converting to be a valid C++ program, we need to get rid
of the -fpermissive shortcut.  E.g., 'char *s = xmalloc (size);' needs
a cast in C++, but -fpermissive downgrades that to a warning.
There's another similarly sized series on my github to address that,
but it needs cleaning up and possibly redoing parts.  I can't tell
when I'll be able to get to it.  It may take several weeks to land
all that in mainline, unless I manage to recruit help (hint!, hint!).

There's also the "we shouldn't throw from signal handlers" issue I
mentioned in the reply to Yao, which has nobody working on
yet, afaik.

>   2. This is a fairly massive patch series, and in the interest
>      of not making it inhuman for you to maintain it, I would be
>      perfectly fine with a fairly quick process towards getting
>      those patches pushed. Apart from the last few ones dealing
>      with TRY_CATCH, it's fairly simple patches.

Thanks, that'd be great.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-12 13:14           ` Pedro Alves
@ 2015-02-12 14:43             ` Pedro Alves
  2015-02-12 14:59               ` Joel Brobecker
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-12 14:43 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 02/12/2015 01:14 PM, Pedro Alves wrote:
>> > I haven't had a chance to review all the patches, and I will admit
>> > that I winced a little when seeing some of them (but accepted them),
> Not sure whether I want to ask which.  :-)

Probably a minor thing, but I'd like to avoid a potential misunderstanding
here. I just realized that I never really knew what "winced" really means,
and that I may have misinterpreted what you said, which I guess
can make my response sound odd.  What I understood was that some of
the patches were ugly, but you accepted them anyway in the name
of progress.  :-)

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-12 14:43             ` Pedro Alves
@ 2015-02-12 14:59               ` Joel Brobecker
  0 siblings, 0 replies; 100+ messages in thread
From: Joel Brobecker @ 2015-02-12 14:59 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> >> > I haven't had a chance to review all the patches, and I will admit
> >> > that I winced a little when seeing some of them (but accepted them),
> > Not sure whether I want to ask which.  :-)
> 
> Probably a minor thing, but I'd like to avoid a potential misunderstanding
> here. I just realized that I never really knew what "winced" really means,
> and that I may have misinterpreted what you said, which I guess
> can make my response sound odd.  What I understood was that some of
> the patches were ugly, but you accepted them anyway in the name
> of progress.  :-)

No worries, the answer made total sense to me, and is exactly what
I expected it to be, with the humour that matched the evasiveness
of the statement ;-).

I didn't say which one(s) it was, because I don't want to be the one
starting a debate on them. In the end, I accepted them because I just
did not see a better solution anyway.

-- 
Joel

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-09 23:49     ` Pedro Alves
  2015-02-12 11:49       ` Pedro Alves
@ 2015-02-14 17:29       ` Doug Evans
  2015-02-14 18:36         ` Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: Doug Evans @ 2015-02-14 17:29 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Andrew Pinski, gdb-patches, GCC Patches

On Mon, Feb 9, 2015 at 3:49 PM, Pedro Alves <palves@redhat.com> wrote:
> On 02/09/2015 11:35 PM, Andrew Pinski wrote:
>> On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
>>> Just like libiberty.h.  So that C++ programs, such as GDB when built
>>> as a C++ program, can use it.
>>
>> Why is not needed for GCC building with C++ compiler?
>
> Because it doesn't include it.
>
> The header of the file claims it is part of GDB, though MAINTAINERS
> nowadays says that everything under include/ is owned by GCC.

Wait, what?

The actual wording is:
"The rule is that if the file exists in the gcc tree then gcc owns it."
It originated from this thread,
https://sourceware.org/ml/gdb/2013-11/msg00025.html
That's not the first message in the thread, but that's where
I remember wanting to see something written down.

Perhaps kinda unfortunate for things like include/gdb/gdb-index.h.
But at least it's a rule that can be expressed in one sentence,
and I don't think it's been a problem.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-14 17:29       ` Doug Evans
@ 2015-02-14 18:36         ` Pedro Alves
  2015-02-14 22:46           ` Doug Evans
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-14 18:36 UTC (permalink / raw)
  To: Doug Evans; +Cc: Andrew Pinski, gdb-patches, GCC Patches

On 02/14/2015 05:29 PM, Doug Evans wrote:
> On Mon, Feb 9, 2015 at 3:49 PM, Pedro Alves <palves@redhat.com> wrote:
>> On 02/09/2015 11:35 PM, Andrew Pinski wrote:
>>> Why is not needed for GCC building with C++ compiler?
>>
>> Because it doesn't include it.
>>
>> The header of the file claims it is part of GDB, though MAINTAINERS
>> nowadays says that everything under include/ is owned by GCC.
>
> Wait, what?
>
> The actual wording is:
> "The rule is that if the file exists in the gcc tree then gcc owns it."

I was paraphrasing, and simplified it.  That distinction seems
irrelevant to me here because the file does exist in the gcc tree.
It's necessary to build libiberty (for libiberty/floatformat.o).

It's a fact that the header claims it is part of GDB:

~~~~~~
/* IEEE floating point support declarations, for GDB, the GNU Debugger.
   Copyright (C) 1991-2015 Free Software Foundation, Inc.

This file is part of GDB.
(...)
~~~~~~

I guess it should say that it is part of libiberty instead.

> It originated from this thread,
> https://sourceware.org/ml/gdb/2013-11/msg00025.html
> That's not the first message in the thread, but that's where
> I remember wanting to see something written down.
>
> Perhaps kinda unfortunate for things like include/gdb/gdb-index.h.
> But at least it's a rule that can be expressed in one sentence,
> and I don't think it's been a problem.

I'm confused -- I didn't say it was a problem, nor expressed any
concern with the rule.  I just was pointing out facts.

ISTM that the procedure here is to push this change first through
the gcc repo first, and then merge it to binutils-gdb git.  Is that
wrong?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-14 18:36         ` Pedro Alves
@ 2015-02-14 22:46           ` Doug Evans
  0 siblings, 0 replies; 100+ messages in thread
From: Doug Evans @ 2015-02-14 22:46 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Andrew Pinski, gdb-patches, GCC Patches

On Sat, Feb 14, 2015 at 10:36 AM, Pedro Alves <palves@redhat.com> wrote:
> On 02/14/2015 05:29 PM, Doug Evans wrote:
>> On Mon, Feb 9, 2015 at 3:49 PM, Pedro Alves <palves@redhat.com> wrote:
>>> On 02/09/2015 11:35 PM, Andrew Pinski wrote:
>>>> Why is not needed for GCC building with C++ compiler?
>>>
>>> Because it doesn't include it.
>>>
>>> The header of the file claims it is part of GDB, though MAINTAINERS
>>> nowadays says that everything under include/ is owned by GCC.
>>
>> Wait, what?
>>
>> The actual wording is:
>> "The rule is that if the file exists in the gcc tree then gcc owns it."
>
> I was paraphrasing, and simplified it.  That distinction seems
> irrelevant to me here because the file does exist in the gcc tree.
> It's necessary to build libiberty (for libiberty/floatformat.o).

No worries, I just wanted to make sure it didn't say something
it shouldn't.

> It's a fact that the header claims it is part of GDB:
>
> ~~~~~~
> /* IEEE floating point support declarations, for GDB, the GNU Debugger.
>    Copyright (C) 1991-2015 Free Software Foundation, Inc.
>
> This file is part of GDB.
> (...)
> ~~~~~~
>
> I guess it should say that it is part of libiberty instead.

At the least the current wording is confusing.

>> It originated from this thread,
>> https://sourceware.org/ml/gdb/2013-11/msg00025.html
>> That's not the first message in the thread, but that's where
>> I remember wanting to see something written down.
>>
>> Perhaps kinda unfortunate for things like include/gdb/gdb-index.h.
>> But at least it's a rule that can be expressed in one sentence,
>> and I don't think it's been a problem.
>
> I'm confused -- I didn't say it was a problem, nor expressed any
> concern with the rule.  I just was pointing out facts.

I didn't say you said it was a problem.
It was just an offhand comment about the rule itself,
not anything you said.

> ISTM that the procedure here is to push this change first through
> the gcc repo first, and then merge it to binutils-gdb git.  Is that
> wrong?

That's the procedure as I understand it.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (38 preceding siblings ...)
  2015-02-11 17:15 ` Yao Qi
@ 2015-02-17 23:19 ` Patrick Palka
  2015-02-18 21:54   ` Yao Qi
  2015-02-27 18:19 ` Pedro Alves
  40 siblings, 1 reply; 100+ messages in thread
From: Patrick Palka @ 2015-02-17 23:19 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Mon, Feb 9, 2015 at 6:20 PM, Pedro Alves <palves@redhat.com> wrote:
> I'm glad to announce that the global maintainers have reached
> consensus on converting GDB to use C++ as implementation language.
>
> See the project page here: https://sourceware.org/gdb/wiki/cxx-conversion

My opinion is not worth much but I must admit that I am not a fan of
migrating to C++.  To keep it short -- on the whole, despite C's
disadvantages and C++'s advantages, I personally find C to be much
more pleasing to work with.  I hope it is not too presumptuous to
objectively state that it is easier to follow the unassailable KISS
principle with C.

On another note, as you all may already know, C++ support in GDB is
not great.  A migration to C++ will in the medium term make it harder
to debug GDB with GDB.  I wonder if this is an issue worth
considering.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 09/36] floatformat.h: Wrap in extern "C".
  2015-02-12 11:49       ` Pedro Alves
@ 2015-02-18 19:55         ` Jakub Jelinek
  0 siblings, 0 replies; 100+ messages in thread
From: Jakub Jelinek @ 2015-02-18 19:55 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Andrew Pinski, gdb-patches, GCC Patches

On Thu, Feb 12, 2015 at 11:49:01AM +0000, Pedro Alves wrote:
> On 02/09/2015 11:49 PM, Pedro Alves wrote:
> > On 02/09/2015 11:35 PM, Andrew Pinski wrote:
> >> On Mon, Feb 9, 2015 at 3:20 PM, Pedro Alves <palves@redhat.com> wrote:
> >>> Just like libiberty.h.  So that C++ programs, such as GDB when built
> >>> as a C++ program, can use it.
> >>
> >> Why is not needed for GCC building with C++ compiler?
> > 
> > Because it doesn't include it.
> > 
> > The header of the file claims it is part of GDB, though MAINTAINERS
> > nowadays says that everything under include/ is owned by GCC.
> 
> Here's an update that moves the extern "C" below the #include.
> 
> OK to push to the GCC repo?
> 
> From: Pedro Alves <palves@redhat.com>
> Subject: [PATCH] floatformat.h: Wrap in extern "C".
> 
> Just like libiberty.h.  So that C++ programs, such as GDB when built
> as a C++ program, can use it.
> 
> include/ChangeLog:
> 2015-02-12  Pedro Alves  <palves@redhat.com>
> 
> 	* floatformat.h [__cplusplus]: Wrap in extern "C".

Ok, thanks.

	Jakub

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-17 23:19 ` Patrick Palka
@ 2015-02-18 21:54   ` Yao Qi
  2015-02-18 23:49     ` Patrick Palka
  0 siblings, 1 reply; 100+ messages in thread
From: Yao Qi @ 2015-02-18 21:54 UTC (permalink / raw)
  To: Patrick Palka, Pedro Alves; +Cc: gdb-patches

On 02/17/2015 11:19 PM, Patrick Palka wrote:
> On another note, as you all may already know, C++ support in GDB is
> not great.  A migration to C++ will in the medium term make it harder
> to debug GDB with GDB.  I wonder if this is an issue worth
> considering.

Migration to C++ will increase the priority of improving C++ support in
GDB, which is the right thing to do, IMO.

-- 
Yao

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-18 21:54   ` Yao Qi
@ 2015-02-18 23:49     ` Patrick Palka
  0 siblings, 0 replies; 100+ messages in thread
From: Patrick Palka @ 2015-02-18 23:49 UTC (permalink / raw)
  To: Yao Qi; +Cc: Pedro Alves, gdb-patches

On Wed, Feb 18, 2015 at 4:41 PM, Yao Qi <qiyaoltc@gmail.com> wrote:
> On 02/17/2015 11:19 PM, Patrick Palka wrote:
>> On another note, as you all may already know, C++ support in GDB is
>> not great.  A migration to C++ will in the medium term make it harder
>> to debug GDB with GDB.  I wonder if this is an issue worth
>> considering.
>
> Migration to C++ will increase the priority of improving C++ support in
> GDB, which is the right thing to do, IMO.

That makes sense.

>
> --
> Yao

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 02/36] Add --enable-build-with-cxx configure switch
  2015-02-10 22:11   ` Yao Qi
@ 2015-02-27 13:24     ` Pedro Alves
  2015-02-27 14:20       ` Yao Qi
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-27 13:24 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 02/10/2015 10:11 PM, Yao Qi wrote:

>> @@ -172,11 +186,17 @@ then
>>      for w in ${build_warnings}; do
>>  	case $w in
>>  	-Werr*) WERROR_CFLAGS=-Werror ;;
>> -	*) # Check that GCC accepts it
>> +	*)
>> +	    # Check whether GCC accepts it.  Append -Werror to CFLAGS
> 
> s/CFLAGS/CXXFLAGS/ ?  Since you want to catch cc1plus warnings, so
> option should be append CXXFLAGS.

The -Werror idea here was just so that we could put C or C++-specific
warnings in build_warnings and have them automatically filtered out.

I ended up explicitly splitting C vs C++ specific warnings now,
so this -Werror is gone.

I also moved "-fpermissive" to $COMPILER instead, as really that's
a C++ mode, not a warning flag.  We want to use it even if gdb is
configured with --enable-build-warning=no.

Here's the new version.  Let me know what you think.

----
From 847cc322ca685432ea2962499e8fe3b8448e748f Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 27 Feb 2015 13:11:25 +0000
Subject: [PATCH] Add --enable-build-with-cxx configure switch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ (98/03)
compiler.

The name of the switch should be familiar to those who followed GCC's
own C++ conversion process.

. Adding -fpermissive to COMPILER in C++ mode (see the new
build-with-cxx.m4 file) makes errors like these be warnings instead:

  gdb/infrun.c:6597:1: error:   initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive]
   sig_print_info (enum gdb_signal oursig)
   ^
  gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’:
  gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive]
     restore_infcall_suspend_state (state);
				 ^

so that the compiler carries on compiling the file.  -Werror still
catches the warnings, so nothing is lost, only our lifes are made
easier by concentrating on getting other more important things out of
the way first.

There's no way to quiet those warnings.  Until they're all fixed, when
building in C++ mode, -Werror is disabled by default.

. Adding -Wno-narrowing suppresses thousands of instances of this warning:

  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]

We can defer handling those until we target C++11.


. Adding -Wno-sign-compare suppresses thousands of instances of this warning:

  gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
	 if (tmpulongest == tdep->fcntl_F_GETLK64)
				  ^


. Adding -Wno-write-strings suppresses thousands of instances of this warning:

  gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’:
  gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "editable";
	      ^
  gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "noneditable";
	      ^

For now, it's best to hide these warnings from view until we're
'-fpermissive'-clean, and can thus start building with -Werror.
The C compiler has always managed to build working GDBs with these
issues in the code, so a C++ compiler should too.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER): New, get it from autoconf.
	(COMPILE.pre, CC_LD): Use COMPILER.
	(CXX): Get from autoconf instead.
	(CXX_FOR_TARGET): Default to g++ instead of gcc.
	* acinclude.m4: Include build-with-cxx.m4.
	* build-with-cxx.m4: New file.
	* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
	Disable -Werror by default if building in C++ mode.
	(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
	-Wno-narrowing in C++ mode.  Only enable -Wpointer-sign in C mode.
	Run supported-warning-flags tests with the C++ compiler.
	Save/restore CXXFLAGS too.
	* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER): New, get it from autoconf.
	(CXX): Get from autoconf instead.
	(COMPILE.pre): Use COMPILER.
	(CC-LD): Rename to ...
	(CC_LD): ... this.  Use COMPILER.
	(gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust.
	(CXX_FOR_TARGET): Default to g++ instead of gcc.
	* acinclude.m4: Include build-with-cxx.m4.
	* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
	Disable -Werror by default if building in C++ mode.
	(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
	-Wno-narrowing in C++ mode. Run supported-warning-flags tests with
	the C++ compiler.  Save/restore CXXFLAGS too.
	* configure: Regenerate.
---
 gdb/Makefile.in            |  17 +-
 gdb/acinclude.m4           |   3 +
 gdb/build-with-cxx.m4      |  41 +++++
 gdb/configure              | 380 ++++++++++++++++++++++++++++++++++++++++++++-
 gdb/configure.ac           |  39 ++++-
 gdb/gdbserver/Makefile.in  |  16 +-
 gdb/gdbserver/acinclude.m4 |   3 +
 gdb/gdbserver/configure    | 374 +++++++++++++++++++++++++++++++++++++++++++-
 gdb/gdbserver/configure.ac |  33 +++-
 9 files changed, 875 insertions(+), 31 deletions(-)
 create mode 100644 gdb/build-with-cxx.m4

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 16e2f1c..1921ebf 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -79,12 +79,16 @@ MSGMERGE = msgmerge
 PACKAGE = @PACKAGE@
 CATALOGS = @CATALOGS@
 
+# The name of the compiler to use.
+COMPILER = @COMPILER@
+
 # 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
 # will be incorrectly compiled.  The "fixincludes" script in the gcc
 # distribution will fix your include files up.
 CC=@CC@
+CXX=@CXX@
 
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
@@ -93,7 +97,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 = $(CC)
+COMPILE.pre = $(COMPILER)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
@@ -123,7 +127,7 @@ 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=$(CC)
+CC_LD=$(COMPILER)
 
 # Where is our "include" directory?  Typically $(srcdir)/../include.
 # This is essentially the header file directory for the library
@@ -762,19 +766,18 @@ CC_FOR_TARGET = ` \
     fi; \
   fi`
 
-CXX = gcc
 CXX_FOR_TARGET = ` \
-  if [ -f $${rootme}/../gcc/xgcc ] ; then \
+  if [ -f $${rootme}/../gcc/xg++ ] ; then \
     if [ -f $${rootme}/../$(target_subdir)newlib/Makefile ] ; then \
-      echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/$(target_subdir)newlib/targ-include -idirafter $${rootsrc}/../$(target_subdir)newlib/libc/include -nostdinc -B$${rootme}/../$(target_subdir)newlib/; \
+      echo $${rootme}/../gcc/xg++ -B$${rootme}/../gcc/ -idirafter $${rootme}/$(target_subdir)newlib/targ-include -idirafter $${rootsrc}/../$(target_subdir)newlib/libc/include -nostdinc -B$${rootme}/../$(target_subdir)newlib/; \
     else \
-      echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/; \
+      echo $${rootme}/../gcc/xg++ -B$${rootme}/../gcc/; \
     fi; \
   else \
     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
       echo $(CXX); \
     else \
-      t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
+      t='$(program_transform_name)'; echo g++ | sed -e '' $$t; \
     fi; \
   fi`
 
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index b0ff259..b3e8ac1 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -60,6 +60,9 @@ m4_include([common/common.m4])
 dnl For libiberty_INIT.
 m4_include(../libiberty/libiberty.m4)
 
+dnl For --enable-build-with-cxx and COMPILER.
+m4_include(build-with-cxx.m4)
+
 ## ----------------------------------------- ##
 ## ANSIfy the C compiler whenever possible.  ##
 ## From Franc,ois Pinard                     ##
diff --git a/gdb/build-with-cxx.m4 b/gdb/build-with-cxx.m4
new file mode 100644
index 0000000..8802f4d
--- /dev/null
+++ b/gdb/build-with-cxx.m4
@@ -0,0 +1,41 @@
+dnl Copyright (C) 2014-2015 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([--enable-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=no])
+
+  if test "$enable_build_with_cxx" = "yes"; then
+    # We're using -fpermissive as shortcut for now.
+    COMPILER='$(CXX) -fpermissive'
+   else
+    COMPILER='$(CC)'
+  fi
+  AC_SUBST(COMPILER)
+])
diff --git a/gdb/configure b/gdb/configure
index cf7b81a..db6a93c 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -724,6 +724,7 @@ MAKE
 CCDEPMODE
 DEPDIR
 am__leading_dot
+COMPILER
 INSTALL_STRIP_PROGRAM
 STRIP
 install_sh
@@ -742,6 +743,9 @@ build
 EGREP
 GREP
 CPP
+ac_ct_CXX
+CXXFLAGS
+CXX
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -796,6 +800,7 @@ enable_option_checking
 enable_maintainer_mode
 enable_plugins
 enable_largefile
+enable_build_with_cxx
 with_separate_debug_dir
 with_gdb_datadir
 with_relocated_sources
@@ -849,6 +854,9 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+CXX
+CXXFLAGS
+CCC
 CPP
 MAKEINFO
 MAKEINFOFLAGS
@@ -1484,6 +1492,7 @@ Optional Features:
 			  (and sometimes confusing) to the casual installer
   --enable-plugins        Enable support for plugins
   --disable-largefile     omit support for large files
+  --enable-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)
@@ -1567,6 +1576,8 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   MAKEINFO    Parent configure detects if it is of sufficient version.
   MAKEINFOFLAGS
@@ -1696,6 +1707,44 @@ fi
 
 } # ac_fn_c_try_compile
 
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_cxx_try_compile
+
 # ac_fn_c_try_cpp LINENO
 # ----------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -3487,6 +3536,264 @@ 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
 
+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
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+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
+
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4634,6 +4941,30 @@ 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=no
+fi
+
+
+  if test "$enable_build_with_cxx" = "yes"; then
+    # We're using -fpermissive as shortcut for now.
+    COMPILER='$(CXX) -fpermissive'
+   else
+    COMPILER='$(CC)'
+  fi
+
+
+
 # Dependency checking.
 rm -rf .tst 2>/dev/null
 mkdir .tst 2>/dev/null
@@ -13038,8 +13369,11 @@ if test "${enable_werror+set}" = set; then :
 fi
 
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -13048,13 +13382,21 @@ if test "${ERROR_ON_WARNING}" = yes ; then
     WERROR_CFLAGS="-Werror"
 fi
 
+# These options work in either C or C++ modes.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
 -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
 -Wold-style-declaration -Wold-style-definition"
 
+# 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"
+fi
+
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.
 case "${host}" in
@@ -13092,6 +13434,18 @@ 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.
+if test "$enable_build_with_cxx" = "yes"; then
+    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
 then
@@ -13102,10 +13456,14 @@ $as_echo_n "checking compiler warning flags... " >&6; }
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.
 	    saved_CFLAGS="$CFLAGS"
 	    CFLAGS="$CFLAGS $w"
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS $w"
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -13116,11 +13474,12 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+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
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
@@ -13129,6 +13488,15 @@ fi
 
 
 
+if test "$enable_build_with_cxx" = "yes"; then
+   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.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cygwin" >&5
 $as_echo_n "checking for cygwin... " >&6; }
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 56c0709..30fa2f5 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -27,6 +27,8 @@ AM_MAINTAINER_MODE
 . $srcdir/../bfd/development.sh
 
 AC_PROG_CC
+AC_PROG_CXX
+
 AC_USE_SYSTEM_EXTENSIONS
 ACX_LARGEFILE
 AM_PROG_CC_STDC
@@ -36,6 +38,9 @@ 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])
@@ -1959,8 +1964,11 @@ AC_ARG_ENABLE(werror,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
    esac])
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -1969,13 +1977,21 @@ if test "${ERROR_ON_WARNING}" = yes ; then
     WERROR_CFLAGS="-Werror"
 fi
 
+# These options work in either C or C++ modes.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
 -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
 -Wold-style-declaration -Wold-style-definition"
 
+# 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"
+fi
+
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.
 case "${host}" in
@@ -2011,6 +2027,13 @@ 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])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
+
 WARN_CFLAGS=""
 if test "x${build_warnings}" != x -a "x$GCC" = xyes
 then
@@ -2020,11 +2043,15 @@ then
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.
 	    saved_CFLAGS="$CFLAGS"
 	    CFLAGS="$CFLAGS $w"
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS $w"
 	    AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
@@ -2032,6 +2059,10 @@ fi
 AC_SUBST(WARN_CFLAGS)
 AC_SUBST(WERROR_CFLAGS)
 
+if test "$enable_build_with_cxx" = "yes"; then
+   AC_LANG_POP([C++])
+fi
+
 # In the Cygwin environment, we need some additional flags.
 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
 [AC_EGREP_CPP(^lose$, [
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e479c7c..cb35470 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -49,7 +49,11 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 RANLIB = @RANLIB@
 
+# The name of the compiler to use.
+COMPILER = @COMPILER@
+
 CC = @CC@
+CXX = @CXX@
 AR = @AR@
 AR_FLAGS = rc
 
@@ -60,7 +64,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 = $(CC)
+COMPILE.pre = $(COMPILER)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
@@ -78,8 +82,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=${CC}
+#CC_LD=gcc -static
+CC_LD=$(COMPILER)
 
 # Where is the "include" directory?  Traditionally ../include or ./include
 INCLUDE_DIR =  ${srcdir}/../../include
@@ -294,7 +298,7 @@ clean-info: force
 
 gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBGNU) $(LIBIBERTY)
 	rm -f gdbserver$(EXEEXT)
-	${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
+	$(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
 	$(LIBGNU) $(LIBIBERTY) $(GDBSERVER_LIBS) $(XM_CLIBS)
 
 $(LIBGNU) $(LIBIBERTY) $(GNULIB_H): all-lib
@@ -304,7 +308,7 @@ all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile
 
 gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY)
 	rm -f gdbreplay$(EXEEXT)
-	${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \
+	$(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \
 	  $(XM_CLIBS) $(LIBGNU) $(LIBIBERTY)
 
 IPA_OBJS=ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o \
@@ -316,7 +320,7 @@ IPA_LIB=libinproctrace.so
 
 $(IPA_LIB): $(IPA_OBJS) ${ADD_DEPS} ${CDEPS}
 	rm -f $(IPA_LIB)
-	${CC-LD} -shared -fPIC -Wl,--no-undefined $(INTERNAL_CFLAGS) \
+	$(CC_LD) -shared -fPIC -Wl,--no-undefined $(INTERNAL_CFLAGS) \
 	$(INTERNAL_LDFLAGS) -o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread
 
 # Put the proper machine-specific files first, so M-. on a machine
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index ba4a21f..cbed321 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -23,6 +23,9 @@ m4_include(../common/common.m4)
 dnl For libiberty_INIT.
 m4_include(../../libiberty/libiberty.m4)
 
+dnl For --enable-build-with-cxx and COMPILER.
+m4_include(../build-with-cxx.m4)
+
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 7c39130..a14def9 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -615,6 +615,7 @@ DEPDIR
 am__leading_dot
 host_noncanonical
 target_noncanonical
+COMPILER
 RANLIB
 AR
 INSTALL_DATA
@@ -635,6 +636,9 @@ build
 EGREP
 GREP
 CPP
+ac_ct_CXX
+CXXFLAGS
+CXX
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -688,6 +692,7 @@ ac_user_opts='
 enable_option_checking
 enable_maintainer_mode
 enable_largefile
+enable_build_with_cxx
 enable_libmcheck
 with_ust
 with_ust_include
@@ -706,6 +711,9 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+CXX
+CXXFLAGS
+CCC
 CPP'
 
 
@@ -1328,6 +1336,7 @@ 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
+  --enable-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-inprocess-agent
@@ -1354,6 +1363,8 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
 
 Use these variables to override the choices made by `configure' or to help
@@ -1474,6 +1485,44 @@ fi
 
 } # ac_fn_c_try_compile
 
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_cxx_try_compile
+
 # ac_fn_c_try_cpp LINENO
 # ----------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -3206,6 +3255,263 @@ 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
 
+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
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+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
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4403,6 +4709,30 @@ $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=no
+fi
+
+
+  if test "$enable_build_with_cxx" = "yes"; then
+    # We're using -fpermissive as shortcut for now.
+    COMPILER='$(CXX) -fpermissive'
+   else
+    COMPILER='$(CC)'
+  fi
+
+
+
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
@@ -5451,8 +5781,11 @@ if test "${enable_werror+set}" = set; then :
 fi
 
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -5464,6 +5797,23 @@ fi
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
+# 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"
+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_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$GCC" = xyes
 then
@@ -5474,10 +5824,14 @@ $as_echo_n "checking compiler warning flags... " >&6; }
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.
 	    saved_CFLAGS="$CFLAGS"
 	    CFLAGS="$CFLAGS $w"
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS $w"
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -5488,11 +5842,12 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+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
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
@@ -5501,6 +5856,15 @@ fi
 
 
 
+if test "$enable_build_with_cxx" = "yes"; then
+   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
+
 old_LIBS="$LIBS"
 LIBS="$LIBS -ldl"
 for ac_func in dladdr
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 60636f7..cefc69e 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -26,6 +26,7 @@ AC_CONFIG_HEADER(config.h:config.in)
 AM_MAINTAINER_MODE
 
 AC_PROG_CC
+AC_PROG_CXX
 AC_GNU_SOURCE
 AC_SYS_LARGEFILE
 
@@ -39,6 +40,9 @@ 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
 
@@ -150,8 +154,11 @@ AC_ARG_ENABLE(werror,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
    esac])
 
-# Enable -Werror by default when using gcc.  Turn it off for releases.
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
+# Enable -Werror by default when using gcc in C mode.  Leave it off
+# for C++ until we're warning clean.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" \
+   && test x"$enable_build_with_cxx" != x"yes" \
+   && $development; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -163,6 +170,18 @@ fi
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
+# 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"
+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_LANG_PUSH([C++])
+fi
+
 WARN_CFLAGS=""
 if test "x$GCC" = xyes
 then
@@ -172,11 +191,15 @@ then
     for w in ${build_warnings}; do
 	case $w in
 	-Werr*) WERROR_CFLAGS=-Werror ;;
-	*) # Check that GCC accepts it
+	*)
+	    # Check whether GCC accepts it.
 	    saved_CFLAGS="$CFLAGS"
 	    CFLAGS="$CFLAGS $w"
+	    saved_CXXFLAGS="$CXXFLAGS"
+	    CXXFLAGS="$CXXFLAGS $w"
 	    AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
 	    CFLAGS="$saved_CFLAGS"
+	    CXXFLAGS="$saved_CXXFLAGS"
 	esac
     done
     AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
@@ -184,6 +207,10 @@ fi
 AC_SUBST(WARN_CFLAGS)
 AC_SUBST(WERROR_CFLAGS)
 
+if test "$enable_build_with_cxx" = "yes"; then
+   AC_LANG_POP([C++])
+fi
+
 dnl dladdr is glibc-specific.  It is used by thread-db.c but only for
 dnl debugging messages.  It lives in -ldl which is handled below so we don't
 dnl use AC_CHECK_LIB (or AC_SEARCH_LIBS) here.  Instead we just temporarily
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 02/36] Add --enable-build-with-cxx configure switch
  2015-02-27 13:24     ` Pedro Alves
@ 2015-02-27 14:20       ` Yao Qi
  2015-02-27 16:29         ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Yao Qi @ 2015-02-27 14:20 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Yao Qi, gdb-patches

Pedro Alves <palves@redhat.com> writes:

> The -Werror idea here was just so that we could put C or C++-specific
> warnings in build_warnings and have them automatically filtered out.
>
> I ended up explicitly splitting C vs C++ specific warnings now,
> so this -Werror is gone.
>
> I also moved "-fpermissive" to $COMPILER instead, as really that's
> a C++ mode, not a warning flag.  We want to use it even if gdb is
> configured with --enable-build-warning=no.
>
> Here's the new version.  Let me know what you think.

That is fine by me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it
  2015-02-09 23:53 ` [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it Pedro Alves
  2015-02-09 23:35   ` Pedro Alves
@ 2015-02-27 16:23   ` Pedro Alves
  1 sibling, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-27 16:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: GCC Patches

On 02/09/2015 11:20 PM, Pedro Alves wrote:
> Converting GDB to be a C++ program, I stumbled on 'basename' issues,
> like:
> 

...
 
> So I thought of adding a m4 file that projects that use libiberty can
> source to pull in the autoconf checks that libiberty needs done in
> order to use its public headers.
> 
> Turns out that this has already happened.  Since I first wrote this a
> few months back, libiberty gained more HAVE_DECL_FOO checks even, for
> the strtol & friends replacements.
> 
> Are the libiberty changes OK?

I moved the libiberty.m4 patch to the gdb/ directory instead,
and pushed it, as below, in order to unblock the GDB C++ conversion
series, and make it easier for others to help with the
conversion as well.

I put a libiberty.m4 patch series here:

 https://github.com/palves/gdb/tree/palves/libiberty_m4

that converts gas, gold, ld, gdb and libiberty/ itself to
use libiberty/libiberty.m4.  If people think that's a good
idea, I can post it at some point.

----
From 07697489f4587e41f4f63aa526c1bd7d2fcd5494 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 27 Feb 2015 15:52:02 +0000
Subject: [PATCH] Create libiberty.m4, have GDB and GDBserver use it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Converting GDB to be a C++ program, I stumbled on 'basename' issues,
like:

 src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’
 /usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’

which I believe led to this bit in gold's configure.ac:

 dnl We have to check these in C, not C++, because autoconf generates
 dnl tests which have no type information, and current glibc provides
 dnl multiple declarations of functions like basename when compiling
 dnl with C++.
 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])

These checks IIUC intend to generate all the HAVE_DECL_FOO symbols
that libiberty.h and ansidecl.h check.

GDB is missing these checks currently, which results in the conflict
shown above.

This adds an m4 file that both GDB and GDBserver's configury use to
pull in the autoconf checks that libiberty clients needs done in order
to use these libiberty.h/ansidecl.h.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* libiberty.m4: New file.
	* acinclude.m4: Include libiberty.m4.
	* configure.ac: Call libiberty_INIT.
	* config.in, configure: Regenerate.

gdb/gdbserver/
2015-02-27  Pedro Alves  <palves@redhat.com>

	* acinclude.m4: Include libiberty.m4.
	* configure.ac: Call libiberty_INIT.
	* config.in, configure: Regenerate.
---
 gdb/ChangeLog              |   7 +
 gdb/gdbserver/ChangeLog    |   6 +
 gdb/acinclude.m4           |   3 +
 gdb/config.in              |  45 ++++++
 gdb/configure              | 269 +++++++++++++++++++++++++++--------
 gdb/configure.ac           |   2 +
 gdb/gdbserver/acinclude.m4 |   3 +
 gdb/gdbserver/config.in    |  41 ++++++
 gdb/gdbserver/configure    | 339 +++++++++++++++++++++++++++++++++++++++++++++
 gdb/gdbserver/configure.ac |   2 +
 gdb/libiberty.m4           |  31 +++++
 11 files changed, 694 insertions(+), 54 deletions(-)
 create mode 100644 gdb/libiberty.m4

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7d3b1ce..dfaad27 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-27  Pedro Alves  <palves@redhat.com>
+
+	* libiberty.m4: New file.
+	* acinclude.m4: Include libiberty.m4.
+	* configure.ac: Call libiberty_INIT.
+	* config.in, configure: Regenerate.
+
 2015-02-27  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
 	* s390-linux-tdep.c (s390_gcc_target_options): Not just handle
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 6bb8950..28b582f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-27  Pedro Alves  <palves@redhat.com>
+
+	* acinclude.m4: Include libiberty.m4.
+	* configure.ac: Call libiberty_INIT.
+	* config.in, configure: Regenerate.
+
 2015-02-26  Pedro Alves  <palves@redhat.com>
 
 	* linux-low.c (linux_wait_1): When incrementing the PC past a
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 1f0b574..0ad90e7 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -57,6 +57,9 @@ sinclude([../config/zlib.m4])
 
 m4_include([common/common.m4])
 
+dnl For libiberty_INIT.
+m4_include(libiberty.m4)
+
 ## ----------------------------------------- ##
 ## ANSIfy the C compiler whenever possible.  ##
 ## From Franc,ois Pinard                     ##
diff --git a/gdb/config.in b/gdb/config.in
index 806cbac..4aaadb5 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -85,6 +85,17 @@
    you don't. */
 #undef HAVE_DECL_ADDR_NO_RANDOMIZE
 
+/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_ASPRINTF
+
+/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BASENAME
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
+
 /* Define to 1 if you have the declaration of `free', and to 0 if you don't.
    */
 #undef HAVE_DECL_FREE
@@ -117,6 +128,34 @@
    */
 #undef HAVE_DECL_STRSTR
 
+/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRTOL
+
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOLL
+
+/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOUL
+
+/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOULL
+
+/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRVERSCMP
+
+/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VASPRINTF
+
+/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VSNPRINTF
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
@@ -225,6 +264,9 @@
 /* Define to 1 if the compiler supports long double. */
 #undef HAVE_LONG_DOUBLE
 
+/* Define to 1 if the system has the type `long long'. */
+#undef HAVE_LONG_LONG
+
 /* Define if <sys/procfs.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
@@ -635,6 +677,9 @@
 /* The size of `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
 /* The size of `unsigned long', as computed by sizeof. */
 #undef SIZEOF_UNSIGNED_LONG
 

diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index 744871a..e5f4b76 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -20,6 +20,9 @@ dnl anything else in gdbserver.
 m4_include(../../config/codeset.m4)
 m4_include(../common/common.m4)
 
+dnl For libiberty_INIT.
+m4_include(../libiberty.m4)
+
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
 
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 8f68ed2..8114628 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -22,10 +22,25 @@
    you don't. */
 #undef HAVE_DECL_ADDR_NO_RANDOMIZE
 
+/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_ASPRINTF
+
+/* Define to 1 if you have the declaration of `basename(char *)', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BASENAME
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#undef HAVE_DECL_FFS
+
 /* Define to 1 if you have the declaration of `perror', and to 0 if you don't.
    */
 #undef HAVE_DECL_PERROR
 
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_SNPRINTF
+
 /* Define to 1 if you have the declaration of `strerror', and to 0 if you
    don't. */
 #undef HAVE_DECL_STRERROR
@@ -34,6 +49,26 @@
    */
 #undef HAVE_DECL_STRSTR
 
+/* Define to 1 if you have the declaration of `strtol', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRTOL
+
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOLL
+
+/* Define to 1 if you have the declaration of `strtoul', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOUL
+
+/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOULL
+
+/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRVERSCMP
+
 /* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_VASPRINTF
@@ -96,6 +131,9 @@
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
+/* Define to 1 if the system has the type `long long'. */
+#undef HAVE_LONG_LONG
+
 /* Define if <thread_db.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
@@ -253,6 +291,9 @@
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at runtime.

diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index f883adc..60636f7 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -193,6 +193,8 @@ LIBS="$LIBS -ldl"
 AC_CHECK_FUNCS(dladdr)
 LIBS="$old_LIBS"
 
+libiberty_INIT
+
 AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
 
 AC_CHECK_TYPES(socklen_t, [], [],
diff --git a/gdb/libiberty.m4 b/gdb/libiberty.m4
new file mode 100644
index 0000000..5655e07
--- /dev/null
+++ b/gdb/libiberty.m4
@@ -0,0 +1,31 @@
+dnl Bits libiberty clients must do on their autoconf step.
+dnl
+dnl   Copyright (C) 2012-2015 Free Software Foundation, Inc.
+dnl
+dnl This file 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; see the file COPYING3.  If not see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+dnl Checks for declarations ansidecl.h and libiberty.h themselves
+dnl check with HAVE_DECL_XXX, etc.
+
+AC_DEFUN([libiberty_INIT],
+[
+  # Check for presence and size of long long.
+  AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
+
+  AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
+  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
+  AC_CHECK_DECLS([strverscmp])
+])
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 02/36] Add --enable-build-with-cxx configure switch
  2015-02-27 14:20       ` Yao Qi
@ 2015-02-27 16:29         ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-27 16:29 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 02/27/2015 02:20 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>> The -Werror idea here was just so that we could put C or C++-specific
>> warnings in build_warnings and have them automatically filtered out.
>>
>> I ended up explicitly splitting C vs C++ specific warnings now,
>> so this -Werror is gone.
>>
>> I also moved "-fpermissive" to $COMPILER instead, as really that's
>> a C++ mode, not a warning flag.  We want to use it even if gdb is
>> configured with --enable-build-warning=no.
>>
>> Here's the new version.  Let me know what you think.
> 
> That is fine by me.

Great, I've pushed this one in.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
  2015-02-11 10:51       ` Pedro Alves
  2015-02-12 12:19         ` Joel Brobecker
@ 2015-02-27 17:41         ` Pedro Alves
  1 sibling, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-27 17:41 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 02/11/2015 10:51 AM, Pedro Alves wrote:
> On 02/11/2015 10:27 AM, Pedro Alves wrote:
> 
>> Below's the patch that I plan on folding in.  Builds in C and C++ modes.
>> Regtesting in progress.
> 
> Regtesting successful.  Here's the current version of the patch.

I've now pushed this in.  I only had to fix conflicts in linux-thread-db.c,
and only one new instance of a reserved keyword appeared in the codebase
meanwhile.  At least, in the files covered by an --enable-targets-all
build on x86_64 GNU/Linux.  Non-x86_64 GNU/Linux host specific files
may still have reserved keywords that need renaming.

Below's what I pushed.  I hope it doesn't cause much rebasing
trouble...

Thanks,
Pedro Alves

---
From fe978cb071b460b2d4aed2f9a71d895f84efce0e Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 27 Feb 2015 16:33:07 +0000
Subject: [PATCH] C++ keyword cleanliness, mostly auto-generated

This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.
---
 gdb/ChangeLog                     |   5 ++
 gdb/gdbserver/ChangeLog           |   5 ++
 gdb/ada-lang.c                    |  58 +++++++++---------
 gdb/ada-lang.h                    |   2 +-
 gdb/addrmap.c                     |  56 ++++++++---------
 gdb/aix-thread.c                  |  32 +++++-----
 gdb/amd64-tdep.c                  |  76 +++++++++++------------
 gdb/bcache.c                      |  14 ++---
 gdb/block.c                       |  10 +--
 gdb/block.h                       |   6 +-
 gdb/break-catch-throw.c           |  14 ++---
 gdb/buildsym.c                    |  18 +++---
 gdb/c-exp.y                       |  42 ++++++-------
 gdb/cli/cli-decode.c              | 110 ++++++++++++++++-----------------
 gdb/cli/cli-decode.h              |   2 +-
 gdb/cli/cli-script.c              |  10 +--
 gdb/cli/cli-setshow.c             |  20 +++---
 gdb/coffread.c                    |  38 ++++++------
 gdb/command.h                     |  24 ++++----
 gdb/common/cleanups.c             |  12 ++--
 gdb/common/filestuff.c            |   9 +--
 gdb/common/filestuff.h            |   4 +-
 gdb/continuations.c               |  12 ++--
 gdb/cp-name-parser.y              |  20 +++---
 gdb/cp-namespace.c                |  63 +++++++++----------
 gdb/cp-support.c                  |  48 +++++++--------
 gdb/cp-support.h                  |   2 +-
 gdb/cp-valprint.c                 |   4 +-
 gdb/d-exp.y                       |   8 +--
 gdb/darwin-nat-info.c             |  22 +++----
 gdb/darwin-nat.c                  | 124 +++++++++++++++++++-------------------
 gdb/dbxread.c                     |  41 +++++++------
 gdb/dwarf2read.c                  |  42 ++++++-------
 gdb/environ.c                     |   6 +-
 gdb/f-exp.y                       |  16 ++---
 gdb/frame.c                       |   6 +-
 gdb/gdbarch.c                     |  22 +++----
 gdb/gdbarch.sh                    |  22 +++----
 gdb/gdbserver/inferiors.h         |   2 +-
 gdb/gdbserver/linux-aarch64-low.c |   4 +-
 gdb/gdbserver/linux-arm-low.c     |  10 +--
 gdb/gdbserver/linux-low.c         |  20 +++---
 gdb/gdbserver/linux-mips-low.c    |  58 +++++++++---------
 gdb/gdbserver/linux-x86-low.c     |  10 +--
 gdb/gdbserver/lynx-low.c          |  12 ++--
 gdb/gdbserver/thread-db.c         |  42 ++++++-------
 gdb/gdbthread.h                   |   2 +-
 gdb/gdbtypes.c                    |  32 +++++-----
 gdb/gnu-v3-abi.c                  |  26 ++++----
 gdb/go-exp.y                      |   8 +--
 gdb/guile/guile-internal.h        |   6 +-
 gdb/guile/scm-symbol.c            |  22 +++----
 gdb/guile/scm-utils.c             |  12 ++--
 gdb/hppa-linux-tdep.c             |  14 ++---
 gdb/ia64-tdep.c                   |  30 ++++-----
 gdb/inf-ttrace.c                  |  32 +++++-----
 gdb/inferior.c                    |   2 +-
 gdb/inferior.h                    |   2 +-
 gdb/jit.c                         |  16 ++---
 gdb/jv-exp.y                      |  24 ++++----
 gdb/linux-thread-db.c             |  52 ++++++++--------
 gdb/macrotab.c                    |  14 ++---
 gdb/mdebugread.c                  |  54 ++++++++---------
 gdb/memattr.c                     |  24 ++++----
 gdb/mi/mi-cmd-var.c               |  14 ++---
 gdb/minsyms.c                     |  20 +++---
 gdb/nat/x86-dregs.c               |   4 +-
 gdb/nto-procfs.c                  |  16 ++---
 gdb/nto-tdep.c                    |   6 +-
 gdb/objc-lang.c                   |  68 ++++++++++-----------
 gdb/p-exp.y                       |  10 +--
 gdb/p-valprint.c                  |   6 +-
 gdb/parse.c                       |  10 +--
 gdb/parser-defs.h                 |   2 +-
 gdb/printcmd.c                    |  24 ++++----
 gdb/psymtab.c                     |  24 ++++----
 gdb/python/py-symbol.c            |  22 +++----
 gdb/remote-mips.c                 |   4 +-
 gdb/remote.c                      |  18 +++---
 gdb/solib-darwin.c                |  20 +++---
 gdb/solib-ia64-hpux.c             |   6 +-
 gdb/solib-pa64.c                  |  28 ++++-----
 gdb/solib-som.c                   |  58 +++++++++---------
 gdb/solib-spu.c                   |  24 ++++----
 gdb/solib-svr4.c                  |  86 +++++++++++++-------------
 gdb/stabsread.c                   |  62 +++++++++----------
 gdb/symfile-debug.c               |   6 +-
 gdb/symfile.h                     |   4 +-
 gdb/symtab.c                      |  48 +++++++--------
 gdb/thread.c                      |  10 +--
 gdb/top.c                         |   2 +-
 gdb/tui/tui-windata.c             |   2 +-
 gdb/typeprint.c                   |  14 ++---
 gdb/ui-file.h                     |   2 +-
 gdb/valarith.c                    |   6 +-
 gdb/value.c                       |   8 +--
 gdb/varobj.c                      |  44 +++++++-------
 gdb/varobj.h                      |   4 +-
 gdb/xcoffread.c                   |  30 ++++-----
 99 files changed, 1140 insertions(+), 1127 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d897031..2ba8a6d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-27  Tom Tromey  <tromey@redhat.com>
+	    Pedro Alves  <palves@redhat.com>
+
+	Rename symbols whose names are reserved C++ keywords throughout.
+
 2015-02-27  Pedro Alves  <palves@redhat.com>
 
 	* Makefile.in (COMPILER): New, get it from autoconf.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 111ed5b..ae35e19 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-27  Tom Tromey  <tromey@redhat.com>
+	    Pedro Alves  <palves@redhat.com>
+
+	Rename symbols whose names are reserved C++ keywords throughout.
+
 2015-02-27  Pedro Alves  <palves@redhat.com>
 
 	* Makefile.in (COMPILER): New, get it from autoconf.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 562627a..b016723 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -274,7 +274,7 @@ struct cache_entry
   /* The name used to perform the lookup.  */
   const char *name;
   /* The namespace used during the lookup.  */
-  domain_enum namespace;
+  domain_enum domain;
   /* The symbol returned by the lookup, or NULL if no matching symbol
      was found.  */
   struct symbol *sym;
@@ -4426,11 +4426,11 @@ ada_clear_symbol_cache (void)
   ada_init_symbol_cache (sym_cache);
 }
 
-/* Search our cache for an entry matching NAME and NAMESPACE.
+/* Search our cache for an entry matching NAME and DOMAIN.
    Return it if found, or NULL otherwise.  */
 
 static struct cache_entry **
-find_entry (const char *name, domain_enum namespace)
+find_entry (const char *name, domain_enum domain)
 {
   struct ada_symbol_cache *sym_cache
     = ada_get_symbol_cache (current_program_space);
@@ -4439,23 +4439,23 @@ find_entry (const char *name, domain_enum namespace)
 
   for (e = &sym_cache->root[h]; *e != NULL; e = &(*e)->next)
     {
-      if (namespace == (*e)->namespace && strcmp (name, (*e)->name) == 0)
+      if (domain == (*e)->domain && strcmp (name, (*e)->name) == 0)
         return e;
     }
   return NULL;
 }
 
-/* Search the symbol cache for an entry matching NAME and NAMESPACE.
+/* Search the symbol cache for an entry matching NAME and DOMAIN.
    Return 1 if found, 0 otherwise.
 
    If an entry was found and SYM is not NULL, set *SYM to the entry's
    SYM.  Same principle for BLOCK if not NULL.  */
 
 static int
-lookup_cached_symbol (const char *name, domain_enum namespace,
+lookup_cached_symbol (const char *name, domain_enum domain,
                       struct symbol **sym, const struct block **block)
 {
-  struct cache_entry **e = find_entry (name, namespace);
+  struct cache_entry **e = find_entry (name, domain);
 
   if (e == NULL)
     return 0;
@@ -4467,10 +4467,10 @@ lookup_cached_symbol (const char *name, domain_enum namespace,
 }
 
 /* Assuming that (SYM, BLOCK) is the result of the lookup of NAME
-   in domain NAMESPACE, save this result in our symbol cache.  */
+   in domain DOMAIN, save this result in our symbol cache.  */
 
 static void
-cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
               const struct block *block)
 {
   struct ada_symbol_cache *sym_cache
@@ -4503,7 +4503,7 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
   e->name = copy = obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
   strcpy (copy, name);
   e->sym = sym;
-  e->namespace = namespace;
+  e->domain = domain;
   e->block = block;
 }
 \f
@@ -4725,7 +4725,7 @@ ada_lookup_simple_minsym (const char *name)
 
 static void
 add_symbols_from_enclosing_procs (struct obstack *obstackp,
-                                  const char *name, domain_enum namespace,
+                                  const char *name, domain_enum domain,
                                   int wild_match_p)
 {
 }
@@ -5404,7 +5404,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
 
 static int
 ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
-			       domain_enum namespace,
+			       domain_enum domain,
 			       struct ada_symbol_info **results,
 			       int full_search)
 {
@@ -5443,7 +5443,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
       if (full_search)
 	{
 	  ada_add_local_symbols (&symbol_list_obstack, name, block,
-				 namespace, wild_match_p);
+				 domain, wild_match_p);
 	}
       else
 	{
@@ -5451,7 +5451,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 	     ada_iterate_over_symbols, and we don't want to search
 	     superblocks.  */
 	  ada_add_block_symbols (&symbol_list_obstack, block, name,
-				 namespace, NULL, wild_match_p);
+				 domain, NULL, wild_match_p);
 	}
       if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search)
 	goto done;
@@ -5461,7 +5461,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
      already performed this search before.  If we have, then return
      the same result.  */
 
-  if (lookup_cached_symbol (name0, namespace, &sym, &block))
+  if (lookup_cached_symbol (name0, domain, &sym, &block))
     {
       if (sym != NULL)
         add_defn_to_vec (&symbol_list_obstack, sym, block);
@@ -5472,14 +5472,14 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
 
   /* Search symbols from all global blocks.  */
  
-  add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1,
+  add_nonlocal_symbols (&symbol_list_obstack, name, domain, 1,
 			wild_match_p);
 
   /* Now add symbols from all per-file blocks if we've gotten no hits
      (not strictly correct, but perhaps better than an error).  */
 
   if (num_defns_collected (&symbol_list_obstack) == 0)
-    add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 0,
+    add_nonlocal_symbols (&symbol_list_obstack, name, domain, 0,
 			  wild_match_p);
 
 done:
@@ -5489,10 +5489,10 @@ done:
   ndefns = remove_extra_symbols (*results, ndefns);
 
   if (ndefns == 0 && full_search && syms_from_global_search)
-    cache_symbol (name0, namespace, NULL, NULL);
+    cache_symbol (name0, domain, NULL, NULL);
 
   if (ndefns == 1 && full_search && syms_from_global_search)
-    cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);
+    cache_symbol (name0, domain, (*results)[0].sym, (*results)[0].block);
 
   ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
 
@@ -5564,7 +5564,7 @@ ada_name_for_lookup (const char *name)
 
 void
 ada_lookup_encoded_symbol (const char *name, const struct block *block,
-			   domain_enum namespace,
+			   domain_enum domain,
 			   struct ada_symbol_info *info)
 {
   struct ada_symbol_info *candidates;
@@ -5573,7 +5573,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
   gdb_assert (info != NULL);
   memset (info, 0, sizeof (struct ada_symbol_info));
 
-  n_candidates = ada_lookup_symbol_list (name, block, namespace, &candidates);
+  n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates);
   if (n_candidates == 0)
     return;
 
@@ -5589,7 +5589,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
 
 struct symbol *
 ada_lookup_symbol (const char *name, const struct block *block0,
-                   domain_enum namespace, int *is_a_field_of_this)
+                   domain_enum domain, int *is_a_field_of_this)
 {
   struct ada_symbol_info info;
 
@@ -5597,7 +5597,7 @@ ada_lookup_symbol (const char *name, const struct block *block0,
     *is_a_field_of_this = 0;
 
   ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
-			     block0, namespace, &info);
+			     block0, domain, &info);
   return info.sym;
 }
 
@@ -7790,17 +7790,17 @@ struct type *
 ada_find_parallel_type (struct type *type, const char *suffix)
 {
   char *name;
-  const char *typename = ada_type_name (type);
+  const char *type_name = ada_type_name (type);
   int len;
 
-  if (typename == NULL)
+  if (type_name == NULL)
     return NULL;
 
-  len = strlen (typename);
+  len = strlen (type_name);
 
   name = (char *) alloca (len + strlen (suffix) + 1);
 
-  strcpy (name, typename);
+  strcpy (name, type_name);
   strcpy (name + len, suffix);
 
   return ada_find_parallel_type_with_name (type, name);
@@ -7863,9 +7863,9 @@ variant_field_index (struct type *type)
 /* A record type with no fields.  */
 
 static struct type *
-empty_record (struct type *template)
+empty_record (struct type *templ)
 {
-  struct type *type = alloc_type_copy (template);
+  struct type *type = alloc_type_copy (templ);
 
   TYPE_CODE (type) = TYPE_CODE_STRUCT;
   TYPE_NFIELDS (type) = 0;
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 29409e6..12761bf 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -244,7 +244,7 @@ extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
                                          domain_enum, int *);
 
 extern void ada_lookup_encoded_symbol
-  (const char *name, const struct block *block, domain_enum namespace,
+  (const char *name, const struct block *block, domain_enum domain,
    struct ada_symbol_info *symbol_info);
 
 extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 9bfcc96..4eb08cd 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -29,14 +29,14 @@
    implementation.  */
 struct addrmap_funcs
 {
-  void (*set_empty) (struct addrmap *this,
+  void (*set_empty) (struct addrmap *self,
                      CORE_ADDR start, CORE_ADDR end_inclusive,
                      void *obj);
-  void *(*find) (struct addrmap *this, CORE_ADDR addr);
-  struct addrmap *(*create_fixed) (struct addrmap *this,
+  void *(*find) (struct addrmap *self, CORE_ADDR addr);
+  struct addrmap *(*create_fixed) (struct addrmap *self,
                                    struct obstack *obstack);
-  void (*relocate) (struct addrmap *this, CORE_ADDR offset);
-  int (*foreach) (struct addrmap *this, addrmap_foreach_fn fn, void *data);
+  void (*relocate) (struct addrmap *self, CORE_ADDR offset);
+  int (*foreach) (struct addrmap *self, addrmap_foreach_fn fn, void *data);
 };
 
 
@@ -113,7 +113,7 @@ struct addrmap_fixed
 
 
 static void
-addrmap_fixed_set_empty (struct addrmap *this,
+addrmap_fixed_set_empty (struct addrmap *self,
                    CORE_ADDR start, CORE_ADDR end_inclusive,
                    void *obj)
 {
@@ -124,9 +124,9 @@ addrmap_fixed_set_empty (struct addrmap *this,
 
 
 static void *
-addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_fixed_find (struct addrmap *self, CORE_ADDR addr)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   struct addrmap_transition *bottom = &map->transitions[0];
   struct addrmap_transition *top = &map->transitions[map->num_transitions - 1];
 
@@ -157,7 +157,7 @@ addrmap_fixed_find (struct addrmap *this, CORE_ADDR addr)
 
 
 static struct addrmap *
-addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_fixed_create_fixed (struct addrmap *self, struct obstack *obstack)
 {
   internal_error (__FILE__, __LINE__,
                   _("addrmap_create_fixed is not implemented yet "
@@ -166,9 +166,9 @@ addrmap_fixed_create_fixed (struct addrmap *this, struct obstack *obstack)
 
 
 static void
-addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_fixed_relocate (struct addrmap *self, CORE_ADDR offset)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   size_t i;
 
   for (i = 0; i < map->num_transitions; i++)
@@ -177,10 +177,10 @@ addrmap_fixed_relocate (struct addrmap *this, CORE_ADDR offset)
 
 
 static int
-addrmap_fixed_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_fixed_foreach (struct addrmap *self, addrmap_foreach_fn fn,
 		       void *data)
 {
-  struct addrmap_fixed *map = (struct addrmap_fixed *) this;
+  struct addrmap_fixed *map = (struct addrmap_fixed *) self;
   size_t i;
 
   for (i = 0; i < map->num_transitions; i++)
@@ -315,26 +315,26 @@ addrmap_splay_tree_insert (struct addrmap_mutable *map,
    tree node at ADDR, even if it would represent a "transition" from
    one value to the same value.  */
 static void
-force_transition (struct addrmap_mutable *this, CORE_ADDR addr)
+force_transition (struct addrmap_mutable *self, CORE_ADDR addr)
 {
   splay_tree_node n
-    = addrmap_splay_tree_lookup (this, addr);
+    = addrmap_splay_tree_lookup (self, addr);
 
   if (! n)
     {
-      n = addrmap_splay_tree_predecessor (this, addr);
-      addrmap_splay_tree_insert (this, addr,
+      n = addrmap_splay_tree_predecessor (self, addr);
+      addrmap_splay_tree_insert (self, addr,
                                  n ? addrmap_node_value (n) : NULL);
     }
 }
 
 
 static void
-addrmap_mutable_set_empty (struct addrmap *this,
+addrmap_mutable_set_empty (struct addrmap *self,
                            CORE_ADDR start, CORE_ADDR end_inclusive,
                            void *obj)
 {
-  struct addrmap_mutable *map = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *map = (struct addrmap_mutable *) self;
   splay_tree_node n, next;
   void *prior_value;
 
@@ -384,7 +384,7 @@ addrmap_mutable_set_empty (struct addrmap *this,
 
 
 static void *
-addrmap_mutable_find (struct addrmap *this, CORE_ADDR addr)
+addrmap_mutable_find (struct addrmap *self, CORE_ADDR addr)
 {
   /* Not needed yet.  */
   internal_error (__FILE__, __LINE__,
@@ -422,15 +422,15 @@ splay_foreach_copy (splay_tree_node n, void *closure)
 
 
 static struct addrmap *
-addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
+addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
 {
-  struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
   struct addrmap_fixed *fixed;
   size_t num_transitions;
 
   /* Count the number of transitions in the tree.  */
   num_transitions = 0;
-  splay_tree_foreach (mutable->tree, splay_foreach_count, &num_transitions);
+  splay_tree_foreach (mutable_obj->tree, splay_foreach_count, &num_transitions);
 
   /* Include an extra entry for the transition at zero (which fixed
      maps have, but mutable maps do not.)  */
@@ -447,7 +447,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
 
   /* Copy all entries from the splay tree to the array, in order 
      of increasing address.  */
-  splay_tree_foreach (mutable->tree, splay_foreach_copy, fixed);
+  splay_tree_foreach (mutable_obj->tree, splay_foreach_copy, fixed);
 
   /* We should have filled the array.  */
   gdb_assert (fixed->num_transitions == num_transitions);
@@ -457,7 +457,7 @@ addrmap_mutable_create_fixed (struct addrmap *this, struct obstack *obstack)
 
 
 static void
-addrmap_mutable_relocate (struct addrmap *this, CORE_ADDR offset)
+addrmap_mutable_relocate (struct addrmap *self, CORE_ADDR offset)
 {
   /* Not needed yet.  */
   internal_error (__FILE__, __LINE__,
@@ -488,15 +488,15 @@ addrmap_mutable_foreach_worker (splay_tree_node node, void *data)
 
 
 static int
-addrmap_mutable_foreach (struct addrmap *this, addrmap_foreach_fn fn,
+addrmap_mutable_foreach (struct addrmap *self, addrmap_foreach_fn fn,
 			 void *data)
 {
-  struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
+  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
   struct mutable_foreach_data foreach_data;
 
   foreach_data.fn = fn;
   foreach_data.data = data;
-  return splay_tree_foreach (mutable->tree, addrmap_mutable_foreach_worker,
+  return splay_tree_foreach (mutable_obj->tree, addrmap_mutable_foreach_worker,
 			     &foreach_data);
 }
 
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c187ea0..b03716b 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -757,9 +757,9 @@ sync_threadlists (void)
       else if (gi == gcount)
 	{
 	  thread = add_thread (ptid_build (infpid, 0, pbuf[pi].pthid));
-	  thread->private = xmalloc (sizeof (struct private_thread_info));
-	  thread->private->pdtid = pbuf[pi].pdtid;
-	  thread->private->tid = pbuf[pi].tid;
+	  thread->priv = xmalloc (sizeof (struct private_thread_info));
+	  thread->priv->pdtid = pbuf[pi].pdtid;
+	  thread->priv->tid = pbuf[pi].tid;
 	  pi++;
 	}
       else
@@ -776,8 +776,8 @@ sync_threadlists (void)
 
 	  if (cmp_result == 0)
 	    {
-	      gbuf[gi]->private->pdtid = pdtid;
-	      gbuf[gi]->private->tid = tid;
+	      gbuf[gi]->priv->pdtid = pdtid;
+	      gbuf[gi]->priv->tid = tid;
 	      pi++;
 	      gi++;
 	    }
@@ -789,9 +789,9 @@ sync_threadlists (void)
 	  else
 	    {
 	      thread = add_thread (pptid);
-	      thread->private = xmalloc (sizeof (struct private_thread_info));
-	      thread->private->pdtid = pdtid;
-	      thread->private->tid = tid;
+	      thread->priv = xmalloc (sizeof (struct private_thread_info));
+	      thread->priv->pdtid = pdtid;
+	      thread->priv->tid = tid;
 	      pi++;
 	    }
 	}
@@ -809,7 +809,7 @@ iter_tid (struct thread_info *thread, void *tidp)
 {
   const pthdb_tid_t tid = *(pthdb_tid_t *)tidp;
 
-  return (thread->private->tid == tid);
+  return (thread->priv->tid == tid);
 }
 
 /* Synchronize libpthdebug's state with the inferior and with GDB,
@@ -999,7 +999,7 @@ aix_thread_resume (struct target_ops *ops,
 	error (_("aix-thread resume: unknown pthread %ld"),
 	       ptid_get_lwp (ptid));
 
-      tid[0] = thread->private->tid;
+      tid[0] = thread->priv->tid;
       if (tid[0] == PTHDB_INVALID_TID)
 	error (_("aix-thread resume: no tid for pthread %ld"),
 	       ptid_get_lwp (ptid));
@@ -1313,10 +1313,10 @@ aix_thread_fetch_registers (struct target_ops *ops,
   else
     {
       thread = find_thread_ptid (inferior_ptid);
-      tid = thread->private->tid;
+      tid = thread->priv->tid;
 
       if (tid == PTHDB_INVALID_TID)
-	fetch_regs_user_thread (regcache, thread->private->pdtid);
+	fetch_regs_user_thread (regcache, thread->priv->pdtid);
       else
 	fetch_regs_kernel_thread (regcache, regno, tid);
     }
@@ -1667,10 +1667,10 @@ aix_thread_store_registers (struct target_ops *ops,
   else
     {
       thread = find_thread_ptid (inferior_ptid);
-      tid = thread->private->tid;
+      tid = thread->priv->tid;
 
       if (tid == PTHDB_INVALID_TID)
-	store_regs_user_thread (regcache, thread->private->pdtid);
+	store_regs_user_thread (regcache, thread->priv->pdtid);
       else
 	store_regs_kernel_thread (regcache, regno, tid);
     }
@@ -1764,8 +1764,8 @@ aix_thread_extra_thread_info (struct target_ops *self,
 
   buf = mem_fileopen ();
 
-  pdtid = thread->private->pdtid;
-  tid = thread->private->tid;
+  pdtid = thread->priv->pdtid;
+  tid = thread->priv->tid;
 
   if (tid != PTHDB_INVALID_TID)
     /* i18n: Like "thread-identifier %d, [state] running, suspended" */
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index a661b88..e9de0f6 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -508,7 +508,7 @@ amd64_merge_classes (enum amd64_reg_class class1, enum amd64_reg_class class2)
   return AMD64_SSE;
 }
 
-static void amd64_classify (struct type *type, enum amd64_reg_class class[2]);
+static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]);
 
 /* Return non-zero if TYPE is a non-POD structure or union type.  */
 
@@ -527,19 +527,19 @@ amd64_non_pod_p (struct type *type)
    arrays) and union types, and store the result in CLASS.  */
 
 static void
-amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
+amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
 {
   /* 1. If the size of an object is larger than two eightbytes, or in
         C++, is a non-POD structure or union type, or contains
         unaligned fields, it has class memory.  */
   if (TYPE_LENGTH (type) > 16 || amd64_non_pod_p (type))
     {
-      class[0] = class[1] = AMD64_MEMORY;
+      theclass[0] = theclass[1] = AMD64_MEMORY;
       return;
     }
 
   /* 2. Both eightbytes get initialized to class NO_CLASS.  */
-  class[0] = class[1] = AMD64_NO_CLASS;
+  theclass[0] = theclass[1] = AMD64_NO_CLASS;
 
   /* 3. Each field of an object is classified recursively so that
         always two fields are considered. The resulting class is
@@ -551,9 +551,9 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
       struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type));
 
       /* All fields in an array have the same type.  */
-      amd64_classify (subtype, class);
-      if (TYPE_LENGTH (type) > 8 && class[1] == AMD64_NO_CLASS)
-	class[1] = class[0];
+      amd64_classify (subtype, theclass);
+      if (TYPE_LENGTH (type) > 8 && theclass[1] == AMD64_NO_CLASS)
+	theclass[1] = theclass[0];
     }
   else
     {
@@ -582,7 +582,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 	  gdb_assert (pos == 0 || pos == 1);
 
 	  amd64_classify (subtype, subclass);
-	  class[pos] = amd64_merge_classes (class[pos], subclass[0]);
+	  theclass[pos] = amd64_merge_classes (theclass[pos], subclass[0]);
 	  if (bitsize <= 64 && pos == 0 && endpos == 1)
 	    /* This is a bit of an odd case:  We have a field that would
 	       normally fit in one of the two eightbytes, except that
@@ -606,9 +606,9 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 	       use up all 16 bytes of the aggregate, and are already
 	       handled just fine (because each portion sits on its own
 	       8-byte).  */
-	    class[1] = amd64_merge_classes (class[1], subclass[0]);
+	    theclass[1] = amd64_merge_classes (theclass[1], subclass[0]);
 	  if (pos == 0)
-	    class[1] = amd64_merge_classes (class[1], subclass[1]);
+	    theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
 	}
     }
 
@@ -616,26 +616,26 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
 
   /* Rule (a): If one of the classes is MEMORY, the whole argument is
      passed in memory.  */
-  if (class[0] == AMD64_MEMORY || class[1] == AMD64_MEMORY)
-    class[0] = class[1] = AMD64_MEMORY;
+  if (theclass[0] == AMD64_MEMORY || theclass[1] == AMD64_MEMORY)
+    theclass[0] = theclass[1] = AMD64_MEMORY;
 
   /* Rule (b): If SSEUP is not preceded by SSE, it is converted to
      SSE.  */
-  if (class[0] == AMD64_SSEUP)
-    class[0] = AMD64_SSE;
-  if (class[1] == AMD64_SSEUP && class[0] != AMD64_SSE)
-    class[1] = AMD64_SSE;
+  if (theclass[0] == AMD64_SSEUP)
+    theclass[0] = AMD64_SSE;
+  if (theclass[1] == AMD64_SSEUP && theclass[0] != AMD64_SSE)
+    theclass[1] = AMD64_SSE;
 }
 
 /* Classify TYPE, and store the result in CLASS.  */
 
 static void
-amd64_classify (struct type *type, enum amd64_reg_class class[2])
+amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
 {
   enum type_code code = TYPE_CODE (type);
   int len = TYPE_LENGTH (type);
 
-  class[0] = class[1] = AMD64_NO_CLASS;
+  theclass[0] = theclass[1] = AMD64_NO_CLASS;
 
   /* Arguments of types (signed and unsigned) _Bool, char, short, int,
      long, long long, and pointers are in the INTEGER class.  Similarly,
@@ -646,28 +646,28 @@ amd64_classify (struct type *type, enum amd64_reg_class class[2])
        || code == TYPE_CODE_CHAR
        || code == TYPE_CODE_PTR || code == TYPE_CODE_REF)
       && (len == 1 || len == 2 || len == 4 || len == 8))
-    class[0] = AMD64_INTEGER;
+    theclass[0] = AMD64_INTEGER;
 
   /* Arguments of types float, double, _Decimal32, _Decimal64 and __m64
      are in class SSE.  */
   else if ((code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
 	   && (len == 4 || len == 8))
     /* FIXME: __m64 .  */
-    class[0] = AMD64_SSE;
+    theclass[0] = AMD64_SSE;
 
   /* Arguments of types __float128, _Decimal128 and __m128 are split into
      two halves.  The least significant ones belong to class SSE, the most
      significant one to class SSEUP.  */
   else if (code == TYPE_CODE_DECFLOAT && len == 16)
     /* FIXME: __float128, __m128.  */
-    class[0] = AMD64_SSE, class[1] = AMD64_SSEUP;
+    theclass[0] = AMD64_SSE, theclass[1] = AMD64_SSEUP;
 
   /* The 64-bit mantissa of arguments of type long double belongs to
      class X87, the 16-bit exponent plus 6 bytes of padding belongs to
      class X87UP.  */
   else if (code == TYPE_CODE_FLT && len == 16)
     /* Class X87 and X87UP.  */
-    class[0] = AMD64_X87, class[1] = AMD64_X87UP;
+    theclass[0] = AMD64_X87, theclass[1] = AMD64_X87UP;
 
   /* Arguments of complex T where T is one of the types float or
      double get treated as if they are implemented as:
@@ -679,19 +679,19 @@ amd64_classify (struct type *type, enum amd64_reg_class class[2])
 
   */
   else if (code == TYPE_CODE_COMPLEX && len == 8)
-    class[0] = AMD64_SSE;
+    theclass[0] = AMD64_SSE;
   else if (code == TYPE_CODE_COMPLEX && len == 16)
-    class[0] = class[1] = AMD64_SSE;
+    theclass[0] = theclass[1] = AMD64_SSE;
 
   /* A variable of type complex long double is classified as type
      COMPLEX_X87.  */
   else if (code == TYPE_CODE_COMPLEX && len == 32)
-    class[0] = AMD64_COMPLEX_X87;
+    theclass[0] = AMD64_COMPLEX_X87;
 
   /* Aggregates.  */
   else if (code == TYPE_CODE_ARRAY || code == TYPE_CODE_STRUCT
 	   || code == TYPE_CODE_UNION)
-    amd64_classify_aggregate (type, class);
+    amd64_classify_aggregate (type, theclass);
 }
 
 static enum return_value_convention
@@ -699,7 +699,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 		    struct type *type, struct regcache *regcache,
 		    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
-  enum amd64_reg_class class[2];
+  enum amd64_reg_class theclass[2];
   int len = TYPE_LENGTH (type);
   static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM };
   static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM };
@@ -710,7 +710,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
   gdb_assert (!(readbuf && writebuf));
 
   /* 1. Classify the return type with the classification algorithm.  */
-  amd64_classify (type, class);
+  amd64_classify (type, theclass);
 
   /* 2. If the type has class MEMORY, then the caller provides space
      for the return value and passes the address of this storage in
@@ -719,7 +719,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 
      On return %rax will contain the address that has been passed in
      by the caller in %rdi.  */
-  if (class[0] == AMD64_MEMORY)
+  if (theclass[0] == AMD64_MEMORY)
     {
       /* As indicated by the comment above, the ABI guarantees that we
          can always find the return value just after the function has
@@ -738,7 +738,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 
   /* 8. If the class is COMPLEX_X87, the real part of the value is
         returned in %st0 and the imaginary part in %st1.  */
-  if (class[0] == AMD64_COMPLEX_X87)
+  if (theclass[0] == AMD64_COMPLEX_X87)
     {
       if (readbuf)
 	{
@@ -760,7 +760,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
 
-  gdb_assert (class[1] != AMD64_MEMORY);
+  gdb_assert (theclass[1] != AMD64_MEMORY);
   gdb_assert (len <= 16);
 
   for (i = 0; len > 0; i++, len -= 8)
@@ -768,7 +768,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
       int regnum = -1;
       int offset = 0;
 
-      switch (class[i])
+      switch (theclass[i])
 	{
 	case AMD64_INTEGER:
 	  /* 3. If the class is INTEGER, the next available register
@@ -801,7 +801,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
 	case AMD64_X87UP:
 	  /* 7. If the class is X87UP, the value is returned together
              with the previous X87 value in %st0.  */
-	  gdb_assert (i > 0 && class[0] == AMD64_X87);
+	  gdb_assert (i > 0 && theclass[0] == AMD64_X87);
 	  regnum = AMD64_ST0_REGNUM;
 	  offset = 8;
 	  len = 2;
@@ -865,21 +865,21 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
     {
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
-      enum amd64_reg_class class[2];
+      enum amd64_reg_class theclass[2];
       int needed_integer_regs = 0;
       int needed_sse_regs = 0;
       int j;
 
       /* Classify argument.  */
-      amd64_classify (type, class);
+      amd64_classify (type, theclass);
 
       /* Calculate the number of integer and SSE registers needed for
          this argument.  */
       for (j = 0; j < 2; j++)
 	{
-	  if (class[j] == AMD64_INTEGER)
+	  if (theclass[j] == AMD64_INTEGER)
 	    needed_integer_regs++;
-	  else if (class[j] == AMD64_SSE)
+	  else if (theclass[j] == AMD64_SSE)
 	    needed_sse_regs++;
 	}
 
@@ -906,7 +906,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
 	      int regnum = -1;
 	      int offset = 0;
 
-	      switch (class[j])
+	      switch (theclass[j])
 		{
 		case AMD64_INTEGER:
 		  regnum = integer_regnum[integer_reg++];
diff --git a/gdb/bcache.c b/gdb/bcache.c
index 78c6d5d..f3abc12 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -264,14 +264,14 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
 
   /* The user's string isn't in the list.  Insert it after *ps.  */
   {
-    struct bstring *new
+    struct bstring *newobj
       = obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
 
-    memcpy (&new->d.data, addr, length);
-    new->length = length;
-    new->next = bcache->bucket[hash_index];
-    new->half_hash = half_hash;
-    bcache->bucket[hash_index] = new;
+    memcpy (&newobj->d.data, addr, length);
+    newobj->length = length;
+    newobj->next = bcache->bucket[hash_index];
+    newobj->half_hash = half_hash;
+    bcache->bucket[hash_index] = newobj;
 
     bcache->unique_count++;
     bcache->unique_size += length;
@@ -280,7 +280,7 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
     if (added)
       *added = 1;
 
-    return &new->d.data;
+    return &newobj->d.data;
   }
 }
 \f
diff --git a/gdb/block.c b/gdb/block.c
index 4175672..00a7012 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -34,7 +34,7 @@
 struct block_namespace_info
 {
   const char *scope;
-  struct using_direct *using;
+  struct using_direct *using_decl;
 };
 
 static void block_initialize_namespace (struct block *block,
@@ -326,7 +326,7 @@ block_using (const struct block *block)
   if (block == NULL || BLOCK_NAMESPACE (block) == NULL)
     return NULL;
   else
-    return BLOCK_NAMESPACE (block)->using;
+    return BLOCK_NAMESPACE (block)->using_decl;
 }
 
 /* Set BLOCK's using member to USING; if needed, allocate memory via
@@ -335,12 +335,12 @@ block_using (const struct block *block)
 
 void
 block_set_using (struct block *block,
-		 struct using_direct *using,
+		 struct using_direct *using_decl,
 		 struct obstack *obstack)
 {
   block_initialize_namespace (block, obstack);
 
-  BLOCK_NAMESPACE (block)->using = using;
+  BLOCK_NAMESPACE (block)->using_decl = using_decl;
 }
 
 /* If BLOCK_NAMESPACE (block) is NULL, allocate it via OBSTACK and
@@ -354,7 +354,7 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
       BLOCK_NAMESPACE (block)
 	= obstack_alloc (obstack, sizeof (struct block_namespace_info));
       BLOCK_NAMESPACE (block)->scope = NULL;
-      BLOCK_NAMESPACE (block)->using = NULL;
+      BLOCK_NAMESPACE (block)->using_decl = NULL;
     }
 }
 
diff --git a/gdb/block.h b/gdb/block.h
index e45f445..bdc5888 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -92,7 +92,7 @@ struct block
 	 this block: using directives and the current namespace
 	 scope.  */
       
-      struct block_namespace_info *namespace;
+      struct block_namespace_info *the_namespace;
     }
     cplus_specific;
   }
@@ -118,7 +118,7 @@ struct global_block
 #define BLOCK_FUNCTION(bl)	(bl)->function
 #define BLOCK_SUPERBLOCK(bl)	(bl)->superblock
 #define BLOCK_DICT(bl)		(bl)->dict
-#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.namespace
+#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.the_namespace
 
 struct blockvector
 {
@@ -176,7 +176,7 @@ extern void block_set_scope (struct block *block, const char *scope,
 extern struct using_direct *block_using (const struct block *block);
 
 extern void block_set_using (struct block *block,
-			     struct using_direct *using,
+			     struct using_direct *using_decl,
 			     struct obstack *obstack);
 
 extern const struct block *block_static_block (const struct block *block);
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index fb04932..2baf506 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -162,7 +162,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
 {
   struct exception_catchpoint *self
     = (struct exception_catchpoint *) bs->breakpoint_at;
-  char *typename = NULL;
+  char *type_name = NULL;
   volatile struct gdb_exception e;
 
   bkpt_breakpoint_ops.check_status (bs);
@@ -178,22 +178,22 @@ check_status_exception_catchpoint (struct bpstats *bs)
       char *canon;
 
       fetch_probe_arguments (NULL, &typeinfo_arg);
-      typename = cplus_typename_from_type_info (typeinfo_arg);
+      type_name = cplus_typename_from_type_info (typeinfo_arg);
 
-      canon = cp_canonicalize_string (typename);
+      canon = cp_canonicalize_string (type_name);
       if (canon != NULL)
 	{
-	  xfree (typename);
-	  typename = canon;
+	  xfree (type_name);
+	  type_name = canon;
 	}
     }
 
   if (e.reason < 0)
     exception_print (gdb_stderr, e);
-  else if (regexec (self->pattern, typename, 0, NULL, 0) != 0)
+  else if (regexec (self->pattern, type_name, 0, NULL, 0) != 0)
     bs->stop = 0;
 
-  xfree (typename);
+  xfree (type_name);
 }
 
 /* Implement the 're_set' method.  */
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index bb3ee26..2a24a25 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1622,7 +1622,7 @@ augment_type_symtab (void)
 struct context_stack *
 push_context (int desc, CORE_ADDR valu)
 {
-  struct context_stack *new;
+  struct context_stack *newobj;
 
   if (context_stack_depth == context_stack_size)
     {
@@ -1632,18 +1632,18 @@ push_context (int desc, CORE_ADDR valu)
 		  (context_stack_size * sizeof (struct context_stack)));
     }
 
-  new = &context_stack[context_stack_depth++];
-  new->depth = desc;
-  new->locals = local_symbols;
-  new->old_blocks = pending_blocks;
-  new->start_addr = valu;
-  new->using_directives = using_directives;
-  new->name = NULL;
+  newobj = &context_stack[context_stack_depth++];
+  newobj->depth = desc;
+  newobj->locals = local_symbols;
+  newobj->old_blocks = pending_blocks;
+  newobj->start_addr = valu;
+  newobj->using_directives = using_directives;
+  newobj->name = NULL;
 
   local_symbols = NULL;
   using_directives = NULL;
 
-  return new;
+  return newobj;
 }
 
 /* Pop a context block.  Returns the address of the context block just
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index e6de803..84f3a33 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -164,7 +164,7 @@ static int type_aggregate_p (struct type *);
 
     struct type_stack *type_stack;
 
-    struct objc_class_str class;
+    struct objc_class_str theclass;
   }
 
 %{
@@ -215,11 +215,11 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token <ssym> UNKNOWN_CPP_NAME
 %token <voidval> COMPLETE
 %token <tsym> TYPENAME
-%token <class> CLASSNAME	/* ObjC Class name */
+%token <theclass> CLASSNAME	/* ObjC Class name */
 %type <sval> name
 %type <svec> string_exp
 %type <ssym> name_not_typename
-%type <tsym> typename
+%type <tsym> type_name
 
  /* This is like a '[' token, but is only generated when parsing
     Objective C.  This lets us reuse the same parser without
@@ -238,7 +238,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token TEMPLATE
 %token ERROR
 %token NEW DELETE
-%type <sval> operator
+%type <sval> oper
 %token REINTERPRET_CAST DYNAMIC_CAST STATIC_CAST CONST_CAST
 %token ENTRY
 %token TYPEOF
@@ -479,17 +479,17 @@ exp	:	exp OBJC_LBRAC exp1 ']'
 
 exp	: 	OBJC_LBRAC TYPENAME
 			{
-			  CORE_ADDR class;
+			  CORE_ADDR theclass;
 
-			  class = lookup_objc_class (parse_gdbarch (pstate),
+			  theclass = lookup_objc_class (parse_gdbarch (pstate),
 						     copy_name ($2.stoken));
-			  if (class == 0)
+			  if (theclass == 0)
 			    error (_("%s is not an ObjC Class"),
 				   copy_name ($2.stoken));
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate,
 					    parse_type (pstate)->builtin_int);
-			  write_exp_elt_longcst (pstate, (LONGEST) class);
+			  write_exp_elt_longcst (pstate, (LONGEST) theclass);
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  start_msglist();
 			}
@@ -505,7 +505,7 @@ exp	:	OBJC_LBRAC CLASSNAME
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  write_exp_elt_type (pstate,
 					    parse_type (pstate)->builtin_int);
-			  write_exp_elt_longcst (pstate, (LONGEST) $2.class);
+			  write_exp_elt_longcst (pstate, (LONGEST) $2.theclass);
 			  write_exp_elt_opcode (pstate, OP_LONG);
 			  start_msglist();
 			}
@@ -1390,7 +1390,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 					       $2.length);
 			  $$ = NULL;
 			}
-	|	UNSIGNED typename
+	|	UNSIGNED type_name
 			{ $$ = lookup_unsigned_typename (parse_language (pstate),
 							 parse_gdbarch (pstate),
 							 TYPE_NAME($2.type)); }
@@ -1398,7 +1398,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 			{ $$ = lookup_unsigned_typename (parse_language (pstate),
 							 parse_gdbarch (pstate),
 							 "int"); }
-	|	SIGNED_KEYWORD typename
+	|	SIGNED_KEYWORD type_name
 			{ $$ = lookup_signed_typename (parse_language (pstate),
 						       parse_gdbarch (pstate),
 						       TYPE_NAME($2.type)); }
@@ -1419,7 +1419,7 @@ typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
 			{ $$ = follow_types ($1); }
 	;
 
-typename:	TYPENAME
+type_name:	TYPENAME
 	|	INT_KEYWORD
 		{
 		  $$.stoken.ptr = "int";
@@ -1501,7 +1501,7 @@ const_or_volatile_noopt:  	const_and_volatile
 			{ insert_type (tp_volatile); }
 	;
 
-operator:	OPERATOR NEW
+oper:	OPERATOR NEW
 			{ $$ = operator_stoken (" new"); }
 	|	OPERATOR DELETE
 			{ $$ = operator_stoken (" delete"); }
@@ -1632,7 +1632,7 @@ name	:	NAME { $$ = $1.stoken; }
 	|	TYPENAME { $$ = $1.stoken; }
 	|	NAME_OR_INT  { $$ = $1.stoken; }
 	|	UNKNOWN_CPP_NAME  { $$ = $1.stoken; }
-	|	operator { $$ = $1; }
+	|	oper { $$ = $1; }
 	;
 
 name_not_typename :	NAME
@@ -1644,7 +1644,7 @@ name_not_typename :	NAME
    context where only a name could occur, this might be useful.
   	|	NAME_OR_INT
  */
-	|	operator
+	|	oper
 			{
 			  struct field_of_this_result is_a_field_of_this;
 
@@ -2274,7 +2274,7 @@ enum token_flags
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
   enum token_flags flags;
@@ -2493,7 +2493,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	if ((tokentab3[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2506,7 +2506,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	if ((tokentab2[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2803,7 +2803,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	if ((ident_tokens[i].flags & FLAG_CXX) != 0
 	    && parse_language (par_state)->la_language != language_cplus)
@@ -2946,10 +2946,10 @@ classify_name (struct parser_state *par_state, const struct block *block,
       CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy);
       if (Class)
 	{
-	  yylval.class.class = Class;
+	  yylval.theclass.theclass = Class;
 	  sym = lookup_struct_typedef (copy, expression_context_block, 1);
 	  if (sym)
-	    yylval.class.type = SYMBOL_TYPE (sym);
+	    yylval.theclass.type = SYMBOL_TYPE (sym);
 	  return CLASSNAME;
 	}
     }
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4ec6ec0..2ee2ae0 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -189,7 +189,7 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
    of *LIST).  */
 
 struct cmd_list_element *
-add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
+add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 	 const char *doc, struct cmd_list_element **list)
 {
   struct cmd_list_element *c
@@ -228,7 +228,7 @@ add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
     }
 
   c->name = name;
-  c->class = class;
+  c->theclass = theclass;
   set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
@@ -283,7 +283,7 @@ deprecate_cmd (struct cmd_list_element *cmd, const char *replacement)
 }
 
 struct cmd_list_element *
-add_alias_cmd (const char *name, const char *oldname, enum command_class class,
+add_alias_cmd (const char *name, const char *oldname, enum command_class theclass,
 	       int abbrev_flag, struct cmd_list_element **list)
 {
   const char *tmp;
@@ -306,7 +306,7 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
       return 0;
     }
 
-  c = add_cmd (name, class, NULL, old->doc, list);
+  c = add_cmd (name, theclass, NULL, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
   if (old->doc_allocated)
@@ -335,13 +335,13 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
    containing that list.  */
 
 struct cmd_list_element *
-add_prefix_cmd (const char *name, enum command_class class,
+add_prefix_cmd (const char *name, enum command_class theclass,
 		cmd_cfunc_ftype *fun,
 		const char *doc, struct cmd_list_element **prefixlist,
 		const char *prefixname, int allow_unknown,
 		struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
   struct cmd_list_element *p;
 
   c->prefixlist = prefixlist;
@@ -363,13 +363,13 @@ add_prefix_cmd (const char *name, enum command_class class,
 /* Like add_prefix_cmd but sets the abbrev_flag on the new command.  */
 
 struct cmd_list_element *
-add_abbrev_prefix_cmd (const char *name, enum command_class class,
+add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
 		       cmd_cfunc_ftype *fun, const char *doc,
 		       struct cmd_list_element **prefixlist,
 		       const char *prefixname,
 		       int allow_unknown, struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
 
   c->prefixlist = prefixlist;
   c->prefixname = prefixname;
@@ -403,13 +403,13 @@ empty_sfunc (char *args, int from_tty, struct cmd_list_element *c)
 static struct cmd_list_element *
 add_set_or_show_cmd (const char *name,
 		     enum cmd_types type,
-		     enum command_class class,
+		     enum command_class theclass,
 		     var_types var_type,
 		     void *var,
 		     const char *doc,
 		     struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, NULL, doc, list);
 
   gdb_assert (type == set_cmd || type == show_cmd);
   c->type = type;
@@ -432,7 +432,7 @@ add_set_or_show_cmd (const char *name,
 
 static void
 add_setshow_cmd_full (const char *name,
-		      enum command_class class,
+		      enum command_class theclass,
 		      var_types var_type, void *var,
 		      const char *set_doc, const char *show_doc,
 		      const char *help_doc,
@@ -458,7 +458,7 @@ add_setshow_cmd_full (const char *name,
       full_set_doc = xstrdup (set_doc);
       full_show_doc = xstrdup (show_doc);
     }
-  set = add_set_or_show_cmd (name, set_cmd, class, var_type, var,
+  set = add_set_or_show_cmd (name, set_cmd, theclass, var_type, var,
 			     full_set_doc, set_list);
   set->doc_allocated = 1;
 
@@ -467,7 +467,7 @@ add_setshow_cmd_full (const char *name,
 
   set_cmd_prefix (set, set_list);
 
-  show = add_set_or_show_cmd (name, show_cmd, class, var_type, var,
+  show = add_set_or_show_cmd (name, show_cmd, theclass, var_type, var,
 			      full_show_doc, show_list);
   show->doc_allocated = 1;
   show->show_value_func = show_func;
@@ -485,7 +485,7 @@ add_setshow_cmd_full (const char *name,
 
 void
 add_setshow_enum_cmd (const char *name,
-		      enum command_class class,
+		      enum command_class theclass,
 		      const char *const *enumlist,
 		      const char **var,
 		      const char *set_doc,
@@ -498,7 +498,7 @@ add_setshow_enum_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_enum, var,
+  add_setshow_cmd_full (name, theclass, var_enum, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -514,7 +514,7 @@ const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
    string.  FUNC is the corresponding callback.  */
 void
 add_setshow_auto_boolean_cmd (const char *name,
-			      enum command_class class,
+			      enum command_class theclass,
 			      enum auto_boolean *var,
 			      const char *set_doc, const char *show_doc,
 			      const char *help_doc,
@@ -525,7 +525,7 @@ add_setshow_auto_boolean_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_auto_boolean, var,
+  add_setshow_cmd_full (name, theclass, var_auto_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -538,7 +538,7 @@ add_setshow_auto_boolean_cmd (const char *name,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
+add_setshow_boolean_cmd (const char *name, enum command_class theclass, int *var,
 			 const char *set_doc, const char *show_doc,
 			 const char *help_doc,
 			 cmd_sfunc_ftype *set_func,
@@ -549,7 +549,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
   static const char *boolean_enums[] = { "on", "off", NULL };
   struct cmd_list_element *c;
 
-  add_setshow_cmd_full (name, class, var_boolean, var,
+  add_setshow_cmd_full (name, theclass, var_boolean, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -560,7 +560,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class class, int *var,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_filename_cmd (const char *name, enum command_class class,
+add_setshow_filename_cmd (const char *name, enum command_class theclass,
 			  char **var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -571,7 +571,7 @@ add_setshow_filename_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_result;
 
-  add_setshow_cmd_full (name, class, var_filename, var,
+  add_setshow_cmd_full (name, theclass, var_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -582,7 +582,7 @@ add_setshow_filename_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_string_cmd (const char *name, enum command_class class,
+add_setshow_string_cmd (const char *name, enum command_class theclass,
 			char **var,
 			const char *set_doc, const char *show_doc,
 			const char *help_doc,
@@ -591,7 +591,7 @@ add_setshow_string_cmd (const char *name, enum command_class class,
 			struct cmd_list_element **set_list,
 			struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_string, var,
+  add_setshow_cmd_full (name, theclass, var_string, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -601,7 +601,7 @@ add_setshow_string_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 struct cmd_list_element *
-add_setshow_string_noescape_cmd (const char *name, enum command_class class,
+add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
 				 char **var,
 				 const char *set_doc, const char *show_doc,
 				 const char *help_doc,
@@ -612,7 +612,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_cmd;
 
-  add_setshow_cmd_full (name, class, var_string_noescape, var,
+  add_setshow_cmd_full (name, theclass, var_string_noescape, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -623,7 +623,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class class,
 /* Add element named NAME to both the set and show command LISTs (the
    list for set/show or some sublist thereof).  */
 void
-add_setshow_optional_filename_cmd (const char *name, enum command_class class,
+add_setshow_optional_filename_cmd (const char *name, enum command_class theclass,
 				   char **var,
 				   const char *set_doc, const char *show_doc,
 				   const char *help_doc,
@@ -634,7 +634,7 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set_result;
  
-  add_setshow_cmd_full (name, class, var_optional_filename, var,
+  add_setshow_cmd_full (name, theclass, var_optional_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -666,7 +666,7 @@ integer_unlimited_completer (struct cmd_list_element *ignore,
    value.  SET_DOC and SHOW_DOC are the documentation strings.  This
    function is only used in Python API.  Please don't use it elsewhere.  */
 void
-add_setshow_integer_cmd (const char *name, enum command_class class,
+add_setshow_integer_cmd (const char *name, enum command_class theclass,
 			 int *var,
 			 const char *set_doc, const char *show_doc,
 			 const char *help_doc,
@@ -677,7 +677,7 @@ add_setshow_integer_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_integer, var,
+  add_setshow_cmd_full (name, theclass, var_integer, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -691,7 +691,7 @@ add_setshow_integer_cmd (const char *name, enum command_class class,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_uinteger_cmd (const char *name, enum command_class class,
+add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
 			  unsigned int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -702,7 +702,7 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_uinteger, var,
+  add_setshow_cmd_full (name, theclass, var_uinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -716,7 +716,7 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_zinteger_cmd (const char *name, enum command_class class,
+add_setshow_zinteger_cmd (const char *name, enum command_class theclass,
 			  int *var,
 			  const char *set_doc, const char *show_doc,
 			  const char *help_doc,
@@ -725,7 +725,7 @@ add_setshow_zinteger_cmd (const char *name, enum command_class class,
 			  struct cmd_list_element **set_list,
 			  struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_zinteger, var,
+  add_setshow_cmd_full (name, theclass, var_zinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -734,7 +734,7 @@ add_setshow_zinteger_cmd (const char *name, enum command_class class,
 
 void
 add_setshow_zuinteger_unlimited_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
@@ -746,7 +746,7 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,
 {
   struct cmd_list_element *set;
 
-  add_setshow_cmd_full (name, class, var_zuinteger_unlimited, var,
+  add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -760,7 +760,7 @@ add_setshow_zuinteger_unlimited_cmd (const char *name,
    add_cmd.  VAR is address of the variable which will contain the
    value.  SET_DOC and SHOW_DOC are the documentation strings.  */
 void
-add_setshow_zuinteger_cmd (const char *name, enum command_class class,
+add_setshow_zuinteger_cmd (const char *name, enum command_class theclass,
 			   unsigned int *var,
 			   const char *set_doc, const char *show_doc,
 			   const char *help_doc,
@@ -769,7 +769,7 @@ add_setshow_zuinteger_cmd (const char *name, enum command_class class,
 			   struct cmd_list_element **set_list,
 			   struct cmd_list_element **show_list)
 {
-  add_setshow_cmd_full (name, class, var_zuinteger, var,
+  add_setshow_cmd_full (name, theclass, var_zuinteger, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
@@ -870,19 +870,19 @@ add_info_alias (const char *name, const char *oldname, int abbrev_flag)
 /* Add an element to the list of commands.  */
 
 struct cmd_list_element *
-add_com (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
+add_com (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 	 const char *doc)
 {
-  return add_cmd (name, class, fun, doc, &cmdlist);
+  return add_cmd (name, theclass, fun, doc, &cmdlist);
 }
 
 /* Add an alias or abbreviation command to the list of commands.  */
 
 struct cmd_list_element *
-add_com_alias (const char *name, const char *oldname, enum command_class class,
+add_com_alias (const char *name, const char *oldname, enum command_class theclass,
 	       int abbrev_flag)
 {
-  return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
+  return add_alias_cmd (name, oldname, theclass, abbrev_flag, &cmdlist);
 }
 \f
 /* Recursively walk the commandlist structures, and print out the
@@ -991,7 +991,7 @@ help_cmd (const char *command, struct ui_file *stream)
 
   /* If this is a class name, print all of the commands in the class.  */
   if (c->func == NULL)
-    help_list (cmdlist, "", c->class, stream);
+    help_list (cmdlist, "", c->theclass, stream);
 
   if (c->hook_pre || c->hook_post)
     fprintf_filtered (stream,
@@ -1021,7 +1021,7 @@ help_cmd (const char *command, struct ui_file *stream)
  */
 void
 help_list (struct cmd_list_element *list, const char *cmdtype,
-	   enum command_class class, struct ui_file *stream)
+	   enum command_class theclass, struct ui_file *stream)
 {
   int len;
   char *cmdtype1, *cmdtype2;
@@ -1042,14 +1042,14 @@ help_list (struct cmd_list_element *list, const char *cmdtype,
       strcpy (cmdtype2 + len - 1, " sub");
     }
 
-  if (class == all_classes)
+  if (theclass == all_classes)
     fprintf_filtered (stream, "List of classes of %scommands:\n\n", cmdtype2);
   else
     fprintf_filtered (stream, "List of %scommands:\n\n", cmdtype2);
 
-  help_cmd_list (list, class, cmdtype, (int) class >= 0, stream);
+  help_cmd_list (list, theclass, cmdtype, (int) theclass >= 0, stream);
 
-  if (class == all_classes)
+  if (theclass == all_classes)
     {
       fprintf_filtered (stream, "\n\
 Type \"help%s\" followed by a class name for a list of commands in ",
@@ -1091,7 +1091,7 @@ help_all (struct ui_file *stream)
       if (c->func == NULL)
 	{
 	  fprintf_filtered (stream, "\nCommand class: %s\n\n", c->name);
-	  help_cmd_list (cmdlist, c->class, "", 1, stream);
+	  help_cmd_list (cmdlist, c->theclass, "", 1, stream);
 	}
     }
 
@@ -1104,7 +1104,7 @@ help_all (struct ui_file *stream)
       if (c->abbrev_flag)
         continue;
 
-      if (c->class == no_class)
+      if (c->theclass == no_class)
 	{
 	  if (!seen_unclassified)
 	    {
@@ -1187,7 +1187,7 @@ print_help_for_command (struct cmd_list_element *c, const char *prefix,
  * is at the low level, not the high-level).
  */
 void
-help_cmd_list (struct cmd_list_element *list, enum command_class class,
+help_cmd_list (struct cmd_list_element *list, enum command_class theclass,
 	       const char *prefix, int recurse, struct ui_file *stream)
 {
   struct cmd_list_element *c;
@@ -1195,16 +1195,16 @@ help_cmd_list (struct cmd_list_element *list, enum command_class class,
   for (c = list; c; c = c->next)
     {      
       if (c->abbrev_flag == 0
-	  && (class == all_commands
-	      || (class == all_classes && c->func == NULL)
-	      || (class == c->class && c->func != NULL)))
+	  && (theclass == all_commands
+	      || (theclass == all_classes && c->func == NULL)
+	      || (theclass == c->theclass && c->func != NULL)))
 	{
 	  print_help_for_command (c, prefix, recurse, stream);
 	}
       else if (c->abbrev_flag == 0 && recurse
-	       && class == class_user && c->prefixlist != NULL)
+	       && theclass == class_user && c->prefixlist != NULL)
 	/* User-defined commands may be subcommands.  */
-	help_cmd_list (*c->prefixlist, class, c->prefixname, 
+	help_cmd_list (*c->prefixlist, theclass, c->prefixname,
 		       recurse, stream);
     }
 }
@@ -1898,6 +1898,6 @@ cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
 int
 cli_user_command_p (struct cmd_list_element *cmd)
 {
-  return (cmd->class == class_user
+  return (cmd->theclass == class_user
 	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
 }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index ec89325..a669ba6 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -53,7 +53,7 @@ struct cmd_list_element
     const char *name;
 
     /* Command class; class values are chosen by application program.  */
-    enum command_class class;
+    enum command_class theclass;
 
     /* When 1 indicated that this command is deprecated.  It may be
        removed from gdb's command set in the future.  */
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 2989b05..65232da 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1532,7 +1532,7 @@ define_command (char *comname, int from_tty)
     {
       int q;
 
-      if (c->class == class_user || c->class == class_alias)
+      if (c->theclass == class_user || c->theclass == class_alias)
 	q = query (_("Redefine command \"%s\"? "), c->name);
       else
 	q = query (_("Really redefine built-in command \"%s\"? "), c->name);
@@ -1584,11 +1584,11 @@ define_command (char *comname, int from_tty)
 	     "Type commands for definition of \"%s\".", comfull);
   cmds = read_command_lines (tmpbuf, from_tty, 1, 0, 0);
 
-  if (c && c->class == class_user)
+  if (c && c->theclass == class_user)
     free_command_lines (&c->user_commands);
 
   newc = add_cmd (comname, class_user, user_defined_command,
-		  (c && c->class == class_user)
+		  (c && c->theclass == class_user)
 		  ? c->doc : xstrdup ("User-defined."), list);
   newc->user_commands = cmds;
 
@@ -1629,7 +1629,7 @@ document_command (char *comname, int from_tty)
   tem = comname;
   c = lookup_cmd (&tem, *list, "", 0, 1);
 
-  if (c->class != class_user)
+  if (c->theclass != class_user)
     error (_("Command \"%s\" is built-in."), comfull);
 
   xsnprintf (tmpbuf, sizeof (tmpbuf), "Type documentation for \"%s\".",
@@ -1739,7 +1739,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
       const char *prefixname = c->prefixname;
 
       for (c = *c->prefixlist; c != NULL; c = c->next)
-	if (c->class == class_user || c->prefixlist != NULL)
+	if (c->theclass == class_user || c->prefixlist != NULL)
 	  show_user_1 (c, prefixname, c->name, gdb_stdout);
       return;
     }
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 09bf28d..8d01b52 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -37,8 +37,8 @@ notify_command_param_changed_p (int param_changed, struct cmd_list_element *c)
   if (param_changed == 0)
     return 0;
 
-  if (c->class == class_maintenance || c->class == class_deprecated
-      || c->class == class_obscure)
+  if (c->theclass == class_maintenance || c->theclass == class_deprecated
+      || c->theclass == class_obscure)
     return 0;
 
   return 1;
@@ -158,16 +158,16 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
     {
     case var_string:
       {
-	char *new;
+	char *newobj;
 	const char *p;
 	char *q;
 	int ch;
 
 	if (arg == NULL)
 	  arg = "";
-	new = (char *) xmalloc (strlen (arg) + 2);
+	newobj = (char *) xmalloc (strlen (arg) + 2);
 	p = arg;
-	q = new;
+	q = newobj;
 	while ((ch = *p++) != '\000')
 	  {
 	    if (ch == '\\')
@@ -195,18 +195,18 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  *q++ = ' ';
 #endif
 	*q++ = '\0';
-	new = (char *) xrealloc (new, q - new);
+	newobj = (char *) xrealloc (newobj, q - newobj);
 
 	if (*(char **) c->var == NULL
-	    || strcmp (*(char **) c->var, new) != 0)
+	    || strcmp (*(char **) c->var, newobj) != 0)
 	  {
 	    xfree (*(char **) c->var);
-	    *(char **) c->var = new;
+	    *(char **) c->var = newobj;
 
 	    option_changed = 1;
 	  }
 	else
-	  xfree (new);
+	  xfree (newobj);
       }
       break;
     case var_string_noescape:
@@ -693,7 +693,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix)
 	}
       else
 	{
-	  if (list->class != no_set_class)
+	  if (list->theclass != no_set_class)
 	    {
 	      struct cleanup *option_chain
 		= make_cleanup_ui_out_tuple_begin_end (uiout, "option");
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 20c8c5e..366d828 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -773,7 +773,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   struct coff_symbol coff_symbol;
   struct coff_symbol *cs = &coff_symbol;
   static struct internal_syment main_sym;
@@ -1067,9 +1067,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 	         context_stack_depth is zero, and complain if not.  */
 
 	      depth = 0;
-	      new = push_context (depth, fcn_start_addr);
+	      newobj = push_context (depth, fcn_start_addr);
 	      fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
-	      new->name =
+	      newobj->name =
 		process_coff_symbol (&fcn_cs_saved, 
 				     &fcn_aux_saved, objfile);
 	    }
@@ -1092,9 +1092,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  break;
 		}
 
-	      new = pop_context ();
+	      newobj = pop_context ();
 	      /* Stack must be empty now.  */
-	      if (context_stack_depth > 0 || new == NULL)
+	      if (context_stack_depth > 0 || newobj == NULL)
 		{
 		  complaint (&symfile_complaints,
 			     _("Unmatched .ef symbol(s) ignored "
@@ -1129,8 +1129,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		enter_linenos (fcn_line_ptr, fcn_first_line,
 			       fcn_last_line, objfile);
 
-	      finish_block (new->name, &local_symbols,
-			    new->old_blocks, new->start_addr,
+	      finish_block (newobj->name, &local_symbols,
+			    newobj->old_blocks, newobj->start_addr,
 			    fcn_cs_saved.c_value
 			    + fcn_aux_saved.x_sym.x_misc.x_fsize
 			    + ANOFFSET (objfile->section_offsets,
@@ -1158,8 +1158,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		  break;
 		}
 
-	      new = pop_context ();
-	      if (depth-- != new->depth)
+	      newobj = pop_context ();
+	      if (depth-- != newobj->depth)
 		{
 		  complaint (&symfile_complaints,
 			     _("Mismatched .eb symbol ignored "
@@ -1173,11 +1173,11 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 		    cs->c_value + ANOFFSET (objfile->section_offsets,
 					    SECT_OFF_TEXT (objfile));
 		  /* Make a block for the local symbols within.  */
-		  finish_block (0, &local_symbols, new->old_blocks,
-				new->start_addr, tmpaddr);
+		  finish_block (0, &local_symbols, newobj->old_blocks,
+				newobj->start_addr, tmpaddr);
 		}
 	      /* Now pop locals of block just finished.  */
-	      local_symbols = new->locals;
+	      local_symbols = newobj->locals;
 	    }
 	  break;
 
@@ -2060,7 +2060,7 @@ coff_read_struct_type (int index, int length, int lastsym,
 
   struct type *type;
   struct nextfield *list = 0;
-  struct nextfield *new;
+  struct nextfield *newobj;
   int nfields = 0;
   int n;
   char *name;
@@ -2087,9 +2087,9 @@ coff_read_struct_type (int index, int length, int lastsym,
 	case C_MOU:
 
 	  /* Get space to record the next field's data.  */
-	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
-	  new->next = list;
-	  list = new;
+	  newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+	  newobj->next = list;
+	  list = newobj;
 
 	  /* Save the data.  */
 	  list->field.name = obstack_copy0 (&objfile->objfile_obstack,
@@ -2104,9 +2104,9 @@ coff_read_struct_type (int index, int length, int lastsym,
 	case C_FIELD:
 
 	  /* Get space to record the next field's data.  */
-	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
-	  new->next = list;
-	  list = new;
+	  newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+	  newobj->next = list;
+	  list = newobj;
 
 	  /* Save the data.  */
 	  list->field.name = obstack_copy0 (&objfile->objfile_obstack,
diff --git a/gdb/command.h b/gdb/command.h
index 956eeaa..bdf625b 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -248,7 +248,7 @@ typedef void (show_value_ftype) (struct ui_file *file,
 extern show_value_ftype deprecated_show_value_hack;
 
 extern void add_setshow_enum_cmd (const char *name,
-				  enum command_class class,
+				  enum command_class theclass,
 				  const char *const *enumlist,
 				  const char **var,
 				  const char *set_doc,
@@ -260,7 +260,7 @@ extern void add_setshow_enum_cmd (const char *name,
 				  struct cmd_list_element **show_list);
 
 extern void add_setshow_auto_boolean_cmd (const char *name,
-					  enum command_class class,
+					  enum command_class theclass,
 					  enum auto_boolean *var,
 					  const char *set_doc,
 					  const char *show_doc,
@@ -271,7 +271,7 @@ extern void add_setshow_auto_boolean_cmd (const char *name,
 					  struct cmd_list_element **show_list);
 
 extern void add_setshow_boolean_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc, const char *show_doc,
 				     const char *help_doc,
@@ -281,7 +281,7 @@ extern void add_setshow_boolean_cmd (const char *name,
 				     struct cmd_list_element **show_list);
 
 extern void add_setshow_filename_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      char **var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -292,7 +292,7 @@ extern void add_setshow_filename_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_string_cmd (const char *name,
-				    enum command_class class,
+				    enum command_class theclass,
 				    char **var,
 				    const char *set_doc,
 				    const char *show_doc,
@@ -304,7 +304,7 @@ extern void add_setshow_string_cmd (const char *name,
 
 extern struct cmd_list_element *add_setshow_string_noescape_cmd
 		      (const char *name,
-		       enum command_class class,
+		       enum command_class theclass,
 		       char **var,
 		       const char *set_doc,
 		       const char *show_doc,
@@ -315,7 +315,7 @@ extern struct cmd_list_element *add_setshow_string_noescape_cmd
 		       struct cmd_list_element **show_list);
 
 extern void add_setshow_optional_filename_cmd (const char *name,
-					       enum command_class class,
+					       enum command_class theclass,
 					       char **var,
 					       const char *set_doc,
 					       const char *show_doc,
@@ -326,7 +326,7 @@ extern void add_setshow_optional_filename_cmd (const char *name,
 					       struct cmd_list_element **show_list);
 
 extern void add_setshow_integer_cmd (const char *name,
-				     enum command_class class,
+				     enum command_class theclass,
 				     int *var,
 				     const char *set_doc,
 				     const char *show_doc,
@@ -337,7 +337,7 @@ extern void add_setshow_integer_cmd (const char *name,
 				     struct cmd_list_element **show_list);
 
 extern void add_setshow_uinteger_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      unsigned int *var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -348,7 +348,7 @@ extern void add_setshow_uinteger_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_zinteger_cmd (const char *name,
-				      enum command_class class,
+				      enum command_class theclass,
 				      int *var,
 				      const char *set_doc,
 				      const char *show_doc,
@@ -359,7 +359,7 @@ extern void add_setshow_zinteger_cmd (const char *name,
 				      struct cmd_list_element **show_list);
 
 extern void add_setshow_zuinteger_cmd (const char *name,
-				       enum command_class class,
+				       enum command_class theclass,
 				       unsigned int *var,
 				       const char *set_doc,
 				       const char *show_doc,
@@ -371,7 +371,7 @@ extern void add_setshow_zuinteger_cmd (const char *name,
 
 extern void
   add_setshow_zuinteger_unlimited_cmd (const char *name,
-				       enum command_class class,
+				       enum command_class theclass,
 				       int *var,
 				       const char *set_doc,
 				       const char *show_doc,
diff --git a/gdb/common/cleanups.c b/gdb/common/cleanups.c
index 964df7a..e57e4cc 100644
--- a/gdb/common/cleanups.c
+++ b/gdb/common/cleanups.c
@@ -79,15 +79,15 @@ static struct cleanup *
 make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
 		  void *arg,  void (*free_arg) (void *))
 {
-  struct cleanup *new
+  struct cleanup *newobj
     = (struct cleanup *) xmalloc (sizeof (struct cleanup));
   struct cleanup *old_chain = *pmy_chain;
 
-  new->next = *pmy_chain;
-  new->function = function;
-  new->free_arg = free_arg;
-  new->arg = arg;
-  *pmy_chain = new;
+  newobj->next = *pmy_chain;
+  newobj->function = function;
+  newobj->free_arg = free_arg;
+  newobj->arg = arg;
+  *pmy_chain = newobj;
 
   gdb_assert (old_chain != NULL);
   return old_chain;
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index ef12821..14d6324 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -343,10 +343,11 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
 /* See filestuff.h.  */
 
 int
-gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
+gdb_socketpair_cloexec (int domain, int style, int protocol,
+			int filedes[2])
 {
 #ifdef HAVE_SOCKETPAIR
-  int result = socketpair (namespace, style | SOCK_CLOEXEC, protocol, filedes);
+  int result = socketpair (domain, style | SOCK_CLOEXEC, protocol, filedes);
 
   if (result != -1)
     {
@@ -363,9 +364,9 @@ gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
 /* See filestuff.h.  */
 
 int
-gdb_socket_cloexec (int namespace, int style, int protocol)
+gdb_socket_cloexec (int domain, int style, int protocol)
 {
-  int result = socket (namespace, style | SOCK_CLOEXEC, protocol);
+  int result = socket (domain, style | SOCK_CLOEXEC, protocol);
 
   if (result != -1)
     socket_mark_cloexec (result);
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index f44f3b1..98522a6 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -54,13 +54,13 @@ extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
 /* Like 'socketpair', but ensures that the returned file descriptors
    have the close-on-exec flag set.  */
 
-extern int gdb_socketpair_cloexec (int namespace, int style, int protocol,
+extern int gdb_socketpair_cloexec (int domain, int style, int protocol,
 				   int filedes[2]);
 
 /* Like 'socket', but ensures that the returned file descriptor has
    the close-on-exec flag set.  */
 
-extern int gdb_socket_cloexec (int namespace, int style, int protocol);
+extern int gdb_socket_cloexec (int domain, int style, int protocol);
 
 /* Like 'pipe', but ensures that the returned file descriptors have
    the close-on-exec flag set.  */
diff --git a/gdb/continuations.c b/gdb/continuations.c
index 412a085..e753dc1 100644
--- a/gdb/continuations.c
+++ b/gdb/continuations.c
@@ -39,13 +39,13 @@ make_continuation (struct continuation **pmy_chain,
 		   continuation_ftype *function,
 		   void *arg,  void (*free_arg) (void *))
 {
-  struct continuation *new = XNEW (struct continuation);
+  struct continuation *newobj = XNEW (struct continuation);
 
-  new->next = *pmy_chain;
-  new->function = function;
-  new->free_arg = free_arg;
-  new->arg = arg;
-  *pmy_chain = new;
+  newobj->next = *pmy_chain;
+  newobj->function = function;
+  newobj->free_arg = free_arg;
+  newobj->arg = arg;
+  *pmy_chain = newobj;
 }
 
 static void
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index c1e7951..b4690ea 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -277,9 +277,9 @@ make_name (const char *name, int len)
     const char *opname;
   }
 
-%type <comp> exp exp1 type start start_opt operator colon_name
+%type <comp> exp exp1 type start start_opt oper colon_name
 %type <comp> unqualified_name colon_ext_name
-%type <comp> template template_arg
+%type <comp> templ template_arg
 %type <comp> builtin_type
 %type <comp> typespec_2 array_indicator
 %type <comp> colon_ext_only ext_only_name
@@ -439,7 +439,7 @@ demangler_special
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, $2, $4); }
 		;
 
-operator	:	OPERATOR NEW
+oper	:	OPERATOR NEW
 			{
 			  /* Match the whitespacing of cplus_demangle_operators.
 			     It would abort on unrecognized string otherwise.  */
@@ -554,8 +554,8 @@ conversion_op_name
 
 /* DEMANGLE_COMPONENT_NAME */
 /* This accepts certain invalid placements of '~'.  */
-unqualified_name:	operator
-		|	operator '<' template_params '>'
+unqualified_name:	oper
+		|	oper '<' template_params '>'
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
 		|	'~' NAME
 			{ $$ = make_dtor (gnu_v3_complete_object_dtor, $2); }
@@ -579,9 +579,9 @@ colon_name	:	name
 name		:	nested_name NAME %prec NAME
 			{ $$ = $1.comp; d_right ($1.last) = $2; }
 		|	NAME %prec NAME
-		|	nested_name template %prec NAME
+		|	nested_name templ %prec NAME
 			{ $$ = $1.comp; d_right ($1.last) = $2; }
-		|	template %prec NAME
+		|	templ %prec NAME
 		;
 
 colon_ext_name	:	colon_name
@@ -611,13 +611,13 @@ nested_name	:	NAME COLONCOLON
 			  d_left ($$.last) = $2;
 			  d_right ($$.last) = NULL;
 			}
-		|	template COLONCOLON
+		|	templ COLONCOLON
 			{ $$.comp = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
 			  d_left ($$.comp) = $1;
 			  d_right ($$.comp) = NULL;
 			  $$.last = $$.comp;
 			}
-		|	nested_name template COLONCOLON
+		|	nested_name templ COLONCOLON
 			{ $$.comp = $1.comp;
 			  d_right ($1.last) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
 			  $$.last = d_right ($1.last);
@@ -628,7 +628,7 @@ nested_name	:	NAME COLONCOLON
 
 /* DEMANGLE_COMPONENT_TEMPLATE */
 /* DEMANGLE_COMPONENT_TEMPLATE_ARGLIST */
-template	:	NAME '<' template_params '>'
+templ	:	NAME '<' template_params '>'
 			{ $$ = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
 		;
 
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index e278189..4f68432 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -126,7 +126,7 @@ cp_add_using_directive (const char *dest,
                         struct obstack *obstack)
 {
   struct using_direct *current;
-  struct using_direct *new;
+  struct using_direct *newobj;
 
   /* Has it already been added?  */
 
@@ -163,39 +163,39 @@ cp_add_using_directive (const char *dest,
       return;
     }
 
-  new = obstack_alloc (obstack, (sizeof (*new)
+  newobj = obstack_alloc (obstack, (sizeof (*newobj)
 				 + (VEC_length (const_char_ptr, excludes)
-				    * sizeof (*new->excludes))));
-  memset (new, 0, sizeof (*new));
+				    * sizeof (*newobj->excludes))));
+  memset (newobj, 0, sizeof (*newobj));
 
   if (copy_names)
     {
-      new->import_src = obstack_copy0 (obstack, src, strlen (src));
-      new->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
+      newobj->import_src = obstack_copy0 (obstack, src, strlen (src));
+      newobj->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
     }
   else
     {
-      new->import_src = src;
-      new->import_dest = dest;
+      newobj->import_src = src;
+      newobj->import_dest = dest;
     }
 
   if (alias != NULL && copy_names)
-    new->alias = obstack_copy0 (obstack, alias, strlen (alias));
+    newobj->alias = obstack_copy0 (obstack, alias, strlen (alias));
   else
-    new->alias = alias;
+    newobj->alias = alias;
 
   if (declaration != NULL && copy_names)
-    new->declaration = obstack_copy0 (obstack,
+    newobj->declaration = obstack_copy0 (obstack,
 				      declaration, strlen (declaration));
   else
-    new->declaration = declaration;
+    newobj->declaration = declaration;
 
-  memcpy (new->excludes, VEC_address (const_char_ptr, excludes),
-	  VEC_length (const_char_ptr, excludes) * sizeof (*new->excludes));
-  new->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
+  memcpy (newobj->excludes, VEC_address (const_char_ptr, excludes),
+	  VEC_length (const_char_ptr, excludes) * sizeof (*newobj->excludes));
+  newobj->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
 
-  new->next = using_directives;
-  using_directives = new;
+  newobj->next = using_directives;
+  using_directives = newobj;
 }
 
 /* Test whether or not NAMESPACE looks like it mentions an anonymous
@@ -293,14 +293,14 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
 
   if (search)
     {
-      struct symbol *this;
+      struct symbol *lang_this;
       struct type *type;
 
-      this = lookup_language_this (language_def (language_cplus), block);
-      if (this == NULL)
+      lang_this = lookup_language_this (language_def (language_cplus), block);
+      if (lang_this == NULL)
 	return NULL;
 
-      type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
+      type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this)));
       /* If TYPE_NAME is NULL, abandon trying to find this symbol.
 	 This can happen for lambda functions compiled with clang++,
 	 which outputs no name for the container class.  */
@@ -384,7 +384,7 @@ cp_search_static_and_baseclasses (const char *name,
    "this" if we can compute it.  */
 
 static struct symbol *
-cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
+cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
 			       const struct block *block,
 			       const domain_enum domain, int search)
 {
@@ -393,11 +393,11 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
   unsigned int prefix_len;
   struct symbol *sym;
 
-  if (namespace[0] != '\0')
+  if (the_namespace[0] != '\0')
     {
-      concatenated_name = alloca (strlen (namespace) + 2
+      concatenated_name = alloca (strlen (the_namespace) + 2
 				  + strlen (name) + 1);
-      strcpy (concatenated_name, namespace);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, name);
       name = concatenated_name;
@@ -412,7 +412,8 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name,
      class/namespace.  Since we're only searching static and global blocks
      there's often no need to first do that lookup.  */
 
-  is_in_anonymous = namespace[0] != '\0' && cp_is_in_anonymous (namespace);
+  is_in_anonymous
+    = the_namespace[0] != '\0' && cp_is_in_anonymous (the_namespace);
   sym = cp_basic_lookup_symbol (name, block, domain, is_in_anonymous);
   if (sym != NULL)
     return sym;
@@ -786,7 +787,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
 			const char *scope,
 			int scope_len)
 {
-  char *namespace;
+  char *the_namespace;
 
   if (scope[scope_len] != '\0')
     {
@@ -822,10 +823,10 @@ lookup_namespace_scope (const struct language_defn *langdef,
   if (scope_len == 0 && strchr (name, ':') == NULL)
     return cp_lookup_bare_symbol (langdef, name, block, domain, 1);
 
-  namespace = alloca (scope_len + 1);
-  strncpy (namespace, scope, scope_len);
-  namespace[scope_len] = '\0';
-  return cp_lookup_symbol_in_namespace (namespace, name,
+  the_namespace = alloca (scope_len + 1);
+  strncpy (the_namespace, scope, scope_len);
+  the_namespace[scope_len] = '\0';
+  return cp_lookup_symbol_in_namespace (the_namespace, name,
 					block, domain, 1);
 }
 
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 59463e3..260601f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -56,7 +56,7 @@ static void overload_list_add_symbol (struct symbol *sym,
 				      const char *oload_name);
 
 static void make_symbol_overload_list_using (const char *func_name,
-					     const char *namespace);
+					     const char *the_namespace);
 
 static void make_symbol_overload_list_qualified (const char *func_name);
 
@@ -326,15 +326,15 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
     {
       if (d_left (comp)->type == DEMANGLE_COMPONENT_NAME)
 	{
-	  struct demangle_component new;
+	  struct demangle_component newobj;
 
 	  ui_file_write (buf, d_left (comp)->u.s_name.s,
 			 d_left (comp)->u.s_name.len);
 	  name = ui_file_obsavestring (buf, &info->obstack, &len);
-	  new.type = DEMANGLE_COMPONENT_NAME;
-	  new.u.s_name.s = name;
-	  new.u.s_name.len = len;
-	  if (inspect_type (info, &new, finder, data))
+	  newobj.type = DEMANGLE_COMPONENT_NAME;
+	  newobj.u.s_name.s = name;
+	  newobj.u.s_name.len = len;
+	  if (inspect_type (info, &newobj, finder, data))
 	    {
 	      char *n, *s;
 	      long slen;
@@ -344,7 +344,7 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
 		 node.  */
 
 	      ui_file_rewind (buf);
-	      n = cp_comp_to_string (&new, 100);
+	      n = cp_comp_to_string (&newobj, 100);
 	      if (n == NULL)
 		{
 		  /* If something went astray, abort typedef substitutions.  */
@@ -1174,7 +1174,7 @@ overload_list_add_symbol (struct symbol *sym,
 
 struct symbol **
 make_symbol_overload_list (const char *func_name,
-			   const char *namespace)
+			   const char *the_namespace)
 {
   struct cleanup *old_cleanups;
   const char *name;
@@ -1187,15 +1187,15 @@ make_symbol_overload_list (const char *func_name,
 
   old_cleanups = make_cleanup (xfree, sym_return_val);
 
-  make_symbol_overload_list_using (func_name, namespace);
+  make_symbol_overload_list_using (func_name, the_namespace);
 
-  if (namespace[0] == '\0')
+  if (the_namespace[0] == '\0')
     name = func_name;
   else
     {
       char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
-      strcpy (concatenated_name, namespace);
+	= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, func_name);
       name = concatenated_name;
@@ -1226,19 +1226,19 @@ make_symbol_overload_list_block (const char *name,
 
 static void
 make_symbol_overload_list_namespace (const char *func_name,
-                                     const char *namespace)
+                                     const char *the_namespace)
 {
   const char *name;
   const struct block *block = NULL;
 
-  if (namespace[0] == '\0')
+  if (the_namespace[0] == '\0')
     name = func_name;
   else
     {
       char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+	= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
 
-      strcpy (concatenated_name, namespace);
+      strcpy (concatenated_name, the_namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, func_name);
       name = concatenated_name;
@@ -1263,7 +1263,7 @@ static void
 make_symbol_overload_list_adl_namespace (struct type *type,
                                          const char *func_name)
 {
-  char *namespace;
+  char *the_namespace;
   const char *type_name;
   int i, prefix_len;
 
@@ -1287,11 +1287,11 @@ make_symbol_overload_list_adl_namespace (struct type *type,
 
   if (prefix_len != 0)
     {
-      namespace = alloca (prefix_len + 1);
-      strncpy (namespace, type_name, prefix_len);
-      namespace[prefix_len] = '\0';
+      the_namespace = alloca (prefix_len + 1);
+      strncpy (the_namespace, type_name, prefix_len);
+      the_namespace[prefix_len] = '\0';
 
-      make_symbol_overload_list_namespace (func_name, namespace);
+      make_symbol_overload_list_namespace (func_name, the_namespace);
     }
 
   /* Check public base type */
@@ -1340,7 +1340,7 @@ reset_directive_searched (void *data)
 
 static void
 make_symbol_overload_list_using (const char *func_name,
-				 const char *namespace)
+				 const char *the_namespace)
 {
   struct using_direct *current;
   const struct block *block;
@@ -1365,7 +1365,7 @@ make_symbol_overload_list_using (const char *func_name,
         if (current->alias != NULL || current->declaration != NULL)
           continue;
 
-        if (strcmp (namespace, current->import_dest) == 0)
+        if (strcmp (the_namespace, current->import_dest) == 0)
 	  {
 	    /* Mark this import as searched so that the recursive call
 	       does not search it again.  */
@@ -1383,7 +1383,7 @@ make_symbol_overload_list_using (const char *func_name,
       }
 
   /* Now, add names for this namespace.  */
-  make_symbol_overload_list_namespace (func_name, namespace);
+  make_symbol_overload_list_namespace (func_name, the_namespace);
 }
 
 /* This does the bulk of the work of finding overloaded symbols.
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 407da62..cbff610 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -198,7 +198,7 @@ extern struct symbol *cp_lookup_symbol_nonlocal
       const struct block *block,
       const domain_enum domain);
 
-extern struct symbol *cp_lookup_symbol_namespace (const char *namespace,
+extern struct symbol *cp_lookup_symbol_namespace (const char *the_namespace,
 						  const char *name,
 						  const struct block *block,
 						  const domain_enum domain);
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 624976b..93f4c1b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -96,9 +96,9 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
 int
 cp_is_vtbl_ptr_type (struct type *type)
 {
-  const char *typename = type_name_no_tag (type);
+  const char *type_name = type_name_no_tag (type);
 
-  return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
+  return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
 }
 
 /* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index c6543ca..9936b6b 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -946,7 +946,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1330,7 +1330,7 @@ yylex (void)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -1339,7 +1339,7 @@ yylex (void)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1565,7 +1565,7 @@ yylex (void)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	/* It is ok to always set this, even though we don't always
 	   strictly need to.  */
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 53ca1ea..90e61da 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -118,7 +118,7 @@ get_task_from_args (char *args)
     {
       if (ptid_equal (inferior_ptid, null_ptid))
 	printf_unfiltered (_("No inferior running\n"));
-      return current_inferior ()->private->task;
+      return current_inferior ()->priv->task;
     }
   if (strcmp (args, "gdb") == 0)
     return mach_task_self ();
@@ -258,32 +258,32 @@ info_mach_ports_command (char *args, int from_tty)
 	    {
 	      struct inferior *inf = current_inferior ();
 
-	      if (port == inf->private->task)
+	      if (port == inf->priv->task)
 		printf_unfiltered (_(" inferior-task"));
-	      else if (port == inf->private->notify_port)
+	      else if (port == inf->priv->notify_port)
 		printf_unfiltered (_(" inferior-notify"));
 	      else
 		{
 		  int k;
 		  darwin_thread_t *t;
 
-		  for (k = 0; k < inf->private->exception_info.count; k++)
-		    if (port == inf->private->exception_info.ports[k])
+		  for (k = 0; k < inf->priv->exception_info.count; k++)
+		    if (port == inf->priv->exception_info.ports[k])
 		      {
 			printf_unfiltered (_(" inferior-excp-port"));
 			break;
 		      }
 
-		  if (inf->private->threads)
+		  if (inf->priv->threads)
 		    {
 		      for (k = 0;
 			   VEC_iterate(darwin_thread_t,
-				       inf->private->threads, k, t);
+				       inf->priv->threads, k, t);
 			   k++)
 			if (port == t->gdb_port)
 			  {
 			    printf_unfiltered (_(" inferior-thread for 0x%x"),
-					       inf->private->task);
+					       inf->priv->task);
 			    break;
 			  }
 		    }
@@ -742,7 +742,7 @@ info_mach_region_command (char *exp, int from_tty)
     error (_("Inferior not available"));
 
   inf = current_inferior ();
-  darwin_debug_region (inf->private->task, address);
+  darwin_debug_region (inf->priv->task, address);
 }
 
 static void
@@ -811,7 +811,7 @@ info_mach_exceptions_command (char *args, int from_tty)
 	{
 	  if (ptid_equal (inferior_ptid, null_ptid))
 	    printf_unfiltered (_("No inferior running\n"));
-	  disp_exception (&current_inferior ()->private->exception_info);
+	  disp_exception (&current_inferior ()->priv->exception_info);
 	  return;
 	}
       else if (strcmp (args, "host") == 0)
@@ -835,7 +835,7 @@ info_mach_exceptions_command (char *args, int from_tty)
       inf = current_inferior ();
       
       kret = task_get_exception_ports
-	(inf->private->task, EXC_MASK_ALL, info.masks,
+	(inf->priv->task, EXC_MASK_ALL, info.masks,
 	 &info.count, info.ports, info.behaviors, info.flavors);
       MACH_CHECK_ERROR (kret);
       disp_exception (&info);
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index dfce179..070f307 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -277,7 +277,7 @@ darwin_check_new_threads (struct inferior *inf)
   unsigned int new_nbr;
   unsigned int old_nbr;
   unsigned int new_ix, old_ix;
-  darwin_inferior *darwin_inf = inf->private;
+  darwin_inferior *darwin_inf = inf->priv;
   VEC (darwin_thread_t) *thread_vec;
 
   /* Get list of threads.  */
@@ -372,7 +372,7 @@ darwin_check_new_threads (struct inferior *inf)
 	    {
 	      tp = find_thread_ptid (ptid_build (inf->pid, 0, 0));
 	      gdb_assert (tp);
-	      tp->private = pti;
+	      tp->priv = pti;
 	    }
 	  VEC_safe_push (darwin_thread_t, thread_vec, pti);
 	  new_ix++;
@@ -403,13 +403,13 @@ darwin_check_new_threads (struct inferior *inf)
 static int
 find_inferior_task_it (struct inferior *inf, void *port_ptr)
 {
-  return inf->private->task == *(task_t*)port_ptr;
+  return inf->priv->task == *(task_t*)port_ptr;
 }
 
 static int
 find_inferior_notify_it (struct inferior *inf, void *port_ptr)
 {
-  return inf->private->notify_port == *(task_t*)port_ptr;
+  return inf->priv->notify_port == *(task_t*)port_ptr;
 }
 
 /* Return an inferior by task port.  */
@@ -434,7 +434,7 @@ darwin_find_thread (struct inferior *inf, thread_t thread)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     if (t->gdb_port == thread)
       return t;
@@ -446,14 +446,14 @@ darwin_find_thread (struct inferior *inf, thread_t thread)
 static void
 darwin_suspend_inferior (struct inferior *inf)
 {
-  if (!inf->private->suspended)
+  if (!inf->priv->suspended)
     {
       kern_return_t kret;
 
-      kret = task_suspend (inf->private->task);
+      kret = task_suspend (inf->priv->task);
       MACH_CHECK_ERROR (kret);
 
-      inf->private->suspended = 1;
+      inf->priv->suspended = 1;
     }
 }
 
@@ -462,14 +462,14 @@ darwin_suspend_inferior (struct inferior *inf)
 static void
 darwin_resume_inferior (struct inferior *inf)
 {
-  if (inf->private->suspended)
+  if (inf->priv->suspended)
     {
       kern_return_t kret;
 
-      kret = task_resume (inf->private->task);
+      kret = task_resume (inf->priv->task);
       MACH_CHECK_ERROR (kret);
 
-      inf->private->suspended = 0;
+      inf->priv->suspended = 0;
     }
 }
 
@@ -706,7 +706,7 @@ darwin_send_reply (struct inferior *inf, darwin_thread_t *thread)
 		   MACH_PORT_NULL);
   MACH_CHECK_ERROR (kret);
 
-  inf->private->pending_messages--;
+  inf->priv->pending_messages--;
 }
 
 static void
@@ -776,7 +776,7 @@ darwin_resume_inferior_threads (struct inferior *inf, int step, int nsignal)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, thread);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, thread);
        k++)
     darwin_resume_thread (inf, thread, step, nsignal);
 }
@@ -808,7 +808,7 @@ darwin_suspend_inferior_threads (struct inferior *inf)
   int k;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, thread);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, thread);
        k++)
     switch (thread->msg_state)
       {
@@ -928,7 +928,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
 	}
       *pinf = inf;
       *pthread = thread;
-      inf->private->pending_messages++;
+      inf->priv->pending_messages++;
 
       status->kind = TARGET_WAITKIND_STOPPED;
       thread->msg_state = DARWIN_MESSAGE;
@@ -995,7 +995,7 @@ darwin_decode_message (mach_msg_header_t *hdr,
       inf = darwin_find_inferior_by_notify (hdr->msgh_local_port);
       if (inf != NULL)
 	{
-	  if (!inf->private->no_ptrace)
+	  if (!inf->priv->no_ptrace)
 	    {
 	      pid_t res;
 	      int wstatus;
@@ -1099,7 +1099,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
 
       status->kind = TARGET_WAITKIND_STOPPED;
       status->value.sig = GDB_SIGNAL_TRAP;
-      thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+      thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
       thread->msg_state = DARWIN_STOPPED;
       return ptid_build (inf->pid, 0, thread->gdb_port);
     }
@@ -1203,7 +1203,7 @@ darwin_stop (struct target_ops *self, ptid_t t)
   struct inferior *inf = current_inferior ();
 
   /* FIXME: handle in no_ptrace mode.  */
-  gdb_assert (!inf->private->no_ptrace);
+  gdb_assert (!inf->priv->no_ptrace);
   kill (inf->pid, SIGINT);
 }
 
@@ -1216,33 +1216,33 @@ darwin_mourn_inferior (struct target_ops *ops)
   int i;
 
   /* Deallocate threads.  */
-  if (inf->private->threads)
+  if (inf->priv->threads)
     {
       int k;
       darwin_thread_t *t;
       for (k = 0;
-	   VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+	   VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
 	   k++)
 	{
 	  kret = mach_port_deallocate (gdb_task, t->gdb_port);
 	  MACH_CHECK_ERROR (kret);
 	}
-      VEC_free (darwin_thread_t, inf->private->threads);
-      inf->private->threads = NULL;
+      VEC_free (darwin_thread_t, inf->priv->threads);
+      inf->priv->threads = NULL;
     }
 
   kret = mach_port_move_member (gdb_task,
-				inf->private->notify_port, MACH_PORT_NULL);
+				inf->priv->notify_port, MACH_PORT_NULL);
   MACH_CHECK_ERROR (kret);
 
-  kret = mach_port_request_notification (gdb_task, inf->private->task,
+  kret = mach_port_request_notification (gdb_task, inf->priv->task,
 					 MACH_NOTIFY_DEAD_NAME, 0,
 					 MACH_PORT_NULL,
 					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
 					 &prev);
   /* This can fail if the task is dead.  */
   inferior_debug (4, "task=0x%x, prev=0x%x, notify_port=0x%x\n",
-		  inf->private->task, prev, inf->private->notify_port);
+		  inf->priv->task, prev, inf->priv->notify_port);
 
   if (kret == KERN_SUCCESS)
     {
@@ -1250,24 +1250,24 @@ darwin_mourn_inferior (struct target_ops *ops)
       MACH_CHECK_ERROR (kret);
     }
 
-  kret = mach_port_destroy (gdb_task, inf->private->notify_port);
+  kret = mach_port_destroy (gdb_task, inf->priv->notify_port);
   MACH_CHECK_ERROR (kret);
 
 
   /* Deallocate saved exception ports.  */
-  for (i = 0; i < inf->private->exception_info.count; i++)
+  for (i = 0; i < inf->priv->exception_info.count; i++)
     {
       kret = mach_port_deallocate
-	(gdb_task, inf->private->exception_info.ports[i]);
+	(gdb_task, inf->priv->exception_info.ports[i]);
       MACH_CHECK_ERROR (kret);
     }
-  inf->private->exception_info.count = 0;
+  inf->priv->exception_info.count = 0;
 
-  kret = mach_port_deallocate (gdb_task, inf->private->task);
+  kret = mach_port_deallocate (gdb_task, inf->priv->task);
   MACH_CHECK_ERROR (kret);
 
-  xfree (inf->private);
-  inf->private = NULL;
+  xfree (inf->priv);
+  inf->priv = NULL;
 
   inf_child_mourn_inferior (ops);
 }
@@ -1279,7 +1279,7 @@ darwin_reply_to_all_pending_messages (struct inferior *inf)
   darwin_thread_t *t;
 
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     {
       if (t->msg_state == DARWIN_MESSAGE)
@@ -1302,7 +1302,7 @@ darwin_stop_inferior (struct inferior *inf)
 
   darwin_reply_to_all_pending_messages (inf);
 
-  if (inf->private->no_ptrace)
+  if (inf->priv->no_ptrace)
     return;
 
   res = kill (inf->pid, SIGSTOP);
@@ -1367,7 +1367,7 @@ darwin_kill_inferior (struct target_ops *ops)
 
   gdb_assert (inf != NULL);
 
-  kret = darwin_restore_exception_ports (inf->private);
+  kret = darwin_restore_exception_ports (inf->priv);
   MACH_CHECK_ERROR (kret);
 
   darwin_reply_to_all_pending_messages (inf);
@@ -1396,9 +1396,9 @@ darwin_attach_pid (struct inferior *inf)
   mach_port_t prev_not;
   exception_mask_t mask;
 
-  inf->private = XCNEW (darwin_inferior);
+  inf->priv = XCNEW (darwin_inferior);
 
-  kret = task_for_pid (gdb_task, inf->pid, &inf->private->task);
+  kret = task_for_pid (gdb_task, inf->pid, &inf->priv->task);
   if (kret != KERN_SUCCESS)
     {
       int status;
@@ -1415,7 +1415,7 @@ darwin_attach_pid (struct inferior *inf)
     }
 
   inferior_debug (2, _("inferior task: 0x%x, pid: %d\n"),
-		  inf->private->task, inf->pid);
+		  inf->priv->task, inf->pid);
 
   if (darwin_ex_port == MACH_PORT_NULL)
     {
@@ -1452,23 +1452,23 @@ darwin_attach_pid (struct inferior *inf)
 
   /* Create a port to be notified when the child task terminates.  */
   kret = mach_port_allocate (gdb_task, MACH_PORT_RIGHT_RECEIVE,
-			     &inf->private->notify_port);
+			     &inf->priv->notify_port);
   if (kret != KERN_SUCCESS)
     error (_("Unable to create notification port, mach_port_allocate "
 	     "returned: %d"),
 	   kret);
 
   kret = mach_port_move_member (gdb_task,
-				inf->private->notify_port, darwin_port_set);
+				inf->priv->notify_port, darwin_port_set);
   if (kret != KERN_SUCCESS)
     error (_("Unable to move notification port into new port set, "
 	     "mach_port_move_member\n"
 	     "returned: %d"),
 	   kret);
 
-  kret = mach_port_request_notification (gdb_task, inf->private->task,
+  kret = mach_port_request_notification (gdb_task, inf->priv->task,
 					 MACH_NOTIFY_DEAD_NAME, 0,
-					 inf->private->notify_port,
+					 inf->priv->notify_port,
 					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
 					 &prev_not);
   if (kret != KERN_SUCCESS)
@@ -1487,7 +1487,7 @@ its own.  This is unexpected, but should otherwise not have any actual\n\
 impact on the debugging session."));
     }
 
-  kret = darwin_save_exception_ports (inf->private);
+  kret = darwin_save_exception_ports (inf->priv);
   if (kret != KERN_SUCCESS)
     error (_("Unable to save exception ports, task_get_exception_ports"
 	     "returned: %d"),
@@ -1498,7 +1498,7 @@ impact on the debugging session."));
     mask = EXC_MASK_ALL;
   else
     mask = EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT;
-  kret = task_set_exception_ports (inf->private->task, mask, darwin_ex_port,
+  kret = task_set_exception_ports (inf->priv->task, mask, darwin_ex_port,
 				   EXCEPTION_DEFAULT, THREAD_STATE_NONE);
   if (kret != KERN_SUCCESS)
     error (_("Unable to set exception ports, task_set_exception_ports"
@@ -1517,9 +1517,9 @@ darwin_init_thread_list (struct inferior *inf)
 
   darwin_check_new_threads (inf);
 
-  gdb_assert (inf->private->threads
-	      && VEC_length (darwin_thread_t, inf->private->threads) > 0);
-  thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+  gdb_assert (inf->priv->threads
+	      && VEC_length (darwin_thread_t, inf->priv->threads) > 0);
+  thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
 
   /* Note: fork_inferior automatically add a thead but it uses a wrong ptid.
      Fix up.  */
@@ -1665,7 +1665,7 @@ darwin_setup_fake_stop_event (struct inferior *inf)
      as well.  Otherwise, we'll try resuming it when resuming the
      inferior, and get a warning because the thread's suspend count
      is already zero, making the resume request useless.  */
-  thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
+  thread = VEC_index (darwin_thread_t, inf->priv->threads, 0);
   kret = thread_suspend (thread->gdb_port);
   MACH_CHECK_ERROR (kret);
 }
@@ -1719,11 +1719,11 @@ darwin_attach (struct target_ops *ops, const char *args, int from_tty)
 
   darwin_init_thread_list (inf);
 
-  darwin_check_osabi (inf->private, ptid_get_tid (inferior_ptid));
+  darwin_check_osabi (inf->priv, ptid_get_tid (inferior_ptid));
 
   darwin_setup_fake_stop_event (inf);
 
-  inf->private->no_ptrace = 1;
+  inf->priv->no_ptrace = 1;
 }
 
 /* Take a program previously attached to and detaches it.
@@ -1753,13 +1753,13 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
     }
 
   /* If ptrace() is in use, stop the process.  */
-  if (!inf->private->no_ptrace)
+  if (!inf->priv->no_ptrace)
     darwin_stop_inferior (inf);
 
-  kret = darwin_restore_exception_ports (inf->private);
+  kret = darwin_restore_exception_ports (inf->priv);
   MACH_CHECK_ERROR (kret);
 
-  if (!inf->private->no_ptrace)
+  if (!inf->priv->no_ptrace)
     {
       res = PTRACE (PT_DETACH, inf->pid, 0, 0);
       if (res != 0)
@@ -1772,7 +1772,7 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
   /* When using ptrace, we have just performed a PT_DETACH, which
      resumes the inferior.  On the other hand, when we are not using
      ptrace, we need to resume its execution ourselves.  */
-  if (inf->private->no_ptrace)
+  if (inf->priv->no_ptrace)
     darwin_resume_inferior (inf);
 
   darwin_mourn_inferior (ops);
@@ -1990,7 +1990,7 @@ darwin_xfer_partial (struct target_ops *ops,
     {
     case TARGET_OBJECT_MEMORY:
       {
-	int l = darwin_read_write_inferior (inf->private->task, offset,
+	int l = darwin_read_write_inferior (inf->priv->task, offset,
 					    readbuf, writebuf, len);
 
 	if (l == 0)
@@ -2009,7 +2009,7 @@ darwin_xfer_partial (struct target_ops *ops,
           /* Support only read.  */
           return TARGET_XFER_E_IO;
         }
-      return darwin_read_dyld_info (inf->private->task, offset, readbuf, len,
+      return darwin_read_dyld_info (inf->priv->task, offset, readbuf, len,
 				    xfered_len);
 #endif
     default:
@@ -2032,10 +2032,10 @@ set_enable_mach_exceptions (char *args, int from_tty,
 	mask = EXC_MASK_ALL;
       else
 	{
-	  darwin_restore_exception_ports (inf->private);
+	  darwin_restore_exception_ports (inf->priv);
 	  mask = EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT;
 	}
-      kret = task_set_exception_ports (inf->private->task, mask, darwin_ex_port,
+      kret = task_set_exception_ports (inf->priv->task, mask, darwin_ex_port,
 				       EXCEPTION_DEFAULT, THREAD_STATE_NONE);
       MACH_CHECK_ERROR (kret);
     }
@@ -2070,7 +2070,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
 
   /* First linear search.  */
   for (k = 0;
-       VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+       VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
        k++)
     if (t->inf_port == lwp)
       return ptid_build (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
@@ -2078,7 +2078,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
   /* Maybe the port was never extract.  Do it now.  */
 
   /* First get inferior port names.  */
-  kret = mach_port_names (inf->private->task, &names, &names_count, &types,
+  kret = mach_port_names (inf->priv->task, &names, &names_count, &types,
 			  &types_count);
   MACH_CHECK_ERROR (kret);
   if (kret != KERN_SUCCESS)
@@ -2094,7 +2094,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
 
       /* We just need to know the corresponding name in gdb name space.
 	 So extract and deallocate the right.  */
-      kret = mach_port_extract_right (inf->private->task, names[i],
+      kret = mach_port_extract_right (inf->priv->task, names[i],
 				      MACH_MSG_TYPE_COPY_SEND,
 				      &local_name, &local_type);
       if (kret != KERN_SUCCESS)
@@ -2102,7 +2102,7 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
       mach_port_deallocate (gdb_task, local_name);
 
       for (k = 0;
-	   VEC_iterate (darwin_thread_t, inf->private->threads, k, t);
+	   VEC_iterate (darwin_thread_t, inf->priv->threads, k, t);
 	   k++)
 	if (t->gdb_port == local_name)
 	  {
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 6d9bacc..4f60e10 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2702,7 +2702,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		    struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   /* This remembers the address of the start of a function.  It is
      used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries
      are relative to the current function's start address.  On systems
@@ -2779,15 +2779,16 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	    }
 
 	  within_function = 0;
-	  new = pop_context ();
+	  newobj = pop_context ();
 
 	  /* Make a block for the local symbols within.  */
-	  block = finish_block (new->name, &local_symbols, new->old_blocks,
-				new->start_addr, new->start_addr + valu);
+	  block = finish_block (newobj->name, &local_symbols,
+				newobj->old_blocks,
+				newobj->start_addr, newobj->start_addr + valu);
 
 	  /* For C++, set the block's scope.  */
-	  if (SYMBOL_LANGUAGE (new->name) == language_cplus)
-	    cp_set_block_scope (new->name, block, &objfile->objfile_obstack);
+	  if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
+	    cp_set_block_scope (newobj->name, block, &objfile->objfile_obstack);
 
 	  /* May be switching to an assembler file which may not be using
 	     block relative stabs, so reset the offset.  */
@@ -2847,8 +2848,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	  break;
 	}
 
-      new = pop_context ();
-      if (desc != new->depth)
+      newobj = pop_context ();
+      if (desc != newobj->depth)
 	lbrac_mismatch_complaint (symnum);
 
       if (local_symbols != NULL)
@@ -2861,7 +2862,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		     _("misplaced N_LBRAC entry; discarding local "
 		       "symbols which have no enclosing block"));
 	}
-      local_symbols = new->locals;
+      local_symbols = newobj->locals;
 
       if (context_stack_depth > 1)
 	{
@@ -2876,15 +2877,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 	      /* Muzzle a compiler bug that makes end < start.
 
 		 ??? Which compilers?  Is this ever harmful?.  */
-	      if (new->start_addr > valu)
+	      if (newobj->start_addr > valu)
 		{
 		  complaint (&symfile_complaints,
 			     _("block start larger than block end"));
-		  new->start_addr = valu;
+		  newobj->start_addr = valu;
 		}
 	      /* Make a block for the local symbols within.  */
-	      finish_block (0, &local_symbols, new->old_blocks,
-			    new->start_addr, valu);
+	      finish_block (0, &local_symbols, newobj->old_blocks,
+			    newobj->start_addr, valu);
 	    }
 	}
       else
@@ -3183,20 +3184,20 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 		{
 		  struct block *block;
 
-		  new = pop_context ();
+		  newobj = pop_context ();
 		  /* Make a block for the local symbols within.  */
-		  block = finish_block (new->name, &local_symbols,
-					new->old_blocks, new->start_addr,
+		  block = finish_block (newobj->name, &local_symbols,
+					newobj->old_blocks, newobj->start_addr,
 					valu);
 
 		  /* For C++, set the block's scope.  */
-		  if (SYMBOL_LANGUAGE (new->name) == language_cplus)
-		    cp_set_block_scope (new->name, block,
+		  if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
+		    cp_set_block_scope (newobj->name, block,
 					&objfile->objfile_obstack);
 		}
 
-	      new = push_context (0, valu);
-	      new->name = define_symbol (valu, name, desc, type, objfile);
+	      newobj = push_context (0, valu);
+	      newobj->name = define_symbol (valu, name, desc, type, objfile);
 	      break;
 
 	    default:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ac78165..30abef5 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3808,7 +3808,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 dw2_map_matching_symbols (struct objfile *objfile,
-			  const char * name, domain_enum namespace,
+			  const char * name, domain_enum domain,
 			  int global,
 			  int (*callback) (struct block *,
 					   struct symbol *, void *),
@@ -11275,7 +11275,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   CORE_ADDR lowpc;
   CORE_ADDR highpc;
   struct die_info *child_die;
@@ -11343,15 +11343,15 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
 
-  new = push_context (0, lowpc);
-  new->name = new_symbol_full (die, read_type_die (die, cu), cu,
+  newobj = push_context (0, lowpc);
+  newobj->name = new_symbol_full (die, read_type_die (die, cu), cu,
 			       (struct symbol *) templ_func);
 
   /* If there is a location expression for DW_AT_frame_base, record
      it.  */
   attr = dwarf2_attr (die, DW_AT_frame_base, cu);
   if (attr)
-    dwarf2_symbol_mark_computed (attr, new->name, cu, 1);
+    dwarf2_symbol_mark_computed (attr, newobj->name, cu, 1);
 
   cu->list_in_scope = &local_symbols;
 
@@ -11401,9 +11401,9 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
 
-  new = pop_context ();
+  newobj = pop_context ();
   /* Make a block for the local symbols within.  */
-  block = finish_block (new->name, &local_symbols, new->old_blocks,
+  block = finish_block (newobj->name, &local_symbols, newobj->old_blocks,
                         lowpc, highpc);
 
   /* For C++, set the block's scope.  */
@@ -11415,7 +11415,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
   /* If we have address ranges, record them.  */
   dwarf2_record_block_ranges (die, block, baseaddr, cu);
 
-  gdbarch_make_symbol_special (gdbarch, new->name, objfile);
+  gdbarch_make_symbol_special (gdbarch, newobj->name, objfile);
 
   /* Attach template arguments to function.  */
   if (! VEC_empty (symbolp, template_args))
@@ -11437,8 +11437,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
      a function declares a class that has methods).  This means that
      when we finish processing a function scope, we may need to go
      back to building a containing block's symbol lists.  */
-  local_symbols = new->locals;
-  using_directives = new->using_directives;
+  local_symbols = newobj->locals;
+  using_directives = newobj->using_directives;
 
   /* If we've finished processing a top-level function, subsequent
      symbols go in the file symbol list.  */
@@ -11454,7 +11454,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *new;
+  struct context_stack *newobj;
   CORE_ADDR lowpc, highpc;
   struct die_info *child_die;
   CORE_ADDR baseaddr;
@@ -11481,13 +11481,13 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  child_die = sibling_die (child_die);
 	}
     }
-  new = pop_context ();
+  newobj = pop_context ();
 
   if (local_symbols != NULL || using_directives != NULL)
     {
       struct block *block
-        = finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
-                        highpc);
+        = finish_block (0, &local_symbols, newobj->old_blocks,
+			newobj->start_addr, highpc);
 
       /* Note that recording ranges after traversing children, as we
          do here, means that recording a parent's ranges entails
@@ -11501,8 +11501,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
          to do.  */
       dwarf2_record_block_ranges (die, block, baseaddr, cu);
     }
-  local_symbols = new->locals;
-  using_directives = new->using_directives;
+  local_symbols = newobj->locals;
+  using_directives = newobj->using_directives;
 }
 
 /* Read in DW_TAG_GNU_call_site and insert it to CU->call_site_htab.  */
@@ -12715,7 +12715,7 @@ static int
 dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
 {
   const char *fieldname;
-  const char *typename;
+  const char *type_name;
   int len;
 
   if (die->parent == NULL)
@@ -12727,13 +12727,13 @@ dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
     return 0;
 
   fieldname = dwarf2_name (die, cu);
-  typename = dwarf2_name (die->parent, cu);
-  if (fieldname == NULL || typename == NULL)
+  type_name = dwarf2_name (die->parent, cu);
+  if (fieldname == NULL || type_name == NULL)
     return 0;
 
   len = strlen (fieldname);
-  return (strncmp (fieldname, typename, len) == 0
-	  && (typename[len] == '\0' || typename[len] == '<'));
+  return (strncmp (fieldname, type_name, len) == 0
+	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
 /* Add a member function to the proper fieldlist.  */
diff --git a/gdb/environ.c b/gdb/environ.c
index 88dd834..824a6f5 100644
--- a/gdb/environ.c
+++ b/gdb/environ.c
@@ -78,10 +78,10 @@ init_environ (struct gdb_environ *e)
   while (--i >= 0)
     {
       int len = strlen (e->vector[i]);
-      char *new = (char *) xmalloc (len + 1);
+      char *newobj = (char *) xmalloc (len + 1);
 
-      memcpy (new, e->vector[i], len + 1);
-      e->vector[i] = new;
+      memcpy (newobj, e->vector[i], len + 1);
+      e->vector[i] = newobj;
     }
 }
 
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 896296d..144e17f 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -830,7 +830,7 @@ parse_number (struct parser_state *par_state,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1006,11 +1006,11 @@ yylex (void)
   
   /* See if it is a special .foo. operator.  */
   
-  for (i = 0; dot_ops[i].operator != NULL; i++)
-    if (strncmp (tokstart, dot_ops[i].operator,
-		 strlen (dot_ops[i].operator)) == 0)
+  for (i = 0; dot_ops[i].oper != NULL; i++)
+    if (strncmp (tokstart, dot_ops[i].oper,
+		 strlen (dot_ops[i].oper)) == 0)
       {
-	lexptr += strlen (dot_ops[i].operator);
+	lexptr += strlen (dot_ops[i].oper);
 	yylval.opcode = dot_ops[i].opcode;
 	return dot_ops[i].token;
       }
@@ -1175,9 +1175,9 @@ yylex (void)
   
   /* Catch specific keywords.  */
   
-  for (i = 0; f77_keywords[i].operator != NULL; i++)
-    if (strlen (f77_keywords[i].operator) == namelen
-	&& strncmp (tokstart, f77_keywords[i].operator, namelen) == 0)
+  for (i = 0; f77_keywords[i].oper != NULL; i++)
+    if (strlen (f77_keywords[i].oper) == namelen
+	&& strncmp (tokstart, f77_keywords[i].oper, namelen) == 0)
       {
 	/* 	lexptr += strlen(f77_keywords[i].operator); */ 
 	yylval.opcode = f77_keywords[i].opcode;
diff --git a/gdb/frame.c b/gdb/frame.c
index 5b1a8d9..6b1be94 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -753,9 +753,9 @@ frame_find_by_id (struct frame_id id)
 
   for (frame = get_current_frame (); ; frame = prev_frame)
     {
-      struct frame_id this = get_frame_id (frame);
+      struct frame_id self = get_frame_id (frame);
 
-      if (frame_id_eq (id, this))
+      if (frame_id_eq (id, self))
 	/* An exact match.  */
 	return frame;
 
@@ -769,7 +769,7 @@ frame_find_by_id (struct frame_id id)
 	 frame in the current frame chain can have this ID.  See the
 	 comment at frame_id_inner for details.   */
       if (get_frame_type (frame) == NORMAL_FRAME
-	  && !frame_id_inner (get_frame_arch (frame), id, this)
+	  && !frame_id_inner (get_frame_arch (frame), id, self)
 	  && frame_id_inner (get_frame_arch (prev_frame), id,
 			     get_frame_id (prev_frame)))
 	return NULL;
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index aa1a369..97874c9 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -5029,7 +5029,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
   if (new_gdbarch->initialized_p)
     {
       struct gdbarch_list **list;
-      struct gdbarch_list *this;
+      struct gdbarch_list *self;
       if (gdbarch_debug)
 	fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
 			    "Previous architecture %s (%s) selected\n",
@@ -5041,12 +5041,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
-      /* Unlink THIS.  */
-      this = (*list);
-      (*list) = this->next;
-      /* Insert THIS at the front.  */
-      this->next = rego->arches;
-      rego->arches = this;
+      /* Unlink SELF.  */
+      self = (*list);
+      (*list) = self->next;
+      /* Insert SELF at the front.  */
+      self->next = rego->arches;
+      rego->arches = self;
       /* Return it.  */
       return new_gdbarch;
     }
@@ -5061,10 +5061,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
   /* Insert the new architecture into the front of the architecture
      list (keep the list sorted Most Recently Used).  */
   {
-    struct gdbarch_list *this = XNEW (struct gdbarch_list);
-    this->next = rego->arches;
-    this->gdbarch = new_gdbarch;
-    rego->arches = this;
+    struct gdbarch_list *self = XNEW (struct gdbarch_list);
+    self->next = rego->arches;
+    self->gdbarch = new_gdbarch;
+    rego->arches = self;
   }    
 
   /* Check that the newly installed architecture is valid.  Plug in
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 18b9360..19be5a0 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -2366,7 +2366,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
   if (new_gdbarch->initialized_p)
     {
       struct gdbarch_list **list;
-      struct gdbarch_list *this;
+      struct gdbarch_list *self;
       if (gdbarch_debug)
 	fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
 			    "Previous architecture %s (%s) selected\n",
@@ -2378,12 +2378,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
       gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
-      /* Unlink THIS.  */
-      this = (*list);
-      (*list) = this->next;
-      /* Insert THIS at the front.  */
-      this->next = rego->arches;
-      rego->arches = this;
+      /* Unlink SELF.  */
+      self = (*list);
+      (*list) = self->next;
+      /* Insert SELF at the front.  */
+      self->next = rego->arches;
+      rego->arches = self;
       /* Return it.  */
       return new_gdbarch;
     }
@@ -2398,10 +2398,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
   /* Insert the new architecture into the front of the architecture
      list (keep the list sorted Most Recently Used).  */
   {
-    struct gdbarch_list *this = XNEW (struct gdbarch_list);
-    this->next = rego->arches;
-    this->gdbarch = new_gdbarch;
-    rego->arches = this;
+    struct gdbarch_list *self = XNEW (struct gdbarch_list);
+    self->next = rego->arches;
+    self->gdbarch = new_gdbarch;
+    rego->arches = self;
   }    
 
   /* Check that the newly installed architecture is valid.  Plug in
diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h
index c75499d..0569586 100644
--- a/gdb/gdbserver/inferiors.h
+++ b/gdb/gdbserver/inferiors.h
@@ -69,7 +69,7 @@ struct process_info
   const struct target_desc *tdesc;
 
   /* Private target data.  */
-  struct process_info_private *private;
+  struct process_info_private *priv;
 };
 
 #define ptid_of(inf) ((inf)->entry.id)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 6b84042..a34fe5d 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -721,7 +721,7 @@ aarch64_get_debug_reg_state ()
   struct process_info *proc;
 
   proc = current_process ();
-  return &proc->private->arch_private->debug_reg_state;
+  return &proc->priv->arch_private->debug_reg_state;
 }
 
 /* Record the insertion of one breakpoint/watchpoint, as represented
@@ -1151,7 +1151,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       int tid = ptid_get_lwp (ptid);
       struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
       struct aarch64_debug_reg_state *state
-	= &proc->private->arch_private->debug_reg_state;
+	= &proc->priv->arch_private->debug_reg_state;
 
       if (show_debug_regs)
 	fprintf (stderr, "prepare_to_resume thread %ld\n", lwpid_of (thread));
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 303d9c8..2cd1668 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -590,12 +590,12 @@ arm_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   if (watch)
     {
       count = arm_linux_get_hw_watchpoint_count ();
-      pts = proc->private->arch_private->wpts;
+      pts = proc->priv->arch_private->wpts;
     }
   else
     {
       count = arm_linux_get_hw_breakpoint_count ();
-      pts = proc->private->arch_private->bpts;
+      pts = proc->priv->arch_private->bpts;
     }
 
   for (i = 0; i < count; i++)
@@ -630,12 +630,12 @@ arm_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   if (watch)
     {
       count = arm_linux_get_hw_watchpoint_count ();
-      pts = proc->private->arch_private->wpts;
+      pts = proc->priv->arch_private->wpts;
     }
   else
     {
       count = arm_linux_get_hw_breakpoint_count ();
-      pts = proc->private->arch_private->bpts;
+      pts = proc->priv->arch_private->bpts;
     }
 
   for (i = 0; i < count; i++)
@@ -725,7 +725,7 @@ arm_prepare_to_resume (struct lwp_info *lwp)
   struct thread_info *thread = get_lwp_thread (lwp);
   int pid = lwpid_of (thread);
   struct process_info *proc = find_process_pid (pid_of (thread));
-  struct arch_process_info *proc_info = proc->private->arch_private;
+  struct arch_process_info *proc_info = proc->priv->arch_private;
   struct arch_lwp_info *lwp_info = lwp->arch_private;
   int i;
 
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c0d3b0d..a278c9a 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -357,13 +357,13 @@ linux_add_process (int pid, int attached)
   struct process_info *proc;
 
   proc = add_process (pid, attached);
-  proc->private = xcalloc (1, sizeof (*proc->private));
+  proc->priv = xcalloc (1, sizeof (*proc->priv));
 
   /* Set the arch when the first LWP stops.  */
-  proc->private->new_inferior = 1;
+  proc->priv->new_inferior = 1;
 
   if (the_low_target.new_process != NULL)
-    proc->private->arch_private = the_low_target.new_process ();
+    proc->priv->arch_private = the_low_target.new_process ();
 
   return proc;
 }
@@ -1167,10 +1167,10 @@ linux_mourn (struct process_info *process)
   find_inferior (&all_threads, delete_lwp_callback, process);
 
   /* Freeing all private data.  */
-  priv = process->private;
+  priv = process->priv;
   free (priv->arch_private);
   free (priv);
-  process->private = NULL;
+  process->priv = NULL;
 
   remove_process (process);
 }
@@ -1842,7 +1842,7 @@ linux_low_filter_event (int lwpid, int wstat)
 	 is stopped for the first time, but before we access any
 	 inferior registers.  */
       proc = find_process_pid (pid_of (thread));
-      if (proc->private->new_inferior)
+      if (proc->priv->new_inferior)
 	{
 	  struct thread_info *saved_thread;
 
@@ -1853,7 +1853,7 @@ linux_low_filter_event (int lwpid, int wstat)
 
 	  current_thread = saved_thread;
 
-	  proc->private->new_inferior = 0;
+	  proc->priv->new_inferior = 0;
 	}
     }
 
@@ -2757,7 +2757,7 @@ linux_wait_1 (ptid_t ptid,
       && current_thread->last_resume_kind != resume_step
       && (
 #if defined (USE_THREAD_DB) && !defined (__ANDROID__)
-	  (current_process ()->private->thread_db != NULL
+	  (current_process ()->priv->thread_db != NULL
 	   && (WSTOPSIG (w) == __SIGRTMIN
 	       || WSTOPSIG (w) == __SIGRTMIN + 1))
 	  ||
@@ -4821,7 +4821,7 @@ linux_look_up_symbols (void)
 #ifdef USE_THREAD_DB
   struct process_info *proc = current_process ();
 
-  if (proc->private->thread_db != NULL)
+  if (proc->priv->thread_db != NULL)
     return;
 
   /* If the kernel supports tracing clones, then we don't need to
@@ -5741,7 +5741,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
 {
   char *document;
   unsigned document_len;
-  struct process_info_private *const priv = current_process ()->private;
+  struct process_info_private *const priv = current_process ()->priv;
   char filename[PATH_MAX];
   int pid, is_elf64;
 
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 478bb6e..f081dda 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -353,19 +353,19 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
 {
   ptid_t ptid = ptid_of (get_lwp_thread (lwp));
   struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
 
   if (lwp->arch_private->watch_registers_changed)
     {
       /* Only update the watch registers if we have set or unset a
 	 watchpoint already.  */
-      if (mips_linux_watch_get_num_valid (&private->watch_mirror) > 0)
+      if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
 	{
 	  /* Write the mirrored watch register values.  */
 	  int tid = ptid_get_lwp (ptid);
 
 	  if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
-			    &private->watch_mirror))
+			    &priv->watch_mirror))
 	    perror_with_name ("Couldn't write watch register");
 	}
 
@@ -395,7 +395,7 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 		   int len, struct raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   struct pt_watch_regs regs;
   struct mips_watchpoint *new_watch;
   struct mips_watchpoint **pw;
@@ -406,17 +406,17 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 
   lwpid = lwpid_of (current_thread);
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					0))
     return -1;
 
   if (len <= 0)
     return -1;
 
-  regs = private->watch_readback;
+  regs = priv->watch_readback;
   /* Add the current watches.  */
-  mips_linux_watch_populate_regs (private->current_watches, &regs);
+  mips_linux_watch_populate_regs (priv->current_watches, &regs);
 
   /* Now try to add the new watch.  */
   watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
@@ -431,12 +431,12 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   new_watch->type = watch_type;
   new_watch->next = NULL;
 
-  pw = &private->current_watches;
+  pw = &priv->current_watches;
   while (*pw != NULL)
     pw = &(*pw)->next;
   *pw = new_watch;
 
-  private->watch_mirror = regs;
+  priv->watch_mirror = regs;
 
   /* Only update the threads of this process.  */
   pid = pid_of (proc);
@@ -453,7 +453,7 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 		   int len, struct raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
 
   int deleted_one;
   int pid;
@@ -465,7 +465,7 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   /* Search for a known watch that matches.  Then unlink and free it.  */
   watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
   deleted_one = 0;
-  pw = &private->current_watches;
+  pw = &priv->current_watches;
   while ((w = *pw))
     {
       if (w->addr == addr && w->len == len && w->type == watch_type)
@@ -483,11 +483,11 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 
   /* At this point watch_readback is known to be valid because we
      could not have added the watch without reading it.  */
-  gdb_assert (private->watch_readback_valid == 1);
+  gdb_assert (priv->watch_readback_valid == 1);
 
-  private->watch_mirror = private->watch_readback;
-  mips_linux_watch_populate_regs (private->current_watches,
-				  &private->watch_mirror);
+  priv->watch_mirror = priv->watch_readback;
+  mips_linux_watch_populate_regs (priv->current_watches,
+				  &priv->watch_mirror);
 
   /* Only update the threads of this process.  */
   pid = pid_of (proc);
@@ -503,21 +503,21 @@ static int
 mips_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   int n;
   int num_valid;
   long lwpid = lwpid_of (current_thread);
 
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					1))
     return 0;
 
-  num_valid = mips_linux_watch_get_num_valid (&private->watch_readback);
+  num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
 
   for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
-    if (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+    if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 	& (R_MASK | W_MASK))
       return 1;
 
@@ -531,7 +531,7 @@ static CORE_ADDR
 mips_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
-  struct arch_process_info *private = proc->private->arch_private;
+  struct arch_process_info *priv = proc->priv->arch_private;
   int n;
   int num_valid;
   long lwpid = lwpid_of (current_thread);
@@ -543,28 +543,28 @@ mips_stopped_data_address (void)
      triggered.  */
 
   if (!mips_linux_read_watch_registers (lwpid,
-					&private->watch_readback,
-					&private->watch_readback_valid,
+					&priv->watch_readback,
+					&priv->watch_readback_valid,
 					0))
     return 0;
 
-  num_valid = mips_linux_watch_get_num_valid (&private->watch_readback);
+  num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
 
   for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
-    if (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+    if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 	& (R_MASK | W_MASK))
       {
 	CORE_ADDR t_low, t_hi;
 	int t_irw;
 	struct mips_watchpoint *watch;
 
-	t_low = mips_linux_watch_get_watchlo (&private->watch_readback, n);
+	t_low = mips_linux_watch_get_watchlo (&priv->watch_readback, n);
 	t_irw = t_low & IRW_MASK;
-	t_hi = (mips_linux_watch_get_watchhi (&private->watch_readback, n)
+	t_hi = (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
 		| IRW_MASK);
 	t_low &= ~(CORE_ADDR)t_hi;
 
-	for (watch = private->current_watches;
+	for (watch = priv->current_watches;
 	     watch != NULL;
 	     watch = watch->next)
 	  {
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index e58a7ac..171735c 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -690,7 +690,7 @@ x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 	struct x86_debug_reg_state *state
-	  = &proc->private->arch_private->debug_reg_state;
+	  = &proc->priv->arch_private->debug_reg_state;
 
 	return x86_dr_insert_watchpoint (state, hw_type, addr, size);
       }
@@ -719,7 +719,7 @@ x86_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 	enum target_hw_bp_type hw_type
 	  = raw_bkpt_type_to_target_hw_bp_type (type);
 	struct x86_debug_reg_state *state
-	  = &proc->private->arch_private->debug_reg_state;
+	  = &proc->priv->arch_private->debug_reg_state;
 
 	return x86_dr_remove_watchpoint (state, hw_type, addr, size);
       }
@@ -733,7 +733,7 @@ static int
 x86_stopped_by_watchpoint (void)
 {
   struct process_info *proc = current_process ();
-  return x86_dr_stopped_by_watchpoint (&proc->private->arch_private->debug_reg_state);
+  return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state);
 }
 
 static CORE_ADDR
@@ -741,7 +741,7 @@ x86_stopped_data_address (void)
 {
   struct process_info *proc = current_process ();
   CORE_ADDR addr;
-  if (x86_dr_stopped_data_address (&proc->private->arch_private->debug_reg_state,
+  if (x86_dr_stopped_data_address (&proc->priv->arch_private->debug_reg_state,
 				   &addr))
     return addr;
   return 0;
@@ -786,7 +786,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
       int pid = ptid_get_pid (ptid);
       struct process_info *proc = find_process_pid (pid);
       struct x86_debug_reg_state *state
-	= &proc->private->arch_private->debug_reg_state;
+	= &proc->priv->arch_private->debug_reg_state;
 
       x86_linux_dr_set (ptid, DR_CONTROL, 0);
 
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 98797ba..460346c 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -218,8 +218,8 @@ lynx_add_process (int pid, int attached)
 
   proc = add_process (pid, attached);
   proc->tdesc = lynx_tdesc;
-  proc->private = xcalloc (1, sizeof (*proc->private));
-  proc->private->last_wait_event_ptid = null_ptid;
+  proc->priv = xcalloc (1, sizeof (*proc->priv));
+  proc->priv->last_wait_event_ptid = null_ptid;
 
   return proc;
 }
@@ -334,7 +334,7 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
      unexpected signals (Eg SIG61) when we resume the inferior
      using a different thread.  */
   if (ptid_equal (ptid, minus_one_ptid))
-    ptid = current_process()->private->last_wait_event_ptid;
+    ptid = current_process()->priv->last_wait_event_ptid;
 
   /* The ptid might still be minus_one_ptid; this can happen between
      the moment we create the inferior or attach to a process, and
@@ -422,7 +422,7 @@ retry:
 
   ret = lynx_waitpid (pid, &wstat);
   new_ptid = lynx_ptid_build (ret, ((union wait *) &wstat)->w_tid);
-  find_process_pid (ret)->private->last_wait_event_ptid = new_ptid;
+  find_process_pid (ret)->priv->last_wait_event_ptid = new_ptid;
 
   /* If this is a new thread, then add it now.  The reason why we do
      this here instead of when handling new-thread events is because
@@ -552,8 +552,8 @@ static void
 lynx_mourn (struct process_info *proc)
 {
   /* Free our private data.  */
-  free (proc->private);
-  proc->private = NULL;
+  free (proc->priv);
+  proc->priv = NULL;
 
   clear_inferiors ();
 }
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index a8b6f42..5bf808e 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -192,7 +192,7 @@ thread_db_create_event (CORE_ADDR where)
   td_event_msg_t msg;
   td_err_e err;
   struct lwp_info *lwp;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   gdb_assert (thread_db->td_ta_event_getmsg_p != NULL);
 
@@ -228,7 +228,7 @@ thread_db_enable_reporting (void)
   td_thr_events_t events;
   td_notify_t notify;
   td_err_e err;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   if (thread_db->td_ta_set_event_p == NULL
       || thread_db->td_ta_event_addr_p == NULL
@@ -272,7 +272,7 @@ find_one_thread (ptid_t ptid)
   td_err_e err;
   struct thread_info *inferior;
   struct lwp_info *lwp;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int lwpid = ptid_get_lwp (ptid);
 
   inferior = (struct thread_info *) find_inferior_id (&all_threads, ptid);
@@ -352,7 +352,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
   if (thread_db_use_events)
     {
       td_err_e err;
-      struct thread_db *thread_db = proc->private->thread_db;
+      struct thread_db *thread_db = proc->priv->thread_db;
 
       err = thread_db->td_thr_event_enable_p (th_p, 1);
       if (err != TD_OK)
@@ -391,7 +391,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 {
   td_thrinfo_t ti;
   td_err_e err;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
 
   err = thread_db->td_thr_get_info_p (th_p, &ti);
   if (err != TD_OK)
@@ -430,7 +430,7 @@ thread_db_find_new_threads (void)
 {
   td_err_e err;
   ptid_t ptid = current_ptid;
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int loop, iteration;
 
   /* This function is only called when we first initialize thread_db.
@@ -476,7 +476,7 @@ thread_db_find_new_threads (void)
 static void
 thread_db_look_up_symbols (void)
 {
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   const char **sym_list;
   CORE_ADDR unused;
 
@@ -491,7 +491,7 @@ thread_db_look_up_symbols (void)
 int
 thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp)
 {
-  struct thread_db *thread_db = current_process ()->private->thread_db;
+  struct thread_db *thread_db = current_process ()->priv->thread_db;
   int may_ask_gdb = !thread_db->all_symbols_looked_up;
 
   /* If we've passed the call to thread_db_look_up_symbols, then
@@ -514,7 +514,7 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
   struct thread_db *thread_db;
 
   proc = get_thread_process (thread);
-  thread_db = proc->private->thread_db;
+  thread_db = proc->priv->thread_db;
 
   /* If the thread layer is not (yet) initialized, fail.  */
   if (thread_db == NULL || !thread_db->all_symbols_looked_up)
@@ -575,10 +575,10 @@ thread_db_load_search (void)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  gdb_assert (proc->private->thread_db == NULL);
+  gdb_assert (proc->priv->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
-  proc->private->thread_db = tdb;
+  proc->priv->thread_db = tdb;
 
   tdb->td_ta_new_p = &td_ta_new;
 
@@ -589,7 +589,7 @@ thread_db_load_search (void)
       if (debug_threads)
 	debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
       free (tdb);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
       return 0;
     }
 
@@ -620,10 +620,10 @@ try_thread_db_load_1 (void *handle)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  gdb_assert (proc->private->thread_db == NULL);
+  gdb_assert (proc->priv->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
-  proc->private->thread_db = tdb;
+  proc->priv->thread_db = tdb;
 
   tdb->handle = handle;
 
@@ -640,7 +640,7 @@ try_thread_db_load_1 (void *handle)
 	  if (required)						\
 	    {							\
 	      free (tdb);					\
-	      proc->private->thread_db = NULL;			\
+	      proc->priv->thread_db = NULL;			\
 	      return 0;						\
 	    }							\
 	}							\
@@ -656,7 +656,7 @@ try_thread_db_load_1 (void *handle)
       if (debug_threads)
 	debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err));
       free (tdb);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
       return 0;
     }
 
@@ -909,7 +909,7 @@ switch_to_process (struct process_info *proc)
 static void
 disable_thread_event_reporting (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
   if (thread_db)
     {
       td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
@@ -941,7 +941,7 @@ disable_thread_event_reporting (struct process_info *proc)
 static void
 remove_thread_event_breakpoints (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
 
   if (thread_db->td_create_bp != NULL)
     {
@@ -959,7 +959,7 @@ remove_thread_event_breakpoints (struct process_info *proc)
 void
 thread_db_detach (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
 
   if (thread_db)
     {
@@ -973,7 +973,7 @@ thread_db_detach (struct process_info *proc)
 void
 thread_db_mourn (struct process_info *proc)
 {
-  struct thread_db *thread_db = proc->private->thread_db;
+  struct thread_db *thread_db = proc->priv->thread_db;
   if (thread_db)
     {
       td_err_e (*td_ta_delete_p) (td_thragent_t *);
@@ -992,7 +992,7 @@ thread_db_mourn (struct process_info *proc)
 #endif  /* USE_LIBTHREAD_DB_DIRECTLY  */
 
       free (thread_db);
-      proc->private->thread_db = NULL;
+      proc->priv->thread_db = NULL;
     }
 }
 
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index a2f378a..e9ae47d 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -261,7 +261,7 @@ struct thread_info
   struct frame_id initiating_frame;
 
   /* Private data used by the target vector implementation.  */
-  struct private_thread_info *private;
+  struct private_thread_info *priv;
 
   /* Function that is called to free PRIVATE.  If this is NULL, then
      xfree will be called on PRIVATE.  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index ebb047f..24f64be 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1519,7 +1519,7 @@ struct type *
 lookup_struct_elt_type (struct type *type, const char *name, int noerr)
 {
   int i;
-  char *typename;
+  char *type_name;
 
   for (;;)
     {
@@ -1533,9 +1533,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT 
       && TYPE_CODE (type) != TYPE_CODE_UNION)
     {
-      typename = type_to_string (type);
-      make_cleanup (xfree, typename);
-      error (_("Type %s is not a structure or union type."), typename);
+      type_name = type_to_string (type);
+      make_cleanup (xfree, type_name);
+      error (_("Type %s is not a structure or union type."), type_name);
     }
 
 #if 0
@@ -1544,10 +1544,10 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
      I.e. when doing "ptype bell->bar" for "struct foo { int bar; int
      foo; } bell;" Disabled by fnf.  */
   {
-    char *typename;
+    char *type_name;
 
-    typename = type_name_no_tag (type);
-    if (typename != NULL && strcmp (typename, name) == 0)
+    type_name = type_name_no_tag (type);
+    if (type_name != NULL && strcmp (type_name, name) == 0)
       return type;
   }
 #endif
@@ -1587,9 +1587,9 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
       return NULL;
     }
 
-  typename = type_to_string (type);
-  make_cleanup (xfree, typename);
-  error (_("Type %s has no component named %s."), typename, name);
+  type_name = type_to_string (type);
+  make_cleanup (xfree, type_name);
+  error (_("Type %s has no component named %s."), type_name, name);
 }
 
 /* Store in *MAX the largest number representable by unsigned integer type
@@ -2719,7 +2719,7 @@ class_types_same_p (const struct type *a, const struct type *b)
    distance_to_ancestor (A, D, 1) = -1.  */
 
 static int
-distance_to_ancestor (struct type *base, struct type *dclass, int public)
+distance_to_ancestor (struct type *base, struct type *dclass, int is_public)
 {
   int i;
   int d;
@@ -2732,10 +2732,10 @@ distance_to_ancestor (struct type *base, struct type *dclass, int public)
 
   for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
     {
-      if (public && ! BASETYPE_VIA_PUBLIC (dclass, i))
+      if (is_public && ! BASETYPE_VIA_PUBLIC (dclass, i))
 	continue;
 
-      d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), public);
+      d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), is_public);
       if (d >= 0)
 	return 1 + d;
     }
@@ -4190,7 +4190,7 @@ recursive_dump_type (struct type *type, int spaces)
 
 struct type_pair
 {
-  struct type *old, *new;
+  struct type *old, *newobj;
 };
 
 static hashval_t
@@ -4246,7 +4246,7 @@ copy_type_recursive (struct objfile *objfile,
   pair.old = type;
   slot = htab_find_slot (copied_types, &pair, INSERT);
   if (*slot != NULL)
-    return ((struct type_pair *) *slot)->new;
+    return ((struct type_pair *) *slot)->newobj;
 
   new_type = alloc_type_arch (get_type_arch (type));
 
@@ -4255,7 +4255,7 @@ copy_type_recursive (struct objfile *objfile,
   stored
     = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair));
   stored->old = type;
-  stored->new = new_type;
+  stored->newobj = new_type;
   *slot = stored;
 
   /* Copy the common fields of types.  For the main type, we simply
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 1dfb37b..6a96d21 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1077,7 +1077,7 @@ gnuv3_get_typeid (struct value *value)
   struct gdbarch *gdbarch;
   struct cleanup *cleanup;
   struct value *result;
-  char *typename, *canonical;
+  char *type_name, *canonical;
 
   /* We have to handle values a bit trickily here, to allow this code
      to work properly with non_lvalue values that are really just
@@ -1096,20 +1096,20 @@ gnuv3_get_typeid (struct value *value)
   type = make_cv_type (0, 0, type, NULL);
   gdbarch = get_type_arch (type);
 
-  typename = type_to_string (type);
-  if (typename == NULL)
+  type_name = type_to_string (type);
+  if (type_name == NULL)
     error (_("cannot find typeinfo for unnamed type"));
-  cleanup = make_cleanup (xfree, typename);
+  cleanup = make_cleanup (xfree, type_name);
 
   /* We need to canonicalize the type name here, because we do lookups
      using the demangled name, and so we must match the format it
      uses.  E.g., GDB tends to use "const char *" as a type name, but
      the demangler uses "char const *".  */
-  canonical = cp_canonicalize_string (typename);
+  canonical = cp_canonicalize_string (type_name);
   if (canonical != NULL)
     {
       make_cleanup (xfree, canonical);
-      typename = canonical;
+      type_name = canonical;
     }
 
   typeinfo_type = gnuv3_get_typeid_type (gdbarch);
@@ -1125,7 +1125,7 @@ gnuv3_get_typeid (struct value *value)
 
       vtable = gnuv3_get_vtable (gdbarch, type, address);
       if (vtable == NULL)
-	error (_("cannot find typeinfo for object of type '%s'"), typename);
+	error (_("cannot find typeinfo for object of type '%s'"), type_name);
       typeinfo_value = value_field (vtable, vtable_field_type_info);
       result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
 				      typeinfo_value));
@@ -1135,12 +1135,12 @@ gnuv3_get_typeid (struct value *value)
       char *sym_name;
       struct bound_minimal_symbol minsym;
 
-      sym_name = concat ("typeinfo for ", typename, (char *) NULL);
+      sym_name = concat ("typeinfo for ", type_name, (char *) NULL);
       make_cleanup (xfree, sym_name);
       minsym = lookup_minimal_symbol (sym_name, NULL, NULL);
 
       if (minsym.minsym == NULL)
-	error (_("could not find typeinfo symbol for '%s'"), typename);
+	error (_("could not find typeinfo symbol for '%s'"), type_name);
 
       result = value_at_lazy (typeinfo_type, BMSYMBOL_VALUE_ADDRESS (minsym));
     }
@@ -1188,21 +1188,21 @@ gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
 static struct type *
 gnuv3_get_type_from_type_info (struct value *type_info_ptr)
 {
-  char *typename;
+  char *type_name;
   struct cleanup *cleanup;
   struct value *type_val;
   struct expression *expr;
   struct type *result;
 
-  typename = gnuv3_get_typename_from_type_info (type_info_ptr);
-  cleanup = make_cleanup (xfree, typename);
+  type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
+  cleanup = make_cleanup (xfree, type_name);
 
   /* We have to parse the type name, since in general there is not a
      symbol for a type.  This is somewhat bogus since there may be a
      mis-parse.  Another approach might be to re-use the demangler's
      internal form to reconstruct the type somehow.  */
 
-  expr = parse_expression (typename);
+  expr = parse_expression (type_name);
   make_cleanup (xfree, expr);
 
   type_val = evaluate_type (expr);
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 2443983..bada4cf 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -988,7 +988,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1075,7 +1075,7 @@ lex_one_token (struct parser_state *par_state)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -1084,7 +1084,7 @@ lex_one_token (struct parser_state *par_state)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1315,7 +1315,7 @@ lex_one_token (struct parser_state *par_state)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
 	/* It is ok to always set this, even though we don't always
 	   strictly need to.  */
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index fe306b4..509120b 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -139,12 +139,12 @@ extern SCM gdbscm_string_string;
 \f
 /* scm-utils.c */
 
-extern void gdbscm_define_variables (const scheme_variable *, int public);
+extern void gdbscm_define_variables (const scheme_variable *, int is_public);
 
-extern void gdbscm_define_functions (const scheme_function *, int public);
+extern void gdbscm_define_functions (const scheme_function *, int is_public);
 
 extern void gdbscm_define_integer_constants (const scheme_integer_constant *,
-					     int public);
+					     int is_public);
 
 extern void gdbscm_printf (SCM port, const char *format, ...)
   ATTRIBUTE_PRINTF (2, 3);
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 829143e..1891237 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -434,11 +434,11 @@ gdbscm_symbol_constant_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return scm_from_bool (class == LOC_CONST || class == LOC_CONST_BYTES);
+  return scm_from_bool (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
 }
 
 /* (symbol-function? <gdb:symbol>) -> boolean */
@@ -449,11 +449,11 @@ gdbscm_symbol_function_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return scm_from_bool (class == LOC_BLOCK);
+  return scm_from_bool (theclass == LOC_BLOCK);
 }
 
 /* (symbol-variable? <gdb:symbol>) -> boolean */
@@ -464,14 +464,14 @@ gdbscm_symbol_variable_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symbol *symbol = s_smob->symbol;
-  enum address_class class;
+  enum address_class theclass;
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
   return scm_from_bool (!SYMBOL_IS_ARGUMENT (symbol)
-			&& (class == LOC_LOCAL || class == LOC_REGISTER
-			    || class == LOC_STATIC || class == LOC_COMPUTED
-			    || class == LOC_OPTIMIZED_OUT));
+			&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
+			    || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+			    || theclass == LOC_OPTIMIZED_OUT));
 }
 
 /* (symbol-needs-frame? <gdb:symbol>) -> boolean
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index 023097f..59d8b52 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -27,14 +27,14 @@
 /* Define VARIABLES in the gdb module.  */
 
 void
-gdbscm_define_variables (const scheme_variable *variables, int public)
+gdbscm_define_variables (const scheme_variable *variables, int is_public)
 {
   const scheme_variable *sv;
 
   for (sv = variables; sv->name != NULL; ++sv)
     {
       scm_c_define (sv->name, sv->value);
-      if (public)
+      if (is_public)
 	scm_c_export (sv->name, NULL);
     }
 }
@@ -42,7 +42,7 @@ gdbscm_define_variables (const scheme_variable *variables, int public)
 /* Define FUNCTIONS in the gdb module.  */
 
 void
-gdbscm_define_functions (const scheme_function *functions, int public)
+gdbscm_define_functions (const scheme_function *functions, int is_public)
 {
   const scheme_function *sf;
 
@@ -53,7 +53,7 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
       scm_set_procedure_property_x (proc, gdbscm_documentation_symbol,
 				    gdbscm_scm_from_c_string (sf->doc_string));
-      if (public)
+      if (is_public)
 	scm_c_export (sf->name, NULL);
     }
 }
@@ -62,14 +62,14 @@ gdbscm_define_functions (const scheme_function *functions, int public)
 
 void
 gdbscm_define_integer_constants (const scheme_integer_constant *constants,
-				 int public)
+				 int is_public)
 {
   const scheme_integer_constant *sc;
 
   for (sc = constants; sc->name != NULL; ++sc)
     {
       scm_c_define (sc->name, scm_from_int (sc->value));
-      if (public)
+      if (is_public)
 	scm_c_export (sc->name, NULL);
     }
 }
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 55fcd23..6dc2e84 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -136,7 +136,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   unsigned int dummy[HPPA_MAX_INSN_PATTERN_LEN];
   int offs = 0;
-  int try;
+  int attempt;
   /* offsets to try to find the trampoline */
   static int pcoffs[] = { 0, 4*4, 5*4 };
   /* offsets to the rt_sigframe structure */
@@ -154,12 +154,12 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
      e4008200 be,l 0x100(%sr2, %r0), %sr0, %r31
      08000240 nop  */
 
-  for (try = 0; try < ARRAY_SIZE (pcoffs); try++)
+  for (attempt = 0; attempt < ARRAY_SIZE (pcoffs); attempt++)
     {
-      if (insns_match_pattern (gdbarch, sp + pcoffs[try],
+      if (insns_match_pattern (gdbarch, sp + pcoffs[attempt],
 			       hppa_sigtramp, dummy))
 	{
-          offs = sfoffs[try];
+          offs = sfoffs[attempt];
 	  break;
 	}
     }
@@ -171,8 +171,8 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
 	  /* sigaltstack case: we have no way of knowing which offset to 
 	     use in this case; default to new kernel handling.  If this is
 	     wrong the unwinding will fail.  */
-	  try = 2;
-	  sp = pc - pcoffs[try];
+	  attempt = 2;
+	  sp = pc - pcoffs[attempt];
 	}
       else
       {
@@ -186,7 +186,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
      bad we cannot include system specific headers :-(.
      sizeof(struct siginfo) == 128
      offsetof(struct ucontext, uc_mcontext) == 24.  */
-  return sp + sfoffs[try] + 128 + 24;
+  return sp + sfoffs[attempt] + 128 + 24;
 }
 
 struct hppa_linux_sigtramp_unwind_cache
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 89f7ae3..c237aaa 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -512,7 +512,7 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
 {
   gdb_byte bundle[BUNDLE_LEN];
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
-  long long template;
+  long long templ;
   int val;
 
   /* Warn about slot numbers greater than 2.  We used to generate
@@ -543,8 +543,8 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
     return 0;
 
   *instr = slotN_contents (bundle, slotnum);
-  template = extract_bit_field (bundle, 0, 5);
-  *it = template_encoding_table[(int)template][slotnum];
+  templ = extract_bit_field (bundle, 0, 5);
+  *it = template_encoding_table[(int)templ][slotnum];
 
   if (slotnum == 2 || (slotnum == 1 && *it == L))
     addr += 16;
@@ -642,7 +642,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_breakpoint;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   if (slotnum > 2)
@@ -671,8 +671,8 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
      a breakpoint on an L-X instruction.  */
   bp_tgt->shadow_len = BUNDLE_LEN - shadow_slotnum;
 
-  template = extract_bit_field (bundle, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       /* X unit types can only be used in slot 2, and are actually
 	 part of a 2-slot L-X instruction.  We cannot break at this
@@ -681,7 +681,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
       gdb_assert (slotnum == 2);
       error (_("Can't insert breakpoint for non-existing slot X"));
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       /* L unit types can only be used in slot 1.  But the associated
 	 opcode for that instruction is in slot 2, so bump the slot number
@@ -739,7 +739,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
   int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_breakpoint, instr_saved;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   addr &= ~0x0f;
@@ -761,8 +761,8 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
      for addressing the SHADOW_CONTENTS placement.  */
   shadow_slotnum = slotnum;
 
-  template = extract_bit_field (bundle_mem, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle_mem, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       /* X unit types can only be used in slot 2, and are actually
 	 part of a 2-slot L-X instruction.  We refuse to insert
@@ -776,7 +776,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
       do_cleanups (cleanup);
       return -1;
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       /* L unit types can only be used in slot 1.  But the breakpoint
 	 was actually saved using slot 2, so update the slot number
@@ -829,7 +829,7 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
   int slotnum = (int) (*pcptr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
   long long instr_fetched;
   int val;
-  int template;
+  int templ;
   struct cleanup *cleanup;
 
   if (slotnum > 2)
@@ -857,13 +857,13 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
 
   /* Check for L type instruction in slot 1, if present then bump up the slot
      number to the slot 2.  */
-  template = extract_bit_field (bundle, 0, 5);
-  if (template_encoding_table[template][slotnum] == X)
+  templ = extract_bit_field (bundle, 0, 5);
+  if (template_encoding_table[templ][slotnum] == X)
     {
       gdb_assert (slotnum == 2);
       error (_("Can't insert breakpoint for non-existing slot X"));
     }
-  if (template_encoding_table[template][slotnum] == L)
+  if (template_encoding_table[templ][slotnum] == L)
     {
       gdb_assert (slotnum == 1);
       slotnum = 2;
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 080e167..8957ca2 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -424,9 +424,9 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child,
       inf_ttrace_num_lwps_in_syscall = 0;
 
       ti = inferior_thread ();
-      ti->private =
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
     }
   else
@@ -610,7 +610,7 @@ inf_ttrace_create_threads_after_attach (int pid)
   /* Add the stopped thread.  */
   ptid = ptid_build (pid, tts.tts_lwpid, 0);
   ti = add_thread (ptid);
-  ti->private = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
+  ti->priv = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
   inf_ttrace_num_lwps++;
 
   /* We use the "first stopped thread" as the currently active thread.  */
@@ -631,7 +631,7 @@ inf_ttrace_create_threads_after_attach (int pid)
 
       ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
       ti = add_thread (ptid);
-      ti->private = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
+      ti->priv = xzalloc (sizeof (struct inf_ttrace_private_thread_info));
       inf_ttrace_num_lwps++;
     }
 }
@@ -750,7 +750,7 @@ inf_ttrace_delete_dead_threads_callback (struct thread_info *info, void *arg)
     return 0;
 
   lwpid = ptid_get_lwp (info->ptid);
-  p = (struct inf_ttrace_private_thread_info *) info->private;
+  p = (struct inf_ttrace_private_thread_info *) info->priv;
 
   /* Check if an lwp that was dying is still there or not.  */
   if (p->dying && (kill (lwpid, 0) == -1))
@@ -772,7 +772,7 @@ inf_ttrace_resume_lwp (struct thread_info *info, ttreq_t request, int sig)
   if (ttrace (request, pid, lwpid, TT_NOPC, sig, 0) == -1)
     {
       struct inf_ttrace_private_thread_info *p
-	= (struct inf_ttrace_private_thread_info *) info->private;
+	= (struct inf_ttrace_private_thread_info *) info->priv;
       if (p->dying && errno == EPROTO)
 	/* This is expected, it means the dying lwp is really gone
 	   by now.  If ttrace had an event to inform the debugger
@@ -872,10 +872,10 @@ inf_ttrace_wait (struct target_ops *ops,
       /* We haven't set the private member on the main thread yet.  Do
 	 it now.  */
       ti = find_thread_ptid (inferior_ptid);
-      gdb_assert (ti != NULL && ti->private == NULL);
-      ti->private =
+      gdb_assert (ti != NULL && ti->priv == NULL);
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
 
       /* Notify the core that this ptid changed.  This changes
@@ -955,9 +955,9 @@ inf_ttrace_wait (struct target_ops *ops,
       lwpid = tts.tts_u.tts_thread.tts_target_lwpid;
       ptid = ptid_build (tts.tts_pid, lwpid, 0);
       ti = add_thread (ptid);
-      ti->private =
+      ti->priv =
 	xmalloc (sizeof (struct inf_ttrace_private_thread_info));
-      memset (ti->private, 0,
+      memset (ti->priv, 0,
 	      sizeof (struct inf_ttrace_private_thread_info));
       inf_ttrace_num_lwps++;
       ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
@@ -973,7 +973,7 @@ inf_ttrace_wait (struct target_ops *ops,
 	printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (ptid));
       ti = find_thread_ptid (ptid);
       gdb_assert (ti != NULL);
-      ((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
+      ((struct inf_ttrace_private_thread_info *)ti->priv)->dying = 1;
       inf_ttrace_num_lwps--;
       /* Let the thread really exit.  */
       ttrace (TT_LWP_CONTINUE, ptid_get_pid (ptid),
@@ -990,7 +990,7 @@ inf_ttrace_wait (struct target_ops *ops,
 			  target_pid_to_str (ptid));
       ti = find_thread_ptid (ptid);
       gdb_assert (ti != NULL);
-      ((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
+      ((struct inf_ttrace_private_thread_info *)ti->priv)->dying = 1;
       inf_ttrace_num_lwps--;
 
       /* Resume the lwp_terminate-caller thread.  */
@@ -1146,10 +1146,10 @@ static char *
 inf_ttrace_extra_thread_info (struct target_ops *self,
 			      struct thread_info *info)
 {
-  struct inf_ttrace_private_thread_info* private =
-    (struct inf_ttrace_private_thread_info *) info->private;
+  struct inf_ttrace_private_thread_info* priv =
+    (struct inf_ttrace_private_thread_info *) info->priv;
 
-  if (private != NULL && private->dying)
+  if (priv != NULL && priv->dying)
     return "Exiting";
 
   return NULL;
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 6b4f65f..ba320b5 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -101,7 +101,7 @@ free_inferior (struct inferior *inf)
   xfree (inf->terminal);
   free_environ (inf->environment);
   target_desc_info_free (inf->tdesc_info);
-  xfree (inf->private);
+  xfree (inf->priv);
   xfree (inf);
 }
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 4463de6..2530777 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -381,7 +381,7 @@ struct inferior
   struct continuation *continuations;
 
   /* Private data used by the target vector implementation.  */
-  struct private_inferior *private;
+  struct private_inferior *priv;
 
   /* HAS_EXIT_CODE is true if the inferior exited with an exit code.
      In this case, the EXIT_CODE field is also valid.  */
diff --git a/gdb/jit.c b/gdb/jit.c
index 712d1e2..32a3fc7 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -532,15 +532,15 @@ jit_symtab_open_impl (struct gdb_symbol_callbacks *cb,
 
 static int
 compare_block (const struct gdb_block *const old,
-               const struct gdb_block *const new)
+               const struct gdb_block *const newobj)
 {
   if (old == NULL)
     return 1;
-  if (old->begin < new->begin)
+  if (old->begin < newobj->begin)
     return 1;
-  else if (old->begin == new->begin)
+  else if (old->begin == newobj->begin)
     {
-      if (old->end > new->end)
+      if (old->end > newobj->end)
         return 1;
       else
         return 0;
@@ -1220,20 +1220,20 @@ static void
 jit_frame_this_id (struct frame_info *this_frame, void **cache,
                    struct frame_id *this_id)
 {
-  struct jit_unwind_private private;
+  struct jit_unwind_private priv;
   struct gdb_frame_id frame_id;
   struct gdb_reader_funcs *funcs;
   struct gdb_unwind_callbacks callbacks;
 
-  private.registers = NULL;
-  private.this_frame = this_frame;
+  priv.registers = NULL;
+  priv.this_frame = this_frame;
 
   /* We don't expect the frame_id function to set any registers, so we
      set reg_set to NULL.  */
   callbacks.reg_get = jit_unwind_reg_get_impl;
   callbacks.reg_set = NULL;
   callbacks.target_read = jit_target_read_impl;
-  callbacks.priv_data = &private;
+  callbacks.priv_data = &priv;
 
   gdb_assert (loaded_jit_reader);
   funcs = loaded_jit_reader->functions;
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 653eb81..2ed1c17 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -842,7 +842,7 @@ parse_number (struct parser_state *par_state,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -896,7 +896,7 @@ yylex (void)
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
 	lexptr += 3;
 	yylval.opcode = tokentab3[i].opcode;
@@ -905,7 +905,7 @@ yylex (void)
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
 	lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;
@@ -1461,21 +1461,21 @@ static struct expression *
 copy_exp (struct expression *expr, int endpos)
 {
   int len = length_of_subexp (expr, endpos);
-  struct expression *new
-    = (struct expression *) malloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
+  struct expression *newobj
+    = (struct expression *) malloc (sizeof (*newobj) + EXP_ELEM_TO_BYTES (len));
 
-  new->nelts = len;
-  memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
-  new->language_defn = 0;
+  newobj->nelts = len;
+  memcpy (newobj->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
+  newobj->language_defn = 0;
 
-  return new;
+  return newobj;
 }
 
 /* Insert the expression NEW into the current expression (expout) at POS.  */
 static void
-insert_exp (struct parser_state *par_state, int pos, struct expression *new)
+insert_exp (struct parser_state *par_state, int pos, struct expression *newobj)
 {
-  int newlen = new->nelts;
+  int newlen = newobj->nelts;
   int i;
 
   /* Grow expout if necessary.  In this function's only use at present,
@@ -1485,7 +1485,7 @@ insert_exp (struct parser_state *par_state, int pos, struct expression *new)
   for (i = par_state->expout_ptr - 1; i >= pos; i--)
     par_state->expout->elts[i + newlen] = par_state->expout->elts[i];
   
-  memcpy (par_state->expout->elts + pos, new->elts,
+  memcpy (par_state->expout->elts + pos, newobj->elts,
 	  EXP_ELEM_TO_BYTES (newlen));
   par_state->expout_ptr += newlen;
 }
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index f09685e..c3d479b 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -394,7 +394,7 @@ have_threads_callback (struct thread_info *thread, void *args)
   if (ptid_get_pid (thread->ptid) != pid)
     return 0;
 
-  return thread->private != NULL;
+  return thread->priv != NULL;
 }
 
 static int
@@ -1241,11 +1241,11 @@ thread_db_inferior_created (struct target_ops *target, int from_tty)
    from libthread_db thread state information.  */
 
 static void
-update_thread_state (struct private_thread_info *private,
+update_thread_state (struct private_thread_info *priv,
 		     const td_thrinfo_t *ti_p)
 {
-  private->dying = (ti_p->ti_state == TD_THR_UNKNOWN
-		    || ti_p->ti_state == TD_THR_ZOMBIE);
+  priv->dying = (ti_p->ti_state == TD_THR_UNKNOWN
+		 || ti_p->ti_state == TD_THR_ZOMBIE);
 }
 
 /* Attach to a new thread.  This function is called when we receive a
@@ -1272,16 +1272,16 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
   tp = find_thread_ptid (ptid);
   if (tp != NULL)
     {
-      /* If tp->private is NULL, then GDB is already attached to this
+      /* If tp->priv is NULL, then GDB is already attached to this
 	 thread, but we do not know anything about it.  We can learn
 	 about it here.  This can only happen if we have some other
 	 way besides libthread_db to notice new threads (i.e.
 	 PTRACE_EVENT_CLONE); assume the same mechanism notices thread
 	 exit, so this can not be a stale thread recreated with the
 	 same ID.  */
-      if (tp->private != NULL)
+      if (tp->priv != NULL)
 	{
-	  if (!tp->private->dying)
+	  if (!tp->priv->dying)
 	    return 0;
 
 	  delete_thread (ptid);
@@ -1328,7 +1328,7 @@ record_thread (struct thread_db_info *info,
 	       const td_thrinfo_t *ti_p)
 {
   td_err_e err;
-  struct private_thread_info *private;
+  struct private_thread_info *priv;
   int new_thread = (tp == NULL);
 
   /* A thread ID of zero may mean the thread library has not
@@ -1338,18 +1338,18 @@ record_thread (struct thread_db_info *info,
     return;
 
   /* Construct the thread's private data.  */
-  private = xmalloc (sizeof (struct private_thread_info));
-  memset (private, 0, sizeof (struct private_thread_info));
+  priv = xmalloc (sizeof (struct private_thread_info));
+  memset (priv, 0, sizeof (struct private_thread_info));
 
-  private->th = *th_p;
-  private->tid = ti_p->ti_tid;
-  update_thread_state (private, ti_p);
+  priv->th = *th_p;
+  priv->tid = ti_p->ti_tid;
+  update_thread_state (priv, ti_p);
 
   /* Add the thread to GDB's thread list.  */
   if (tp == NULL)
-    tp = add_thread_with_info (ptid, private);
+    tp = add_thread_with_info (ptid, priv);
   else
-    tp->private = private;
+    tp->priv = priv;
 
   /* Enable thread event reporting for this thread, except when
      debugging a core file.  */
@@ -1379,8 +1379,8 @@ detach_thread (ptid_t ptid)
      something re-uses its thread ID.  We'll report the thread exit
      when the underlying LWP dies.  */
   thread_info = find_thread_ptid (ptid);
-  gdb_assert (thread_info != NULL && thread_info->private != NULL);
-  thread_info->private->dying = 1;
+  gdb_assert (thread_info != NULL && thread_info->priv != NULL);
+  thread_info->priv->dying = 1;
 }
 
 static void
@@ -1649,7 +1649,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
 
   ptid = ptid_build (info->pid, ti.ti_lid, 0);
   tp = find_thread_ptid (ptid);
-  if (tp == NULL || tp->private == NULL)
+  if (tp == NULL || tp->priv == NULL)
     {
       if (attach_thread (ptid, th_p, &ti))
 	cb_data->new_threads += 1;
@@ -1666,7 +1666,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
     {
       /* Need to update this if not using the libthread_db events
 	 (particularly, the TD_DEATH event).  */
-      update_thread_state (tp->private, &ti);
+      update_thread_state (tp->priv, &ti);
     }
 
   return 0;
@@ -1829,12 +1829,12 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
   struct thread_info *thread_info = find_thread_ptid (ptid);
   struct target_ops *beneath;
 
-  if (thread_info != NULL && thread_info->private != NULL)
+  if (thread_info != NULL && thread_info->priv != NULL)
     {
       static char buf[64];
       thread_t tid;
 
-      tid = thread_info->private->tid;
+      tid = thread_info->priv->tid;
       snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
 		tid, ptid_get_lwp (ptid));
 
@@ -1852,10 +1852,10 @@ static char *
 thread_db_extra_thread_info (struct target_ops *self,
 			     struct thread_info *info)
 {
-  if (info->private == NULL)
+  if (info->priv == NULL)
     return NULL;
 
-  if (info->private->dying)
+  if (info->priv->dying)
     return "Exiting";
 
   return NULL;
@@ -1880,7 +1880,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
   /* Find the matching thread.  */
   thread_info = find_thread_ptid (ptid);
 
-  if (thread_info != NULL && thread_info->private != NULL)
+  if (thread_info != NULL && thread_info->priv != NULL)
     {
       td_err_e err;
       psaddr_t address;
@@ -1899,7 +1899,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 	  /* Note the cast through uintptr_t: this interface only works if
 	     a target address fits in a psaddr_t, which is a host pointer.
 	     So a 32-bit debugger can not access 64-bit TLS through this.  */
-	  err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
+	  err = info->td_thr_tls_get_addr_p (&thread_info->priv->th,
 					     (psaddr_t)(uintptr_t) lm,
 					     offset, &address);
 	}
@@ -1917,7 +1917,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
 	     PR libc/16831 due to GDB PR threads/16954 LOAD_MODULE is also NULL.
 	     The constant number 1 depends on GNU __libc_setup_tls
 	     initialization of l_tls_modid to 1.  */
-	  err = info->td_thr_tlsbase_p (&thread_info->private->th,
+	  err = info->td_thr_tlsbase_p (&thread_info->priv->th,
 					1, &address);
 	  address = (char *) address + offset;
 	}
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 4c50e66..4c5341e 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -450,7 +450,7 @@ macro_include (struct macro_source_file *source,
                int line,
                const char *included)
 {
-  struct macro_source_file *new;
+  struct macro_source_file *newobj;
   struct macro_source_file **link;
 
   /* Find the right position in SOURCE's `includes' list for the new
@@ -496,13 +496,13 @@ macro_include (struct macro_source_file *source,
   /* At this point, we know that LINE is an unused line number, and
      *LINK points to the entry an #inclusion at that line should
      precede.  */
-  new = new_source_file (source->table, included);
-  new->included_by = source;
-  new->included_at_line = line;
-  new->next_included = *link;
-  *link = new;
+  newobj = new_source_file (source->table, included);
+  newobj->included_by = source;
+  newobj->included_at_line = line;
+  newobj->next_included = *link;
+  *link = newobj;
 
-  return new;
+  return newobj;
 }
 
 
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 5965761..058bb7c 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -430,24 +430,24 @@ static struct parse_stack
 static void
 push_parse_stack (void)
 {
-  struct parse_stack *new;
+  struct parse_stack *newobj;
 
   /* Reuse frames if possible.  */
   if (top_stack && top_stack->prev)
-    new = top_stack->prev;
+    newobj = top_stack->prev;
   else
-    new = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
+    newobj = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
   /* Initialize new frame with previous content.  */
   if (top_stack)
     {
-      struct parse_stack *prev = new->prev;
+      struct parse_stack *prev = newobj->prev;
 
-      *new = *top_stack;
-      top_stack->prev = new;
-      new->prev = prev;
-      new->next = top_stack;
+      *newobj = *top_stack;
+      top_stack->prev = newobj;
+      newobj->prev = prev;
+      newobj->next = top_stack;
     }
-  top_stack = new;
+  top_stack = newobj;
 }
 
 /* Exit a lexical context.  */
@@ -559,7 +559,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
   struct type *t;
   struct field *f;
   int count = 1;
-  enum address_class class;
+  enum address_class theclass;
   TIR tir;
   long svalue = sh->value;
   int bitsize;
@@ -600,7 +600,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       break;
 
     case stGlobal:		/* External symbol, goes into global block.  */
-      class = LOC_STATIC;
+      theclass = LOC_STATIC;
       b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
 			     GLOBAL_BLOCK);
       s = new_symbol (name);
@@ -608,7 +608,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       goto data;
 
     case stStatic:		/* Static data, goes into current block.  */
-      class = LOC_STATIC;
+      theclass = LOC_STATIC;
       b = top_stack->cur_block;
       s = new_symbol (name);
       if (SC_IS_COMMON (sh->sc))
@@ -629,13 +629,13 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       s = new_symbol (name);
       SYMBOL_VALUE (s) = svalue;
       if (sh->sc == scRegister)
-	class = mdebug_register_index;
+	theclass = mdebug_register_index;
       else
-	class = LOC_LOCAL;
+	theclass = LOC_LOCAL;
 
     data:			/* Common code for symbols describing data.  */
       SYMBOL_DOMAIN (s) = VAR_DOMAIN;
-      SYMBOL_ACLASS_INDEX (s) = class;
+      SYMBOL_ACLASS_INDEX (s) = theclass;
       add_symbol (s, top_stack->cur_st, b);
 
       /* Type could be missing if file is compiled without debugging info.  */
@@ -3416,7 +3416,7 @@ parse_partial_symbols (struct objfile *objfile)
 	  for (cur_sdx = 0; cur_sdx < fh->csym;)
 	    {
 	      char *name;
-	      enum address_class class;
+	      enum address_class theclass;
 	      CORE_ADDR minsym_value;
 
 	      (*swap_sym_in) (cur_bfd,
@@ -3572,7 +3572,7 @@ parse_partial_symbols (struct objfile *objfile)
 							 mst_file_bss,
 							 SECT_OFF_BSS (objfile),
 							 objfile);
-		  class = LOC_STATIC;
+		  theclass = LOC_STATIC;
 		  break;
 
 		case stIndirect:	/* Irix5 forward declaration */
@@ -3584,11 +3584,11 @@ parse_partial_symbols (struct objfile *objfile)
 		     structs from alpha and mips cc.  */
 		  if (sh.iss == 0 || has_opaque_xref (fh, &sh))
 		    goto skip;
-		  class = LOC_TYPEDEF;
+		  theclass = LOC_TYPEDEF;
 		  break;
 
 		case stConstant:	/* Constant decl */
-		  class = LOC_CONST;
+		  theclass = LOC_CONST;
 		  break;
 
 		case stUnion:
@@ -3644,7 +3644,7 @@ parse_partial_symbols (struct objfile *objfile)
 		}
 	      /* Use this gdb symbol.  */
 	      add_psymbol_to_list (name, strlen (name), 1,
-				   VAR_DOMAIN, class,
+				   VAR_DOMAIN, theclass,
 				   &objfile->static_psymbols,
 				   0, sh.value, psymtab_language, objfile);
 	    skip:
@@ -3658,7 +3658,7 @@ parse_partial_symbols (struct objfile *objfile)
 	  PST_PRIVATE (save_pst)->extern_tab = ext_ptr;
 	  for (; --cur_sdx >= 0; ext_ptr++)
 	    {
-	      enum address_class class;
+	      enum address_class theclass;
 	      SYMR *psh;
 	      char *name;
 	      CORE_ADDR svalue;
@@ -3708,7 +3708,7 @@ parse_partial_symbols (struct objfile *objfile)
 		     Ignore them, as parse_external will ignore them too.  */
 		  continue;
 		case stLabel:
-		  class = LOC_LABEL;
+		  theclass = LOC_LABEL;
 		  break;
 		default:
 		  unknown_ext_complaint (debug_info->ssext + psh->iss);
@@ -3719,12 +3719,12 @@ parse_partial_symbols (struct objfile *objfile)
 		  if (SC_IS_COMMON (psh->sc))
 		    continue;
 
-		  class = LOC_STATIC;
+		  theclass = LOC_STATIC;
 		  break;
 		}
 	      name = debug_info->ssext + psh->iss;
 	      add_psymbol_to_list (name, strlen (name), 1,
-				   VAR_DOMAIN, class,
+				   VAR_DOMAIN, theclass,
 				   &objfile->global_psymbols,
 				   0, svalue,
 				   psymtab_language, objfile);
@@ -4568,7 +4568,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 
 static struct symbol *
 mylookup_symbol (char *name, const struct block *block,
-		 domain_enum domain, enum address_class class)
+		 domain_enum domain, enum address_class theclass)
 {
   struct block_iterator iter;
   int inc;
@@ -4579,14 +4579,14 @@ mylookup_symbol (char *name, const struct block *block,
     {
       if (SYMBOL_LINKAGE_NAME (sym)[0] == inc
 	  && SYMBOL_DOMAIN (sym) == domain
-	  && SYMBOL_CLASS (sym) == class
+	  && SYMBOL_CLASS (sym) == theclass
 	  && strcmp (SYMBOL_LINKAGE_NAME (sym), name) == 0)
 	return sym;
     }
 
   block = BLOCK_SUPERBLOCK (block);
   if (block)
-    return mylookup_symbol (name, block, domain, class);
+    return mylookup_symbol (name, block, domain, theclass);
   return 0;
 }
 
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e6a98f6..a2aac07 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -112,11 +112,11 @@ mem_region_cmp (const void *untyped_lhs, const void *untyped_rhs)
 /* Allocate a new memory region, with default settings.  */
 
 void
-mem_region_init (struct mem_region *new)
+mem_region_init (struct mem_region *newobj)
 {
-  memset (new, 0, sizeof (struct mem_region));
-  new->enabled_p = 1;
-  new->attrib = default_mem_attrib;
+  memset (newobj, 0, sizeof (struct mem_region));
+  newobj->enabled_p = 1;
+  newobj->attrib = default_mem_attrib;
 }
 
 /* This function should be called before any command which would
@@ -174,7 +174,7 @@ static void
 create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 		   const struct mem_attrib *attrib)
 {
-  struct mem_region new;
+  struct mem_region newobj;
   int i, ix;
 
   /* lo == hi is a useless empty region.  */
@@ -184,11 +184,11 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
       return;
     }
 
-  mem_region_init (&new);
-  new.lo = lo;
-  new.hi = hi;
+  mem_region_init (&newobj);
+  newobj.lo = lo;
+  newobj.hi = hi;
 
-  ix = VEC_lower_bound (mem_region_s, mem_region_list, &new,
+  ix = VEC_lower_bound (mem_region_s, mem_region_list, &newobj,
 			mem_region_lessthan);
 
   /* Check for an overlapping memory region.  We only need to check
@@ -214,9 +214,9 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 	}
     }
 
-  new.number = ++mem_number;
-  new.attrib = *attrib;
-  VEC_safe_insert (mem_region_s, mem_region_list, ix, &new);
+  newobj.number = ++mem_number;
+  newobj.attrib = *attrib;
+  VEC_safe_insert (mem_region_s, mem_region_list, ix, &newobj);
 }
 
 /*
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index d9b37f8..ee0bbc6 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -35,7 +35,7 @@ extern unsigned int varobjdebug;		/* defined in varobj.c.  */
 
 static void varobj_update_one (struct varobj *var,
 			       enum print_values print_values,
-			       int explicit);
+			       int is_explicit);
 
 static int mi_print_value_p (struct varobj *var,
 			     enum print_values print_values);
@@ -730,14 +730,14 @@ mi_cmd_var_update (char *command, char **argv, int argc)
 
 static void
 varobj_update_one (struct varobj *var, enum print_values print_values,
-		   int explicit)
+		   int is_explicit)
 {
   struct ui_out *uiout = current_uiout;
   VEC (varobj_update_result) *changes;
   varobj_update_result *r;
   int i;
   
-  changes = varobj_update (&var, explicit);
+  changes = varobj_update (&var, is_explicit);
   
   for (i = 0; VEC_iterate (varobj_update_result, changes, i, r); ++i)
     {
@@ -803,14 +803,14 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
       ui_out_field_int (uiout, "has_more",
 			varobj_has_more (r->varobj, to));
 
-      if (r->new)
+      if (r->newobj)
 	{
 	  int j;
 	  varobj_p child;
 	  struct cleanup *cleanup;
 
 	  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children");
-	  for (j = 0; VEC_iterate (varobj_p, r->new, j, child); ++j)
+	  for (j = 0; VEC_iterate (varobj_p, r->newobj, j, child); ++j)
 	    {
 	      struct cleanup *cleanup_child;
 
@@ -821,8 +821,8 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
 	    }
 
 	  do_cleanups (cleanup);
-	  VEC_free (varobj_p, r->new);
-	  r->new = NULL;	/* Paranoia.  */
+	  VEC_free (varobj_p, r->newobj);
+	  r->newobj = NULL;	/* Paranoia.  */
 	}
 
       do_cleanups (cleanup);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 83b2070..f8985e8 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -550,7 +550,7 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc_in,
 {
   int lo;
   int hi;
-  int new;
+  int newobj;
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
   struct minimal_symbol *best_symbol = NULL;
@@ -617,15 +617,15 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc_in,
 		{
 		  /* pc is still strictly less than highest address.  */
 		  /* Note "new" will always be >= lo.  */
-		  new = (lo + hi) / 2;
-		  if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[new]) >= pc)
-		      || (lo == new))
+		  newobj = (lo + hi) / 2;
+		  if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[newobj]) >= pc)
+		      || (lo == newobj))
 		    {
-		      hi = new;
+		      hi = newobj;
 		    }
 		  else
 		    {
-		      lo = new;
+		      lo = newobj;
 		    }
 		}
 
@@ -975,7 +975,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
 				 struct objfile *objfile)
 {
   struct obj_section *obj_section;
-  struct msym_bunch *new;
+  struct msym_bunch *newobj;
   struct minimal_symbol *msymbol;
 
   /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
@@ -1001,10 +1001,10 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
 
   if (msym_bunch_index == BUNCH_SIZE)
     {
-      new = XCNEW (struct msym_bunch);
+      newobj = XCNEW (struct msym_bunch);
       msym_bunch_index = 0;
-      new->next = msym_bunch;
-      msym_bunch = new;
+      newobj->next = msym_bunch;
+      msym_bunch = newobj;
     }
   msymbol = &msym_bunch->contents[msym_bunch_index];
   MSYMBOL_SET_LANGUAGE (msymbol, language_auto,
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 37d1ff1..b1fae73 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -407,8 +407,8 @@ x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state,
       int align = addr % max_wp_len;
       /* Four (eight on AMD64) is the maximum length a debug register
 	 can watch.  */
-      int try = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
-      int size = size_try_array[try][align];
+      int attempt = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
+      int size = size_try_array[attempt][align];
 
       if (what == WP_COUNT)
 	{
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 323d614..7312060 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -247,24 +247,24 @@ update_thread_private_data_name (struct thread_info *new_thread,
   gdb_assert (newname != NULL);
   gdb_assert (new_thread != NULL);
   newnamelen = strlen (newname);
-  if (!new_thread->private)
+  if (!new_thread->priv)
     {
-      new_thread->private = xmalloc (offsetof (struct private_thread_info,
+      new_thread->priv = xmalloc (offsetof (struct private_thread_info,
 					       name)
 				     + newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
-  else if (strcmp (newname, new_thread->private->name) != 0)
+  else if (strcmp (newname, new_thread->priv->name) != 0)
     {
       /* Reallocate if neccessary.  */
-      int oldnamelen = strlen (new_thread->private->name);
+      int oldnamelen = strlen (new_thread->priv->name);
 
       if (oldnamelen < newnamelen)
-	new_thread->private = xrealloc (new_thread->private,
+	new_thread->priv = xrealloc (new_thread->priv,
 					offsetof (struct private_thread_info,
 						  name)
 					+ newnamelen + 1);
-      memcpy (new_thread->private->name, newname, newnamelen + 1);
+      memcpy (new_thread->priv->name, newname, newnamelen + 1);
     }
 }
 
@@ -299,7 +299,7 @@ update_thread_private_data (struct thread_info *new_thread,
 
   update_thread_private_data_name (new_thread, tn->name_buf);
 
-  pti = (struct private_thread_info *) new_thread->private;
+  pti = (struct private_thread_info *) new_thread->priv;
   pti->tid = tid;
   pti->state = state;
   pti->flags = flags;
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index b6e8600..93c230c 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -364,9 +364,9 @@ static const char *nto_thread_state_str[] =
 char *
 nto_extra_thread_info (struct target_ops *self, struct thread_info *ti)
 {
-  if (ti && ti->private
-      && ti->private->state < ARRAY_SIZE (nto_thread_state_str))
-    return (char *)nto_thread_state_str [ti->private->state];
+  if (ti && ti->priv
+      && ti->priv->state < ARRAY_SIZE (nto_thread_state_str))
+    return (char *)nto_thread_state_str [ti->priv->state];
   return "";
 }
 
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 979ba01..0d1d96b 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -65,7 +65,7 @@ struct objc_class {
 
 struct objc_super {
   CORE_ADDR receiver;
-  CORE_ADDR class;
+  CORE_ADDR theclass;
 };
 
 struct objc_method {
@@ -413,16 +413,16 @@ static char *msglist_sel;
 void
 start_msglist(void)
 {
-  struct selname *new = 
+  struct selname *newobj =
     (struct selname *) xmalloc (sizeof (struct selname));
 
-  new->next = selname_chain;
-  new->msglist_len = msglist_len;
-  new->msglist_sel = msglist_sel;
+  newobj->next = selname_chain;
+  newobj->msglist_len = msglist_len;
+  newobj->msglist_sel = msglist_sel;
   msglist_len = 0;
   msglist_sel = (char *)xmalloc(1);
   *msglist_sel = 0;
-  selname_chain = new;
+  selname_chain = newobj;
 }
 
 void
@@ -856,7 +856,7 @@ parse_selector (char *method, char **selector)
 }
 
 static char * 
-parse_method (char *method, char *type, char **class, 
+parse_method (char *method, char *type, char **theclass,
 	      char **category, char **selector)
 {
   char *s1 = NULL;
@@ -869,7 +869,7 @@ parse_method (char *method, char *type, char **class,
   char *nselector = NULL;
 
   gdb_assert (type != NULL);
-  gdb_assert (class != NULL);
+  gdb_assert (theclass != NULL);
   gdb_assert (category != NULL);
   gdb_assert (selector != NULL);
   
@@ -941,8 +941,8 @@ parse_method (char *method, char *type, char **class,
 
   if (type != NULL)
     *type = ntype;
-  if (class != NULL)
-    *class = nclass;
+  if (theclass != NULL)
+    *theclass = nclass;
   if (category != NULL)
     *category = ncategory;
   if (selector != NULL)
@@ -952,7 +952,7 @@ parse_method (char *method, char *type, char **class,
 }
 
 static void
-find_methods (char type, const char *class, const char *category, 
+find_methods (char type, const char *theclass, const char *category, 
 	      const char *selector,
 	      VEC (const_char_ptr) **symbol_names)
 {
@@ -1018,8 +1018,8 @@ find_methods (char type, const char *class, const char *category,
 	  if ((type != '\0') && (ntype != type))
 	    continue;
 
-	  if ((class != NULL) 
-	      && ((nclass == NULL) || (strcmp (class, nclass) != 0)))
+	  if ((theclass != NULL)
+	      && ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
 	    continue;
 
 	  if ((category != NULL) && 
@@ -1112,7 +1112,7 @@ const char *
 find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
 {
   char type = '\0';
-  char *class = NULL;
+  char *theclass = NULL;
   char *category = NULL;
   char *selector = NULL;
 
@@ -1125,7 +1125,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
 
   buf = (char *) alloca (strlen (method) + 1);
   strcpy (buf, method);
-  tmp = parse_method (buf, &type, &class, &category, &selector);
+  tmp = parse_method (buf, &type, &theclass, &category, &selector);
 
   if (tmp == NULL)
     {
@@ -1138,7 +1138,7 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
       selector_case = 1;
     }
 
-  find_methods (type, class, category, selector, symbol_names);
+  find_methods (type, theclass, category, selector, symbol_names);
 
   /* If we hit the "selector" case, and we found some methods, then
      add the selector itself as a symbol, if it exists.  */
@@ -1417,34 +1417,34 @@ read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   super->receiver = read_memory_unsigned_integer (addr, 4, byte_order);
-  super->class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+  super->theclass = read_memory_unsigned_integer (addr + 4, 4, byte_order);
 };
 
 static void 
 read_objc_class (struct gdbarch *gdbarch, CORE_ADDR addr,
-		 struct objc_class *class)
+		 struct objc_class *theclass)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
-  class->isa = read_memory_unsigned_integer (addr, 4, byte_order);
-  class->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
-  class->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
-  class->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
-  class->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
-  class->instance_size = read_memory_unsigned_integer (addr + 18, 4,
+  theclass->isa = read_memory_unsigned_integer (addr, 4, byte_order);
+  theclass->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+  theclass->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
+  theclass->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
+  theclass->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
+  theclass->instance_size = read_memory_unsigned_integer (addr + 18, 4,
 						       byte_order);
-  class->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
-  class->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
-  class->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
-  class->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
+  theclass->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
+  theclass->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
+  theclass->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
+  theclass->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
 }
 
 static CORE_ADDR
 find_implementation_from_class (struct gdbarch *gdbarch,
-				CORE_ADDR class, CORE_ADDR sel)
+				CORE_ADDR theclass, CORE_ADDR sel)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  CORE_ADDR subclass = class;
+  CORE_ADDR subclass = theclass;
 
   while (subclass != 0) 
     {
@@ -1563,10 +1563,10 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
   sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
 
   read_objc_super (gdbarch, super, &sstr);
-  if (sstr.class == 0)
+  if (sstr.theclass == 0)
     return 0;
   
-  res = find_implementation_from_class (gdbarch, sstr.class, sel);
+  res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
   if (new_pc != 0)
     *new_pc = res;
   if (res == 0)
@@ -1591,10 +1591,10 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
   sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
 
   read_objc_super (gdbarch, super, &sstr);
-  if (sstr.class == 0)
+  if (sstr.theclass == 0)
     return 0;
   
-  res = find_implementation_from_class (gdbarch, sstr.class, sel);
+  res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
   if (new_pc != 0)
     *new_pc = res;
   if (res == 0)
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a1c78bf..c214cf1 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1103,7 +1103,7 @@ pop_current_type (void)
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1173,8 +1173,8 @@ yylex (void)
   /* See if it is a special token of length 3.  */
   if (explen > 2)
     for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-      if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
-          && (!isalpha (tokentab3[i].operator[0]) || explen == 3
+      if (strncasecmp (tokstart, tokentab3[i].oper, 3) == 0
+          && (!isalpha (tokentab3[i].oper[0]) || explen == 3
               || (!isalpha (tokstart[3])
 		  && !isdigit (tokstart[3]) && tokstart[3] != '_')))
         {
@@ -1186,8 +1186,8 @@ yylex (void)
   /* See if it is a special token of length 2.  */
   if (explen > 1)
   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-      if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
-          && (!isalpha (tokentab2[i].operator[0]) || explen == 2
+      if (strncasecmp (tokstart, tokentab2[i].oper, 2) == 0
+          && (!isalpha (tokentab2[i].oper[0]) || explen == 2
               || (!isalpha (tokstart[2])
 		  && !isdigit (tokstart[2]) && tokstart[2] != '_')))
         {
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index ead0ac2..f7e2aae 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -483,10 +483,10 @@ const char pascal_vtbl_ptr_name[] =
 int
 pascal_object_is_vtbl_ptr_type (struct type *type)
 {
-  const char *typename = type_name_no_tag (type);
+  const char *type_name = type_name_no_tag (type);
 
-  return (typename != NULL
-	  && strcmp (typename, pascal_vtbl_ptr_name) == 0);
+  return (type_name != NULL
+	  && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
 }
 
 /* Return truth value for the assertion that TYPE is of the type
diff --git a/gdb/parse.c b/gdb/parse.c
index ce60d69..af01947 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -140,13 +140,13 @@ static struct funcall *funcall_chain;
 void
 start_arglist (void)
 {
-  struct funcall *new;
+  struct funcall *newobj;
 
-  new = (struct funcall *) xmalloc (sizeof (struct funcall));
-  new->next = funcall_chain;
-  new->arglist_len = arglist_len;
+  newobj = (struct funcall *) xmalloc (sizeof (struct funcall));
+  newobj->next = funcall_chain;
+  newobj->arglist_len = arglist_len;
   arglist_len = 0;
-  funcall_chain = new;
+  funcall_chain = newobj;
 }
 
 /* Return the number of arguments in a function call just terminated,
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index abf5a2c..a377ec3 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -114,7 +114,7 @@ struct objc_class_str
   {
     struct stoken stoken;
     struct type *type;
-    int class;
+    int theclass;
   };
 
 typedef struct type *type_ptr;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 88a07d1..cdbed30 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1496,7 +1496,7 @@ display_command (char *arg, int from_tty)
 {
   struct format_data fmt;
   struct expression *expr;
-  struct display *new;
+  struct display *newobj;
   int display_it = 1;
   const char *exp = arg;
 
@@ -1535,20 +1535,20 @@ display_command (char *arg, int from_tty)
       innermost_block = NULL;
       expr = parse_expression (exp);
 
-      new = (struct display *) xmalloc (sizeof (struct display));
+      newobj = (struct display *) xmalloc (sizeof (struct display));
 
-      new->exp_string = xstrdup (exp);
-      new->exp = expr;
-      new->block = innermost_block;
-      new->pspace = current_program_space;
-      new->next = display_chain;
-      new->number = ++display_number;
-      new->format = fmt;
-      new->enabled_p = 1;
-      display_chain = new;
+      newobj->exp_string = xstrdup (exp);
+      newobj->exp = expr;
+      newobj->block = innermost_block;
+      newobj->pspace = current_program_space;
+      newobj->next = display_chain;
+      newobj->number = ++display_number;
+      newobj->format = fmt;
+      newobj->enabled_p = 1;
+      display_chain = newobj;
 
       if (from_tty)
-	do_one_display (new);
+	do_one_display (newobj);
 
       dont_repeat ();
     }
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 4ee9dc1..b3c2f44 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1247,13 +1247,13 @@ psymtab_to_fullname (struct partial_symtab *ps)
   return ps->fullname;
 }
 
-/*  For all symbols, s, in BLOCK that are in NAMESPACE and match NAME
+/*  For all symbols, s, in BLOCK that are in DOMAIN and match NAME
     according to the function MATCH, call CALLBACK(BLOCK, s, DATA).
     BLOCK is assumed to come from OBJFILE.  Returns 1 iff CALLBACK
     ever returns non-zero, and otherwise returns 0.  */
 
 static int
-map_block (const char *name, domain_enum namespace, struct objfile *objfile,
+map_block (const char *name, domain_enum domain, struct objfile *objfile,
 	   struct block *block,
 	   int (*callback) (struct block *, struct symbol *, void *),
 	   void *data, symbol_compare_ftype *match)
@@ -1265,7 +1265,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
        sym != NULL; sym = block_iter_match_next (name, match, &iter))
     {
       if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), 
-				 SYMBOL_DOMAIN (sym), namespace))
+				 SYMBOL_DOMAIN (sym), domain))
 	{
 	  if (callback (block, sym, data))
 	    return 1;
@@ -1280,7 +1280,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
 
 static void
 psym_map_matching_symbols (struct objfile *objfile,
-			   const char *name, domain_enum namespace,
+			   const char *name, domain_enum domain,
 			   int global,
 			   int (*callback) (struct block *,
 					    struct symbol *, void *),
@@ -1295,7 +1295,7 @@ psym_map_matching_symbols (struct objfile *objfile,
     {
       QUIT;
       if (ps->readin
-	  || match_partial_symbol (objfile, ps, global, name, namespace, match,
+	  || match_partial_symbol (objfile, ps, global, name, domain, match,
 				   ordered_compare))
 	{
 	  struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
@@ -1304,7 +1304,7 @@ psym_map_matching_symbols (struct objfile *objfile,
 	  if (cust == NULL)
 	    continue;
 	  block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
-	  if (map_block (name, namespace, objfile, block,
+	  if (map_block (name, domain, objfile, block,
 			 callback, data, match))
 	    return;
 	  if (callback (block, NULL, data))
@@ -1550,12 +1550,12 @@ psymbol_hash (const void *addr, int length)
   struct partial_symbol *psymbol = (struct partial_symbol *) addr;
   unsigned int lang = psymbol->ginfo.language;
   unsigned int domain = PSYMBOL_DOMAIN (psymbol);
-  unsigned int class = PSYMBOL_CLASS (psymbol);
+  unsigned int theclass = PSYMBOL_CLASS (psymbol);
 
   h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
   h = hash_continue (&lang, sizeof (unsigned int), h);
   h = hash_continue (&domain, sizeof (unsigned int), h);
-  h = hash_continue (&class, sizeof (unsigned int), h);
+  h = hash_continue (&theclass, sizeof (unsigned int), h);
   h = hash_continue (psymbol->ginfo.name, strlen (psymbol->ginfo.name), h);
 
   return h;
@@ -1633,7 +1633,7 @@ psymbol_bcache_full (struct partial_symbol *sym,
 static const struct partial_symbol *
 add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
 		       domain_enum domain,
-		       enum address_class class,
+		       enum address_class theclass,
 		       long val,	/* Value as a long */
 		       CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
 		       enum language language, struct objfile *objfile,
@@ -1658,7 +1658,7 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
   SYMBOL_SECTION (&psymbol) = -1;
   SYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
   PSYMBOL_DOMAIN (&psymbol) = domain;
-  PSYMBOL_CLASS (&psymbol) = class;
+  PSYMBOL_CLASS (&psymbol) = theclass;
 
   SYMBOL_SET_NAMES (&psymbol, name, namelength, copy_name, objfile);
 
@@ -1718,7 +1718,7 @@ append_psymbol_to_list (struct psymbol_allocation_list *list,
 void
 add_psymbol_to_list (const char *name, int namelength, int copy_name,
 		     domain_enum domain,
-		     enum address_class class,
+		     enum address_class theclass,
 		     struct psymbol_allocation_list *list, 
 		     long val,	/* Value as a long */
 		     CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
@@ -1729,7 +1729,7 @@ add_psymbol_to_list (const char *name, int namelength, int copy_name,
   int added;
 
   /* Stash the partial symbol away in the cache.  */
-  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, class,
+  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, theclass,
 				val, coreaddr, language, objfile, &added);
 
   /* Do not duplicate global partial symbols.  */
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 696935b..729bc64 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -147,42 +147,42 @@ static PyObject *
 sympy_is_constant (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return PyBool_FromLong (class == LOC_CONST || class == LOC_CONST_BYTES);
+  return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
 }
 
 static PyObject *
 sympy_is_function (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
-  return PyBool_FromLong (class == LOC_BLOCK);
+  return PyBool_FromLong (theclass == LOC_BLOCK);
 }
 
 static PyObject *
 sympy_is_variable (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  enum address_class class;
+  enum address_class theclass;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  class = SYMBOL_CLASS (symbol);
+  theclass = SYMBOL_CLASS (symbol);
 
   return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (symbol)
-			  && (class == LOC_LOCAL || class == LOC_REGISTER
-			      || class == LOC_STATIC || class == LOC_COMPUTED
-			      || class == LOC_OPTIMIZED_OUT));
+			  && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
+			      || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+			      || theclass == LOC_OPTIMIZED_OUT));
 }
 
 /* Implementation of gdb.Symbol.needs_frame -> Boolean.
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 7a2fd1a..143e5fd 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -846,7 +846,7 @@ mips_send_packet (const char *s, int get_ack)
   /* unsigned */ int len;
   unsigned char *packet;
   int cksum;
-  int try;
+  int attempt;
 
   len = strlen (s);
   if (len > DATA_MAXLEN)
@@ -873,7 +873,7 @@ mips_send_packet (const char *s, int get_ack)
   /* We can only have one outstanding data packet, so we just wait for
      the acknowledgement here.  Keep retransmitting the packet until
      we get one, or until we've tried too many times.  */
-  for (try = 0; try < mips_send_retries; try++)
+  for (attempt = 0; attempt < mips_send_retries; attempt++)
     {
       int garbage;
       int ch;
diff --git a/gdb/remote.c b/gdb/remote.c
index 3d2c1c2..2a823eb 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1659,15 +1659,15 @@ demand_private_info (ptid_t ptid)
 
   gdb_assert (info);
 
-  if (!info->private)
+  if (!info->priv)
     {
-      info->private = xmalloc (sizeof (*(info->private)));
+      info->priv = xmalloc (sizeof (*(info->priv)));
       info->private_dtor = free_private_thread_info;
-      info->private->core = -1;
-      info->private->extra = 0;
+      info->priv->core = -1;
+      info->priv->extra = 0;
     }
 
-  return info->private;
+  return info->priv;
 }
 
 /* Call this function as a result of
@@ -2910,8 +2910,8 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
     {
       struct thread_info *info = find_thread_ptid (tp->ptid);
 
-      if (info && info->private)
-	return info->private->extra;
+      if (info && info->priv)
+	return info->priv->extra;
       else
 	return NULL;
     }
@@ -11156,8 +11156,8 @@ remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
 {
   struct thread_info *info = find_thread_ptid (ptid);
 
-  if (info && info->private)
-    return info->private->core;
+  if (info && info->priv)
+    return info->priv->core;
   return -1;
 }
 
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index d742f82..f96841f 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -271,7 +271,7 @@ darwin_current_sos (void)
       char *file_path;
       int errcode;
       struct darwin_so_list *dnew;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
 
       /* Read image info from inferior.  */
@@ -302,22 +302,22 @@ darwin_current_sos (void)
 
       /* Create and fill the new so_list element.  */
       dnew = XCNEW (struct darwin_so_list);
-      new = &dnew->sl;
+      newobj = &dnew->sl;
       old_chain = make_cleanup (xfree, dnew);
 
-      new->lm_info = &dnew->li;
+      newobj->lm_info = &dnew->li;
 
-      strncpy (new->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
       xfree (file_path);
-      new->lm_info->lm_addr = load_addr;
+      newobj->lm_info->lm_addr = load_addr;
 
       if (head == NULL)
-	head = new;
+	head = newobj;
       else
-	tail->next = new;
-      tail = new;
+	tail->next = newobj;
+      tail = newobj;
 
       discard_cleanups (old_chain);
     }
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index cca6892..3b0bf48 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -119,7 +119,7 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
   struct regcache *regcache = get_thread_regcache (ptid);
   CORE_ADDR pc = regcache_read_pc (regcache);
   struct address_space *aspace = get_regcache_aspace (regcache);
-  ia64_insn t0, t1, slot[3], template, insn;
+  ia64_insn t0, t1, slot[3], templ, insn;
   int slotnum;
   bfd_byte bundle[16];
 
@@ -139,12 +139,12 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
   /* bundles are always in little-endian byte order */
   t0 = bfd_getl64 (bundle);
   t1 = bfd_getl64 (bundle + 8);
-  template = (t0 >> 1) & 0xf;
+  templ = (t0 >> 1) & 0xf;
   slot[0] = (t0 >>  5) & 0x1ffffffffffLL;
   slot[1] = ((t0 >> 46) & 0x3ffff) | ((t1 & 0x7fffff) << 18);
   slot[2] = (t1 >> 23) & 0x1ffffffffffLL;
 
-  if (template == 2 && slotnum == 1)
+  if (templ == 2 && slotnum == 1)
     {
       /* skip L slot in MLI template: */
       slotnum = 2;
diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index 64c3d7f..a176aab 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -426,7 +426,7 @@ pa64_current_sos (void)
     {
       struct load_module_desc dll_desc;
       char *dll_path;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
 
       if (dll_index == 0)
@@ -443,22 +443,22 @@ pa64_current_sos (void)
 			    pa64_target_read_memory,
 			    0, dld_cache.load_map);
 
-      new = (struct so_list *) xmalloc (sizeof (struct so_list));
-      memset (new, 0, sizeof (struct so_list));
-      new->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
-      memset (new->lm_info, 0, sizeof (struct lm_info));
+      newobj = (struct so_list *) xmalloc (sizeof (struct so_list));
+      memset (newobj, 0, sizeof (struct so_list));
+      newobj->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
+      memset (newobj->lm_info, 0, sizeof (struct lm_info));
 
-      strncpy (new->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, dll_path, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
 
-      memcpy (&new->lm_info->desc, &dll_desc, sizeof (dll_desc));
+      memcpy (&newobj->lm_info->desc, &dll_desc, sizeof (dll_desc));
 
 #ifdef SOLIB_PA64_DBG
       {
-        struct load_module_desc *d = &new->lm_info->desc;
+        struct load_module_desc *d = &newobj->lm_info->desc;
 
-	printf ("\n+ library \"%s\" is described at index %d\n", new->so_name, 
+	printf ("\n+ library \"%s\" is described at index %d\n", newobj->so_name,
 		dll_index);
 	printf ("    text_base = %s\n", hex_string (d->text_base));
 	printf ("    text_size = %s\n", hex_string (d->text_size));
@@ -475,9 +475,9 @@ pa64_current_sos (void)
 #endif
 
       /* Link the new object onto the list.  */
-      new->next = NULL;
-      *link_ptr = new;
-      link_ptr = &new->next;
+      newobj->next = NULL;
+      *link_ptr = newobj;
+      link_ptr = &newobj->next;
     }
 
   return head;
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index deb1d17..27e39a7 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -585,18 +585,18 @@ som_current_sos (void)
     {
       char *namebuf;
       CORE_ADDR addr;
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
       int errcode;
       struct dld_list dbuf;
       gdb_byte tsdbuf[4];
 
-      new = (struct so_list *) xmalloc (sizeof (struct so_list));
-      old_chain = make_cleanup (xfree, new);
+      newobj = (struct so_list *) xmalloc (sizeof (struct so_list));
+      old_chain = make_cleanup (xfree, newobj);
 
-      memset (new, 0, sizeof (*new));
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      make_cleanup (xfree, new->lm_info);
+      memset (newobj, 0, sizeof (*newobj));
+      newobj->lm_info = xmalloc (sizeof (struct lm_info));
+      make_cleanup (xfree, newobj->lm_info);
 
       read_memory (lm, (gdb_byte *)&dbuf, sizeof (struct dld_list));
 
@@ -608,15 +608,15 @@ som_current_sos (void)
 		 safe_strerror (errcode));
       else
 	{
-	  strncpy (new->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
-	  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+	  strncpy (newobj->so_name, namebuf, SO_NAME_MAX_PATH_SIZE - 1);
+	  newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
 	  xfree (namebuf);
-	  strcpy (new->so_original_name, new->so_name);
+	  strcpy (newobj->so_original_name, newobj->so_name);
 	}
 
-	if (new->so_name[0] && !match_main (new->so_name))
+	if (newobj->so_name[0] && !match_main (newobj->so_name))
 	  {
-	    struct lm_info *lmi = new->lm_info;
+	    struct lm_info *lmi = newobj->lm_info;
 	    unsigned int tmp;
 
 	    lmi->lm_addr = lm;
@@ -642,41 +642,41 @@ som_current_sos (void)
 	      = extract_unsigned_integer (tsdbuf, 4, byte_order);
 
 #ifdef SOLIB_SOM_DBG
-	    printf ("\n+ library \"%s\" is described at %s\n", new->so_name,
+	    printf ("\n+ library \"%s\" is described at %s\n", newobj->so_name,
 	    	    paddress (target_gdbarch (), lm));
-	    printf ("  'version' is %d\n", new->lm_info->struct_version);
-	    printf ("  'bind_mode' is %d\n", new->lm_info->bind_mode);
+	    printf ("  'version' is %d\n", newobj->lm_info->struct_version);
+	    printf ("  'bind_mode' is %d\n", newobj->lm_info->bind_mode);
 	    printf ("  'library_version' is %d\n", 
-	    	    new->lm_info->library_version);
+		    newobj->lm_info->library_version);
 	    printf ("  'text_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->text_addr));
 	    printf ("  'text_link_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_link_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->text_link_addr));
 	    printf ("  'text_end' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->text_end));
+		    paddress (target_gdbarch (), newobj->lm_info->text_end));
 	    printf ("  'data_start' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->data_start));
+		    paddress (target_gdbarch (), newobj->lm_info->data_start));
 	    printf ("  'bss_start' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->bss_start));
+		    paddress (target_gdbarch (), newobj->lm_info->bss_start));
 	    printf ("  'data_end' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->data_end));
+		    paddress (target_gdbarch (), newobj->lm_info->data_end));
 	    printf ("  'got_value' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->got_value));
+		    paddress (target_gdbarch (), newobj->lm_info->got_value));
 	    printf ("  'tsd_start_addr' is %s\n",
-	    	    paddress (target_gdbarch (), new->lm_info->tsd_start_addr));
+		    paddress (target_gdbarch (), newobj->lm_info->tsd_start_addr));
 #endif
 
-	    new->addr_low = lmi->text_addr;
-	    new->addr_high = lmi->text_end;
+	    newobj->addr_low = lmi->text_addr;
+	    newobj->addr_high = lmi->text_end;
 
 	    /* Link the new object onto the list.  */
-	    new->next = NULL;
-	    *link_ptr = new;
-	    link_ptr = &new->next;
+	    newobj->next = NULL;
+	    *link_ptr = newobj;
+	    link_ptr = &newobj->next;
 	  }
  	else
 	  {
-	    free_so (new);
+	    free_so (newobj);
 	  }
 
       lm = EXTRACT (next);
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 6145112..3c8cd1a 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -119,19 +119,19 @@ append_ocl_sos (struct so_list **link_ptr)
 					      byte_order);
 	      if (data != 0x0)
 		{
-		  struct so_list *new;
+		  struct so_list *newobj;
 
 		  /* Allocate so_list structure.  */
-		  new = XCNEW (struct so_list);
+		  newobj = XCNEW (struct so_list);
 
 		  /* Encode FD and object ID in path name.  */
-		  xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
+		  xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>",
 			     hex_string (data),
 			     SPUADDR_SPU (*ocl_program_addr_base));
-		  strcpy (new->so_original_name, new->so_name);
+		  strcpy (newobj->so_original_name, newobj->so_name);
 
-		  *link_ptr = new;
-		  link_ptr = &new->next;
+		  *link_ptr = newobj;
+		  link_ptr = &newobj->next;
 		}
 	    }
 	  if (ex.reason < 0)
@@ -195,7 +195,7 @@ spu_current_sos (void)
   for (i = 0; i < size; i += 4)
     {
       int fd = extract_unsigned_integer (buf + i, 4, byte_order);
-      struct so_list *new;
+      struct so_list *newobj;
 
       unsigned long long addr;
       char annex[32], id[100];
@@ -214,16 +214,16 @@ spu_current_sos (void)
 	continue;
 
       /* Allocate so_list structure.  */
-      new = XCNEW (struct so_list);
+      newobj = XCNEW (struct so_list);
 
       /* Encode FD and object ID in path name.  Choose the name so as not
 	 to conflict with any (normal) SVR4 library path name.  */
-      xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
+      xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>",
 		 hex_string (addr), fd);
-      strcpy (new->so_original_name, new->so_name);
+      strcpy (newobj->so_original_name, newobj->so_name);
 
-      *link_ptr = new;
-      link_ptr = &new->next;
+      *link_ptr = newobj;
+      link_ptr = &newobj->next;
     }
 
   /* Append OpenCL sos.  */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 849c452..2143021 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -932,7 +932,7 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 {
   struct svr4_info *info;
   CORE_ADDR ldsomap;
-  struct so_list *new;
+  struct so_list *newobj;
   struct cleanup *old_chain;
   CORE_ADDR name_lm;
 
@@ -947,11 +947,11 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
   if (!ldsomap)
     return 0;
 
-  new = XCNEW (struct so_list);
-  old_chain = make_cleanup (xfree, new);
-  new->lm_info = lm_info_read (ldsomap);
-  make_cleanup (xfree, new->lm_info);
-  name_lm = new->lm_info ? new->lm_info->l_name : 0;
+  newobj = XCNEW (struct so_list);
+  old_chain = make_cleanup (xfree, newobj);
+  newobj->lm_info = lm_info_read (ldsomap);
+  make_cleanup (xfree, newobj->lm_info);
+  name_lm = newobj->lm_info ? newobj->lm_info->l_name : 0;
   do_cleanups (old_chain);
 
   return (name_lm >= vaddr && name_lm < vaddr + size);
@@ -1087,17 +1087,17 @@ svr4_copy_library_list (struct so_list *src)
 
   while (src != NULL)
     {
-      struct so_list *new;
+      struct so_list *newobj;
 
-      new = xmalloc (sizeof (struct so_list));
-      memcpy (new, src, sizeof (struct so_list));
+      newobj = xmalloc (sizeof (struct so_list));
+      memcpy (newobj, src, sizeof (struct so_list));
 
-      new->lm_info = xmalloc (sizeof (struct lm_info));
-      memcpy (new->lm_info, src->lm_info, sizeof (struct lm_info));
+      newobj->lm_info = xmalloc (sizeof (struct lm_info));
+      memcpy (newobj->lm_info, src->lm_info, sizeof (struct lm_info));
 
-      new->next = NULL;
-      *link = new;
-      link = &new->next;
+      newobj->next = NULL;
+      *link = newobj;
+      link = &newobj->next;
 
       src = src->next;
     }
@@ -1272,24 +1272,24 @@ static struct so_list *
 svr4_default_sos (void)
 {
   struct svr4_info *info = get_svr4_info ();
-  struct so_list *new;
+  struct so_list *newobj;
 
   if (!info->debug_loader_offset_p)
     return NULL;
 
-  new = XCNEW (struct so_list);
+  newobj = XCNEW (struct so_list);
 
-  new->lm_info = xzalloc (sizeof (struct lm_info));
+  newobj->lm_info = xzalloc (sizeof (struct lm_info));
 
   /* Nothing will ever check the other fields if we set l_addr_p.  */
-  new->lm_info->l_addr = info->debug_loader_offset;
-  new->lm_info->l_addr_p = 1;
+  newobj->lm_info->l_addr = info->debug_loader_offset;
+  newobj->lm_info->l_addr_p = 1;
 
-  strncpy (new->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
-  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-  strcpy (new->so_original_name, new->so_name);
+  strncpy (newobj->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
+  newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+  strcpy (newobj->so_original_name, newobj->so_name);
 
-  return new;
+  return newobj;
 }
 
 /* Read the whole inferior libraries chain starting at address LM.
@@ -1309,28 +1309,28 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 
   for (; lm != 0; prev_lm = lm, lm = next_lm)
     {
-      struct so_list *new;
+      struct so_list *newobj;
       struct cleanup *old_chain;
       int errcode;
       char *buffer;
 
-      new = XCNEW (struct so_list);
-      old_chain = make_cleanup_free_so (new);
+      newobj = XCNEW (struct so_list);
+      old_chain = make_cleanup_free_so (newobj);
 
-      new->lm_info = lm_info_read (lm);
-      if (new->lm_info == NULL)
+      newobj->lm_info = lm_info_read (lm);
+      if (newobj->lm_info == NULL)
 	{
 	  do_cleanups (old_chain);
 	  return 0;
 	}
 
-      next_lm = new->lm_info->l_next;
+      next_lm = newobj->lm_info->l_next;
 
-      if (new->lm_info->l_prev != prev_lm)
+      if (newobj->lm_info->l_prev != prev_lm)
 	{
 	  warning (_("Corrupted shared library list: %s != %s"),
 		   paddress (target_gdbarch (), prev_lm),
-		   paddress (target_gdbarch (), new->lm_info->l_prev));
+		   paddress (target_gdbarch (), newobj->lm_info->l_prev));
 	  do_cleanups (old_chain);
 	  return 0;
 	}
@@ -1340,18 +1340,18 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
          SVR4, it has no name.  For others (Solaris 2.3 for example), it
          does have a name, so we can no longer use a missing name to
          decide when to ignore it.  */
-      if (ignore_first && new->lm_info->l_prev == 0)
+      if (ignore_first && newobj->lm_info->l_prev == 0)
 	{
 	  struct svr4_info *info = get_svr4_info ();
 
-	  first_l_name = new->lm_info->l_name;
-	  info->main_lm_addr = new->lm_info->lm_addr;
+	  first_l_name = newobj->lm_info->l_name;
+	  info->main_lm_addr = newobj->lm_info->lm_addr;
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
       /* Extract this shared object's name.  */
-      target_read_string (new->lm_info->l_name, &buffer,
+      target_read_string (newobj->lm_info->l_name, &buffer,
 			  SO_NAME_MAX_PATH_SIZE - 1, &errcode);
       if (errcode != 0)
 	{
@@ -1359,30 +1359,30 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 	     inferior executable, then this is not a normal shared
 	     object, but (most likely) a vDSO.  In this case, silently
 	     skip it; otherwise emit a warning. */
-	  if (first_l_name == 0 || new->lm_info->l_name != first_l_name)
+	  if (first_l_name == 0 || newobj->lm_info->l_name != first_l_name)
 	    warning (_("Can't read pathname for load map: %s."),
 		     safe_strerror (errcode));
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
-      strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-      strcpy (new->so_original_name, new->so_name);
+      strncpy (newobj->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+      newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+      strcpy (newobj->so_original_name, newobj->so_name);
       xfree (buffer);
 
       /* If this entry has no name, or its name matches the name
 	 for the main executable, don't include it in the list.  */
-      if (! new->so_name[0] || match_main (new->so_name))
+      if (! newobj->so_name[0] || match_main (newobj->so_name))
 	{
 	  do_cleanups (old_chain);
 	  continue;
 	}
 
       discard_cleanups (old_chain);
-      new->next = 0;
-      **link_ptr_ptr = new;
-      *link_ptr_ptr = &new->next;
+      newobj->next = 0;
+      **link_ptr_ptr = newobj;
+      *link_ptr_ptr = &newobj->next;
     }
 
   return 1;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 2a160c5..a0e6388 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1807,10 +1807,10 @@ again:
         while (**pp && **pp != '#')
           {
             struct type *arg_type = read_type (pp, objfile);
-            struct type_list *new = alloca (sizeof (*new));
-            new->type = arg_type;
-            new->next = arg_types;
-            arg_types = new;
+            struct type_list *newobj = alloca (sizeof (*newobj));
+            newobj->type = arg_type;
+            newobj->next = arg_types;
+            arg_types = newobj;
             num_args++;
           }
         if (**pp == '#')
@@ -2999,7 +2999,7 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
 		    struct objfile *objfile)
 {
   char *p;
-  struct nextfield *new;
+  struct nextfield *newobj;
 
   /* We better set p right now, in case there are no fields at all...    */
 
@@ -3015,11 +3015,11 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
     {
       STABS_CONTINUE (pp, objfile);
       /* Get space to record the next field's data.  */
-      new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (xfree, new);
-      memset (new, 0, sizeof (struct nextfield));
-      new->next = fip->list;
-      fip->list = new;
+      newobj = (struct nextfield *) xmalloc (sizeof (struct nextfield));
+      make_cleanup (xfree, newobj);
+      memset (newobj, 0, sizeof (struct nextfield));
+      newobj->next = fip->list;
+      fip->list = newobj;
 
       /* Get the field name.  */
       p = *pp;
@@ -3097,7 +3097,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 		  struct objfile *objfile)
 {
   int i;
-  struct nextfield *new;
+  struct nextfield *newobj;
 
   if (**pp != '!')
     {
@@ -3137,12 +3137,12 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
-      new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (xfree, new);
-      memset (new, 0, sizeof (struct nextfield));
-      new->next = fip->list;
-      fip->list = new;
-      FIELD_BITSIZE (new->field) = 0;	/* This should be an unpacked
+      newobj = (struct nextfield *) xmalloc (sizeof (struct nextfield));
+      make_cleanup (xfree, newobj);
+      memset (newobj, 0, sizeof (struct nextfield));
+      newobj->next = fip->list;
+      fip->list = newobj;
+      FIELD_BITSIZE (newobj->field) = 0;	/* This should be an unpacked
 					   field!  */
 
       STABS_CONTINUE (pp, objfile);
@@ -3164,8 +3164,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	}
       ++(*pp);
 
-      new->visibility = *(*pp)++;
-      switch (new->visibility)
+      newobj->visibility = *(*pp)++;
+      switch (newobj->visibility)
 	{
 	case VISIBILITY_PRIVATE:
 	case VISIBILITY_PROTECTED:
@@ -3177,8 +3177,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	  {
 	    complaint (&symfile_complaints,
 		       _("Unknown visibility `%c' for baseclass"),
-		       new->visibility);
-	    new->visibility = VISIBILITY_PUBLIC;
+		       newobj->visibility);
+	    newobj->visibility = VISIBILITY_PUBLIC;
 	  }
 	}
 
@@ -3189,7 +3189,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
 	   corresponding to this baseclass.  Always zero in the absence of
 	   multiple inheritance.  */
 
-	SET_FIELD_BITPOS (new->field, read_huge_number (pp, ',', &nbits, 0));
+	SET_FIELD_BITPOS (newobj->field, read_huge_number (pp, ',', &nbits, 0));
 	if (nbits != 0)
 	  return 0;
       }
@@ -3198,8 +3198,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
          base class.  Read it, and remember it's type name as this
          field's name.  */
 
-      new->field.type = read_type (pp, objfile);
-      new->field.name = type_name_no_tag (new->field.type);
+      newobj->field.type = read_type (pp, objfile);
+      newobj->field.name = type_name_no_tag (newobj->field.type);
 
       /* Skip trailing ';' and bump count of number of fields seen.  */
       if (**pp == ';')
@@ -4350,7 +4350,7 @@ common_block_end (struct objfile *objfile)
      symbol for the common block name for later fixup.  */
   int i;
   struct symbol *sym;
-  struct pending *new = 0;
+  struct pending *newobj = 0;
   struct pending *next;
   int j;
 
@@ -4373,7 +4373,7 @@ common_block_end (struct objfile *objfile)
        next = next->next)
     {
       for (j = 0; j < next->nsyms; j++)
-	add_symbol_to_list (next->symbol[j], &new);
+	add_symbol_to_list (next->symbol[j], &newobj);
     }
 
   /* Copy however much of COMMON_BLOCK we need.  If COMMON_BLOCK is
@@ -4382,9 +4382,9 @@ common_block_end (struct objfile *objfile)
 
   if (common_block != NULL)
     for (j = common_block_i; j < common_block->nsyms; j++)
-      add_symbol_to_list (common_block->symbol[j], &new);
+      add_symbol_to_list (common_block->symbol[j], &newobj);
 
-  SYMBOL_TYPE (sym) = (struct type *) new;
+  SYMBOL_TYPE (sym) = (struct type *) newobj;
 
   /* Should we be putting local_symbols back to what it was?
      Does it matter?  */
@@ -4554,9 +4554,9 @@ cleanup_undefined_types_1 (void)
 		struct pending *ppt;
 		int i;
 		/* Name of the type, without "struct" or "union".  */
-		const char *typename = TYPE_TAG_NAME (*type);
+		const char *type_name = TYPE_TAG_NAME (*type);
 
-		if (typename == NULL)
+		if (type_name == NULL)
 		  {
 		    complaint (&symfile_complaints, _("need a type name"));
 		    break;
@@ -4574,7 +4574,7 @@ cleanup_undefined_types_1 (void)
 			    && (TYPE_INSTANCE_FLAGS (*type) ==
 				TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
 			    && strcmp (SYMBOL_LINKAGE_NAME (sym),
-				       typename) == 0)
+				       type_name) == 0)
                           replace_type (*type, SYMBOL_TYPE (sym));
 		      }
 		  }
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index e0600a9..6a3351a 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -249,7 +249,7 @@ debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
 
 static void
 debug_qf_map_matching_symbols (struct objfile *objfile,
-			       const char *name, domain_enum namespace,
+			       const char *name, domain_enum domain,
 			       int global,
 			       int (*callback) (struct block *,
 						struct symbol *, void *),
@@ -263,14 +263,14 @@ debug_qf_map_matching_symbols (struct objfile *objfile,
   fprintf_filtered (gdb_stdlog,
 		    "qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s, %s, %s)\n",
 		    objfile_debug_name (objfile), name,
-		    domain_name (namespace), global,
+		    domain_name (domain), global,
 		    host_address_to_string (callback),
 		    host_address_to_string (data),
 		    host_address_to_string (match),
 		    host_address_to_string (ordered_compare));
 
   debug_data->real_sf->qf->map_matching_symbols (objfile, name,
-						 namespace, global,
+						 domain, global,
 						 callback, data,
 						 match,
 						 ordered_compare);
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 0bf40c1..1f5fa9a 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -238,7 +238,7 @@ struct quick_symbol_functions
   void (*expand_symtabs_with_fullname) (struct objfile *objfile,
 					const char *fullname);
 
-  /* Find global or static symbols in all tables that are in NAMESPACE 
+  /* Find global or static symbols in all tables that are in DOMAIN
      and for which MATCH (symbol name, NAME) == 0, passing each to 
      CALLBACK, reading in partial symbol tables as needed.  Look
      through global symbols if GLOBAL and otherwise static symbols.
@@ -256,7 +256,7 @@ struct quick_symbol_functions
      non-zero to indicate that the scan should be terminated.  */
 
   void (*map_matching_symbols) (struct objfile *,
-				const char *name, domain_enum namespace,
+				const char *name, domain_enum domain,
 				int global,
 				int (*callback) (struct block *,
 						 struct symbol *, void *),
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5302afa..81fdddf 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5028,44 +5028,44 @@ completion_list_add_name (const char *symname,
      of matches.  Note that the name is moved to freshly malloc'd space.  */
 
   {
-    char *new;
+    char *newobj;
     enum maybe_add_completion_enum add_status;
 
     if (word == sym_text)
       {
-	new = xmalloc (strlen (symname) + 5);
-	strcpy (new, symname);
+	newobj = xmalloc (strlen (symname) + 5);
+	strcpy (newobj, symname);
       }
     else if (word > sym_text)
       {
 	/* Return some portion of symname.  */
-	new = xmalloc (strlen (symname) + 5);
-	strcpy (new, symname + (word - sym_text));
+	newobj = xmalloc (strlen (symname) + 5);
+	strcpy (newobj, symname + (word - sym_text));
       }
     else
       {
 	/* Return some of SYM_TEXT plus symname.  */
-	new = xmalloc (strlen (symname) + (sym_text - word) + 5);
-	strncpy (new, word, sym_text - word);
-	new[sym_text - word] = '\0';
-	strcat (new, symname);
+	newobj = xmalloc (strlen (symname) + (sym_text - word) + 5);
+	strncpy (newobj, word, sym_text - word);
+	newobj[sym_text - word] = '\0';
+	strcat (newobj, symname);
       }
 
-    add_status = maybe_add_completion (completion_tracker, new);
+    add_status = maybe_add_completion (completion_tracker, newobj);
 
     switch (add_status)
       {
       case MAYBE_ADD_COMPLETION_OK:
-	VEC_safe_push (char_ptr, return_val, new);
+	VEC_safe_push (char_ptr, return_val, newobj);
 	break;
       case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
-	VEC_safe_push (char_ptr, return_val, new);
+	VEC_safe_push (char_ptr, return_val, newobj);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_MAX_REACHED:
-	xfree (new);
+	xfree (newobj);
 	throw_max_completions_reached_error ();
       case MAYBE_ADD_COMPLETION_DUPLICATE:
-	xfree (new);
+	xfree (newobj);
 	break;
       }
   }
@@ -5665,30 +5665,30 @@ static void
 add_filename_to_list (const char *fname, const char *text, const char *word,
 		      VEC (char_ptr) **list)
 {
-  char *new;
+  char *newobj;
   size_t fnlen = strlen (fname);
 
   if (word == text)
     {
       /* Return exactly fname.  */
-      new = xmalloc (fnlen + 5);
-      strcpy (new, fname);
+      newobj = xmalloc (fnlen + 5);
+      strcpy (newobj, fname);
     }
   else if (word > text)
     {
       /* Return some portion of fname.  */
-      new = xmalloc (fnlen + 5);
-      strcpy (new, fname + (word - text));
+      newobj = xmalloc (fnlen + 5);
+      strcpy (newobj, fname + (word - text));
     }
   else
     {
       /* Return some of TEXT plus fname.  */
-      new = xmalloc (fnlen + (text - word) + 5);
-      strncpy (new, word, text - word);
-      new[text - word] = '\0';
-      strcat (new, fname);
+      newobj = xmalloc (fnlen + (text - word) + 5);
+      strncpy (newobj, word, text - word);
+      newobj[text - word] = '\0';
+      strcat (newobj, fname);
     }
-  VEC_safe_push (char_ptr, *list, new);
+  VEC_safe_push (char_ptr, *list, newobj);
 }
 
 static int
diff --git a/gdb/thread.c b/gdb/thread.c
index a2a5a9b..01eb2ba 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -182,12 +182,12 @@ clear_thread_inferior_resources (struct thread_info *tp)
 static void
 free_thread (struct thread_info *tp)
 {
-  if (tp->private)
+  if (tp->priv)
     {
       if (tp->private_dtor)
-	tp->private_dtor (tp->private);
+	tp->private_dtor (tp->priv);
       else
-	xfree (tp->private);
+	xfree (tp->priv);
     }
 
   xfree (tp->name);
@@ -288,11 +288,11 @@ add_thread_silent (ptid_t ptid)
 }
 
 struct thread_info *
-add_thread_with_info (ptid_t ptid, struct private_thread_info *private)
+add_thread_with_info (ptid_t ptid, struct private_thread_info *priv)
 {
   struct thread_info *result = add_thread_silent (ptid);
 
-  result->private = private;
+  result->priv = priv;
 
   if (print_thread_events)
     printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
diff --git a/gdb/top.c b/gdb/top.c
index 8242e12..55c6896 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -462,7 +462,7 @@ execute_command (char *p, int from_tty)
 	deprecated_cmd_warning (line);
 
       /* c->user_commands would be NULL in the case of a python command.  */
-      if (c->class == class_user && c->user_commands)
+      if (c->theclass == class_user && c->user_commands)
 	execute_user_command (c, arg);
       else if (c->type == set_cmd)
 	do_set_command (arg, from_tty, c);
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 602bddc..5271ee8 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -253,7 +253,7 @@ tui_check_data_values (struct frame_info *frame)
 	    has changed (data_element_ptr, frame, &new_value)
 	    {
 	      data_element_ptr->value = new_value;
-	      update the display with the new value, hiliting it.
+	      update the display with the newobj value, hiliting it.
 	    }
 #endif
 	}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index d39e2e3..234be7f 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -335,9 +335,9 @@ find_typedef_in_hash (const struct type_print_options *flags, struct type *t)
    NEW is the new name for a type TYPE.  */
 
 void
-typedef_print (struct type *type, struct symbol *new, struct ui_file *stream)
+typedef_print (struct type *type, struct symbol *newobj, struct ui_file *stream)
 {
-  LA_PRINT_TYPEDEF (type, new, stream);
+  LA_PRINT_TYPEDEF (type, newobj, stream);
 }
 
 /* The default way to print a typedef.  */
@@ -499,9 +499,9 @@ whatis_command (char *exp, int from_tty)
 /* TYPENAME is either the name of a type, or an expression.  */
 
 static void
-ptype_command (char *typename, int from_tty)
+ptype_command (char *type_name, int from_tty)
 {
-  whatis_exp (typename, 1);
+  whatis_exp (type_name, 1);
 }
 
 /* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
@@ -592,16 +592,16 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
    and whatis_command().  */
 
 void
-maintenance_print_type (char *typename, int from_tty)
+maintenance_print_type (char *type_name, int from_tty)
 {
   struct value *val;
   struct type *type;
   struct cleanup *old_chain;
   struct expression *expr;
 
-  if (typename != NULL)
+  if (type_name != NULL)
     {
-      expr = parse_expression (typename);
+      expr = parse_expression (type_name);
       old_chain = make_cleanup (free_current_contents, &expr);
       if (expr->elts[0].opcode == OP_TYPE)
 	{
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 24155f9..6673574 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -77,7 +77,7 @@ extern void set_ui_file_put (struct ui_file *stream, ui_file_put_ftype *put);
 
 typedef void (ui_file_delete_ftype) (struct ui_file * stream);
 extern void set_ui_file_data (struct ui_file *stream, void *data,
-			      ui_file_delete_ftype *delete);
+			      ui_file_delete_ftype *to_delete);
 
 typedef int (ui_file_fseek_ftype) (struct ui_file *stream, long offset,
 				   int whence);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index f33515c..fb9ec60 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -284,14 +284,14 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
    situations or combinations thereof.  */
 
 static struct value *
-value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
+value_user_defined_cpp_op (struct value **args, int nargs, char *oper,
                            int *static_memfuncp, enum noside noside)
 {
 
   struct symbol *symp = NULL;
   struct value *valp = NULL;
 
-  find_overload_match (args, nargs, operator, BOTH /* could be method */,
+  find_overload_match (args, nargs, oper, BOTH /* could be method */,
                        &args[0] /* objp */,
                        NULL /* pass NULL symbol since symbol is unknown */,
                        &valp, &symp, static_memfuncp, 0, noside);
@@ -308,7 +308,7 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
       return value_of_variable (symp, 0);
     }
 
-  error (_("Could not find %s."), operator);
+  error (_("Could not find %s."), oper);
 }
 
 /* Lookup user defined operator NAME.  Return a value representing the
diff --git a/gdb/value.c b/gdb/value.c
index 9445f25..06da269 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1790,13 +1790,13 @@ record_latest_value (struct value *val)
   i = value_history_count % VALUE_HISTORY_CHUNK;
   if (i == 0)
     {
-      struct value_history_chunk *new
+      struct value_history_chunk *newobj
 	= (struct value_history_chunk *)
 
       xmalloc (sizeof (struct value_history_chunk));
-      memset (new->values, 0, sizeof new->values);
-      new->next = value_history_chain;
-      value_history_chain = new;
+      memset (newobj->values, 0, sizeof newobj->values);
+      newobj->next = value_history_chain;
+      value_history_chain = newobj;
     }
 
   value_history_chain->values[i] = val;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 43ea96f..ce80bc7 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -702,7 +702,7 @@ static void
 install_dynamic_child (struct varobj *var,
 		       VEC (varobj_p) **changed,
 		       VEC (varobj_p) **type_changed,
-		       VEC (varobj_p) **new,
+		       VEC (varobj_p) **newobj,
 		       VEC (varobj_p) **unchanged,
 		       int *cchanged,
 		       int index,
@@ -713,9 +713,9 @@ install_dynamic_child (struct varobj *var,
       /* There's no child yet.  */
       struct varobj *child = varobj_add_child (var, item);
 
-      if (new)
+      if (newobj)
 	{
-	  VEC_safe_push (varobj_p, *new, child);
+	  VEC_safe_push (varobj_p, *newobj, child);
 	  *cchanged = 1;
 	}
     }
@@ -790,7 +790,7 @@ static int
 update_dynamic_varobj_children (struct varobj *var,
 				VEC (varobj_p) **changed,
 				VEC (varobj_p) **type_changed,
-				VEC (varobj_p) **new,
+				VEC (varobj_p) **newobj,
 				VEC (varobj_p) **unchanged,
 				int *cchanged,
 				int update_children,
@@ -851,7 +851,7 @@ update_dynamic_varobj_children (struct varobj *var,
 
 	  install_dynamic_child (var, can_mention ? changed : NULL,
 				 can_mention ? type_changed : NULL,
-				 can_mention ? new : NULL,
+				 can_mention ? newobj : NULL,
 				 can_mention ? unchanged : NULL,
 				 can_mention ? cchanged : NULL, i,
 				 item);
@@ -1622,11 +1622,11 @@ varobj_value_has_mutated (const struct varobj *var, struct value *new_value,
    to point to the new varobj.  */
 
 VEC(varobj_update_result) *
-varobj_update (struct varobj **varp, int explicit)
+varobj_update (struct varobj **varp, int is_explicit)
 {
   int type_changed = 0;
   int i;
-  struct value *new;
+  struct value *newobj;
   VEC (varobj_update_result) *stack = NULL;
   VEC (varobj_update_result) *result = NULL;
 
@@ -1635,7 +1635,7 @@ varobj_update (struct varobj **varp, int explicit)
      changing type.  One use case for frozen varobjs is
      retaining previously evaluated expressions, and we don't
      want them to be reevaluated at all.  */
-  if (!explicit && (*varp)->frozen)
+  if (!is_explicit && (*varp)->frozen)
     return result;
 
   if (!(*varp)->root->is_valid)
@@ -1660,15 +1660,15 @@ varobj_update (struct varobj **varp, int explicit)
 	 the frame in which a local existed.  We are letting the 
 	 value_of_root variable dispose of the varobj if the type
 	 has changed.  */
-      new = value_of_root (varp, &type_changed);
-      if (update_type_if_necessary(*varp, new))
+      newobj = value_of_root (varp, &type_changed);
+      if (update_type_if_necessary(*varp, newobj))
 	  type_changed = 1;
       r.varobj = *varp;
       r.type_changed = type_changed;
-      if (install_new_value ((*varp), new, type_changed))
+      if (install_new_value ((*varp), newobj, type_changed))
 	r.changed = 1;
       
-      if (new == NULL)
+      if (newobj == NULL)
 	r.status = VAROBJ_NOT_IN_SCOPE;
       r.value_installed = 1;
 
@@ -1703,15 +1703,15 @@ varobj_update (struct varobj **varp, int explicit)
 	{
 	  struct type *new_type;
 
-	  new = value_of_child (v->parent, v->index);
-	  if (update_type_if_necessary(v, new))
+	  newobj = value_of_child (v->parent, v->index);
+	  if (update_type_if_necessary(v, newobj))
 	    r.type_changed = 1;
-	  if (new)
-	    new_type = value_type (new);
+	  if (newobj)
+	    new_type = value_type (newobj);
 	  else
 	    new_type = v->root->lang_ops->type_of_child (v->parent, v->index);
 
-	  if (varobj_value_has_mutated (v, new, new_type))
+	  if (varobj_value_has_mutated (v, newobj, new_type))
 	    {
 	      /* The children are no longer valid; delete them now.
 	         Report the fact that its type changed as well.  */
@@ -1723,7 +1723,7 @@ varobj_update (struct varobj **varp, int explicit)
 	      r.type_changed = 1;
 	    }
 
-	  if (install_new_value (v, new, r.type_changed))
+	  if (install_new_value (v, newobj, r.type_changed))
 	    {
 	      r.changed = 1;
 	      v->updated = 0;
@@ -1735,7 +1735,7 @@ varobj_update (struct varobj **varp, int explicit)
       if (varobj_is_dynamic_p (v))
 	{
 	  VEC (varobj_p) *changed = 0, *type_changed = 0, *unchanged = 0;
-	  VEC (varobj_p) *new = 0;
+	  VEC (varobj_p) *newobj = 0;
 	  int i, children_changed = 0;
 
 	  if (v->frozen)
@@ -1767,14 +1767,14 @@ varobj_update (struct varobj **varp, int explicit)
 
 	  /* If update_dynamic_varobj_children returns 0, then we have
 	     a non-conforming pretty-printer, so we skip it.  */
-	  if (update_dynamic_varobj_children (v, &changed, &type_changed, &new,
+	  if (update_dynamic_varobj_children (v, &changed, &type_changed, &newobj,
 					      &unchanged, &children_changed, 1,
 					      v->from, v->to))
 	    {
-	      if (children_changed || new)
+	      if (children_changed || newobj)
 		{
 		  r.children_changed = 1;
-		  r.new = new;
+		  r.newobj = newobj;
 		}
 	      /* Push in reverse order so that the first child is
 		 popped from the work stack first, and so will be
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 6fe7009..8860526 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -75,7 +75,7 @@ typedef struct varobj_update_result_t
      It lists the new children (which must necessarily come at the end
      of the child list) added during an update.  The caller is
      responsible for freeing this vector.  */
-  VEC (varobj_p) *new;
+  VEC (varobj_p) *newobj;
 } varobj_update_result;
 
 DEF_VEC_O (varobj_update_result);
@@ -303,7 +303,7 @@ extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
 			      void *data);
 
 extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, 
-						 int explicit);
+						 int is_explicit);
 
 extern void varobj_invalidate (void);
 
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 6015711..e83bd13 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1028,7 +1028,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
   /* fcn_cs_saved is global because process_xcoff_symbol needs it.  */
   union internal_auxent fcn_aux_saved = main_aux;
-  struct context_stack *new;
+  struct context_stack *newobj;
 
   char *filestring = " _start_ ";	/* Name of the current file.  */
 
@@ -1355,13 +1355,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
 	      within_function = 1;
 
-	      new = push_context (0, fcn_start_addr + off);
+	      newobj = push_context (0, fcn_start_addr + off);
 
-	      new->name = define_symbol
+	      newobj->name = define_symbol
 		(fcn_cs_saved.c_value + off,
 		 fcn_stab_saved.c_name, 0, 0, objfile);
-	      if (new->name != NULL)
-		SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
+	      if (newobj->name != NULL)
+		SYMBOL_SECTION (newobj->name) = SECT_OFF_TEXT (objfile);
 	    }
 	  else if (strcmp (cs->c_name, ".ef") == 0)
 	    {
@@ -1379,17 +1379,17 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 		  within_function = 0;
 		  break;
 		}
-	      new = pop_context ();
+	      newobj = pop_context ();
 	      /* Stack must be empty now.  */
-	      if (context_stack_depth > 0 || new == NULL)
+	      if (context_stack_depth > 0 || newobj == NULL)
 		{
 		  ef_complaint (cs->c_symnum);
 		  within_function = 0;
 		  break;
 		}
 
-	      finish_block (new->name, &local_symbols, new->old_blocks,
-			    new->start_addr,
+	      finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+			    newobj->start_addr,
 			    (fcn_cs_saved.c_value
 			     + fcn_aux_saved.x_sym.x_misc.x_fsize
 			     + ANOFFSET (objfile->section_offsets,
@@ -1459,7 +1459,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	  if (strcmp (cs->c_name, ".bb") == 0)
 	    {
 	      depth++;
-	      new = push_context (depth,
+	      newobj = push_context (depth,
 				  (cs->c_value
 				   + ANOFFSET (objfile->section_offsets,
 					       SECT_OFF_TEXT (objfile))));
@@ -1471,8 +1471,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 		  eb_complaint (cs->c_symnum);
 		  break;
 		}
-	      new = pop_context ();
-	      if (depth-- != new->depth)
+	      newobj = pop_context ();
+	      if (depth-- != newobj->depth)
 		{
 		  eb_complaint (cs->c_symnum);
 		  break;
@@ -1480,13 +1480,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	      if (local_symbols && context_stack_depth > 0)
 		{
 		  /* Make a block for the local symbols within.  */
-		  finish_block (new->name, &local_symbols, new->old_blocks,
-				new->start_addr,
+		  finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+				newobj->start_addr,
 				(cs->c_value
 				 + ANOFFSET (objfile->section_offsets,
 					     SECT_OFF_TEXT (objfile))));
 		}
-	      local_symbols = new->locals;
+	      local_symbols = newobj->locals;
 	    }
 	  break;
 
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
                   ` (39 preceding siblings ...)
  2015-02-17 23:19 ` Patrick Palka
@ 2015-02-27 18:19 ` Pedro Alves
  2015-02-27 23:52   ` Patrick Palka
  2015-03-07 16:01   ` Pedro Alves
  40 siblings, 2 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-27 18:19 UTC (permalink / raw)
  To: gdb-patches

A quick status update on this series.  All patches but one
up to the TRY_CATCH part are now pushed.  That is,

    > [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it
    > [PATCH 02/36] Add --enable-build-with-cxx configure switch
    > [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
    > [PATCH 04/36] Fix struct, union, and enum nesting in C++
    > [PATCH 05/36] Fix redefinition errors in C++ mode
    > [PATCH 06/36] record-btrace.c: Remove redefinitions
    > [PATCH 07/36] Make array object extern
    > [PATCH 08/36] elf-bfd.h: Wrap in extern "C".
    > [PATCH 09/36] floatformat.h: Wrap in extern "C".
    > [PATCH 10/36] Add extern "C" to declarations of C symbols
    > [PATCH 11/36] Make functions and variables exported by the IPA be extern "C"
    > [PATCH 12/36] proc-service, extern "C"
    > [PATCH 13/36] target.h: Include infrun.h
    > [PATCH 14/36] Do not do arithmetic on enum types
    > [PATCH 15/36] Don't forward declare enum target_hw_bp_type
    > [PATCH 16/36] x86 Linux/ptrace: fix offsetof usage in C++ mode
    > [PATCH 17/36] mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args
    > [PATCH 18/36] Rename struct lzma_stream to avoid clash with system header
    > [PATCH 19/36] Exported const objects
    > [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
    > [PATCH 22/36] Remove duplicate const
    > [PATCH 23/36] gdbarch.h: include regcache.h
    > [PATCH 24/36] breakpoint.h: move enum âprint_stop_actionâ
    > [PATCH 25/36] python/python-internal.h: enum âext_lang_rcâ not defined
    > [PATCH 26/36] Adjust self tests to cope with GDB built as a C++ program
    > [PATCH 27/36] catch_command_errors: Remove 'mask' parameter
    > [PATCH 28/36] Move exception_none to common code, and use it

All the above are now pushed.

I didn't push this one, as it introduces an aliasing violation:

    > [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast

These are still pending:

    > [PATCH 29/36] Normalize TRY_CATCH exception handling block
    > [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros
    > [PATCH 31/36] Split TRY_CATCH into TRY + CATCH
    > [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere
    > [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions
    > [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks
    > [PATCH 35/36] kill volatile struct gdb_exception
    > [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode

I don't have time right now to rebase this part, but I'd like
to move ahead with it sometime soon.  If anyone has comments on
this, now's the time to send them out.

> Known problems:
> 
> . Other hosts/native targets will naturally stumble on more
>   host-specific code that needs converting, which I can't easily test.
>   Help very much welcome!

This is still true.  :-)

> 
> . '--enable-targets=all' doesn't link yet in C++ mode.  This just more
>   extern "C" problems.

This is fixed, or will be, once the TRY_CATCH patches land,
at least on x86_64 GNU/Linux.  It was handled with
a couple bfd and opcodes patches.

>   
> I wrote a second series a few months ago that built on an older
> version of this one and fixes all the '-fpermissive' errors/warnings,
> until GDB and GDBserver build cleanly with -Werror, on x86_64 Fedora.
> It's naturally rotten in a few places by now, and in need of some
> further cleaning up but it shouldn't be that far off.  You can find it
> here:
> 
>   https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt-part-2-no-fpermissive
>   git@github.com:palves/gdb.git palves/cxx-conversion-attempt-part-2-no-fpermissive

A couple weeks ago I rebased this second part and cleaned it up
substantially.  It's not fully ready, and now needs
another rebase though...

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/36] Make array object extern
  2015-02-09 23:51 ` [PATCH 07/36] Make array object extern Pedro Alves
@ 2015-02-27 22:47   ` Simon Marchi
  2015-02-27 22:58     ` Pedro Alves
  0 siblings, 1 reply; 100+ messages in thread
From: Simon Marchi @ 2015-02-27 22:47 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 02/09/2015 06:20 PM, Pedro Alves wrote:
> Compiling python.c in C++ mode, we get:
> 
>   ...src/gdb/python/python.c: At global scope:
>   ...src/gdb/python/python.c:106:31: error: storage size of ‘GdbMethods’ isn’t known
>    static PyMethodDef GdbMethods[];
> 				 ^
> 
> Fix it by making the affected array objects extern.
> 
> gdb/ChangeLog:
> 2015-02-09  Pedro Alves  <palves@redhat.com>
> 
> 	* python/python.c (GdbMethods): Rename to ...
> 	(python_GdbMethods): ... this and make extern.
> 	(GdbModuleDef): Rename to ...
> 	(python_GdbModuleDef): ... this and make extern.
> ---
>  gdb/python/python.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/gdb/python/python.c b/gdb/python/python.c
> index 9854c79..a13638f 100644
> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -103,10 +103,10 @@ const struct extension_language_defn extension_language_python =
>  
>  int gdb_python_initialized;
>  
> -static PyMethodDef GdbMethods[];
> +extern PyMethodDef python_GdbMethods[];
>  
>  #ifdef IS_PY3K
> -static struct PyModuleDef GdbModuleDef;
> +extern struct PyModuleDef python_GdbModuleDef;
>  #endif
>  
>  PyObject *gdb_module;
> @@ -1712,11 +1712,11 @@ message == an error message without a stack will be printed."),
>    PyEval_InitThreads ();
>  
>  #ifdef IS_PY3K
> -  gdb_module = PyModule_Create (&GdbModuleDef);
> +  gdb_module = PyModule_Create (&python_GdbModuleDef);
>    /* Add _gdb module to the list of known built-in modules.  */
>    _PyImport_FixupBuiltin (gdb_module, "_gdb");
>  #else
> -  gdb_module = Py_InitModule ("_gdb", GdbMethods);
> +  gdb_module = Py_InitModule ("_gdb", python_GdbMethods);
>  #endif
>    if (gdb_module == NULL)
>      goto fail;
> @@ -1932,7 +1932,7 @@ gdbpy_initialized (const struct extension_language_defn *extlang)
>  
>  #ifdef HAVE_PYTHON
>  
> -static PyMethodDef GdbMethods[] =
> +PyMethodDef python_GdbMethods[] =
>  {
>    { "history", gdbpy_history, METH_VARARGS,
>      "Get a value from history" },
> @@ -2044,7 +2044,7 @@ Return a tuple containing all inferiors." },
>  };
>  
>  #ifdef IS_PY3K
> -static struct PyModuleDef GdbModuleDef =
> +struct PyModuleDef python_GdbModuleDef =
>  {
>    PyModuleDef_HEAD_INIT,
>    "_gdb",

Hi Pedro,

I think you forgot one instance of GdbMethods, used when building with
Python 3. This should fix it:

From 33c839c7bb4bb201fa20f22e0935831b7e1de27f Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Fri, 27 Feb 2015 17:40:36 -0500
Subject: [PATCH] Fix Python 3 build

Rename forgotten GdbMethods to python_GdbMethods.

gdb/ChangeLog:

	* python/python.c (python_GdbModuleDef): Rename GdbMethods to
	python_GdbMethods.
---
 gdb/python/python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index a13638f..c3ffbae 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2050,7 +2050,7 @@ struct PyModuleDef python_GdbModuleDef =
   "_gdb",
   NULL,
   -1,
-  GdbMethods,
+  python_GdbMethods,
   NULL,
   NULL,
   NULL,
-- 
2.1.4



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/36] Make array object extern
  2015-02-27 22:47   ` Simon Marchi
@ 2015-02-27 22:58     ` Pedro Alves
  2015-02-27 23:04       ` Simon Marchi
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-02-27 22:58 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 02/27/2015 10:47 PM, Simon Marchi wrote:
> On 02/09/2015 06:20 PM, Pedro Alves wrote:

> I think you forgot one instance of GdbMethods, used when building with
> Python 3. This should fix it:
> 
> From 33c839c7bb4bb201fa20f22e0935831b7e1de27f Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon.marchi@ericsson.com>
> Date: Fri, 27 Feb 2015 17:40:36 -0500
> Subject: [PATCH] Fix Python 3 build
> 
> Rename forgotten GdbMethods to python_GdbMethods.

Whoops, sorry about that.  Please push.

Thank you.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/36] Make array object extern
  2015-02-27 22:58     ` Pedro Alves
@ 2015-02-27 23:04       ` Simon Marchi
  0 siblings, 0 replies; 100+ messages in thread
From: Simon Marchi @ 2015-02-27 23:04 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 02/27/2015 05:58 PM, Pedro Alves wrote:
> On 02/27/2015 10:47 PM, Simon Marchi wrote:
>> On 02/09/2015 06:20 PM, Pedro Alves wrote:
> 
>> I think you forgot one instance of GdbMethods, used when building with
>> Python 3. This should fix it:
>>
>> From 33c839c7bb4bb201fa20f22e0935831b7e1de27f Mon Sep 17 00:00:00 2001
>> From: Simon Marchi <simon.marchi@ericsson.com>
>> Date: Fri, 27 Feb 2015 17:40:36 -0500
>> Subject: [PATCH] Fix Python 3 build
>>
>> Rename forgotten GdbMethods to python_GdbMethods.
> 
> Whoops, sorry about that.  Please push.
> 
> Thank you.

Done!

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-27 18:19 ` Pedro Alves
@ 2015-02-27 23:52   ` Patrick Palka
  2015-02-28  0:09     ` Pedro Alves
  2015-03-07 16:01   ` Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: Patrick Palka @ 2015-02-27 23:52 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Fri, Feb 27, 2015 at 1:19 PM, Pedro Alves <palves@redhat.com> wrote:
> A quick status update on this series.  All patches but one
> up to the TRY_CATCH part are now pushed.  That is,
>
>     > [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it
>     > [PATCH 02/36] Add --enable-build-with-cxx configure switch
>     > [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated
>     > [PATCH 04/36] Fix struct, union, and enum nesting in C++
>     > [PATCH 05/36] Fix redefinition errors in C++ mode
>     > [PATCH 06/36] record-btrace.c: Remove redefinitions
>     > [PATCH 07/36] Make array object extern
>     > [PATCH 08/36] elf-bfd.h: Wrap in extern "C".
>     > [PATCH 09/36] floatformat.h: Wrap in extern "C".
>     > [PATCH 10/36] Add extern "C" to declarations of C symbols
>     > [PATCH 11/36] Make functions and variables exported by the IPA be extern "C"
>     > [PATCH 12/36] proc-service, extern "C"
>     > [PATCH 13/36] target.h: Include infrun.h
>     > [PATCH 14/36] Do not do arithmetic on enum types
>     > [PATCH 15/36] Don't forward declare enum target_hw_bp_type
>     > [PATCH 16/36] x86 Linux/ptrace: fix offsetof usage in C++ mode
>     > [PATCH 17/36] mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args
>     > [PATCH 18/36] Rename struct lzma_stream to avoid clash with system header
>     > [PATCH 19/36] Exported const objects
>     > [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
>     > [PATCH 22/36] Remove duplicate const
>     > [PATCH 23/36] gdbarch.h: include regcache.h
>     > [PATCH 24/36] breakpoint.h: move enum âprint_stop_actionâ
>     > [PATCH 25/36] python/python-internal.h: enum âext_lang_rcâ not defined
>     > [PATCH 26/36] Adjust self tests to cope with GDB built as a C++ program
>     > [PATCH 27/36] catch_command_errors: Remove 'mask' parameter
>     > [PATCH 28/36] Move exception_none to common code, and use it
>
> All the above are now pushed.
>
> I didn't push this one, as it introduces an aliasing violation:
>
>     > [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast
>
> These are still pending:
>
>     > [PATCH 29/36] Normalize TRY_CATCH exception handling block
>     > [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros
>     > [PATCH 31/36] Split TRY_CATCH into TRY + CATCH
>     > [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere
>     > [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions
>     > [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks
>     > [PATCH 35/36] kill volatile struct gdb_exception
>     > [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode
>
> I don't have time right now to rebase this part, but I'd like
> to move ahead with it sometime soon.  If anyone has comments on
> this, now's the time to send them out.
>
>> Known problems:
>>
>> . Other hosts/native targets will naturally stumble on more
>>   host-specific code that needs converting, which I can't easily test.
>>   Help very much welcome!
>
> This is still true.  :-)
>
>>
>> . '--enable-targets=all' doesn't link yet in C++ mode.  This just more
>>   extern "C" problems.
>
> This is fixed, or will be, once the TRY_CATCH patches land,
> at least on x86_64 GNU/Linux.  It was handled with
> a couple bfd and opcodes patches.
>
>>
>> I wrote a second series a few months ago that built on an older
>> version of this one and fixes all the '-fpermissive' errors/warnings,
>> until GDB and GDBserver build cleanly with -Werror, on x86_64 Fedora.
>> It's naturally rotten in a few places by now, and in need of some
>> further cleaning up but it shouldn't be that far off.  You can find it
>> here:
>>
>>   https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt-part-2-no-fpermissive
>>   git@github.com:palves/gdb.git palves/cxx-conversion-attempt-part-2-no-fpermissive
>
> A couple weeks ago I rebased this second part and cleaned it up
> substantially.  It's not fully ready, and now needs
> another rebase though...
>
> Thanks,
> Pedro Alves

Is GDB supposed to build yet with --enable-build-with-cxx? I am
currently getting a slew of errors and warnings when building GDB with
G++ 4.9.1.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-27 23:52   ` Patrick Palka
@ 2015-02-28  0:09     ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-02-28  0:09 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gdb-patches

On 02/27/2015 11:51 PM, Patrick Palka wrote:
> On Fri, Feb 27, 2015 at 1:19 PM, Pedro Alves <palves@redhat.com> wrote:

>> I didn't push this one, as it introduces an aliasing violation:
>>
>>     > [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast

>> These are still pending:
>>
>>     > [PATCH 29/36] Normalize TRY_CATCH exception handling block
>>     > [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros
>>     > [PATCH 31/36] Split TRY_CATCH into TRY + CATCH
>>     > [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere
>>     > [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions
>>     > [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks
>>     > [PATCH 35/36] kill volatile struct gdb_exception
>>     > [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode
>>
>> I don't have time right now to rebase this part, but I'd like
>> to move ahead with it sometime soon.  If anyone has comments on
>> this, now's the time to send them out.

> Is GDB supposed to build yet with --enable-build-with-cxx? I am
> currently getting a slew of errors and warnings when building GDB with
> G++ 4.9.1.

No, not until all the pending patches above are pushed.  Patch 20 needs
to be rewritten using the union trick instead of the invalid cast (strict
aliasing violation) -- help with that much appreciated!  :-)  Googling for
strict aliasing and sockaddr should find a ton of examples.

Even when this series is fully pushed, you'll still get a slew of
warnings due to invalid C++ code that G++ is allowing anyway due
to the -fpermissive shortcut.  Things like 'char *str = xmalloc (size);'
need a cast in C++, but -fpermissive downgrades that error to a warning.
As there's no way to suppress those warnings, for now C++ mode doesn't
enable -Werror.  The follow up part 2 series that I mentioned fixes
all those warnings.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/36] Split TRY_CATCH into TRY + CATCH
  2015-02-09 23:21 ` [PATCH 31/36] Split TRY_CATCH into TRY + CATCH Pedro Alves
@ 2015-03-07 15:58   ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-03-07 15:58 UTC (permalink / raw)
  To: gdb-patches

On 02/09/2015 11:20 PM, Pedro Alves wrote:

> (This patch just converts the framework, but doesn't adjust any caller
> yet.  Subsequent patches will do that.  My idea is to squash this and
> the related patches into a single commit to avoid breaking bisects and
> the auto testers.)

I squashed the following patch in the series (the manual conversions)
and pushed this in, as below.

-----
From 492d29ea1c9a8b2c7d5193908119a4e27c045687 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Sat, 7 Mar 2015 15:14:14 +0000
Subject: [PATCH 3/6] Split TRY_CATCH into TRY + CATCH

This patch splits the TRY_CATCH macro into three, so that we go from
this:

~~~
  volatile gdb_exception ex;

  TRY_CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  if (ex.reason < 0)
    {
    }
~~~

to this:

~~~
  TRY
    {
    }
  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH
~~~

Thus, we'll be getting rid of the local volatile exception object, and
declaring the caught exception in the catch block.

This allows reimplementing TRY/CATCH in terms of C++ exceptions when
building in C++ mode, while still allowing to build GDB in C mode
(using setjmp/longjmp), as a transition step.

TBC, after this patch, is it _not_ valid to have code between the TRY
and the CATCH blocks, like:

  TRY
    {
    }

  // some code here.

  CATCH (ex, RETURN_MASK_ERROR)
    {
    }
  END_CATCH

Just like it isn't valid to do that with C++'s native try/catch.

By switching to creating the exception object inside the CATCH block
scope, we can get rid of all the explicitly allocated volatile
exception objects all over the tree, and map the CATCH block more
directly to C++'s catch blocks.

The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was
done with a script, rerun from scratch at every rebase, no manual
editing involved.  After the mechanical conversion, a few places
needed manual intervention, to fix preexisting cases where we were
using the exception object outside of the TRY_CATCH block, and cases
where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH
after this patch].  The result was folded into this patch so that GDB
still builds at each incremental step.

END_CATCH is necessary for two reasons:

First, because we name the exception object in the CATCH block, which
requires creating a scope, which in turn must be closed somewhere.
Declaring the exception variable in the initializer field of a for
block, like:

  #define CATCH(EXCEPTION, mask) \
    for (struct gdb_exception EXCEPTION; \
         exceptions_state_mc_catch (&EXCEPTION, MASK); \
	 EXCEPTION = exception_none)

would avoid needing END_CATCH, but alas, in C mode, we build with C90,
which doesn't allow mixed declarations and code.

Second, because when TRY/CATCH are wired to real C++ try/catch, as
long as we need to handle cleanup chains, even if there's no CATCH
block that wants to catch the exception, we need for stop at every
frame in the unwind chain and run cleanups, then rethrow.  That will
be done in END_CATCH.

After we require C++, we'll still need TRY/CATCH/END_CATCH until
cleanups are completely phased out -- TRY/CATCH in C++ mode will
save/restore the current cleanup chain, like in C mode, and END_CATCH
catches otherwise uncaugh exceptions, runs cleanups and rethrows, so
that C++ cleanups and exceptions can coexist.

IMO, this still makes the TRY/CATCH code look a bit more like a
newcomer would expect, so IMO worth it even if we weren't considering
C++.

gdb/ChangeLog.
2015-03-07  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.c (struct catcher) <exception>: No
	longer a pointer to volatile exception.  Now an exception value.
	<mask>: Delete field.
	(exceptions_state_mc_init): Remove all parameters.  Adjust.
	(exceptions_state_mc): No longer pop the catcher here.
	(exceptions_state_mc_catch): New function.
	(throw_exception): Adjust.
	* common/common-exceptions.h (exceptions_state_mc_init): Remove
	all parameters.
	(exceptions_state_mc_catch): Declare.
	(TRY_CATCH): Rename to ...
	(TRY): ... this.  Remove EXCEPTION and MASK parameters.
	(CATCH, END_CATCH): New.
	All callers adjusted.

gdb/gdbserver/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

	Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
	instead.
---
 gdb/ChangeLog                    |  17 +++
 gdb/gdbserver/ChangeLog          |   5 +
 gdb/ada-lang.c                   |  42 ++++---
 gdb/ada-typeprint.c              |  11 +-
 gdb/ada-valprint.c               |   7 +-
 gdb/amd64-tdep.c                 |  18 +--
 gdb/break-catch-throw.c          |  22 ++--
 gdb/breakpoint.c                 | 116 ++++++++++---------
 gdb/btrace.c                     |  18 ++-
 gdb/c-varobj.c                   |  38 +++---
 gdb/cli/cli-interp.c             |   6 +-
 gdb/cli/cli-script.c             |  12 +-
 gdb/common/common-exceptions.c   |  64 +++++-----
 gdb/common/common-exceptions.h   |  32 +++--
 gdb/compile/compile-c-symbols.c  |  26 +++--
 gdb/compile/compile-object-run.c |   6 +-
 gdb/completer.c                  |  11 +-
 gdb/corelow.c                    |  19 +--
 gdb/cp-abi.c                     |  17 +--
 gdb/cp-support.c                 |  34 ++++--
 gdb/cp-valprint.c                |  21 ++--
 gdb/dwarf2-frame-tailcall.c      |   6 +-
 gdb/dwarf2-frame.c               |  17 +--
 gdb/dwarf2loc.c                  |  13 ++-
 gdb/dwarf2read.c                 |  24 ++--
 gdb/eval.c                       |  33 +++---
 gdb/event-loop.c                 |   7 +-
 gdb/event-top.c                  |  12 +-
 gdb/exceptions.c                 |  15 ++-
 gdb/f-valprint.c                 |  11 +-
 gdb/frame-unwind.c               |   6 +-
 gdb/frame.c                      |  29 ++---
 gdb/gcore.c                      |  13 ++-
 gdb/gdbserver/server.c           |  38 +++---
 gdb/gdbtypes.c                   |  20 ++--
 gdb/gnu-v3-abi.c                 |  15 ++-
 gdb/guile/guile.c                |  10 +-
 gdb/guile/scm-block.c            |   9 +-
 gdb/guile/scm-breakpoint.c       |  79 +++++++++----
 gdb/guile/scm-cmd.c              |   9 +-
 gdb/guile/scm-disasm.c           |   9 +-
 gdb/guile/scm-frame.c            | 170 ++++++++++++++++++---------
 gdb/guile/scm-lazy-string.c      |  15 ++-
 gdb/guile/scm-math.c             |  38 ++++--
 gdb/guile/scm-param.c            |  19 ++-
 gdb/guile/scm-ports.c            |   9 +-
 gdb/guile/scm-pretty-print.c     |   7 +-
 gdb/guile/scm-symbol.c           |  46 ++++++--
 gdb/guile/scm-symtab.c           |   9 +-
 gdb/guile/scm-type.c             | 105 +++++++++++------
 gdb/guile/scm-value.c            | 244 ++++++++++++++++++++++++++-------------
 gdb/i386-tdep.c                  |  18 +--
 gdb/inf-loop.c                   |  15 ++-
 gdb/infcall.c                    |  13 ++-
 gdb/infcmd.c                     |  16 +--
 gdb/infrun.c                     |  23 ++--
 gdb/jit.c                        |  16 ++-
 gdb/linespec.c                   |  12 +-
 gdb/linux-nat.c                  |   6 +-
 gdb/linux-tdep.c                 |  11 +-
 gdb/linux-thread-db.c            |  19 +--
 gdb/main.c                       |  24 ++--
 gdb/mi/mi-cmd-stack.c            |  17 +--
 gdb/mi/mi-interp.c               |  24 +++-
 gdb/mi/mi-main.c                 |  15 +--
 gdb/p-valprint.c                 |   6 +-
 gdb/parse.c                      |  12 +-
 gdb/ppc-linux-tdep.c             |  10 +-
 gdb/printcmd.c                   |  40 ++++---
 gdb/python/py-arch.c             |   6 +-
 gdb/python/py-block.c            |   9 +-
 gdb/python/py-breakpoint.c       |  57 +++++----
 gdb/python/py-cmd.c              |   7 +-
 gdb/python/py-finishbreakpoint.c |  40 ++++---
 gdb/python/py-frame.c            | 162 ++++++++++++++++----------
 gdb/python/py-framefilter.c      | 134 +++++++++++----------
 gdb/python/py-gdb-readline.c     |  19 +--
 gdb/python/py-inferior.c         |  39 +++++--
 gdb/python/py-infthread.c        |   9 +-
 gdb/python/py-lazy-string.c      |   9 +-
 gdb/python/py-linetable.c        |   9 +-
 gdb/python/py-objfile.c          |  18 ++-
 gdb/python/py-param.c            |   7 +-
 gdb/python/py-prettyprint.c      |  16 ++-
 gdb/python/py-symbol.c           |  45 +++++---
 gdb/python/py-type.c             | 152 ++++++++++++++++--------
 gdb/python/py-utils.c            |   9 +-
 gdb/python/py-value.c            | 228 ++++++++++++++++++++++++------------
 gdb/python/python.c              |  69 ++++++++---
 gdb/record-btrace.c              |  80 +++++++------
 gdb/remote.c                     |  40 ++++---
 gdb/rs6000-aix-tdep.c            |   7 +-
 gdb/rs6000-tdep.c                |   6 +-
 gdb/s390-linux-tdep.c            |   6 +-
 gdb/solib-dsbt.c                 |   8 +-
 gdb/solib-frv.c                  |   8 +-
 gdb/solib-ia64-hpux.c            |  20 ++--
 gdb/solib-spu.c                  |   6 +-
 gdb/solib-svr4.c                 |  19 ++-
 gdb/solib.c                      |  58 ++++++----
 gdb/stack.c                      | 135 +++++++++++++---------
 gdb/symtab.c                     |   6 +-
 gdb/target.c                     |   6 +-
 gdb/top.c                        |  37 +++---
 gdb/tracefile-tfile.c            |   6 +-
 gdb/tui/tui.c                    |   6 +-
 gdb/typeprint.c                  |  10 +-
 gdb/valops.c                     |  13 ++-
 gdb/valprint.c                   |  10 +-
 gdb/value.c                      |  11 +-
 gdb/varobj.c                     |  55 +++++----
 gdb/xml-support.c                |  12 +-
 112 files changed, 2190 insertions(+), 1295 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 641a94c..6df72f7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,20 @@
+2015-03-07  Pedro Alves  <palves@redhat.com>
+
+	* common/common-exceptions.c (struct catcher) <exception>: No
+	longer a pointer to volatile exception.  Now an exception value.
+	<mask>: Delete field.
+	(exceptions_state_mc_init): Remove all parameters.  Adjust.
+	(exceptions_state_mc): No longer pop the catcher here.
+	(exceptions_state_mc_catch): New function.
+	(throw_exception): Adjust.
+	* common/common-exceptions.h (exceptions_state_mc_init): Remove
+	all parameters.
+	(exceptions_state_mc_catch): Declare.
+	(TRY_CATCH): Rename to ...
+	(TRY): ... this.  Remove EXCEPTION and MASK parameters.
+	(CATCH, END_CATCH): New.
+	All callers adjusted.
+
 2015-03-07  Tom Tromey  <tromey@redhat.com>
 
 	* top.c (quit_force): Inline and delete DO_TRY, DO_PRINT_EX.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index e735c8e..70cc374 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-07  Pedro Alves  <palves@redhat.com>
+
+	Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH
+	instead.
+
 2015-03-06  Yao Qi  <yao.qi@linaro.org>
 
 	* linux-aarch64-low.c (aarch64_insert_point): Use
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1e70d12..124e370 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6479,7 +6479,6 @@ type_from_tag (struct value *tag)
 struct value *
 ada_tag_value_at_base_address (struct value *obj)
 {
-  volatile struct gdb_exception e;
   struct value *val;
   LONGEST offset_to_top = 0;
   struct type *ptr_type, *obj_type;
@@ -6514,13 +6513,16 @@ ada_tag_value_at_base_address (struct value *obj)
      see ada_tag_name for more details.  We do not print the error
      message for the same reason.  */
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       offset_to_top = value_as_long (value_ind (value_ptradd (val, -2)));
     }
 
-  if (e.reason < 0)
-    return obj;
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      return obj;
+    }
+  END_CATCH
 
   /* If offset is null, nothing to do.  */
 
@@ -6632,7 +6634,6 @@ ada_tag_name_from_tsd (struct value *tsd)
 const char *
 ada_tag_name (struct value *tag)
 {
-  volatile struct gdb_exception e;
   char *name = NULL;
 
   if (!ada_is_tag_type (value_type (tag)))
@@ -6647,13 +6648,17 @@ ada_tag_name (struct value *tag)
      We also do not print the error message either (which often is very
      low-level (Eg: "Cannot read memory at 0x[...]"), but instead let
      the caller print a more meaningful message if necessary.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct value *tsd = ada_get_tsd_from_tag (tag);
 
       if (tsd != NULL)
 	name = ada_tag_name_from_tsd (tsd);
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   return name;
 }
@@ -11817,19 +11822,19 @@ static CORE_ADDR
 ada_exception_name_addr (enum ada_exception_catchpoint_kind ex,
                          struct breakpoint *b)
 {
-  volatile struct gdb_exception e;
   CORE_ADDR result = 0;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       result = ada_exception_name_addr_1 (ex, b);
     }
 
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       warning (_("failed to get exception name: %s"), e.message);
       return 0;
     }
+  END_CATCH
 
   return result;
 }
@@ -11929,16 +11934,15 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
 
       if (!bl->shlib_disabled)
 	{
-	  volatile struct gdb_exception e;
 	  const char *s;
 
 	  s = cond_string;
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      exp = parse_exp_1 (&s, bl->address,
 				 block_for_pc (bl->address), 0);
 	    }
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ERROR)
 	    {
 	      warning (_("failed to reevaluate internal exception condition "
 			 "for catchpoint %d: %s"),
@@ -11951,6 +11955,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
 		 to NULL.  */
 	      exp = NULL;
 	    }
+	  END_CATCH
 	}
 
       ada_loc->excep_cond_expr = exp;
@@ -12014,7 +12019,6 @@ should_stop_exception (const struct bp_location *bl)
   struct ada_catchpoint *c = (struct ada_catchpoint *) bl->owner;
   const struct ada_catchpoint_location *ada_loc
     = (const struct ada_catchpoint_location *) bl;
-  volatile struct gdb_exception ex;
   int stop;
 
   /* With no specific exception, should always stop.  */
@@ -12029,7 +12033,7 @@ should_stop_exception (const struct bp_location *bl)
     }
 
   stop = 1;
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       struct value *mark;
 
@@ -12037,9 +12041,13 @@ should_stop_exception (const struct bp_location *bl)
       stop = value_true (evaluate_expression (ada_loc->excep_cond_expr));
       value_free_to_mark (mark);
     }
-  if (ex.reason < 0)
-    exception_fprintf (gdb_stderr, ex,
-		       _("Error in testing exception condition:\n"));
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_fprintf (gdb_stderr, ex,
+			 _("Error in testing exception condition:\n"));
+    }
+  END_CATCH
+
   return stop;
 }
 
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 6dba71b..fd85138 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -159,19 +159,19 @@ print_range (struct type *type, struct ui_file *stream,
     case TYPE_CODE_ENUM:
       {
 	struct type *target_type;
-	volatile struct gdb_exception e;
 	LONGEST lo = 0, hi = 0; /* init for gcc -Wall */
+	int got_error = 0;
 
 	target_type = TYPE_TARGET_TYPE (type);
 	if (target_type == NULL)
 	  target_type = type;
 
-	TRY_CATCH (e, RETURN_MASK_ERROR)
+	TRY
 	  {
 	    lo = ada_discrete_type_low_bound (type);
 	    hi = ada_discrete_type_high_bound (type);
 	  }
-	if (e.reason < 0)
+	CATCH (e, RETURN_MASK_ERROR)
 	  {
 	    /* This can happen when the range is dynamic.  Sometimes,
 	       resolving dynamic property values requires us to have
@@ -179,8 +179,11 @@ print_range (struct type *type, struct ui_file *stream,
 	       when the user is using the "ptype" command on a type.
 	       Print the range as an unbounded range.  */
 	    fprintf_filtered (stream, "<>");
+	    got_error = 1;
 	  }
-	else
+	END_CATCH
+
+	if (!got_error)
 	  {
 	    ada_print_scalar (target_type, lo, stream);
 	    fprintf_filtered (stream, " .. ");
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index d5cd04f..34539de 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -1159,15 +1159,18 @@ ada_val_print (struct type *type, const gdb_byte *valaddr,
 	       const struct value *val,
 	       const struct value_print_options *options)
 {
-  volatile struct gdb_exception except;
 
   /* XXX: this catches QUIT/ctrl-c as well.  Isn't that busted?  */
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       ada_val_print_1 (type, valaddr, embedded_offset, address,
 		       stream, recurse, val, options,
 		       current_language);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 }
 
 void
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index ca82858..3e5d1bd 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2466,7 +2466,6 @@ amd64_frame_cache_1 (struct frame_info *this_frame,
 static struct amd64_frame_cache *
 amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct amd64_frame_cache *cache;
 
   if (*this_cache)
@@ -2475,15 +2474,16 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = amd64_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       amd64_frame_cache_1 (this_frame, cache);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
@@ -2582,7 +2582,6 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  volatile struct gdb_exception ex;
   struct amd64_frame_cache *cache;
   CORE_ADDR addr;
   gdb_byte buf[8];
@@ -2593,7 +2592,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
   cache = amd64_alloc_frame_cache ();
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
       cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8;
@@ -2607,11 +2606,12 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   *this_cache = cache;
   return cache;
@@ -2758,7 +2758,6 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  volatile struct gdb_exception ex;
   struct amd64_frame_cache *cache;
   gdb_byte buf[8];
 
@@ -2768,7 +2767,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = amd64_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* Cache base will be %esp plus cache->sp_offset (-8).  */
       get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
@@ -2786,11 +2785,12 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 726825a..f5616c8 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -163,7 +163,6 @@ check_status_exception_catchpoint (struct bpstats *bs)
   struct exception_catchpoint *self
     = (struct exception_catchpoint *) bs->breakpoint_at;
   char *type_name = NULL;
-  volatile struct gdb_exception e;
 
   bkpt_breakpoint_ops.check_status (bs);
   if (bs->stop == 0)
@@ -172,7 +171,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
   if (self->pattern == NULL)
     return;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct value *typeinfo_arg;
       char *canon;
@@ -187,8 +186,11 @@ check_status_exception_catchpoint (struct bpstats *bs)
 	  type_name = canon;
 	}
     }
-  if (e.reason < 0)
-    exception_print (gdb_stderr, e);
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, e);
+    }
+  END_CATCH
 
   if (type_name != NULL)
     {
@@ -206,38 +208,38 @@ re_set_exception_catchpoint (struct breakpoint *self)
 {
   struct symtabs_and_lines sals = {0};
   struct symtabs_and_lines sals_end = {0};
-  volatile struct gdb_exception e;
   struct cleanup *cleanup;
   enum exception_event_kind kind = classify_exception_breakpoint (self);
 
   /* We first try to use the probe interface.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       char *spec = ASTRDUP (exception_functions[kind].probe);
 
       sals = parse_probes (&spec, NULL);
     }
 
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
-      volatile struct gdb_exception ex;
 
       /* Using the probe interface failed.  Let's fallback to the normal
 	 catchpoint mode.  */
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  char *spec = ASTRDUP (exception_functions[kind].function);
 
 	  self->ops->decode_linespec (self, &spec, &sals);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  /* NOT_FOUND_ERROR just means the breakpoint will be
 	     pending, so let it through.  */
 	  if (ex.error != NOT_FOUND_ERROR)
 	    throw_exception (ex);
 	}
+      END_CATCH
     }
+  END_CATCH
 
   cleanup = make_cleanup (xfree, sals.sals);
   update_breakpoint_locations (self, sals, sals_end);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index d85f271..0e59638 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2221,25 +2221,25 @@ static struct agent_expr *
 parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
 {
   struct agent_expr *aexpr = NULL;
-  volatile struct gdb_exception ex;
 
   if (!cond)
     return NULL;
 
   /* We don't want to stop processing, so catch any errors
      that may show up.  */
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       aexpr = gen_eval_for_expr (scope, cond);
     }
 
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       /* If we got here, it means the condition could not be parsed to a valid
 	 bytecode expression and thus can't be evaluated on the target's side.
 	 It's no use iterating through the conditions.  */
       return NULL;
     }
+  END_CATCH
 
   /* We have a valid agent expression.  */
   return aexpr;
@@ -2361,7 +2361,6 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
   struct cleanup *old_cleanups = 0;
   struct expression *expr, **argvec;
   struct agent_expr *aexpr = NULL;
-  volatile struct gdb_exception ex;
   const char *cmdrest;
   const char *format_start, *format_end;
   struct format_piece *fpieces;
@@ -2420,22 +2419,22 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
 
   /* We don't want to stop processing, so catch any errors
      that may show up.  */
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       aexpr = gen_printf (scope, gdbarch, 0, 0,
 			  format_start, format_end - format_start,
 			  fpieces, nargs, argvec);
     }
-
-  do_cleanups (old_cleanups);
-
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       /* If we got here, it means the command could not be parsed to a valid
 	 bytecode expression and thus can't be evaluated on the target's side.
 	 It's no use iterating through the other commands.  */
-      return NULL;
+      aexpr = NULL;
     }
+  END_CATCH
+
+  do_cleanups (old_cleanups);
 
   /* We have a valid agent expression, return it.  */
   return aexpr;
@@ -2572,7 +2571,6 @@ insert_bp_location (struct bp_location *bl,
 {
   enum errors bp_err = GDB_NO_ERROR;
   const char *bp_err_message = NULL;
-  volatile struct gdb_exception e;
 
   if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
     return 0;
@@ -2675,7 +2673,7 @@ insert_bp_location (struct bp_location *bl,
 	  || !(section_is_overlay (bl->section)))
 	{
 	  /* No overlay handling: just set the breakpoint.  */
-	  TRY_CATCH (e, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      int val;
 
@@ -2683,11 +2681,12 @@ insert_bp_location (struct bp_location *bl,
 	      if (val)
 		bp_err = GENERIC_ERROR;
 	    }
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ALL)
 	    {
 	      bp_err = e.error;
 	      bp_err_message = e.message;
 	    }
+	  END_CATCH
 	}
       else
 	{
@@ -2710,7 +2709,7 @@ insert_bp_location (struct bp_location *bl,
 		  bl->overlay_target_info.reqstd_address = addr;
 
 		  /* No overlay handling: just set the breakpoint.  */
-		  TRY_CATCH (e, RETURN_MASK_ALL)
+		  TRY
 		    {
 		      int val;
 
@@ -2719,11 +2718,12 @@ insert_bp_location (struct bp_location *bl,
 		      if (val)
 			bp_err = GENERIC_ERROR;
 		    }
-		  if (e.reason < 0)
+		  CATCH (e, RETURN_MASK_ALL)
 		    {
 		      bp_err = e.error;
 		      bp_err_message = e.message;
 		    }
+		  END_CATCH
 
 		  if (bp_err != GDB_NO_ERROR)
 		    fprintf_unfiltered (tmp_error_stream,
@@ -2736,7 +2736,7 @@ insert_bp_location (struct bp_location *bl,
 	  if (section_is_mapped (bl->section))
 	    {
 	      /* Yes.  This overlay section is mapped into memory.  */
-	      TRY_CATCH (e, RETURN_MASK_ALL)
+	      TRY
 	        {
 		  int val;
 
@@ -2744,11 +2744,12 @@ insert_bp_location (struct bp_location *bl,
 		  if (val)
 		    bp_err = GENERIC_ERROR;
 	        }
-	      if (e.reason < 0)
+	      CATCH (e, RETURN_MASK_ALL)
 	        {
 		  bp_err = e.error;
 		  bp_err_message = e.message;
 	        }
+	      END_CATCH
 	    }
 	  else
 	    {
@@ -10004,7 +10005,6 @@ create_breakpoint (struct gdbarch *gdbarch,
 		   int from_tty, int enabled, int internal,
 		   unsigned flags)
 {
-  volatile struct gdb_exception e;
   char *copy_arg = NULL;
   char *addr_start = arg;
   struct linespec_result canonical;
@@ -10018,24 +10018,17 @@ create_breakpoint (struct gdbarch *gdbarch,
 
   init_linespec_result (&canonical);
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       ops->create_sals_from_address (&arg, &canonical, type_wanted,
 				     addr_start, &copy_arg);
     }
-
-  /* If caller is interested in rc value from parse, set value.  */
-  switch (e.reason)
+  CATCH (e, RETURN_MASK_ERROR)
     {
-    case GDB_NO_ERROR:
-      if (VEC_empty (linespec_sals, canonical.sals))
-	return 0;
-      break;
-    case RETURN_ERROR:
-      switch (e.error)
+      /* If caller is interested in rc value from parse, set
+	 value.  */
+      if (e.error == NOT_FOUND_ERROR)
 	{
-	case NOT_FOUND_ERROR:
-
 	  /* If pending breakpoint support is turned off, throw
 	     error.  */
 
@@ -10066,14 +10059,14 @@ create_breakpoint (struct gdbarch *gdbarch,
 	    pending = 1;
 	    VEC_safe_push (linespec_sals, canonical.sals, &lsal);
 	  }
-	  break;
-	default:
-	  throw_exception (e);
 	}
-      break;
-    default:
-      throw_exception (e);
+      else
+	throw_exception (e);
     }
+  END_CATCH
+
+  if (VEC_empty (linespec_sals, canonical.sals))
+    return 0;
 
   /* Create a chain of things that always need to be cleaned up.  */
   old_chain = make_cleanup_destroy_linespec_result (&canonical);
@@ -11343,7 +11336,6 @@ static void
 watch_command_1 (const char *arg, int accessflag, int from_tty,
 		 int just_location, int internal)
 {
-  volatile struct gdb_exception e;
   struct breakpoint *b, *scope_breakpoint = NULL;
   struct expression *exp;
   const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
@@ -11655,17 +11647,18 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   if (!just_location)
     value_free_to_mark (mark);
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       /* Finally update the new watchpoint.  This creates the locations
 	 that should be inserted.  */
       update_watchpoint (w, 1);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ALL)
     {
       delete_breakpoint (b);
       throw_exception (e);
     }
+  END_CATCH
 
   install_breakpoint (internal, b, 1);
   do_cleanups (back_to);
@@ -13011,10 +13004,15 @@ breakpoint_retire_moribund (void)
 static void
 update_global_location_list_nothrow (enum ugll_insert_mode insert_mode)
 {
-  volatile struct gdb_exception e;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
-    update_global_location_list (insert_mode);
+  TRY
+    {
+      update_global_location_list (insert_mode);
+    }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 /* Clear BKP from a BPS.  */
@@ -14485,22 +14483,22 @@ update_breakpoint_locations (struct breakpoint *b,
       if (b->cond_string != NULL)
 	{
 	  const char *s;
-	  volatile struct gdb_exception e;
 
 	  s = b->cond_string;
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      new_loc->cond = parse_exp_1 (&s, sals.sals[i].pc,
 					   block_for_pc (sals.sals[i].pc), 
 					   0);
 	    }
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ERROR)
 	    {
 	      warning (_("failed to reevaluate condition "
 			 "for breakpoint %d: %s"), 
 		       b->number, e.message);
 	      new_loc->enabled = 0;
 	    }
+	  END_CATCH
 	}
 
       if (sals_end.nelts)
@@ -14564,18 +14562,21 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
 {
   char *s;
   struct symtabs_and_lines sals = {0};
-  volatile struct gdb_exception e;
+  struct gdb_exception exception = exception_none;
 
   gdb_assert (b->ops != NULL);
   s = addr_string;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       b->ops->decode_linespec (b, &s, &sals);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       int not_found_and_ok = 0;
+
+      exception = e;
+
       /* For pending breakpoints, it's expected that parsing will
 	 fail until the right shared library is loaded.  User has
 	 already told to create pending breakpoints and don't need
@@ -14602,8 +14603,9 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
 	  throw_exception (e);
 	}
     }
+  END_CATCH
 
-  if (e.reason == 0 || e.error != NOT_FOUND_ERROR)
+  if (exception.reason == 0 || exception.error != NOT_FOUND_ERROR)
     {
       int i;
 
@@ -15094,9 +15096,8 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
     {
       /* Initialize it just to avoid a GCC false warning.  */
       enum enable_state orig_enable_state = 0;
-      volatile struct gdb_exception e;
 
-      TRY_CATCH (e, RETURN_MASK_ALL)
+      TRY
 	{
 	  struct watchpoint *w = (struct watchpoint *) bpt;
 
@@ -15104,13 +15105,14 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
 	  bpt->enable_state = bp_enabled;
 	  update_watchpoint (w, 1 /* reparse */);
 	}
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ALL)
 	{
 	  bpt->enable_state = orig_enable_state;
 	  exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "),
 			     bpt->number);
 	  return;
 	}
+      END_CATCH
     }
 
   bpt->enable_state = bp_enabled;
@@ -15924,19 +15926,21 @@ save_breakpoints (char *filename, int from_tty,
 
     if (tp->type != bp_dprintf && tp->commands)
       {
-	volatile struct gdb_exception ex;	
 
 	fprintf_unfiltered (fp, "  commands\n");
 	
 	ui_out_redirect (current_uiout, fp);
-	TRY_CATCH (ex, RETURN_MASK_ALL)
+	TRY
 	  {
 	    print_command_lines (current_uiout, tp->commands->commands, 2);
 	  }
 	ui_out_redirect (current_uiout, NULL);
 
-	if (ex.reason < 0)
-	  throw_exception (ex);
+	CATCH (ex, RETURN_MASK_ALL)
+	  {
+	    throw_exception (ex);
+	  }
+	END_CATCH
 
 	fprintf_unfiltered (fp, "  end\n");
       }
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 5436ee9..68057c5 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -549,11 +549,10 @@ ftrace_update_insns (struct btrace_function *bfun,
 static enum btrace_insn_class
 ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  volatile struct gdb_exception error;
   enum btrace_insn_class iclass;
 
   iclass = BTRACE_INSN_OTHER;
-  TRY_CATCH (error, RETURN_MASK_ERROR)
+  TRY
     {
       if (gdbarch_insn_is_call (gdbarch, pc))
 	iclass = BTRACE_INSN_CALL;
@@ -562,6 +561,10 @@ ftrace_classify_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
       else if (gdbarch_insn_is_jump (gdbarch, pc))
 	iclass = BTRACE_INSN_JUMP;
     }
+  CATCH (error, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   return iclass;
 }
@@ -598,7 +601,6 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
 
       for (;;)
 	{
-	  volatile struct gdb_exception error;
 	  struct btrace_insn insn;
 	  int size;
 
@@ -628,8 +630,14 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
 	    level = min (level, end->level);
 
 	  size = 0;
-	  TRY_CATCH (error, RETURN_MASK_ERROR)
-	    size = gdb_insn_length (gdbarch, pc);
+	  TRY
+	    {
+	      size = gdb_insn_length (gdbarch, pc);
+	    }
+	  CATCH (error, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 
 	  insn.pc = pc;
 	  insn.size = size;
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 363a356..59d8b0f 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -91,15 +91,17 @@ adjust_value_for_child_access (struct value **value,
 	{
 	  if (value && *value)
 	    {
-	      volatile struct gdb_exception except;
 
-	      TRY_CATCH (except, RETURN_MASK_ERROR)
+	      TRY
 		{
 		  *value = value_ind (*value);
 		}
 
-	      if (except.reason < 0)
-		*value = NULL;
+	      CATCH (except, RETURN_MASK_ERROR)
+		{
+		  *value = NULL;
+		}
+	      END_CATCH
 	    }
 	  *type = target_type;
 	  if (was_ptr)
@@ -245,7 +247,6 @@ static struct value *
 value_struct_element_index (struct value *value, int type_index)
 {
   struct value *result = NULL;
-  volatile struct gdb_exception e;
   struct type *type = value_type (value);
 
   type = check_typedef (type);
@@ -253,21 +254,20 @@ value_struct_element_index (struct value *value, int type_index)
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
 	      || TYPE_CODE (type) == TYPE_CODE_UNION);
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       if (field_is_static (&TYPE_FIELD (type, type_index)))
 	result = value_static_field (type, type_index);
       else
 	result = value_primitive_field (value, 0, type_index, type);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       return NULL;
     }
-  else
-    {
-      return result;
-    }
+  END_CATCH
+
+  return result;
 }
 
 /* Obtain the information about child INDEX of the variable
@@ -290,7 +290,6 @@ c_describe_child (const struct varobj *parent, int index,
   struct type *type = varobj_get_value_type (parent);
   char *parent_expression = NULL;
   int was_ptr;
-  volatile struct gdb_exception except;
 
   if (cname)
     *cname = NULL;
@@ -319,10 +318,14 @@ c_describe_child (const struct varobj *parent, int index,
 	{
 	  int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      *cvalue = value_subscript (value, real_index);
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 	}
 
       if (ctype)
@@ -391,13 +394,16 @@ c_describe_child (const struct varobj *parent, int index,
 
       if (cvalue && value)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      *cvalue = value_ind (value);
 	    }
 
-	  if (except.reason < 0)
-	    *cvalue = NULL;
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	      *cvalue = NULL;
+	    }
+	  END_CATCH
 	}
 
       /* Don't use get_target_type because it calls
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 1069018..ce43a4a 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -179,7 +179,6 @@ cli_interpreter_exec (void *data, const char *command_str)
 static struct gdb_exception
 safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
 {
-  volatile struct gdb_exception exception;
   struct gdb_exception e = exception_none;
   struct ui_out *saved_uiout;
 
@@ -187,14 +186,15 @@ safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
   saved_uiout = current_uiout;
   current_uiout = command_uiout;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       execute_command (command, from_tty);
     }
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       e = exception;
     }
+  END_CATCH
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 2ec8bcd..7a4ed78 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1111,17 +1111,17 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
 
   if (validator)
     {
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  validator ((*command)->line, closure);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  xfree (*command);
 	  throw_exception (ex);
 	}
+      END_CATCH
     }
 
   /* Nothing special.  */
@@ -1700,13 +1700,12 @@ script_from_file (FILE *stream, const char *file)
   interpreter_async = 0;
 
   {
-    volatile struct gdb_exception e;
 
-    TRY_CATCH (e, RETURN_MASK_ERROR)
+    TRY
       {
 	read_command_file (stream);
       }
-    if (e.reason < 0)
+    CATCH (e, RETURN_MASK_ERROR)
       {
 	/* Re-throw the error, but with the file name information
 	   prepended.  */
@@ -1714,6 +1713,7 @@ script_from_file (FILE *stream, const char *file)
 		     _("%s:%d: Error in sourced command file:\n%s"),
 		     source_file_name, source_line_number, e.message);
       }
+    END_CATCH
   }
 
   do_cleanups (old_cleanups);
diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c
index b65f259..2ad0ce1 100644
--- a/gdb/common/common-exceptions.c
+++ b/gdb/common/common-exceptions.c
@@ -46,9 +46,7 @@ struct catcher
   /* Jump buffer pointing back at the exception handler.  */
   SIGJMP_BUF buf;
   /* Status buffer belonging to the exception handler.  */
-  volatile struct gdb_exception *exception;
-  /* Saved/current state.  */
-  int mask;
+  struct gdb_exception exception;
   struct cleanup *saved_cleanup_chain;
   /* Back link.  */
   struct catcher *prev;
@@ -74,16 +72,12 @@ catcher_list_size (void)
 }
 
 SIGJMP_BUF *
-exceptions_state_mc_init (volatile struct gdb_exception *exception,
-			  return_mask mask)
+exceptions_state_mc_init (void)
 {
   struct catcher *new_catcher = XCNEW (struct catcher);
 
-  /* Start with no exception, save it's address.  */
-  *exception = exception_none;
-  new_catcher->exception = exception;
-
-  new_catcher->mask = mask;
+  /* Start with no exception.  */
+  new_catcher->exception = exception_none;
 
   /* Prevent error/quit during FUNC from calling cleanups established
      prior to here.  */
@@ -134,8 +128,7 @@ exceptions_state_mc (enum catcher_action action)
       switch (action)
 	{
 	case CATCH_ITER:
-	  /* No error/quit has occured.  Just clean up.  */
-	  catcher_pop ();
+	  /* No error/quit has occured.  */
 	  return 0;
 	case CATCH_ITER_1:
 	  current_catcher->state = CATCHER_RUNNING_1;
@@ -152,7 +145,6 @@ exceptions_state_mc (enum catcher_action action)
 	{
 	case CATCH_ITER:
 	  /* The did a "break" from the inner while loop.  */
-	  catcher_pop ();
 	  return 0;
 	case CATCH_ITER_1:
 	  current_catcher->state = CATCHER_RUNNING;
@@ -169,21 +161,10 @@ exceptions_state_mc (enum catcher_action action)
 	{
 	case CATCH_ITER:
 	  {
-	    struct gdb_exception exception = *current_catcher->exception;
-
-	    if (current_catcher->mask & RETURN_MASK (exception.reason))
-	      {
-		/* Exit normally if this catcher can handle this
-		   exception.  The caller analyses the func return
-		   values.  */
-		catcher_pop ();
-		return 0;
-	      }
-	    /* The caller didn't request that the event be caught,
-	       relay the event to the next containing
-	       catch_errors().  */
-	    catcher_pop ();
-	    throw_exception (exception);
+	    /* Exit normally if this catcher can handle this
+	       exception.  The caller analyses the func return
+	       values.  */
+	    return 0;
 	  }
 	default:
 	  internal_error (__FILE__, __LINE__, _("bad state"));
@@ -194,6 +175,31 @@ exceptions_state_mc (enum catcher_action action)
 }
 
 int
+exceptions_state_mc_catch (struct gdb_exception *exception,
+			   int mask)
+{
+  *exception = current_catcher->exception;
+  catcher_pop ();
+
+  if (exception->reason < 0)
+    {
+      if (mask & RETURN_MASK (exception->reason))
+	{
+	  /* Exit normally and let the called handle the
+	     exception.  */
+	  return 1;
+	}
+
+      /* The caller didn't request that the event be caught, relay the
+	 event to the next exception_catch/CATCH.  */
+      throw_exception (*exception);
+    }
+
+  /* No exception was thrown.  */
+  return 0;
+}
+
+int
 exceptions_state_mc_action_iter (void)
 {
   return exceptions_state_mc (CATCH_ITER);
@@ -218,7 +224,7 @@ throw_exception (struct gdb_exception exception)
      to that call via setjmp's return value.  Note that REASON can't
      be zero, by definition in defs.h.  */
   exceptions_state_mc (CATCH_THROWING);
-  *current_catcher->exception = exception;
+  current_catcher->exception = exception;
   SIGLONGJMP (current_catcher->buf, exception.reason);
 }
 
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index a32e6f9..d2c0bee 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -118,14 +118,13 @@ struct gdb_exception
 
 /* Functions to drive the exceptions state machine.  Though declared
    here by necessity, these functions should be considered internal to
-   the exceptions subsystem and not used other than via the TRY_CATCH
-   macro defined below.  */
+   the exceptions subsystem and not used other than via the TRY/CATCH
+   macros defined below.  */
 
-extern SIGJMP_BUF *exceptions_state_mc_init (volatile struct
-					     gdb_exception *exception,
-					     return_mask mask);
+extern SIGJMP_BUF *exceptions_state_mc_init (void);
 extern int exceptions_state_mc_action_iter (void);
 extern int exceptions_state_mc_action_iter_1 (void);
+extern int exceptions_state_mc_catch (struct gdb_exception *, int);
 
 /* Macro to wrap up standard try/catch behavior.
 
@@ -138,26 +137,37 @@ extern int exceptions_state_mc_action_iter_1 (void);
 
    *INDENT-OFF*
 
-   volatile struct gdb_exception e;
-   TRY_CATCH (e, RETURN_MASK_ERROR)
+   TRY
      {
      }
-   switch (e.reason)
+   CATCH (e, RETURN_MASK_ERROR)
      {
-     case RETURN_ERROR: ...
+       switch (e.reason)
+         {
+           case RETURN_ERROR: ...
+         }
      }
+   END_CATCH
 
   */
 
-#define TRY_CATCH(EXCEPTION,MASK) \
+#define TRY \
      { \
        SIGJMP_BUF *buf = \
-	 exceptions_state_mc_init (&(EXCEPTION), (MASK)); \
+	 exceptions_state_mc_init (); \
        SIGSETJMP (*buf); \
      } \
      while (exceptions_state_mc_action_iter ()) \
        while (exceptions_state_mc_action_iter_1 ())
 
+#define CATCH(EXCEPTION, MASK)				\
+  {							\
+    struct gdb_exception EXCEPTION;				\
+    if (exceptions_state_mc_catch (&(EXCEPTION), MASK))
+
+#define END_CATCH				\
+  }
+
 /* *INDENT-ON* */
 
 /* Hook to allow client-specific actions to be performed prior to
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 1921704..15efeff 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -424,7 +424,6 @@ gcc_convert_symbol (void *datum,
 {
   struct compile_c_instance *context = datum;
   domain_enum domain;
-  volatile struct gdb_exception e;
   int found = 0;
 
   switch (request)
@@ -444,7 +443,7 @@ gcc_convert_symbol (void *datum,
 
   /* We can't allow exceptions to escape out of this callback.  Safest
      is to simply emit a gcc error.  */
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       struct symbol *sym;
 
@@ -467,8 +466,11 @@ gcc_convert_symbol (void *datum,
 	}
     }
 
-  if (e.reason < 0)
-    C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+    }
+  END_CATCH
 
   if (compile_debug && !found)
     fprintf_unfiltered (gdb_stdout,
@@ -484,13 +486,12 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
 		    const char *identifier)
 {
   struct compile_c_instance *context = datum;
-  volatile struct gdb_exception e;
   gcc_address result = 0;
   int found = 0;
 
   /* We can't allow exceptions to escape out of this callback.  Safest
      is to simply emit a gcc error.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct symbol *sym;
 
@@ -527,8 +528,11 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
 	}
     }
 
-  if (e.reason < 0)
-    C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      C_CTX (context)->c_ops->error (C_CTX (context), e.message);
+    }
+  END_CATCH
 
   if (compile_debug && !found)
     fprintf_unfiltered (gdb_stdout,
@@ -643,9 +647,8 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 				 CORE_ADDR pc,
 				 struct symbol *sym)
 {
-  volatile struct gdb_exception e;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       if (is_dynamic_type (SYMBOL_TYPE (sym)))
 	{
@@ -699,7 +702,7 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 	}
     }
 
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       if (compiler->symbol_err_map == NULL)
 	compiler->symbol_err_map = htab_create_alloc (10,
@@ -710,6 +713,7 @@ generate_c_for_for_one_variable (struct compile_c_instance *compiler,
 						      xfree);
       insert_symbol_error (compiler->symbol_err_map, sym, e.message);
     }
+  END_CATCH
 }
 
 /* See compile-internal.h.  */
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index c40de0e..6738aad 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -87,7 +87,6 @@ compile_object_run (struct compile_module *module)
   struct frame_id dummy_id;
   struct cleanup *cleanups;
   struct do_module_cleanup *data;
-  volatile struct gdb_exception ex;
   const char *objfile_name_s = objfile_name (module->objfile);
   int dtor_found, executed = 0;
   CORE_ADDR func_addr = module->func_addr;
@@ -101,7 +100,7 @@ compile_object_run (struct compile_module *module)
   xfree (module->source_file);
   xfree (module);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       func_val = value_from_pointer
 		 (builtin_type (target_gdbarch ())->builtin_func_ptr,
@@ -121,7 +120,7 @@ compile_object_run (struct compile_module *module)
 				       do_module_cleanup, data);
 	}
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       /* In the case of DTOR_FOUND or in the case of EXECUTED nothing
 	 needs to be done.  */
@@ -133,6 +132,7 @@ compile_object_run (struct compile_module *module)
 	do_module_cleanup (data);
       throw_exception (ex);
     }
+  END_CATCH
 
   dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
   gdb_assert (!dtor_found && executed);
diff --git a/gdb/completer.c b/gdb/completer.c
index 58418f6..c8c0e4c 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -395,18 +395,21 @@ expression_completer (struct cmd_list_element *ignore,
   struct type *type = NULL;
   char *fieldname;
   const char *p;
-  volatile struct gdb_exception except;
   enum type_code code = TYPE_CODE_UNDEF;
 
   /* Perform a tentative parse of the expression, to see whether a
      field completion is required.  */
   fieldname = NULL;
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       type = parse_expression_for_completion (text, &fieldname, &code);
     }
-  if (except.reason < 0)
-    return NULL;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      return NULL;
+    }
+  END_CATCH
+
   if (fieldname && type)
     {
       for (;;)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 65e1326..9218003 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -278,7 +278,6 @@ core_open (const char *arg, int from_tty)
   bfd *temp_bfd;
   int scratch_chan;
   int flags;
-  volatile struct gdb_exception except;
   char *filename;
 
   target_preopen (from_tty);
@@ -411,13 +410,16 @@ core_open (const char *arg, int from_tty)
      may be a thread_stratum target loaded on top of target core by
      now.  The layer above should claim threads found in the BFD
      sections.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       target_update_thread_list ();
     }
 
-  if (except.reason < 0)
-    exception_print (gdb_stderr, except);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, except);
+    }
+  END_CATCH
 
   p = bfd_core_file_failing_command (core_bfd);
   if (p)
@@ -462,12 +464,15 @@ core_open (const char *arg, int from_tty)
      anything about threads.  That is why the test is >= 2.  */
   if (thread_count () >= 2)
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  thread_command (NULL, from_tty);
 	}
-      if (except.reason < 0)
-	exception_print (gdb_stderr, except);
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	  exception_print (gdb_stderr, except);
+	}
+      END_CATCH
     }
 }
 
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 70a0528..b8af8f0 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -69,18 +69,17 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
 		  int embedded_offset, CORE_ADDR address,
 		  const struct value *val)
 {
-  volatile struct gdb_exception ex;
   int res = 0;
 
   gdb_assert (current_cp_abi.baseclass_offset != NULL);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       res = (*current_cp_abi.baseclass_offset) (type, index, valaddr,
 						embedded_offset,
 						address, val);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
@@ -89,6 +88,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
 		   _("Cannot determine virtual baseclass offset "
 		     "of incomplete object"));
     }
+  END_CATCH
 
   return res;
 }
@@ -109,16 +109,19 @@ value_rtti_type (struct value *v, int *full,
 		 int *top, int *using_enc)
 {
   struct type *ret = NULL;
-  volatile struct gdb_exception e;
 
   if ((current_cp_abi.rtti_type) == NULL)
     return NULL;
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       ret = (*current_cp_abi.rtti_type) (v, full, top, using_enc);
     }
-  if (e.reason < 0)
-    return NULL;
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      return NULL;
+    }
+  END_CATCH
+
   return ret;
 }
 
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 260601f..4bbee94 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -157,7 +157,6 @@ inspect_type (struct demangle_parse_info *info,
   int i;
   char *name;
   struct symbol *sym;
-  volatile struct gdb_exception except;
 
   /* Copy the symbol's name from RET_COMP and look it up
      in the symbol table.  */
@@ -173,12 +172,18 @@ inspect_type (struct demangle_parse_info *info,
     }
 
   sym = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
-  {
-    sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
-  }
 
-  if (except.reason >= 0 && sym != NULL)
+  TRY
+    {
+      sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
+    }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      return 0;
+    }
+  END_CATCH
+
+  if (sym != NULL)
     {
       struct type *otype = SYMBOL_TYPE (sym);
 
@@ -241,18 +246,19 @@ inspect_type (struct demangle_parse_info *info,
 	    }
 
 	  buf = mem_fileopen ();
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	  {
 	    type_print (type, "", buf, -1);
 	  }
 
 	  /* If type_print threw an exception, there is little point
 	     in continuing, so just bow out gracefully.  */
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      ui_file_delete (buf);
 	      return 0;
 	    }
+	  END_CATCH
 
 	  name = ui_file_obsavestring (buf, &info->obstack, &len);
 	  ui_file_delete (buf);
@@ -446,17 +452,21 @@ replace_typedefs (struct demangle_parse_info *info,
 
 	  if (local_name != NULL)
 	    {
-	      struct symbol *sym;
-	      volatile struct gdb_exception except;
+	      struct symbol *sym = NULL;
 
 	      sym = NULL;
-	      TRY_CATCH (except, RETURN_MASK_ALL)
+	      TRY
 		{
 		  sym = lookup_symbol (local_name, 0, VAR_DOMAIN, 0);
 		}
+	      CATCH (except, RETURN_MASK_ALL)
+		{
+		}
+	      END_CATCH
+
 	      xfree (local_name);
 
-	      if (except.reason >= 0 && sym != NULL)
+	      if (sym != NULL)
 		{
 		  struct type *otype = SYMBOL_TYPE (sym);
 		  const char *new_name = (*finder) (otype, data);
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index deb0ed8..feb3a66 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -313,18 +313,21 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 		}
 	      else if (field_is_static (&TYPE_FIELD (type, i)))
 		{
-		  volatile struct gdb_exception ex;
 		  struct value *v = NULL;
 
-		  TRY_CATCH (ex, RETURN_MASK_ERROR)
+		  TRY
 		    {
 		      v = value_static_field (type, i);
 		    }
 
-		  if (ex.reason < 0)
-		    fprintf_filtered (stream,
-				      _("<error reading variable: %s>"),
-				      ex.message);
+		  CATCH (ex, RETURN_MASK_ERROR)
+		    {
+		      fprintf_filtered (stream,
+					_("<error reading variable: %s>"),
+					ex.message);
+		    }
+		  END_CATCH
+
 		  cp_print_static_field (TYPE_FIELD_TYPE (type, i),
 					 v, stream, recurse + 1,
 					 options);
@@ -486,7 +489,6 @@ cp_print_value (struct type *type, struct type *real_type,
       const char *basename = TYPE_NAME (baseclass);
       const gdb_byte *base_valaddr = NULL;
       const struct value *base_val = NULL;
-      volatile struct gdb_exception ex;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
 	{
@@ -506,17 +508,18 @@ cp_print_value (struct type *type, struct type *real_type,
       thisoffset = offset;
       thistype = real_type;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  boffset = baseclass_offset (type, i, valaddr, offset, address, val);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    skip = -1;
 	  else
 	    skip = 1;
 	}
+      END_CATCH
 
       if (skip == 0)
 	{
diff --git a/gdb/dwarf2-frame-tailcall.c b/gdb/dwarf2-frame-tailcall.c
index c99fde0..b412a5b 100644
--- a/gdb/dwarf2-frame-tailcall.c
+++ b/gdb/dwarf2-frame-tailcall.c
@@ -368,7 +368,6 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
   struct gdbarch *prev_gdbarch;
   struct call_site_chain *chain = NULL;
   struct tailcall_cache *cache;
-  volatile struct gdb_exception except;
 
   gdb_assert (*tailcall_cachep == NULL);
 
@@ -377,7 +376,7 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
   this_pc = get_frame_address_in_block (this_frame);
 
   /* Catch any unwinding errors.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       int sp_regnum;
 
@@ -397,12 +396,13 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
       prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum);
       prev_sp_p = 1;
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       if (entry_values_debug)
 	exception_print (gdb_stdout, except);
       return;
     }
+  END_CATCH
 
   /* Ambiguous unwind or unambiguous unwind verified as matching.  */
   if (chain == NULL || chain->length == 0)
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index b648aa3..8fb2ac7 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1025,7 +1025,6 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct dwarf2_frame_cache *cache;
   struct dwarf2_frame_state *fs;
   struct dwarf2_fde *fde;
-  volatile struct gdb_exception ex;
   CORE_ADDR entry_pc;
   const gdb_byte *instr;
 
@@ -1102,7 +1101,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
   execute_cfa_program (fde, instr, fde->end, gdbarch,
 		       get_frame_address_in_block (this_frame), fs);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* Calculate the CFA.  */
       switch (fs->regs.cfa_how)
@@ -1126,7 +1125,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
 	  internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
 	}
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	{
@@ -1138,6 +1137,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       throw_exception (ex);
     }
+  END_CATCH
 
   /* Initialize the register state.  */
   {
@@ -2269,7 +2269,6 @@ dwarf2_build_frame_info (struct objfile *objfile)
   struct dwarf2_cie_table cie_table;
   struct dwarf2_fde_table fde_table;
   struct dwarf2_fde_table *fde_table2;
-  volatile struct gdb_exception e;
 
   cie_table.num_entries = 0;
   cie_table.entries = NULL;
@@ -2311,7 +2310,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
           if (txt)
             unit->tbase = txt->vma;
 
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      frame_ptr = unit->dwarf_frame_buffer;
 	      while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
@@ -2320,7 +2319,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 						EH_CIE_OR_FDE_TYPE_ID);
 	    }
 
-	  if (e.reason < 0)
+	  CATCH (e, RETURN_MASK_ERROR)
 	    {
 	      warning (_("skipping .eh_frame info of %s: %s"),
 		       objfile_name (objfile), e.message);
@@ -2333,6 +2332,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 		}
 	      /* The cie_table is discarded by the next if.  */
 	    }
+	  END_CATCH
 
           if (cie_table.num_entries != 0)
             {
@@ -2352,7 +2352,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
     {
       int num_old_fde_entries = fde_table.num_entries;
 
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  frame_ptr = unit->dwarf_frame_buffer;
 	  while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
@@ -2360,7 +2360,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 					    &cie_table, &fde_table,
 					    EH_CIE_OR_FDE_TYPE_ID);
 	}
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ERROR)
 	{
 	  warning (_("skipping .debug_frame info of %s: %s"),
 		   objfile_name (objfile), e.message);
@@ -2383,6 +2383,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
 	  fde_table.num_entries = num_old_fde_entries;
 	  /* The cie_table is discarded by the next if.  */
 	}
+      END_CATCH
     }
 
   /* Discard the cie_table, it is no longer needed.  */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index aa569ee..e674933 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -983,14 +983,13 @@ struct call_site_chain *
 call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
 		      CORE_ADDR callee_pc)
 {
-  volatile struct gdb_exception e;
   struct call_site_chain *retval = NULL;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       retval = call_site_find_chain_1 (gdbarch, caller_pc, callee_pc);
     }
-  if (e.reason < 0)
+  CATCH (e, RETURN_MASK_ERROR)
     {
       if (e.error == NO_ENTRY_VALUE_ERROR)
 	{
@@ -1002,6 +1001,8 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
       else
 	throw_exception (e);
     }
+  END_CATCH
+
   return retval;
 }
 
@@ -2183,7 +2184,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
   struct dwarf_expr_context *ctx;
   struct cleanup *old_chain, *value_chain;
   struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
-  volatile struct gdb_exception ex;
 
   if (byte_offset < 0)
     invalid_synthetic_pointer ();
@@ -2206,11 +2206,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
   ctx->baton = &baton;
   ctx->funcs = &dwarf_expr_ctx_funcs;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       dwarf_expr_eval (ctx, data, size);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	{
@@ -2229,6 +2229,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
       else
 	throw_exception (ex);
     }
+  END_CATCH
 
   if (ctx->num_pieces > 0)
     {
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a283cba..c185d51 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4221,14 +4221,13 @@ dwarf2_initialize_objfile (struct objfile *objfile)
 void
 dwarf2_build_psymtabs (struct objfile *objfile)
 {
-  volatile struct gdb_exception except;
 
   if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
     {
       init_psymbol_list (objfile, 1024);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       /* This isn't really ideal: all the data we allocate on the
 	 objfile's obstack is still uselessly kept around.  However,
@@ -4238,8 +4237,11 @@ dwarf2_build_psymtabs (struct objfile *objfile)
       dwarf2_build_psymtabs_hard (objfile);
       discard_cleanups (cleanups);
     }
-  if (except.reason < 0)
-    exception_print (gdb_stderr, except);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, except);
+    }
+  END_CATCH
 }
 
 /* Return the total length of the CU described by HEADER.  */
@@ -23171,16 +23173,18 @@ save_gdb_index_command (char *arg, int from_tty)
     dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
     if (dwarf2_per_objfile)
       {
-	volatile struct gdb_exception except;
 
-	TRY_CATCH (except, RETURN_MASK_ERROR)
+	TRY
 	  {
 	    write_psymtabs_to_index (objfile, arg);
 	  }
-	if (except.reason < 0)
-	  exception_fprintf (gdb_stderr, except,
-			     _("Error while writing index for `%s': "),
-			     objfile_name (objfile));
+	CATCH (except, RETURN_MASK_ERROR)
+	  {
+	    exception_fprintf (gdb_stderr, except,
+			       _("Error while writing index for `%s': "),
+			       objfile_name (objfile));
+	  }
+	END_CATCH
       }
   }
 }
diff --git a/gdb/eval.c b/gdb/eval.c
index bb2a0da..9804a97 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -212,7 +212,6 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 		    int preserve_errors)
 {
   struct value *mark, *new_mark, *result;
-  volatile struct gdb_exception ex;
 
   *valp = NULL;
   if (resultp)
@@ -224,11 +223,11 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
   mark = value_mark ();
   result = NULL;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       result = evaluate_subexp (NULL_TYPE, exp, pc, EVAL_NORMAL);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       /* Ignore memory errors if we want watchpoints pointing at
 	 inaccessible memory to still be created; otherwise, throw the
@@ -243,6 +242,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 	  break;
 	}
     }
+  END_CATCH
 
   new_mark = value_mark ();
   if (mark == new_mark)
@@ -258,13 +258,16 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 	*valp = result;
       else
 	{
-	  volatile struct gdb_exception except;
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      value_fetch_lazy (result);
 	      *valp = result;
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	    }
+	  END_CATCH
 	}
     }
 
@@ -762,16 +765,15 @@ evaluate_subexp_standard (struct type *expect_type,
 	 or reference to a base class and print object is on.  */
 
       {
-	volatile struct gdb_exception except;
 	struct value *ret = NULL;
 
-	TRY_CATCH (except, RETURN_MASK_ERROR)
+	TRY
 	  {
 	    ret = value_of_variable (exp->elts[pc + 2].symbol,
 				     exp->elts[pc + 1].block);
 	  }
 
-	if (except.reason < 0)
+	CATCH (except, RETURN_MASK_ERROR)
 	  {
 	    if (noside == EVAL_AVOID_SIDE_EFFECTS)
 	      ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
@@ -779,6 +781,7 @@ evaluate_subexp_standard (struct type *expect_type,
 	    else
 	      throw_exception (except);
 	  }
+	END_CATCH
 
 	return ret;
       }
@@ -1446,20 +1449,21 @@ evaluate_subexp_standard (struct type *expect_type,
 	         operator and continue evaluation.  */
 	      while (unop_user_defined_p (op, arg2))
 		{
-		  volatile struct gdb_exception except;
 		  struct value *value = NULL;
-		  TRY_CATCH (except, RETURN_MASK_ERROR)
+		  TRY
 		    {
 		      value = value_x_unop (arg2, op, noside);
 		    }
 
-		  if (except.reason < 0)
+		  CATCH (except, RETURN_MASK_ERROR)
 		    {
 		      if (except.error == NOT_FOUND_ERROR)
 			break;
 		      else
 			throw_exception (except);
 		    }
+		  END_CATCH
+
 		  arg2 = value;
 		}
 	    }
@@ -1863,20 +1867,21 @@ evaluate_subexp_standard (struct type *expect_type,
          arg1 with the value returned by evaluating operator->().  */
       while (unop_user_defined_p (op, arg1))
 	{
-	  volatile struct gdb_exception except;
 	  struct value *value = NULL;
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      value = value_x_unop (arg1, op, noside);
 	    }
 
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      if (except.error == NOT_FOUND_ERROR)
 		break;
 	      else
 		throw_exception (except);
 	    }
+	  END_CATCH
+
 	  arg1 = value;
 	}
 
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index a2b41a7..79e41fd 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -326,14 +326,13 @@ start_event_loop (void)
      processes it.  */
   while (1)
     {
-      volatile struct gdb_exception ex;
       int result = 0;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  result = gdb_do_one_event ();
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  exception_print (gdb_stderr, ex);
 
@@ -356,6 +355,8 @@ start_event_loop (void)
 	  /* Maybe better to set a flag to be checked somewhere as to
 	     whether display the prompt or not.  */
 	}
+      END_CATCH
+
       if (result < 0)
 	break;
     }
diff --git a/gdb/event-top.c b/gdb/event-top.c
index bbda5dc..e9cc2d7 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -935,24 +935,28 @@ handle_sighup (int sig)
 static void
 async_disconnect (gdb_client_data arg)
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       quit_cover ();
     }
 
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       fputs_filtered ("Could not kill the program being debugged",
 		      gdb_stderr);
       exception_print (gdb_stderr, exception);
     }
+  END_CATCH
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       pop_all_targets ();
     }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   signal (SIGHUP, SIG_DFL);	/*FIXME: ???????????  */
   raise (SIGHUP);
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 64a653a..623e8e0 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -174,7 +174,6 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
 			   char **gdberrmsg,
 		  	   return_mask mask)
 {
-  volatile struct gdb_exception ex;
   struct gdb_exception exception = exception_none;
   volatile int val = 0;
   struct ui_out *saved_uiout;
@@ -183,14 +182,15 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
   saved_uiout = current_uiout;
   current_uiout = func_uiout;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       val = (*func) (current_uiout, func_args);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       exception = ex;
     }
+  END_CATCH
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
@@ -228,17 +228,22 @@ int
 catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
 	      return_mask mask)
 {
+  struct gdb_exception exception = exception_none;
   volatile int val = 0;
-  volatile struct gdb_exception exception;
   struct ui_out *saved_uiout;
 
   /* Save the global ``struct ui_out'' builder.  */
   saved_uiout = current_uiout;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       val = func (func_args);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception = ex;
+    }
+  END_CATCH
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index c2aca71..e841edf 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -443,19 +443,22 @@ info_common_command_for_block (const struct block *block, const char *comname,
 	for (index = 0; index < common->n_entries; index++)
 	  {
 	    struct value *val = NULL;
-	    volatile struct gdb_exception except;
 
 	    printf_filtered ("%s = ",
 			     SYMBOL_PRINT_NAME (common->contents[index]));
 
-	    TRY_CATCH (except, RETURN_MASK_ERROR)
+	    TRY
 	      {
 		val = value_of_variable (common->contents[index], block);
 		value_print (val, gdb_stdout, &opts);
 	      }
 
-	    if (except.reason < 0)
-	      printf_filtered ("<error reading variable: %s>", except.message);
+	    CATCH (except, RETURN_MASK_ERROR)
+	      {
+		printf_filtered ("<error reading variable: %s>", except.message);
+	      }
+	    END_CATCH
+
 	    putchar_filtered ('\n');
 	  }
       }
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index fcfedfd..bba1ae7 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -96,16 +96,15 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
                           const struct frame_unwind *unwinder)
 {
   struct cleanup *old_cleanup;
-  volatile struct gdb_exception ex;
   int res = 0;
 
   old_cleanup = frame_prepare_for_sniffer (this_frame, unwinder);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       res = unwinder->sniffer (unwinder, this_frame, this_cache);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	{
@@ -118,6 +117,7 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
 	}
       throw_exception (ex);
     }
+  END_CATCH
 
   if (res)
     {
diff --git a/gdb/frame.c b/gdb/frame.c
index 7088f32..b3cbf23 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -784,9 +784,9 @@ frame_unwind_pc (struct frame_info *this_frame)
     {
       if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
 	{
-	  volatile struct gdb_exception ex;
 	  struct gdbarch *prev_gdbarch;
 	  CORE_ADDR pc = 0;
+	  int pc_p = 0;
 
 	  /* The right way.  The `pure' way.  The one true way.  This
 	     method depends solely on the register-unwind code to
@@ -806,11 +806,12 @@ frame_unwind_pc (struct frame_info *this_frame)
 	     different ways that a PC could be unwound.  */
 	  prev_gdbarch = frame_unwind_arch (this_frame);
 
-	  TRY_CATCH (ex, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+	      pc_p = 1;
 	    }
-	  if (ex.reason < 0)
+	  CATCH (ex, RETURN_MASK_ERROR)
 	    {
 	      if (ex.error == NOT_AVAILABLE_ERROR)
 		{
@@ -835,7 +836,9 @@ frame_unwind_pc (struct frame_info *this_frame)
 	      else
 		throw_exception (ex);
 	    }
-	  else
+	  END_CATCH
+
+	  if (pc_p)
 	    {
 	      this_frame->prev_pc.value = pc;
 	      this_frame->prev_pc.status = CC_VALUE;
@@ -1963,14 +1966,13 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
 struct frame_info *
 get_prev_frame_always (struct frame_info *this_frame)
 {
-  volatile struct gdb_exception ex;
   struct frame_info *prev_frame = NULL;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       prev_frame = get_prev_frame_always_1 (this_frame);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == MEMORY_ERROR)
 	{
@@ -1994,6 +1996,7 @@ get_prev_frame_always (struct frame_info *this_frame)
       else
 	throw_exception (ex);
     }
+  END_CATCH
 
   return prev_frame;
 }
@@ -2222,21 +2225,21 @@ get_frame_pc (struct frame_info *frame)
 int
 get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
 {
-  volatile struct gdb_exception ex;
 
   gdb_assert (frame->next != NULL);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       *pc = frame_unwind_pc (frame->next);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	return 0;
       else
 	throw_exception (ex);
     }
+  END_CATCH
 
   return 1;
 }
@@ -2307,18 +2310,18 @@ int
 get_frame_address_in_block_if_available (struct frame_info *this_frame,
 					 CORE_ADDR *pc)
 {
-  volatile struct gdb_exception ex;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       *pc = get_frame_address_in_block (this_frame);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	return 0;
       throw_exception (ex);
     }
+  END_CATCH
 
   return 1;
 }
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 3e05c61..44b9d0c 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -114,12 +114,19 @@ write_gcore_file_1 (bfd *obfd)
 void
 write_gcore_file (bfd *obfd)
 {
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   target_prepare_to_generate_core ();
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    write_gcore_file_1 (obfd);
+  TRY
+    {
+      write_gcore_file_1 (obfd);
+    }
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      except = e;
+    }
+  END_CATCH
 
   target_done_generating_core ();
 
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 4189877..08dbb60 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -3144,19 +3144,19 @@ static int exit_code;
 static void
 detach_or_kill_for_exit_cleanup (void *ignore)
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       detach_or_kill_for_exit ();
     }
 
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       fflush (stdout);
       fprintf (stderr, "Detach or kill failed: %s\n", exception.message);
       exit_code = 1;
     }
+  END_CATCH
 }
 
 /* Main function.  This is called by the real "main" function,
@@ -3385,7 +3385,6 @@ captured_main (int argc, char *argv[])
 
   while (1)
     {
-      volatile struct gdb_exception exception;
 
       noack_mode = 0;
       multi_process = 0;
@@ -3397,7 +3396,7 @@ captured_main (int argc, char *argv[])
 
       remote_open (port);
 
-      TRY_CATCH (exception, RETURN_MASK_ERROR)
+      TRY
 	{
 	  /* Wait for events.  This will return when all event sources
 	     are removed from the event loop.  */
@@ -3450,8 +3449,7 @@ captured_main (int argc, char *argv[])
 		}
 	    }
 	}
-
-      if (exception.reason == RETURN_ERROR)
+      CATCH (exception, RETURN_MASK_ERROR)
 	{
 	  if (response_needed)
 	    {
@@ -3459,6 +3457,7 @@ captured_main (int argc, char *argv[])
 	      putpkt (own_buf);
 	    }
 	}
+      END_CATCH
     }
 }
 
@@ -3467,25 +3466,26 @@ captured_main (int argc, char *argv[])
 int
 main (int argc, char *argv[])
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       captured_main (argc, argv);
     }
-
-  /* captured_main should never return.  */
-  gdb_assert (exception.reason < 0);
-
-  if (exception.reason == RETURN_ERROR)
+  CATCH (exception, RETURN_MASK_ALL)
     {
-      fflush (stdout);
-      fprintf (stderr, "%s\n", exception.message);
-      fprintf (stderr, "Exiting\n");
-      exit_code = 1;
+      if (exception.reason == RETURN_ERROR)
+	{
+	  fflush (stdout);
+	  fprintf (stderr, "%s\n", exception.message);
+	  fprintf (stderr, "Exiting\n");
+	  exit_code = 1;
+	}
+
+      exit (exit_code);
     }
+  END_CATCH
 
-  exit (exit_code);
+  gdb_assert_not_reached ("captured_main should never return");
 }
 
 /* Skip PACKET until the next semi-colon (or end of string).  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index d087a12..af59d42 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2299,20 +2299,22 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
 {
   struct ui_file *saved_gdb_stderr;
   struct type *type = NULL; /* Initialize to keep gcc happy.  */
-  volatile struct gdb_exception except;
 
   /* Suppress error messages.  */
   saved_gdb_stderr = gdb_stderr;
   gdb_stderr = ui_file_new ();
 
   /* Call parse_and_eval_type() without fear of longjmp()s.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       type = parse_and_eval_type (p, length);
     }
 
-  if (except.reason < 0)
-    type = builtin_type (gdbarch)->builtin_void;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      type = builtin_type (gdbarch)->builtin_void;
+    }
+  END_CATCH
 
   /* Stop suppressing error messages.  */
   ui_file_delete (gdb_stderr);
@@ -3235,7 +3237,6 @@ check_types_worklist (VEC (type_equality_entry_d) **worklist,
 int
 types_deeply_equal (struct type *type1, struct type *type2)
 {
-  volatile struct gdb_exception except;
   int result = 0;
   struct bcache *cache;
   VEC (type_equality_entry_d) *worklist = NULL;
@@ -3253,7 +3254,7 @@ types_deeply_equal (struct type *type1, struct type *type2)
   entry.type2 = type2;
   VEC_safe_push (type_equality_entry_d, worklist, &entry);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = check_types_worklist (&worklist, cache);
     }
@@ -3264,8 +3265,11 @@ types_deeply_equal (struct type *type1, struct type *type2)
   bcache_xfree (cache);
   VEC_free (type_equality_entry_d, worklist);
   /* Rethrow if there was a problem.  */
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 
   return result;
 }
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d1ed8fc..5c04011 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -904,8 +904,8 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
     {
       /* Initialize it just to avoid a GCC false warning.  */
       CORE_ADDR addr = 0;
+      int got_error = 0;
       struct value *vfn;
-      volatile struct gdb_exception ex;
 
       printf_filtered ("[%d]: ", i);
 
@@ -916,13 +916,18 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
       if (gdbarch_vtable_function_descriptors (gdbarch))
 	vfn = value_addr (vfn);
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  addr = value_as_address (vfn);
 	}
-      if (ex.reason < 0)
-	printf_filtered (_("<error: %s>"), ex.message);
-      else
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  printf_filtered (_("<error: %s>"), ex.message);
+	  got_error = 1;
+	}
+      END_CATCH
+
+      if (!got_error)
 	print_function_pointer_address (opts, gdbarch, addr, gdb_stdout);
       printf_filtered ("\n");
     }
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 1895118..16d15b7 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -310,11 +310,11 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
 {
   int from_tty_arg_pos = -1, to_string_arg_pos = -1;
   int from_tty = 0, to_string = 0;
-  volatile struct gdb_exception except;
   const SCM keywords[] = { from_tty_keyword, to_string_keyword, SCM_BOOL_F };
   char *command;
   char *result = NULL;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#tt",
 			      command_scm, &command, rest,
@@ -325,7 +325,7 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
      executed.  */
   cleanups = make_cleanup (xfree, command);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *inner_cleanups;
 
@@ -346,6 +346,12 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
 
       do_cleanups (inner_cleanups);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 36c14da..50dc6c7 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -678,18 +678,21 @@ gdbscm_lookup_block (SCM pc_scm)
   CORE_ADDR pc;
   const struct block *block = NULL;
   struct compunit_symtab *cust = NULL;
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       cust = find_pc_compunit_symtab (pc);
 
       if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
 	block = block_for_pc (pc);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
     {
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index c1f9f91..ad853ed 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -407,7 +407,7 @@ gdbscm_register_breakpoint_x (SCM self)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   /* We only support registering breakpoints created with make-breakpoint.  */
   if (!bp_smob->is_scheme_bkpt)
@@ -418,7 +418,7 @@ gdbscm_register_breakpoint_x (SCM self)
 
   pending_breakpoint_scm = self;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       char *location = bp_smob->spec.location;
       int internal = bp_smob->spec.is_internal;
@@ -455,6 +455,12 @@ gdbscm_register_breakpoint_x (SCM self)
 	  gdb_assert_not_reached ("invalid breakpoint type");
 	}
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   /* Ensure this gets reset, even if there's an error.  */
   pending_breakpoint_scm = SCM_BOOL_F;
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -473,13 +479,16 @@ gdbscm_delete_breakpoint_x (SCM self)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       delete_breakpoint (bp_smob->bp);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -565,19 +574,22 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
 		   _("boolean"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (gdbscm_is_true (newvalue))
 	enable_breakpoint (bp_smob->bp);
       else
 	disable_breakpoint (bp_smob->bp);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -600,16 +612,19 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue)
 {
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
 		   _("boolean"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       breakpoint_set_silent (bp_smob->bp, gdbscm_is_true (newvalue));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -634,7 +649,6 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   long value;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX),
 		   newvalue, SCM_ARG2, FUNC_NAME, _("integer"));
@@ -643,11 +657,15 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
   if (value < 0)
     value = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_ignore_count (bp_smob->number, (int) value, 0);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -755,17 +773,20 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   long id;
   int valid_id = 0;
-  volatile struct gdb_exception except;
 
   if (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX))
     {
       id = scm_to_long (newvalue);
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  valid_id = valid_task_id (id);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (! valid_id)
 	{
@@ -778,11 +799,15 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
   else
     SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       breakpoint_set_task (bp_smob->bp, id);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -855,7 +880,7 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   char *exp;
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue),
 		   newvalue, SCM_ARG2, FUNC_NAME,
@@ -866,10 +891,16 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
   else
     exp = gdbscm_scm_to_c_string (newvalue);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_breakpoint_condition (bp_smob->bp, exp ? exp : "", 0);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   xfree (exp);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -936,7 +967,6 @@ gdbscm_breakpoint_commands (SCM self)
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct breakpoint *bp;
   long length;
-  volatile struct gdb_exception except;
   struct ui_file *string_file;
   struct cleanup *chain;
   SCM result;
@@ -951,16 +981,17 @@ gdbscm_breakpoint_commands (SCM self)
   chain = make_cleanup_ui_file_delete (string_file);
 
   ui_out_redirect (current_uiout, string_file);
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
   ui_out_redirect (current_uiout, NULL);
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       do_cleanups (chain);
       gdbscm_throw_gdb_exception (except);
     }
+  END_CATCH
 
   cmdstr = ui_file_xstrdup (string_file, &length);
   make_cleanup (xfree, cmdstr);
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 7c6d010..c870fcc 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -762,7 +762,6 @@ gdbscm_register_command_x (SCM self)
   char *cmd_name, *pfx_name;
   struct cmd_list_element **cmd_list;
   struct cmd_list_element *cmd = NULL;
-  volatile struct gdb_exception except;
 
   if (cmdscm_is_valid (c_smob))
     scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL);
@@ -772,7 +771,7 @@ gdbscm_register_command_x (SCM self)
   c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
   xfree (cmd_name);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (c_smob->is_prefix)
 	{
@@ -790,7 +789,11 @@ gdbscm_register_command_x (SCM self)
 			 NULL, c_smob->doc, cmd_list);
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Note: At this point the command exists in gdb.
      So no more errors after this point.  */
diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
index 5ae7075..782d915 100644
--- a/gdb/guile/scm-disasm.c
+++ b/gdb/guile/scm-disasm.c
@@ -283,9 +283,8 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
       char *as = NULL;
       struct ui_file *memfile = mem_fileopen ();
       struct cleanup *cleanups = make_cleanup_ui_file_delete (memfile);
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (using_port)
 	    {
@@ -295,7 +294,11 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
 	  else
 	    insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+	}
+      END_CATCH
 
       as = ui_file_xstrdup (memfile, NULL);
 
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index a30c093..6189802 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -220,7 +220,6 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
   SCM f_scm;
   htab_t htab;
   eqable_gdb_smob **slot;
-  volatile struct gdb_exception except;
   struct frame_id frame_id = null_frame_id;
   struct gdbarch *gdbarch = NULL;
   int frame_id_is_next = 0;
@@ -234,7 +233,7 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
   if (*slot != NULL)
     return (*slot)->containing_scm;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Try to get the previous frame, to determine if this is the last frame
 	 in a corrupt stack.  If so, we need to store the frame_id of the next
@@ -253,8 +252,11 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
 	}
       gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
-    return gdbscm_scm_from_gdb_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      return gdbscm_scm_from_gdb_exception (except);
+    }
+  END_CATCH
 
   f_scm = frscm_make_frame_smob ();
   f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);
@@ -396,15 +398,18 @@ gdbscm_frame_valid_p (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (frame != NULL);
 }
@@ -421,18 +426,23 @@ gdbscm_frame_name (SCM self)
   enum language lang = language_minimal;
   struct frame_info *frame = NULL;
   SCM result;
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	find_frame_funname (frame, &name, &lang, NULL);
     }
-  if (except.reason < 0)
-    xfree (name);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
+  xfree (name);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
   if (frame == NULL)
@@ -461,17 +471,20 @@ gdbscm_frame_type (SCM self)
   frame_smob *f_smob;
   enum frame_type type = NORMAL_FRAME;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	type = get_frame_type (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -490,15 +503,18 @@ gdbscm_frame_arch (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -517,16 +533,19 @@ gdbscm_frame_unwind_stop_reason (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
   enum unwind_stop_reason stop_reason;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -548,17 +567,20 @@ gdbscm_frame_pc (SCM self)
   frame_smob *f_smob;
   CORE_ADDR pc = 0;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	pc = get_frame_pc (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -578,17 +600,20 @@ gdbscm_frame_block (SCM self)
   frame_smob *f_smob;
   const struct block *block = NULL, *fn_block;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	block = get_frame_block (frame, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -626,17 +651,20 @@ gdbscm_frame_function (SCM self)
   frame_smob *f_smob;
   struct symbol *sym = NULL;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	sym = find_pc_function (get_frame_address_in_block (frame));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -660,17 +688,20 @@ gdbscm_frame_older (SCM self)
   frame_smob *f_smob;
   struct frame_info *prev = NULL;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	prev = get_prev_frame (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -694,17 +725,20 @@ gdbscm_frame_newer (SCM self)
   frame_smob *f_smob;
   struct frame_info *next = NULL;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	next = get_next_frame (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -727,17 +761,20 @@ gdbscm_frame_sal (SCM self)
   frame_smob *f_smob;
   struct symtab_and_line sal;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	find_frame_sal (frame, &sal);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -767,15 +804,18 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
   struct frame_info *frame = NULL;
   struct symbol *var = NULL;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -797,7 +837,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
       char *var_name;
       const struct block *block = NULL;
       struct cleanup *cleanup;
-      volatile struct gdb_exception except;
+      struct gdb_exception except = exception_none;
 
       if (! SCM_UNBNDP (block_scm))
 	{
@@ -815,14 +855,19 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
       /* N.B. Between here and the call to do_cleanups, don't do anything
 	 to cause a Scheme exception without performing the cleanup.  */
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (block == NULL)
 	    block = get_frame_block (frame, NULL);
 	  var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
 	}
-      if (except.reason < 0)
-	do_cleanups (cleanup);
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	  except = ex;
+	}
+      END_CATCH
+
+      do_cleanups (cleanup);
       GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
       if (var == NULL)
@@ -841,11 +886,15 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
 		       _("gdb:symbol or string"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = read_var_value (var, frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (value);
 }
@@ -858,17 +907,20 @@ gdbscm_frame_select (SCM self)
 {
   frame_smob *f_smob;
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frscm_frame_smob_to_frame (f_smob);
       if (frame != NULL)
 	select_frame (frame);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     {
@@ -886,13 +938,16 @@ static SCM
 gdbscm_newest_frame (void)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_current_frame ();
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frscm_scm_from_frame_unsafe (frame, current_inferior ());
 }
@@ -904,13 +959,16 @@ static SCM
 gdbscm_selected_frame (void)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_selected_frame (_("No frame is currently selected"));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frscm_scm_from_frame_unsafe (frame, current_inferior ());
 }
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index d9ca97e9..c84ead7 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -234,7 +234,6 @@ gdbscm_lazy_string_to_value (SCM self)
   SCM ls_scm = lsscm_get_lazy_string_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (ls_scm);
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   if (ls_smob->address == 0)
     {
@@ -242,11 +241,15 @@ gdbscm_lazy_string_to_value (SCM self)
 				_("cannot create a value from NULL")));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = value_at_lazy (ls_smob->type, ls_smob->address);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (value);
 }
@@ -268,7 +271,6 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
 {
   lazy_string_smob *ls_smob;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   gdb_assert (lsscm_is_lazy_string (string));
 
@@ -283,15 +285,16 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = value_at_lazy (ls_smob->type, ls_smob->address);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       *except_scmp = gdbscm_scm_from_gdb_exception (except);
       return NULL;
     }
+  END_CATCH
 
   return value;
 }
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 7ff37ce..4b6bb5d 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -83,7 +83,6 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
   struct value *res_val = NULL;
   SCM except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -95,7 +94,7 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (opcode)
 	{
@@ -128,7 +127,11 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
 	  gdb_assert_not_reached ("unsupported operation");
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -156,7 +159,6 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
   struct value *res_val = NULL;
   SCM except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -175,7 +177,7 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (opcode)
 	{
@@ -264,7 +266,11 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
 	  gdb_assert_not_reached ("unsupported operation");
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -441,7 +447,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
   int result = 0;
   SCM except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -460,7 +466,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (op)
 	{
@@ -487,6 +493,12 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
 	  gdb_assert_not_reached ("invalid <gdb:value> comparison");
       }
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -742,7 +754,6 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
 {
   struct value *value = NULL;
   SCM except_scm = SCM_BOOL_F;
-  volatile struct gdb_exception except;
 
   if (type == NULL)
     {
@@ -752,7 +763,7 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
 
   *except_scmp = SCM_BOOL_F;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (vlscm_is_value (obj))
 	{
@@ -859,8 +870,11 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
 	  value = NULL;
 	}
     }
-  if (except.reason < 0)
-    except_scm = gdbscm_scm_from_gdb_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      except_scm = gdbscm_scm_from_gdb_exception (except);
+    }
+  END_CATCH
 
   if (gdbscm_is_true (except_scm))
     {
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 02b4f8a..508bcb9 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -990,7 +990,6 @@ gdbscm_register_parameter_x (SCM self)
     = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   char *cmd_name;
   struct cmd_list_element **set_list, **show_list;
-  volatile struct gdb_exception except;
 
   if (pascm_is_valid (p_smob))
     scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
@@ -1014,7 +1013,7 @@ gdbscm_register_parameter_x (SCM self)
 		_("parameter exists, \"show\" command is already defined"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       add_setshow_generic (p_smob->type, p_smob->cmd_class,
 			   p_smob->cmd_name, p_smob,
@@ -1026,7 +1025,11 @@ gdbscm_register_parameter_x (SCM self)
 			   set_list, show_list,
 			   &p_smob->set_command, &p_smob->show_command);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Note: At this point the parameter exists in gdb.
      So no more errors after this point.  */
@@ -1063,16 +1066,22 @@ gdbscm_parameter_value (SCM self)
       const char *arg;
       char *newarg;
       int found = -1;
-      volatile struct gdb_exception except;
+      struct gdb_exception except = exception_none;
 
       name = gdbscm_scm_to_host_string (self, NULL, &except_scm);
       if (name == NULL)
 	gdbscm_throw (except_scm);
       newarg = concat ("show ", name, (char *) NULL);
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
 	}
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	  except = ex;
+	}
+      END_CATCH
+
       xfree (name);
       xfree (newarg);
       GDBSCM_HANDLE_GDB_EXCEPTION (except);
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index dcf7d2d..8967b92 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -263,20 +263,23 @@ fputsn_filtered (const char *s, size_t size, struct ui_file *stream)
 static void
 ioscm_write (SCM port, const void *data, size_t size)
 {
-  volatile struct gdb_exception except;
 
   /* If we're called on stdin, punt.  */
   if (scm_is_eq (port, input_port_scm))
     return;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (scm_is_eq (port, error_port_scm))
 	fputsn_filtered (data, size, gdb_stderr);
       else
 	fputsn_filtered (data, size, gdb_stdout);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 }
 
 /* Flush gdb's stdout or stderr.  */
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 82cf96c..860cf8e 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -529,11 +529,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
 			      struct gdbarch *gdbarch,
 			      const struct language_defn *language)
 {
-  volatile struct gdb_exception except;
   SCM result = SCM_BOOL_F;
 
   *out_value = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       int rc;
       pretty_printer_worker_smob *w_smob
@@ -568,6 +567,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
 	    (_("invalid result from pretty-printer to-string"), result);
 	}
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   return result;
 }
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 1891237..99ef928 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -483,14 +483,17 @@ gdbscm_symbol_needs_frame_p (SCM self)
   symbol_smob *s_smob
     = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct symbol *symbol = s_smob->symbol;
-  volatile struct gdb_exception except;
   int result = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = symbol_read_needs_frame (symbol);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (result);
 }
@@ -523,7 +526,6 @@ gdbscm_symbol_value (SCM self, SCM rest)
   frame_smob *f_smob = NULL;
   struct frame_info *frame_info = NULL;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O",
 			      rest, &frame_pos, &frame_scm);
@@ -536,7 +538,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
 				 _("cannot get the value of a typedef"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (f_smob != NULL)
 	{
@@ -550,7 +552,11 @@ gdbscm_symbol_value (SCM self, SCM rest)
 
       value = read_var_value (symbol, frame_info);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (value);
 }
@@ -571,8 +577,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
   int block_arg_pos = -1, domain_arg_pos = -1;
   struct field_of_this_result is_a_field_of_this;
   struct symbol *symbol = NULL;
-  volatile struct gdb_exception except;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
 			      name_scm, &name, rest,
@@ -597,18 +603,28 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
     {
       struct frame_info *selected_frame;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  selected_frame = get_selected_frame (_("no frame selected"));
 	  block = get_frame_block (selected_frame, NULL);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+	}
+      END_CATCH
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -630,8 +646,8 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
   int domain_arg_pos = -1;
   int domain = VAR_DOMAIN;
   struct symbol *symbol = NULL;
-  volatile struct gdb_exception except;
   struct cleanup *cleanups;
+  struct gdb_exception except = exception_none;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
 			      name_scm, &name, rest,
@@ -639,10 +655,16 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
 
   cleanups = make_cleanup (xfree, name);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_global_symbol (name, NULL, domain);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 03f616d..009a2b4 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -590,19 +590,22 @@ gdbscm_find_pc_line (SCM pc_scm)
 {
   ULONGEST pc_ull;
   struct symtab_and_line sal;
-  volatile struct gdb_exception except;
 
   init_sal (&sal); /* -Wall */
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CORE_ADDR pc = (CORE_ADDR) pc_ull;
 
       sal = find_pc_line (pc, 0);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return stscm_scm_from_sal (sal);
 }
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index d21a7ae..fa0c213 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -108,9 +108,8 @@ static char *
 tyscm_type_name (struct type *type, SCM *excp)
 {
   char *name = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *old_chain;
       struct ui_file *stb;
@@ -123,11 +122,12 @@ tyscm_type_name (struct type *type, SCM *excp)
       name = ui_file_xstrdup (stb, NULL);
       do_cleanups (old_chain);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       *excp = gdbscm_scm_from_gdb_exception (except);
       return NULL;
     }
+  END_CATCH
 
   return name;
 }
@@ -239,7 +239,6 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
   type_smob *type1_smob, *type2_smob;
   struct type *type1, *type2;
   int result = 0;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (tyscm_is_type (type1_scm), type1_scm, SCM_ARG1, FUNC_NAME,
 		   type_smob_name);
@@ -250,11 +249,15 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
   type1 = type1_smob->type;
   type2 = type2_smob->type;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = types_deeply_equal (type1, type2);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (result);
 }
@@ -628,12 +631,16 @@ gdbscm_type_sizeof (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       check_typedef (type);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   /* Ignore exceptions.  */
 
   return scm_from_long (TYPE_LENGTH (type));
@@ -648,13 +655,16 @@ gdbscm_type_strip_typedefs (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -665,15 +675,18 @@ gdbscm_type_strip_typedefs (SCM self)
 static struct type *
 tyscm_get_composite (struct type *type)
 {
-  volatile struct gdb_exception except;
 
   for (;;)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  type = check_typedef (type);
 	}
-      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (TYPE_CODE (type) != TYPE_CODE_PTR
 	  && TYPE_CODE (type) != TYPE_CODE_REF)
@@ -702,7 +715,6 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
   struct type *type = t_smob->type;
   long n1, n2 = 0;
   struct type *array = NULL;
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l",
 			      n1_scm, &n1, n2_scm, &n2);
@@ -721,13 +733,17 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
 				 _("Array length must not be negative"));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       array = lookup_array_range_type (type, n1, n2);
       if (is_vector)
 	make_vector_type (array);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (array);
 }
@@ -773,13 +789,16 @@ gdbscm_type_pointer (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_pointer_type (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -832,13 +851,16 @@ gdbscm_type_reference (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_reference_type (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -867,13 +889,16 @@ gdbscm_type_const (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (1, 0, type, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -887,13 +912,16 @@ gdbscm_type_volatile (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 1, type, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -907,13 +935,16 @@ gdbscm_type_unqualified (SCM self)
   type_smob *t_smob
     = tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct type *type = t_smob->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 0, type, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return tyscm_scm_from_type (type);
 }
@@ -1212,9 +1243,8 @@ static struct type *
 tyscm_lookup_typename (const char *type_name, const struct block *block)
 {
   struct type *type = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (startswith (type_name, "struct "))
 	type = lookup_struct (type_name + 7, NULL);
@@ -1226,8 +1256,11 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
 	type = lookup_typename (current_language, get_current_arch (),
 				type_name, block, 0);
     }
-  if (except.reason < 0)
-    return NULL;
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      return NULL;
+    }
+  END_CATCH
 
   return type;
 }
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index cacc55c..b10460d 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -143,7 +143,6 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
   value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
   char *s = NULL;
   struct value_print_options opts;
-  volatile struct gdb_exception except;
 
   if (pstate->writingp)
     gdbscm_printf (port, "#<%s ", value_smob_name);
@@ -157,7 +156,7 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
      instead of writingp.  */
   opts.raw = !!pstate->writingp;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct ui_file *stb = mem_fileopen ();
       struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -167,7 +166,11 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
 
       do_cleanups (old_chain);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (s != NULL)
     {
@@ -192,13 +195,16 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2)
   const value_smob *v1_smob = (value_smob *) SCM_SMOB_DATA (v1);
   const value_smob *v2_smob = (value_smob *) SCM_SMOB_DATA (v2);
   int result = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = value_equal (v1_smob->value, v2_smob->value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (result);
 }
@@ -360,7 +366,6 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
   struct value *value = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   t_smob = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG1, FUNC_NAME);
   type = tyscm_type_smob_type (t_smob);
@@ -372,11 +377,15 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
 
   /* There's no (current) need to wrap this in a TRY_CATCH, but for consistency
      and future-proofing we do.  */
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
   {
     value = value_from_contents_and_address (type, NULL, address);
   }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   result = vlscm_scm_from_value (value);
 
@@ -396,13 +405,16 @@ gdbscm_value_optimized_out_p (SCM self)
     = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct value *value = v_smob->value;
   int opt = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       opt = value_optimized_out (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (opt);
 }
@@ -423,15 +435,18 @@ gdbscm_value_address (SCM self)
       struct cleanup *cleanup
 	= make_cleanup_value_free_to_mark (value_mark ());
       SCM address;
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  res_val = value_addr (value);
 	}
-      if (except.reason < 0)
-	address = SCM_BOOL_F;
-      else
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  address = SCM_BOOL_F;
+	}
+      END_CATCH
+
+      if (res_val != NULL)
 	address = vlscm_scm_from_value (res_val);
 
       do_cleanups (cleanup);
@@ -457,15 +472,18 @@ gdbscm_value_dereference (SCM self)
   SCM result;
   struct value *res_val = NULL;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = value_ind (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   result = vlscm_scm_from_value (res_val);
 
@@ -495,11 +513,10 @@ gdbscm_value_referenced_value (SCM self)
   SCM result;
   struct value *res_val = NULL;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (TYPE_CODE (check_typedef (value_type (value))))
         {
@@ -514,7 +531,11 @@ gdbscm_value_referenced_value (SCM self)
 		   " neither a pointer nor a reference"));
         }
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   result = vlscm_scm_from_value (res_val);
 
@@ -550,12 +571,11 @@ gdbscm_value_dynamic_type (SCM self)
     = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct value *value = v_smob->value;
   struct type *type = NULL;
-  volatile struct gdb_exception except;
 
   if (! SCM_UNBNDP (v_smob->type))
     return v_smob->dynamic_type;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup
 	= make_cleanup_value_free_to_mark (value_mark ());
@@ -594,7 +614,11 @@ gdbscm_value_dynamic_type (SCM self)
 
       do_cleanups (cleanup);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (type == NULL)
     v_smob->dynamic_type = gdbscm_value_type (self);
@@ -619,11 +643,10 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
   SCM result;
   struct value *res_val = NULL;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (op == UNOP_DYNAMIC_CAST)
 	res_val = value_dynamic_cast (type, value);
@@ -635,7 +658,11 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
 	  res_val = value_cast (type, value);
 	}
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -686,7 +713,6 @@ gdbscm_value_field (SCM self, SCM field_scm)
   struct value *res_val = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
 		   _("string"));
@@ -696,13 +722,17 @@ gdbscm_value_field (SCM self, SCM field_scm)
   field = gdbscm_scm_to_c_string (field_scm);
   make_cleanup (xfree, field);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *tmp = value;
 
       res_val = value_struct_elt (&tmp, NULL, field, NULL, NULL);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -730,7 +760,6 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
   struct gdbarch *gdbarch;
   SCM result, except_scm;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -749,7 +778,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
       gdbscm_throw (except_scm);
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *tmp = value;
 
@@ -765,7 +794,11 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
 
       res_val = value_subscript (tmp, value_as_long (index));
    }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -792,13 +825,16 @@ gdbscm_value_call (SCM self, SCM args)
   long args_count;
   struct value **vargs = NULL;
   SCM result = SCM_BOOL_F;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       ftype = check_typedef (value_type (function));
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
 		   SCM_ARG1, FUNC_NAME,
@@ -832,7 +868,7 @@ gdbscm_value_call (SCM self, SCM args)
       gdb_assert (gdbscm_is_true (scm_null_p (args)));
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
       struct value *return_value;
@@ -841,7 +877,11 @@ gdbscm_value_call (SCM self, SCM args)
       result = vlscm_scm_from_value (return_value);
       do_cleanups (cleanup);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (gdbscm_is_exception (result))
     gdbscm_throw (result);
@@ -861,17 +901,20 @@ gdbscm_value_to_bytevector (SCM self)
   size_t length = 0;
   const gdb_byte *contents = NULL;
   SCM bv;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
       length = TYPE_LENGTH (type);
       contents = value_contents (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   bv = scm_c_make_bytevector (length);
   memcpy (SCM_BYTEVECTOR_CONTENTS (bv), contents, length);
@@ -902,27 +945,34 @@ gdbscm_value_to_bool (SCM self)
   struct value *value = v_smob->value;
   struct type *type;
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
 		   _("integer-like gdb value"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (TYPE_CODE (type) == TYPE_CODE_PTR)
 	l = value_as_address (value);
       else
 	l = value_as_long (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_bool (l != 0);
 }
@@ -938,27 +988,34 @@ gdbscm_value_to_integer (SCM self)
   struct value *value = v_smob->value;
   struct type *type;
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
 		   _("integer-like gdb value"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (TYPE_CODE (type) == TYPE_CODE_PTR)
 	l = value_as_address (value);
       else
 	l = value_as_long (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (TYPE_UNSIGNED (type))
     return gdbscm_scm_from_ulongest (l);
@@ -977,24 +1034,31 @@ gdbscm_value_to_real (SCM self)
   struct value *value = v_smob->value;
   struct type *type;
   DOUBLEST d = 0;
-  volatile struct gdb_exception except;
 
   type = value_type (value);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
 		   self, SCM_ARG1, FUNC_NAME, _("number"));
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       d = value_as_double (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* TODO: Is there a better way to check if the value fits?  */
   if (d != (double) d)
@@ -1045,7 +1109,6 @@ gdbscm_value_to_string (SCM self, SCM rest)
   struct type *char_type = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1081,11 +1144,15 @@ gdbscm_value_to_string (SCM self, SCM rest)
   /* We don't assume anything about the result of scm_port_conversion_strategy.
      From this point on, if errors is not 'errors, use 'substitute.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   /* If errors is "error" scm_from_stringn may throw a Scheme exception.
      Make sure we don't leak.  This is done via scm_dynwind_begin, et.al.  */
@@ -1131,7 +1198,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
   int length = -1;
   SCM result = SCM_BOOL_F; /* -Wall */
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1142,7 +1209,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
 
   cleanups = make_cleanup (xfree, encoding);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *inner_cleanup
 	= make_cleanup_value_free_to_mark (value_mark ());
@@ -1155,6 +1222,12 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
 
       do_cleanups (inner_cleanup);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   do_cleanups (cleanups);
   GDBSCM_HANDLE_GDB_EXCEPTION (except);
 
@@ -1184,14 +1257,17 @@ gdbscm_value_fetch_lazy_x (SCM self)
   value_smob *v_smob
     = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct value *value = v_smob->value;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (value_lazy (value))
 	value_fetch_lazy (value);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return SCM_UNSPECIFIED;
 }
@@ -1207,12 +1283,11 @@ gdbscm_value_print (SCM self)
   struct value_print_options opts;
   char *s = NULL;
   SCM result;
-  volatile struct gdb_exception except;
 
   get_user_print_options (&opts);
   opts.deref_ref = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct ui_file *stb = mem_fileopen ();
       struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -1222,7 +1297,11 @@ gdbscm_value_print (SCM self)
 
       do_cleanups (old_chain);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Use SCM_FAILED_CONVERSION_QUESTION_MARK to ensure this doesn't
      throw an error if the encoding fails.
@@ -1246,7 +1325,6 @@ gdbscm_parse_and_eval (SCM expr_scm)
   struct value *res_val = NULL;
   SCM result;
   struct cleanup *cleanups;
-  volatile struct gdb_exception except;
 
   /* The sequencing here, as everywhere else, is important.
      We can't have existing cleanups when a Scheme exception is thrown.  */
@@ -1257,11 +1335,15 @@ gdbscm_parse_and_eval (SCM expr_scm)
   cleanups = make_cleanup_value_free_to_mark (value_mark ());
   make_cleanup (xfree, expr_str);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = parse_and_eval (expr_str);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+    }
+  END_CATCH
 
   gdb_assert (res_val != NULL);
   result = vlscm_scm_from_value (res_val);
@@ -1282,15 +1364,18 @@ gdbscm_history_ref (SCM index)
 {
   int i;
   struct value *res_val = NULL; /* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", index, &i);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = access_value_history (i);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return vlscm_scm_from_value (res_val);
 }
@@ -1304,16 +1389,19 @@ gdbscm_history_append_x (SCM value)
   int res_index = -1;
   struct value *v;
   value_smob *v_smob;
-  volatile struct gdb_exception except;
 
   v_smob = vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME);
   v = v_smob->value;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_index = record_latest_value (v);
     }
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
+    }
+  END_CATCH
 
   return scm_from_int (res_index);
 }
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d15d05a..4d97915 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2049,7 +2049,6 @@ i386_frame_cache_1 (struct frame_info *this_frame,
 static struct i386_frame_cache *
 i386_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct i386_frame_cache *cache;
 
   if (*this_cache)
@@ -2058,15 +2057,16 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = i386_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       i386_frame_cache_1 (this_frame, cache);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
@@ -2216,7 +2216,6 @@ i386_epilogue_frame_sniffer (const struct frame_unwind *self,
 static struct i386_frame_cache *
 i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct i386_frame_cache *cache;
   CORE_ADDR sp;
 
@@ -2226,7 +2225,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   cache = i386_alloc_frame_cache ();
   *this_cache = cache;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       cache->pc = get_frame_func (this_frame);
 
@@ -2240,11 +2239,12 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
@@ -2402,7 +2402,6 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  volatile struct gdb_exception ex;
   struct i386_frame_cache *cache;
   CORE_ADDR addr;
   gdb_byte buf[4];
@@ -2412,7 +2411,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
   cache = i386_alloc_frame_cache ();
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       get_frame_register (this_frame, I386_ESP_REGNUM, buf);
       cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4;
@@ -2436,11 +2435,12 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 
       cache->base_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   *this_cache = cache;
   return cache;
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index adeb659..429cd73 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -50,13 +50,12 @@ inferior_event_handler (enum inferior_event_type event_type,
 	 error status.  If an error occurs while getting an event from
 	 the target, just cancel the current command.  */
       {
-	volatile struct gdb_exception ex;
 
-	TRY_CATCH (ex, RETURN_MASK_ALL)
+	TRY
 	  {
 	    fetch_inferior_event (client_data);
 	  }
-	if (ex.reason < 0)
+	CATCH (ex, RETURN_MASK_ALL)
 	  {
 	    bpstat_clear_actions ();
 	    do_all_intermediate_continuations (1);
@@ -64,6 +63,7 @@ inferior_event_handler (enum inferior_event_type event_type,
 
 	    throw_exception (ex);
 	  }
+	END_CATCH
       }
       break;
 
@@ -111,18 +111,21 @@ inferior_event_handler (enum inferior_event_type event_type,
 	 are only run when the command list is all done.  */
       if (interpreter_async)
 	{
-	  volatile struct gdb_exception e;
 
 	  check_frame_language_change ();
 
 	  /* Don't propagate breakpoint commands errors.  Either we're
 	     stopping or some command resumes the inferior.  The user will
 	     be informed.  */
-	  TRY_CATCH (e, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      bpstat_do_actions ();
 	    }
-	  exception_print (gdb_stderr, e);
+	  CATCH (e, RETURN_MASK_ALL)
+	    {
+	      exception_print (gdb_stderr, e);
+	    }
+	  END_CATCH
 	}
       break;
 
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 350572b..705e377 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -383,7 +383,7 @@ get_function_name (CORE_ADDR funaddr, char *buf, int buf_size)
 static struct gdb_exception
 run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 {
-  volatile struct gdb_exception e;
+  struct gdb_exception caught_error = exception_none;
   int saved_in_infcall = call_thread->control.in_infcall;
   ptid_t call_thread_ptid = call_thread->ptid;
   int saved_sync_execution = sync_execution;
@@ -401,7 +401,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
   /* We want stop_registers, please...  */
   call_thread->control.proceed_to_finish = 1;
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       int was_sync = sync_execution;
 
@@ -423,6 +423,11 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 	    async_disable_stdin ();
 	}
     }
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      caught_error = e;
+    }
+  END_CATCH
 
   /* At this point the current thread may have changed.  Refresh
      CALL_THREAD as it could be invalid if its thread has exited.  */
@@ -435,7 +440,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
      If all error()s out of proceed ended up calling normal_stop
      (and perhaps they should; it already does in the special case
      of error out of resume()), then we wouldn't need this.  */
-  if (e.reason < 0)
+  if (caught_error.reason < 0)
     {
       if (call_thread != NULL)
 	breakpoint_auto_delete (call_thread->control.stop_bpstat);
@@ -446,7 +451,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 
   sync_execution = saved_sync_execution;
 
-  return e;
+  return caught_error;
 }
 
 /* A cleanup function that calls delete_std_terminate_breakpoint.  */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e92b777..0211b5d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -411,7 +411,6 @@ strip_bg_char (const char *args, int *bg_char_p)
 void
 post_create_inferior (struct target_ops *target, int from_tty)
 {
-  volatile struct gdb_exception ex;
 
   /* Be sure we own the terminal in case write operations are performed.  */ 
   target_terminal_ours ();
@@ -426,15 +425,16 @@ post_create_inferior (struct target_ops *target, int from_tty)
      if the PC is unavailable (e.g., we're opening a core file with
      missing registers info), ignore it.  */
   stop_pc = 0;
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       stop_pc = regcache_read_pc (get_current_regcache ());
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   if (exec_bfd)
     {
@@ -1669,19 +1669,21 @@ finish_command_continuation (void *arg, int err)
 
 	  if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
 	    {
-	      volatile struct gdb_exception ex;
 	      struct value *func;
 
 	      func = read_var_value (a->function, get_current_frame ());
-	      TRY_CATCH (ex, RETURN_MASK_ALL)
+	      TRY
 		{
 		  /* print_return_value can throw an exception in some
 		     circumstances.  We need to catch this so that we still
 		     delete the breakpoint.  */
 		  print_return_value (func, value_type);
 		}
-	      if (ex.reason < 0)
-		exception_print (gdb_stdout, ex);
+	      CATCH (ex, RETURN_MASK_ALL)
+		{
+		  exception_print (gdb_stdout, ex);
+		}
+	      END_CATCH
 	    }
 	}
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b8c5d8e..0f8f531 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6030,10 +6030,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 				    struct frame_info *frame,
 				    struct symbol *sym)
 {
-  volatile struct gdb_exception e;
-
-  /* We want to ignore errors here.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       struct symbol *vsym;
       struct value *value;
@@ -6062,6 +6059,11 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 	  inferior_thread ()->control.exception_resume_breakpoint = bp;
 	}
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      /* We want to ignore errors here.  */
+    }
+  END_CATCH
 }
 
 /* A helper for check_exception_resume that sets an
@@ -6102,7 +6104,6 @@ static void
 check_exception_resume (struct execution_control_state *ecs,
 			struct frame_info *frame)
 {
-  volatile struct gdb_exception e;
   struct bound_probe probe;
   struct symbol *func;
 
@@ -6121,7 +6122,7 @@ check_exception_resume (struct execution_control_state *ecs,
   if (!func)
     return;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       const struct block *b;
       struct block_iterator iter;
@@ -6158,6 +6159,10 @@ check_exception_resume (struct execution_control_state *ecs,
 	    }
 	}
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 static void
@@ -6200,7 +6205,6 @@ keep_going (struct execution_control_state *ecs)
     }
   else
     {
-      volatile struct gdb_exception e;
       struct regcache *regcache = get_current_regcache ();
       int remove_bp;
       int remove_wps;
@@ -6240,16 +6244,17 @@ keep_going (struct execution_control_state *ecs)
 	clear_step_over_info ();
 
       /* Stop stepping if inserting breakpoints fails.  */
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  insert_breakpoints ();
 	}
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ERROR)
 	{
 	  exception_print (gdb_stderr, e);
 	  stop_waiting (ecs);
 	  return;
 	}
+      END_CATCH
 
       ecs->event_thread->control.trap_expected = (remove_bp || remove_wps);
 
diff --git a/gdb/jit.c b/gdb/jit.c
index 32a3fc7..e872c8f 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -816,7 +816,6 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
   int status;
   jit_dbg_reader_data priv_data;
   struct gdb_reader_funcs *funcs;
-  volatile struct gdb_exception e;
   struct gdb_symbol_callbacks callbacks =
     {
       jit_object_open_impl,
@@ -839,12 +838,17 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
   gdb_mem = xmalloc (code_entry->symfile_size);
 
   status = 1;
-  TRY_CATCH (e, RETURN_MASK_ALL)
-    if (target_read_memory (code_entry->symfile_addr, gdb_mem,
-                            code_entry->symfile_size))
+  TRY
+    {
+      if (target_read_memory (code_entry->symfile_addr, gdb_mem,
+			      code_entry->symfile_size))
+	status = 0;
+    }
+  CATCH (e, RETURN_MASK_ALL)
+    {
       status = 0;
-  if (e.reason < 0)
-    status = 0;
+    }
+  END_CATCH
 
   if (status)
     {
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 265742d..9ec4a5e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2260,22 +2260,22 @@ parse_linespec (linespec_parser *parser, const char **argptr)
   if (token.type == LSTOKEN_COLON)
     {
       char *user_filename;
-      volatile struct gdb_exception ex;
 
       /* Get the current token again and extract the filename.  */
       token = linespec_lexer_lex_one (parser);
       user_filename = copy_token_string (token);
 
       /* Check if the input is a filename.  */
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  PARSER_RESULT (parser)->file_symtabs
 	    = symtabs_from_filename (user_filename);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  file_exception = ex;
 	}
+      END_CATCH
 
       if (file_exception.reason >= 0)
 	{
@@ -3106,7 +3106,6 @@ find_linespec_symbols (struct linespec_state *state,
   struct cleanup *cleanup;
   char *canon;
   const char *lookup_name;
-  volatile struct gdb_exception except;
 
   cleanup = demangle_for_lookup (name, state->language->la_language,
 				 &lookup_name);
@@ -3194,7 +3193,7 @@ find_linespec_symbols (struct linespec_state *state,
       if (!VEC_empty (symbolp, classes))
 	{
 	  /* Now locate a list of suitable methods named METHOD.  */
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      find_method (state, file_symtabs, klass, method, classes,
 			   symbols, minsyms);
@@ -3202,11 +3201,12 @@ find_linespec_symbols (struct linespec_state *state,
 
 	  /* If successful, we're done.  If NOT_FOUND_ERROR
 	     was not thrown, rethrow the exception that we did get.  */
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      if (except.error != NOT_FOUND_ERROR)
 		throw_exception (except);
 	    }
+	  END_CATCH
 	}
     }
 
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 627280e..22ce842 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1202,16 +1202,15 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
   struct lwp_info *lp;
   int status;
   ptid_t ptid;
-  volatile struct gdb_exception ex;
 
   /* Make sure we report all signals during attach.  */
   linux_nat_pass_signals (ops, 0, NULL);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       linux_ops->to_attach (ops, args, from_tty);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       pid_t pid = parse_pid_to_attach (args);
       struct buffer buffer;
@@ -1232,6 +1231,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
       else
 	throw_error (ex.error, "%s", message);
     }
+  END_CATCH
 
   /* The ptrace base target adds the main thread with (pid,0,0)
      format.  Decorate it with lwp info.  */
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index d9884f3..ea0d4cd 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1545,7 +1545,6 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
   char *note_data = NULL;
   gdb_byte *auxv;
   int auxv_len;
-  volatile struct gdb_exception e;
 
   if (! gdbarch_iterate_over_regset_sections_p (gdbarch))
     return NULL;
@@ -1572,12 +1571,16 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
     }
 
   /* Thread register information.  */
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       update_thread_list ();
     }
-  if (e.reason < 0)
-    exception_print (gdb_stderr, e);
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, e);
+    }
+  END_CATCH
+
   thread_args.gdbarch = gdbarch;
   thread_args.pid = ptid_get_pid (inferior_ptid);
   thread_args.obfd = obfd;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index f7f0d38..0669750 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -611,14 +611,13 @@ enable_thread_event_reporting (void)
 static int
 thread_db_find_new_threads_silently (ptid_t ptid)
 {
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       thread_db_find_new_threads_2 (ptid, 1);
     }
 
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       if (libthread_db_debug)
 	exception_fprintf (gdb_stdlog, except,
@@ -648,6 +647,8 @@ thread_db_find_new_threads_silently (ptid_t ptid)
 	  return 1;
 	}
     }
+  END_CATCH
+
   return 0;
 }
 
@@ -1681,7 +1682,6 @@ static int
 find_new_threads_once (struct thread_db_info *info, int iteration,
 		       td_err_e *errp)
 {
-  volatile struct gdb_exception except;
   struct callback_data data;
   td_err_e err = TD_ERR;
 
@@ -1691,7 +1691,7 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
   /* See comment in thread_db_update_thread_list.  */
   gdb_assert (!target_has_execution || thread_db_use_events ());
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       /* Iterate over all user-space threads to discover new threads.  */
       err = info->td_ta_thr_iter_p (info->thread_agent,
@@ -1705,9 +1705,12 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
 
   if (libthread_db_debug)
     {
-      if (except.reason < 0)
-	exception_fprintf (gdb_stdlog, except,
-			   "Warning: find_new_threads_once: ");
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	  exception_fprintf (gdb_stdlog, except,
+			     "Warning: find_new_threads_once: ");
+	}
+      END_CATCH
 
       fprintf_unfiltered (gdb_stdlog,
 			  _("Found %d new threads in iteration %d.\n"),
diff --git a/gdb/main.c b/gdb/main.c
index 7237d2d..ceca807 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -364,9 +364,7 @@ static int
 catch_command_errors (catch_command_errors_ftype *command,
 		      char *arg, int from_tty)
 {
-  volatile struct gdb_exception e;
-
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       int was_sync = sync_execution;
 
@@ -374,7 +372,13 @@ catch_command_errors (catch_command_errors_ftype *command,
 
       maybe_wait_sync_command_done (was_sync);
     }
-  return handle_command_errors (e);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      return handle_command_errors (e);
+    }
+  END_CATCH
+
+  return 1;
 }
 
 /* Type of the command callback passed to catch_command_errors_const.  */
@@ -387,9 +391,7 @@ static int
 catch_command_errors_const (catch_command_errors_const_ftype *command,
 			    const char *arg, int from_tty)
 {
-  volatile struct gdb_exception e;
-
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       int was_sync = sync_execution;
 
@@ -397,7 +399,13 @@ catch_command_errors_const (catch_command_errors_const_ftype *command,
 
       maybe_wait_sync_command_done (was_sync);
     }
-  return handle_command_errors (e);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      return handle_command_errors (e);
+    }
+  END_CATCH
+
+  return 1;
 }
 
 /* Type of this option.  */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 18a357e..1b863eb 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -537,15 +537,13 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 
   if (arg->val || arg->error)
     {
-      volatile struct gdb_exception except;
+      const char *error_message = NULL;
 
       if (arg->error)
-	except.message = arg->error;
+	error_message = arg->error;
       else
 	{
-	  /* TRY_CATCH has two statements, wrap it in a block.  */
-
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      struct value_print_options opts;
 
@@ -554,10 +552,15 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
 	      common_val_print (arg->val, stb, 0, &opts,
 				language_def (SYMBOL_LANGUAGE (arg->sym)));
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	      error_message = except.message;
+	    }
+	  END_CATCH
 	}
-      if (except.message)
+      if (error_message != NULL)
 	fprintf_filtered (stb, _("<error reading variable: %s>"),
-			  except.message);
+			  error_message);
       ui_out_field_stream (uiout, "value", stb);
     }
 
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index f10b0bb..99ce385 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -808,7 +808,6 @@ mi_breakpoint_created (struct breakpoint *b)
 {
   struct mi_interp *mi = top_level_interpreter_data ();
   struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
-  volatile struct gdb_exception e;
 
   if (mi_suppress_notification.breakpoint)
     return;
@@ -827,8 +826,15 @@ mi_breakpoint_created (struct breakpoint *b)
      breakpoint_created notifications.  So, we use
      ui_out_redirect.  */
   ui_out_redirect (mi_uiout, mi->event_channel);
-  TRY_CATCH (e, RETURN_MASK_ERROR)
-    gdb_breakpoint_query (mi_uiout, b->number, NULL);
+  TRY
+    {
+      gdb_breakpoint_query (mi_uiout, b->number, NULL);
+    }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
+
   ui_out_redirect (mi_uiout, NULL);
 
   gdb_flush (mi->event_channel);
@@ -862,7 +868,6 @@ mi_breakpoint_modified (struct breakpoint *b)
 {
   struct mi_interp *mi = top_level_interpreter_data ();
   struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
-  volatile struct gdb_exception e;
 
   if (mi_suppress_notification.breakpoint)
     return;
@@ -881,8 +886,15 @@ mi_breakpoint_modified (struct breakpoint *b)
      breakpoint_created notifications.  So, we use
      ui_out_redirect.  */
   ui_out_redirect (mi_uiout, mi->event_channel);
-  TRY_CATCH (e, RETURN_MASK_ERROR)
-    gdb_breakpoint_query (mi_uiout, b->number, NULL);
+  TRY
+    {
+      gdb_breakpoint_query (mi_uiout, b->number, NULL);
+    }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
+
   ui_out_redirect (mi_uiout, NULL);
 
   gdb_flush (mi->event_channel);
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 7412f7d..acbdb55 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2080,7 +2080,6 @@ mi_execute_command (const char *cmd, int from_tty)
 {
   char *token;
   struct mi_parse *command = NULL;
-  volatile struct gdb_exception exception;
 
   /* This is to handle EOF (^D). We just quit gdb.  */
   /* FIXME: we should call some API function here.  */
@@ -2089,18 +2088,19 @@ mi_execute_command (const char *cmd, int from_tty)
 
   target_log_command (cmd);
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
+  TRY
     {
       command = mi_parse (cmd, &token);
     }
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ALL)
     {
       mi_print_exception (token, exception);
       xfree (token);
     }
-  else
+  END_CATCH
+
+  if (command != NULL)
     {
-      volatile struct gdb_exception result;
       ptid_t previous_ptid = inferior_ptid;
 
       command->token = token;
@@ -2112,17 +2112,18 @@ mi_execute_command (const char *cmd, int from_tty)
 	  timestamp (command->cmd_start);
 	}
 
-      TRY_CATCH (result, RETURN_MASK_ALL)
+      TRY
 	{
 	  captured_mi_execute_command (current_uiout, command);
 	}
-      if (result.reason < 0)
+      CATCH (result, RETURN_MASK_ALL)
 	{
 	  /* The command execution failed and error() was called
 	     somewhere.  */
 	  mi_print_exception (command->token, result);
 	  mi_out_rewind (current_uiout);
 	}
+      END_CATCH
 
       bpstat_do_actions ();
 
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 043f98b..a66ff44 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -725,7 +725,6 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
       const char *basename = type_name_no_tag (baseclass);
       const gdb_byte *base_valaddr = NULL;
       int thisoffset;
-      volatile struct gdb_exception ex;
       int skip = 0;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
@@ -745,17 +744,18 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 
       thisoffset = offset;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  boffset = baseclass_offset (type, i, valaddr, offset, address, val);
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    skip = -1;
 	  else
 	    skip = 1;
 	}
+      END_CATCH
 
       if (skip == 0)
 	{
diff --git a/gdb/parse.c b/gdb/parse.c
index 09fb0b3..ec23dbb 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1133,7 +1133,6 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
 			const struct block *block,
 			int comma, int void_context_p, int *out_subexp)
 {
-  volatile struct gdb_exception except;
   struct cleanup *old_chain, *inner_chain;
   const struct language_defn *lang = NULL;
   struct parser_state ps;
@@ -1215,12 +1214,12 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
   inner_chain = make_cleanup_restore_current_language ();
   set_language (lang->la_language);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (lang->la_parser (&ps))
         lang->la_error (NULL);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       if (! parse_completion)
 	{
@@ -1228,6 +1227,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
 	  throw_exception (except);
 	}
     }
+  END_CATCH
 
   reallocate_expout (&ps);
 
@@ -1283,17 +1283,17 @@ parse_expression_for_completion (const char *string, char **name,
   struct expression *exp = NULL;
   struct value *val;
   int subexp;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       parse_completion = 1;
       exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       /* Nothing, EXP remains NULL.  */
     }
+  END_CATCH
 
   parse_completion = 0;
   if (exp == NULL)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 6c6eacf..3afbff2 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1231,9 +1231,8 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
   if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
     {
       struct target_ops *target = &current_target;
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  /* We do not call target_translate_tls_address here, because
 	     svr4_fetch_objfile_link_map may invalidate the frame chain,
@@ -1248,8 +1247,11 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
 	  spe_context_cache_ptid = inferior_ptid;
 	}
 
-      if (ex.reason < 0)
-	return 0;
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  return 0;
+	}
+      END_CATCH
     }
 
   /* Read variable value.  */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index cdbed30..05c68a0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1692,15 +1692,14 @@ do_one_display (struct display *d)
 
   if (d->exp == NULL)
     {
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  innermost_block = NULL;
 	  d->exp = parse_expression (d->exp_string);
 	  d->block = innermost_block;
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  /* Can't re-parse the expression.  Disable this display item.  */
 	  d->enabled_p = 0;
@@ -1708,6 +1707,7 @@ do_one_display (struct display *d)
 		   d->exp_string, ex.message);
 	  return;
 	}
+      END_CATCH
     }
 
   if (d->block)
@@ -1731,7 +1731,6 @@ do_one_display (struct display *d)
   printf_filtered (": ");
   if (d->format.size)
     {
-      volatile struct gdb_exception ex;
 
       annotate_display_format ();
 
@@ -1755,7 +1754,7 @@ do_one_display (struct display *d)
 
       annotate_display_value ();
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
         {
 	  struct value *val;
 	  CORE_ADDR addr;
@@ -1766,13 +1765,15 @@ do_one_display (struct display *d)
 	    addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
 	  do_examine (d->format, d->exp->gdbarch, addr);
 	}
-      if (ex.reason < 0)
-	fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
+	}
+      END_CATCH
     }
   else
     {
       struct value_print_options opts;
-      volatile struct gdb_exception ex;
 
       annotate_display_format ();
 
@@ -1791,15 +1792,19 @@ do_one_display (struct display *d)
       get_formatted_print_options (&opts, d->format.format);
       opts.raw = d->format.raw;
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
         {
 	  struct value *val;
 
 	  val = evaluate_expression (d->exp);
 	  print_formatted (val, d->format.size, &opts, gdb_stdout);
 	}
-      if (ex.reason < 0)
-	fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+	}
+      END_CATCH
+
       printf_filtered ("\n");
     }
 
@@ -1975,13 +1980,12 @@ print_variable_and_value (const char *name, struct symbol *var,
 			  struct frame_info *frame,
 			  struct ui_file *stream, int indent)
 {
-  volatile struct gdb_exception except;
 
   if (!name)
     name = SYMBOL_PRINT_NAME (var);
 
   fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       struct value *val;
       struct value_print_options opts;
@@ -1995,9 +1999,13 @@ print_variable_and_value (const char *name, struct symbol *var,
 	 function.  */
       frame = NULL;
     }
-  if (except.reason < 0)
-    fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
-		     except.message);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
+		       except.message);
+    }
+  END_CATCH
+
   fprintf_filtered (stream, "\n");
 }
 
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index 49c654b..4fece39 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -199,7 +199,6 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
       char *as = NULL;
       struct ui_file *memfile = mem_fileopen ();
       PyObject *insn_dict = PyDict_New ();
-      volatile struct gdb_exception except;
 
       if (insn_dict == NULL)
         {
@@ -217,11 +216,11 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
           return NULL;  /* PyList_Append Sets the exception.  */
         }
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
         {
           insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
         }
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
         {
           Py_DECREF (result_list);
           ui_file_delete (memfile);
@@ -229,6 +228,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
 	  gdbpy_convert_exception (except);
 	  return NULL;
         }
+      END_CATCH
 
       as = ui_file_xstrdup (memfile, NULL);
       if (PyDict_SetItemString (insn_dict, "addr",
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index fb6a6b6..6c0f5cb 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -373,19 +373,22 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
   gdb_py_ulongest pc;
   const struct block *block = NULL;
   struct compunit_symtab *cust = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       cust = find_pc_compunit_symtab (pc);
 
       if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
 	block = block_for_pc (pc);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
     {
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 7807e4e..dcf1d5a 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -114,7 +114,6 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   int cmp;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -136,14 +135,18 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
   if (cmp < 0)
     return -1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (cmp == 1)
 	enable_breakpoint (self_bp->bp);
       else
 	disable_breakpoint (self_bp->bp);
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return 0;
 }
@@ -227,7 +230,6 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   long id;
   int valid_id = 0;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -242,11 +244,15 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
       if (! gdb_py_int_as_long (newvalue, &id))
 	return -1;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  valid_id = valid_task_id (id);
 	}
-      GDB_PY_SET_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_SET_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (! valid_id)
 	{
@@ -278,15 +284,18 @@ static PyObject *
 bppy_delete_breakpoint (PyObject *self, PyObject *args)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
-  volatile struct gdb_exception except;
 
   BPPY_REQUIRE_VALID (self_bp);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       delete_breakpoint (self_bp->bp);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -298,7 +307,6 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   long value;
-  volatile struct gdb_exception except;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -321,11 +329,15 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
   if (value < 0)
     value = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_ignore_count (self_bp->number, (int) value, 0);
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return 0;
 }
@@ -429,7 +441,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
 {
   char *exp;
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -448,10 +460,15 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
 	return -1;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       set_breakpoint_condition (self_bp->bp, exp, 0);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
 
   if (newvalue != Py_None)
     xfree (exp);
@@ -468,7 +485,6 @@ bppy_get_commands (PyObject *self, void *closure)
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   struct breakpoint *bp = self_bp->bp;
   long length;
-  volatile struct gdb_exception except;
   struct ui_file *string_file;
   struct cleanup *chain;
   PyObject *result;
@@ -483,17 +499,18 @@ bppy_get_commands (PyObject *self, void *closure)
   chain = make_cleanup_ui_file_delete (string_file);
 
   ui_out_redirect (current_uiout, string_file);
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
   ui_out_redirect (current_uiout, NULL);
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       do_cleanups (chain);
       gdbpy_convert_exception (except);
       return NULL;
     }
+  END_CATCH
 
   cmdstr = ui_file_xstrdup (string_file, &length);
   make_cleanup (xfree, cmdstr);
@@ -619,7 +636,6 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   PyObject *temporary = NULL;
   int internal_bp = 0;
   int temporary_bp = 0;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiOO", keywords,
 				     &spec, &type, &access_type,
@@ -644,7 +660,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   bppy_pending_object->number = -1;
   bppy_pending_object->bp = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       char *copy = xstrdup (spec);
       struct cleanup *cleanup = make_cleanup (xfree, copy);
@@ -681,13 +697,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 
       do_cleanups (cleanup);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       PyErr_Format (except.reason == RETURN_QUIT
 		    ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
 		    "%s", except.message);
       return -1;
     }
+  END_CATCH
 
   BPPY_SET_REQUIRE_VALID ((gdbpy_breakpoint_object *) self);
   return 0;
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index a5e96d6..1d89912 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -537,7 +537,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
   int cmdtype;
   int completetype = -1;
   char *docstring = NULL;
-  volatile struct gdb_exception except;
   struct cmd_list_element **cmd_list;
   char *cmd_name, *pfx_name;
   static char *keywords[] = { "name", "command_class", "completer_class",
@@ -637,7 +636,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 
   Py_INCREF (self);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cmd_list_element *cmd;
 
@@ -668,7 +667,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 	set_cmd_completer_handle_brkchars (cmd,
 					   cmdpy_completer_handle_brkchars);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (cmd_name);
       xfree (docstring);
@@ -679,6 +678,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 		    "%s", except.message);
       return -1;
     }
+  END_CATCH
+
   return 0;
 }
 
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 43f6807..34e9643 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -93,7 +93,6 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
 {
   struct finish_breakpoint_object *self_finishbp =
         (struct finish_breakpoint_object *) bp_obj;
-  volatile struct gdb_exception except;
 
   /* Can compute return_value only once.  */
   gdb_assert (!self_finishbp->return_value);
@@ -101,7 +100,7 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
   if (!self_finishbp->return_type)
     return;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *function =
         value_object_to_value (self_finishbp->function_value);
@@ -121,11 +120,12 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
           self_finishbp->return_value = Py_None;
         }
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       gdbpy_print_stack ();
     }
+  END_CATCH
 }
 
 /* Triggered when gdbpy_should_stop has triggered the `stop' callback
@@ -134,19 +134,19 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
 void
 bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
 {
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Can't delete it here, but it will be removed at the next stop.  */
       disable_breakpoint (bp_obj->bp);
       gdb_assert (bp_obj->bp->disposition == disp_del);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       gdbpy_print_stack ();
     }
+  END_CATCH
 }
 
 /* Python function to create a new breakpoint.  */
@@ -166,7 +166,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   PyObject *internal = NULL;
   int internal_bp = 0;
   CORE_ADDR finish_pc, pc;
-  volatile struct gdb_exception except;
   char *addr_str, small_buf[100];
   struct symbol *function;
 
@@ -174,7 +173,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
                                     &frame_obj, &internal))
     return -1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Default frame to newest frame if necessary.  */
       if (frame_obj == NULL)
@@ -212,12 +211,14 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 	    }
 	}
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       return -1;
     }
-  else if (PyErr_Occurred ())
+  END_CATCH
+
+  if (PyErr_Occurred ())
     return -1;
 
   thread = pid_to_thread_id (inferior_ptid);
@@ -243,7 +244,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   self_bpfinish->return_type = NULL;
   self_bpfinish->function_value = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (get_frame_pc_if_available (frame, &pc))
         {
@@ -269,11 +270,12 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
             }
         }
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       /* Just swallow.  Either the return type or the function value
 	 remain NULL.  */
     }
+  END_CATCH
 
   if (self_bpfinish->return_type == NULL || self_bpfinish->function_value == NULL)
     {
@@ -289,7 +291,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   bppy_pending_object->number = -1;
   bppy_pending_object->bp = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Set a breakpoint on the return address.  */
       finish_pc = get_frame_pc (prev_frame);
@@ -306,7 +308,11 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
                          &bkpt_breakpoint_ops,
                          0, 1, internal_bp, 0);
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   self_bpfinish->py_bp.bp->frame_id = frame_id;
   self_bpfinish->py_bp.is_finish_bp = 1;
@@ -347,7 +353,6 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
 static int
 bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
 {
-  volatile struct gdb_exception except;
   struct breakpoint *bp_stopped = (struct breakpoint *) args;
   PyObject *py_bp = (PyObject *) b->py_bp_object;
   struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
@@ -362,18 +367,19 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
       /* Check scope if not currently stopped at the FinishBreakpoint.  */
       if (b != bp_stopped)
         {
-          TRY_CATCH (except, RETURN_MASK_ALL)
+          TRY
             {
               if (b->pspace == current_inferior ()->pspace
                   && (!target_has_registers
                       || frame_find_by_id (b->frame_id) == NULL))
                 bpfinishpy_out_of_scope (finish_bp);
             }
-          if (except.reason < 0)
+          CATCH (except, RETURN_MASK_ALL)
             {
               gdbpy_convert_exception (except);
               gdbpy_print_stack ();
             }
+	  END_CATCH
         }
     }
 
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 9ef8608..cd6e859 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -101,13 +101,16 @@ static PyObject *
 frapy_is_valid (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = frame_object_to_frame_info (self);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (frame == NULL)
     Py_RETURN_FALSE;
@@ -125,19 +128,19 @@ frapy_name (PyObject *self, PyObject *args)
   char *name = NULL;
   enum language lang;
   PyObject *result;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       find_frame_funname (frame, &name, &lang, NULL);
     }
-
-  if (except.reason < 0)
-    xfree (name);
-
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      xfree (name);
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (name)
     {
@@ -161,15 +164,18 @@ frapy_type (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       type = get_frame_type (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return PyInt_FromLong (type);
 }
@@ -182,13 +188,16 @@ frapy_arch (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;    /* Initialize to appease gcc warning.  */
   frame_object *obj = (frame_object *) self;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdbarch_to_arch_object (obj->gdbarch);
 }
@@ -200,14 +209,17 @@ static PyObject *
 frapy_unwind_stop_reason (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;    /* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
   enum unwind_stop_reason stop_reason;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   stop_reason = get_frame_unwind_stop_reason (frame);
 
@@ -222,15 +234,18 @@ frapy_pc (PyObject *self, PyObject *args)
 {
   CORE_ADDR pc = 0;	      /* Initialize to appease gcc warning.  */
   struct frame_info *frame;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       pc = get_frame_pc (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdb_py_long_from_ulongest (pc);
 }
@@ -241,14 +256,13 @@ frapy_pc (PyObject *self, PyObject *args)
 static PyObject *
 frapy_read_register (PyObject *self, PyObject *args)
 {
-  volatile struct gdb_exception except;
   const char *regnum_str;
   struct value *val = NULL;
 
   if (!PyArg_ParseTuple (args, "s", &regnum_str))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct frame_info *frame;
       int regnum;
@@ -264,7 +278,11 @@ frapy_read_register (PyObject *self, PyObject *args)
       if (val == NULL)
         PyErr_SetString (PyExc_ValueError, _("Unknown register."));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return val == NULL ? NULL : value_to_value_object (val);
 }
@@ -277,14 +295,17 @@ frapy_block (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   const struct block *block = NULL, *fn_block;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
       block = get_frame_block (frame, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   for (fn_block = block;
        fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
@@ -316,15 +337,18 @@ frapy_function (PyObject *self, PyObject *args)
 {
   struct symbol *sym = NULL;
   struct frame_info *frame;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       sym = find_pc_function (get_frame_address_in_block (frame));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (sym)
     return symbol_to_symbol_object (sym);
@@ -339,13 +363,12 @@ PyObject *
 frame_info_to_frame_object (struct frame_info *frame)
 {
   frame_object *frame_obj;
-  volatile struct gdb_exception except;
 
   frame_obj = PyObject_New (frame_object, &frame_object_type);
   if (frame_obj == NULL)
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
 
       /* Try to get the previous frame, to determine if this is the last frame
@@ -365,12 +388,14 @@ frame_info_to_frame_object (struct frame_info *frame)
 	}
       frame_obj->gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       Py_DECREF (frame_obj);
       gdbpy_convert_exception (except);
       return NULL;
     }
+  END_CATCH
+
   return (PyObject *) frame_obj;
 }
 
@@ -382,16 +407,19 @@ static PyObject *
 frapy_older (PyObject *self, PyObject *args)
 {
   struct frame_info *frame, *prev = NULL;
-  volatile struct gdb_exception except;
   PyObject *prev_obj = NULL;   /* Initialize to appease gcc warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       prev = get_prev_frame (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (prev)
     prev_obj = (PyObject *) frame_info_to_frame_object (prev);
@@ -412,16 +440,19 @@ static PyObject *
 frapy_newer (PyObject *self, PyObject *args)
 {
   struct frame_info *frame, *next = NULL;
-  volatile struct gdb_exception except;
   PyObject *next_obj = NULL;   /* Initialize to appease gcc warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       next = get_next_frame (frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (next)
     next_obj = (PyObject *) frame_info_to_frame_object (next);
@@ -442,17 +473,20 @@ frapy_find_sal (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   struct symtab_and_line sal;
-  volatile struct gdb_exception except;
   PyObject *sal_obj = NULL;   /* Initialize to appease gcc warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       find_frame_sal (frame, &sal);
       sal_obj = symtab_and_line_to_sal_object (sal);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return sal_obj;
 }
@@ -471,7 +505,6 @@ frapy_read_var (PyObject *self, PyObject *args)
   PyObject *sym_obj, *block_obj = NULL;
   struct symbol *var = NULL;	/* gcc-4.3.2 false warning.  */
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "O|O", &sym_obj, &block_obj))
     return NULL;
@@ -483,7 +516,6 @@ frapy_read_var (PyObject *self, PyObject *args)
       char *var_name;
       const struct block *block = NULL;
       struct cleanup *cleanup;
-      volatile struct gdb_exception except;
 
       var_name = python_string_to_target_string (sym_obj);
       if (!var_name)
@@ -502,7 +534,7 @@ frapy_read_var (PyObject *self, PyObject *args)
 	    }
 	}
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  FRAPY_REQUIRE_VALID (self, frame);
 
@@ -510,12 +542,13 @@ frapy_read_var (PyObject *self, PyObject *args)
 	    block = get_frame_block (frame, NULL);
 	  var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  do_cleanups (cleanup);
 	  gdbpy_convert_exception (except);
 	  return NULL;
 	}
+      END_CATCH
 
       if (!var)
 	{
@@ -535,13 +568,17 @@ frapy_read_var (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, frame);
 
       val = read_var_value (var, frame);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
@@ -552,15 +589,18 @@ static PyObject *
 frapy_select (PyObject *self, PyObject *args)
 {
   struct frame_info *fi;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       FRAPY_REQUIRE_VALID (self, fi);
 
       select_frame (fi);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -572,13 +612,16 @@ PyObject *
 gdbpy_newest_frame (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_current_frame ();
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frame_info_to_frame_object (frame);
 }
@@ -590,13 +633,16 @@ PyObject *
 gdbpy_selected_frame (PyObject *self, PyObject *args)
 {
   struct frame_info *frame = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       frame = get_selected_frame ("No frame is currently selected.");
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return frame_info_to_frame_object (frame);
 }
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 5531d2b..e3336b1 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -201,9 +201,8 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
 static enum ext_lang_bt_status
 py_print_type (struct ui_out *out, struct value *val)
 {
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct type *type;
       struct ui_file *stb;
@@ -216,11 +215,12 @@ py_print_type (struct ui_out *out, struct value *val)
       ui_out_field_stream (out, "type", stb);
       do_cleanups (cleanup);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       return EXT_LANG_BT_ERROR;
     }
+  END_CATCH
 
   return EXT_LANG_BT_OK;
 }
@@ -242,7 +242,6 @@ py_print_value (struct ui_out *out, struct value *val,
 		const struct language_defn *language)
 {
   int should_print = 0;
-  volatile struct gdb_exception except;
   int local_indent = (4 * indent);
 
   /* Never set an indent level for common_val_print if MI.  */
@@ -257,15 +256,16 @@ py_print_value (struct ui_out *out, struct value *val,
     {
       struct type *type = NULL;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  type = check_typedef (value_type (val));
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
 
       if (args_type == MI_PRINT_ALL_VALUES)
 	should_print = 1;
@@ -280,7 +280,7 @@ py_print_value (struct ui_out *out, struct value *val,
 
   if (should_print)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  struct ui_file *stb;
 	  struct cleanup *cleanup;
@@ -291,11 +291,12 @@ py_print_value (struct ui_out *out, struct value *val,
 	  ui_out_field_stream (out, "value", stb);
 	  do_cleanups (cleanup);
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  gdbpy_convert_exception (except);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
     }
 
   return EXT_LANG_BT_OK;
@@ -363,7 +364,6 @@ py_print_single_arg (struct ui_out *out,
 		     const struct language_defn *language)
 {
   struct value *val;
-  volatile struct gdb_exception except;
   enum ext_lang_bt_status retval = EXT_LANG_BT_OK;
 
   if (fa != NULL)
@@ -376,7 +376,7 @@ py_print_single_arg (struct ui_out *out,
   else
     val = fv;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
 
@@ -473,8 +473,11 @@ py_print_single_arg (struct ui_out *out,
 
       do_cleanups (cleanups);
     }
-  if (except.reason < 0)
-    gdbpy_convert_exception (except);
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      gdbpy_convert_exception (except);
+    }
+  END_CATCH
 
   return retval;
 }
@@ -499,7 +502,6 @@ enumerate_args (PyObject *iter,
 {
   PyObject *item;
   struct value_print_options opts;
-  volatile struct gdb_exception except;
 
   get_user_print_options (&opts);
 
@@ -511,15 +513,16 @@ enumerate_args (PyObject *iter,
 
   opts.deref_ref = 1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       annotate_frame_args ();
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto error;
     }
+  END_CATCH
 
   /*  Collect the first argument outside of the loop, so output of
       commas in the argument output is correct.  At the end of the
@@ -578,16 +581,17 @@ enumerate_args (PyObject *iter,
 	      goto error;
 	    }
 
-	  TRY_CATCH (except, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      read_frame_arg (sym, frame, &arg, &entryarg);
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ALL)
 	    {
 	      xfree (sym_name);
 	      gdbpy_convert_exception (except);
 	      goto error;
 	    }
+	  END_CATCH
 
 	  /* The object has not provided a value, so this is a frame
 	     argument to be read by GDB.  In this case we have to
@@ -612,12 +616,12 @@ enumerate_args (PyObject *iter,
 	    {
 	      if (arg.entry_kind != print_entry_values_only)
 		{
-		  TRY_CATCH (except, RETURN_MASK_ALL)
+		  TRY
 		    {
 		      ui_out_text (out, ", ");
 		      ui_out_wrap_hint (out, "    ");
 		    }
-		  if (except.reason < 0)
+		  CATCH (except, RETURN_MASK_ALL)
 		    {
 		      xfree (arg.error);
 		      xfree (entryarg.error);
@@ -625,6 +629,7 @@ enumerate_args (PyObject *iter,
 		      gdbpy_convert_exception (except);
 		      goto error;
 		    }
+		  END_CATCH
 		}
 
 	      if (py_print_single_arg (out, NULL, &entryarg, NULL, &opts,
@@ -664,30 +669,32 @@ enumerate_args (PyObject *iter,
       item = PyIter_Next (iter);
       if (item != NULL)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      ui_out_text (out, ", ");
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ALL)
 	    {
 	      Py_DECREF (item);
 	      gdbpy_convert_exception (except);
 	      goto error;
 	    }
+	  END_CATCH
 	}
       else if (PyErr_Occurred ())
 	goto error;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  annotate_arg_end ();
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  Py_DECREF (item);
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
     }
 
   return EXT_LANG_BT_OK;
@@ -729,7 +736,6 @@ enumerate_locals (PyObject *iter,
       struct value *val;
       enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
       struct symbol *sym;
-      volatile struct gdb_exception except;
       int local_indent = 8 + (8 * indent);
       struct cleanup *locals_cleanups;
 
@@ -761,16 +767,17 @@ enumerate_locals (PyObject *iter,
       /* If the object did not provide a value, read it.  */
       if (val == NULL)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      val = read_var_value (sym, frame);
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      gdbpy_convert_exception (except);
 	      do_cleanups (locals_cleanups);
 	      goto error;
 	    }
+	  END_CATCH
 	}
 
       /* With PRINT_NO_VALUES, MI does not emit a tuple normally as
@@ -781,7 +788,7 @@ enumerate_locals (PyObject *iter,
 	  if (print_args_field || args_type != NO_VALUES)
 	    make_cleanup_ui_out_tuple_begin_end (out, NULL);
 	}
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  if (! ui_out_is_mi_like_p (out))
 	    {
@@ -794,12 +801,13 @@ enumerate_locals (PyObject *iter,
 	  if (! ui_out_is_mi_like_p (out))
 	    ui_out_text (out, " = ");
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  gdbpy_convert_exception (except);
 	  do_cleanups (locals_cleanups);
 	  goto error;
 	}
+      END_CATCH
 
       if (args_type == MI_PRINT_SIMPLE_VALUES)
 	{
@@ -838,15 +846,16 @@ enumerate_locals (PyObject *iter,
 
       do_cleanups (locals_cleanups);
 
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  ui_out_text (out, "\n");
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  gdbpy_convert_exception (except);
 	  goto error;
 	}
+      END_CATCH
     }
 
   if (item == NULL && PyErr_Occurred ())
@@ -947,40 +956,41 @@ py_print_args (PyObject *filter,
 {
   PyObject *args_iter  = get_py_iter_from_func (filter, "frame_args");
   struct cleanup *old_chain = make_cleanup_py_xdecref (args_iter);
-  volatile struct gdb_exception except;
 
   if (args_iter == NULL)
     goto args_error;
 
   make_cleanup_ui_out_list_begin_end (out, "args");
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       annotate_frame_args ();
       if (! ui_out_is_mi_like_p (out))
 	ui_out_text (out, " (");
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto args_error;
     }
+  END_CATCH
 
   if (args_iter != Py_None)
     if (enumerate_args (args_iter, out, args_type, 0, frame)
 	== EXT_LANG_BT_ERROR)
       goto args_error;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (! ui_out_is_mi_like_p (out))
 	ui_out_text (out, ")");
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       gdbpy_convert_exception (except);
       goto args_error;
     }
+  END_CATCH
 
   do_cleanups (old_chain);
   return EXT_LANG_BT_OK;
@@ -1018,7 +1028,6 @@ py_print_frame (PyObject *filter, int flags,
   struct value_print_options opts;
   PyObject *py_inf_frame;
   int print_level, print_frame_info, print_args, print_locals;
-  volatile struct gdb_exception except;
 
   /* Extract print settings from FLAGS.  */
   print_level = (flags & PRINT_LEVEL) ? 1 : 0;
@@ -1042,15 +1051,16 @@ py_print_frame (PyObject *filter, int flags,
   if (frame == NULL)
     return EXT_LANG_BT_ERROR;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       gdbpy_convert_exception (except);
       return EXT_LANG_BT_ERROR;
     }
+  END_CATCH
 
   /* stack-list-variables.  */
   if (print_locals && print_args && ! print_frame_info)
@@ -1074,16 +1084,17 @@ py_print_frame (PyObject *filter, int flags,
 	 and are printed with indention.  */
       if (indent > 0)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      ui_out_spaces (out, indent*4);
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      gdbpy_convert_exception (except);
 	      do_cleanups (cleanup_stack);
 	      return EXT_LANG_BT_ERROR;
 	    }
+	  END_CATCH
 	}
 
       /* The address is required for frame annotations, and also for
@@ -1113,11 +1124,10 @@ py_print_frame (PyObject *filter, int flags,
     {
       struct frame_info **slot;
       int level;
-      volatile struct gdb_exception except;
 
       slot = (struct frame_info **) htab_find_slot (levels_printed,
 						    frame, INSERT);
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  level = frame_relative_level (frame);
 
@@ -1137,12 +1147,13 @@ py_print_frame (PyObject *filter, int flags,
 				    level);
 	    }
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  gdbpy_convert_exception (except);
 	  do_cleanups (cleanup_stack);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
     }
 
   if (print_frame_info)
@@ -1151,19 +1162,20 @@ py_print_frame (PyObject *filter, int flags,
 	 print nothing.  */
       if (opts.addressprint && has_addr)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      annotate_frame_address ();
 	      ui_out_field_core_addr (out, "addr", gdbarch, address);
 	      annotate_frame_address_end ();
 	      ui_out_text (out, " in ");
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      gdbpy_convert_exception (except);
 	      do_cleanups (cleanup_stack);
 	      return EXT_LANG_BT_ERROR;
 	    }
+	  END_CATCH
 	}
 
       /* Print frame function name.  */
@@ -1218,7 +1230,7 @@ py_print_frame (PyObject *filter, int flags,
 	      return EXT_LANG_BT_ERROR;
 	    }
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      annotate_frame_function_name ();
 	      if (function == NULL)
@@ -1226,12 +1238,14 @@ py_print_frame (PyObject *filter, int flags,
 	      else
 		ui_out_field_string (out, "func", function);
 	    }
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      gdbpy_convert_exception (except);
 	      do_cleanups (cleanup_stack);
 	      return EXT_LANG_BT_ERROR;
 	    }
+	  END_CATCH
+
 	  do_cleanups (py_func_cleanup);
 	}
     }
@@ -1251,16 +1265,17 @@ py_print_frame (PyObject *filter, int flags,
   /* File name/source/line number information.  */
   if (print_frame_info)
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  annotate_frame_source_begin ();
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  gdbpy_convert_exception (except);
 	  do_cleanups (cleanup_stack);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
 
       if (PyObject_HasAttrString (filter, "filename"))
 	{
@@ -1285,7 +1300,7 @@ py_print_frame (PyObject *filter, int flags,
 		}
 
 	      make_cleanup (xfree, filename);
-	      TRY_CATCH (except, RETURN_MASK_ERROR)
+	      TRY
 		{
 		  ui_out_wrap_hint (out, "   ");
 		  ui_out_text (out, " at ");
@@ -1293,12 +1308,13 @@ py_print_frame (PyObject *filter, int flags,
 		  ui_out_field_string (out, "file", filename);
 		  annotate_frame_source_file_end ();
 		}
-	      if (except.reason < 0)
+	      CATCH (except, RETURN_MASK_ERROR)
 		{
 		  gdbpy_convert_exception (except);
 		  do_cleanups (cleanup_stack);
 		  return EXT_LANG_BT_ERROR;
 		}
+	      END_CATCH
 	    }
 	  do_cleanups (py_fn_cleanup);
 	}
@@ -1319,18 +1335,19 @@ py_print_frame (PyObject *filter, int flags,
 	  if (py_line != Py_None)
 	    {
 	      line = PyLong_AsLong (py_line);
-	      TRY_CATCH (except, RETURN_MASK_ERROR)
+	      TRY
 		{
 		  ui_out_text (out, ":");
 		  annotate_frame_source_line ();
 		  ui_out_field_int (out, "line", line);
 		}
-	      if (except.reason < 0)
+	      CATCH (except, RETURN_MASK_ERROR)
 		{
 		  gdbpy_convert_exception (except);
 		  do_cleanups (cleanup_stack);
 		  return EXT_LANG_BT_ERROR;
 		}
+	      END_CATCH
 	    }
 	  do_cleanups (py_line_cleanup);
 	}
@@ -1340,17 +1357,18 @@ py_print_frame (PyObject *filter, int flags,
      elided frames, so if MI output detected do not send newline.  */
   if (! ui_out_is_mi_like_p (out))
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  annotate_frame_end ();
 	  ui_out_text (out, "\n");
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  gdbpy_convert_exception (except);
 	  do_cleanups (cleanup_stack);
 	  return EXT_LANG_BT_ERROR;
 	}
+      END_CATCH
     }
 
   if (print_locals)
@@ -1503,22 +1521,22 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
   struct cleanup *cleanups;
   enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
   PyObject *iterable;
-  volatile struct gdb_exception except;
   PyObject *item;
   htab_t levels_printed;
 
   if (!gdb_python_initialized)
     return EXT_LANG_BT_NO_FILTERS;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       gdbarch = get_frame_arch (frame);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       /* Let gdb try to print the stack trace.  */
       return EXT_LANG_BT_NO_FILTERS;
     }
+  END_CATCH
 
   cleanups = ensure_python_env (gdbarch, current_language);
 
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index 7a5c853..0cf4dfd 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -37,18 +37,18 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
 {
   int n;
   char *p = NULL, *q;
-  volatile struct gdb_exception except;
-
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    p = command_line_input (prompt, 0, "python");
-
-  /* Detect user interrupt (Ctrl-C).  */
-  if (except.reason == RETURN_QUIT)
-    return NULL;
 
+  TRY
+    {
+      p = command_line_input (prompt, 0, "python");
+    }
   /* Handle errors by raising Python exceptions.  */
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
+      /* Detect user interrupt (Ctrl-C).  */
+      if (except.reason == RETURN_QUIT)
+	return NULL;
+
       /* The thread state is nulled during gdbpy_readline_wrapper,
 	 with the original value saved in the following undocumented
 	 variable (see Python's Parser/myreadline.c and
@@ -58,6 +58,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
       PyEval_SaveThread ();
       return NULL;
     }
+  END_CATCH
 
   /* Detect EOF (Ctrl-D).  */
   if (p == NULL)
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 5d13e07..fe8a705 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -395,13 +395,18 @@ infpy_threads (PyObject *self, PyObject *args)
   struct threadlist_entry *entry;
   inferior_object *inf_obj = (inferior_object *) self;
   PyObject *tuple;
-  volatile struct gdb_exception except;
 
   INFPY_REQUIRE_VALID (inf_obj);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    update_thread_list ();
-  GDB_PY_HANDLE_EXCEPTION (except);
+  TRY
+    {
+      update_thread_list ();
+    }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   tuple = PyTuple_New (inf_obj->nthreads);
   if (!tuple)
@@ -503,7 +508,6 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
   void *buffer = NULL;
   membuf_object *membuf_obj;
   PyObject *addr_obj, *length_obj, *result;
-  volatile struct gdb_exception except;
   static char *keywords[] = { "address", "length", NULL };
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "OO", keywords,
@@ -514,17 +518,18 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
       || get_addr_from_python (length_obj, &length) < 0)
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       buffer = xmalloc (length);
 
       read_memory (addr, buffer, length);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (buffer);
       GDB_PY_HANDLE_EXCEPTION (except);
     }
+  END_CATCH
 
   membuf_obj = PyObject_New (membuf_object, &membuf_object_type);
   if (membuf_obj == NULL)
@@ -557,11 +562,11 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
 static PyObject *
 infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
 {
+  struct gdb_exception except = exception_none;
   Py_ssize_t buf_len;
   const char *buffer;
   CORE_ADDR addr, length;
   PyObject *addr_obj, *length_obj = NULL;
-  volatile struct gdb_exception except;
   static char *keywords[] = { "address", "buffer", "length", NULL };
 #ifdef IS_PY3K
   Py_buffer pybuf;
@@ -588,10 +593,16 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
   else if (get_addr_from_python (length_obj, &length) < 0)
     goto fail;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       write_memory_with_notification (addr, (gdb_byte *) buffer, length);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
 #ifdef IS_PY3K
   PyBuffer_Release (&pybuf);
 #endif
@@ -701,10 +712,10 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 static PyObject *
 infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
 {
+  struct gdb_exception except = exception_none;
   CORE_ADDR start_addr, length;
   static char *keywords[] = { "address", "length", "pattern", NULL };
   PyObject *start_addr_obj, *length_obj;
-  volatile struct gdb_exception except;
   Py_ssize_t pattern_size;
   const void *buffer;
   CORE_ADDR found_addr;
@@ -760,12 +771,18 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
       goto fail;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       found = target_search_memory (start_addr, length,
 				    buffer, pattern_size,
 				    &found_addr);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
 #ifdef IS_PY3K
   PyBuffer_Release (&pybuf);
 #endif
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 9a9a2e6..4d0a020 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -147,15 +147,18 @@ static PyObject *
 thpy_switch (PyObject *self, PyObject *args)
 {
   thread_object *thread_obj = (thread_object *) self;
-  volatile struct gdb_exception except;
 
   THPY_REQUIRE_VALID (thread_obj);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch_to_thread (thread_obj->thread->ptid);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 9c0f7a4..c9774ab 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -96,7 +96,6 @@ stpy_convert_to_value  (PyObject *self, PyObject *args)
 {
   lazy_string_object *self_string = (lazy_string_object *) self;
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
   if (self_string->address == 0)
     {
@@ -105,11 +104,15 @@ stpy_convert_to_value  (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val = value_at_lazy (self_string->type, self_string->address);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index ff1716b..195a8b3 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -172,18 +172,21 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
   linetable_entry_object *result;
   VEC (CORE_ADDR) *pcs = NULL;
   PyObject *tuple;
-  volatile struct gdb_exception except;
 
   LTPY_REQUIRE_VALID (self, symtab);
 
   if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       pcs = find_pcs_for_symtab_line (symtab, py_line, &best_entry);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   tuple = build_line_table_tuple_from_pcs (py_line, pcs);
   VEC_free (CORE_ADDR, pcs);
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 0a10623..157d200 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -131,15 +131,18 @@ objfpy_get_build_id (PyObject *self, void *closure)
   objfile_object *obj = (objfile_object *) self;
   struct objfile *objfile = obj->objfile;
   const struct elf_build_id *build_id = NULL;
-  volatile struct gdb_exception except;
 
   OBJFPY_REQUIRE_VALID (obj);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       build_id = build_id_bfd_get (objfile->obfd);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (build_id != NULL)
     {
@@ -386,20 +389,23 @@ objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw)
   objfile_object *obj = (objfile_object *) self;
   const char *file_name;
   int symfile_flags = 0;
-  volatile struct gdb_exception except;
 
   OBJFPY_REQUIRE_VALID (obj);
 
   if (!PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       bfd *abfd = symfile_bfd_open (file_name);
 
       symbol_file_add_separate (abfd, file_name, symfile_flags, obj->objfile);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 2fe5be6..06b9ae9 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -662,7 +662,6 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   int parmclass, cmdtype;
   PyObject *enum_values = NULL;
   struct cmd_list_element **set_list, **show_list;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "sii|O", &name, &cmdtype, &parmclass,
 			  &enum_values))
@@ -724,14 +723,14 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 
   Py_INCREF (self);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       add_setshow_generic (parmclass, (enum command_class) cmdtype,
 			   cmd_name, obj,
 			   set_doc, show_doc,
 			   doc, set_list, show_list);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (cmd_name);
       xfree (set_doc);
@@ -743,6 +742,8 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 		    "%s", except.message);
       return -1;
     }
+  END_CATCH
+
   return 0;
 }
 
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index f4c91d0..d8579fa 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -213,11 +213,10 @@ find_pretty_printer (PyObject *value)
 static PyObject *
 pretty_print_one_value (PyObject *printer, struct value **out_value)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
   *out_value = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
       if (result)
@@ -233,6 +232,10 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
 	    }
 	}
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
 
   return result;
 }
@@ -803,13 +806,16 @@ gdbpy_get_varobj_pretty_printer (struct value *value)
 {
   PyObject *val_obj;
   PyObject *pretty_printer = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       value = value_copy (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   val_obj = value_to_value_object (value);
   if (! val_obj)
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 729bc64..4306f61 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -192,16 +192,19 @@ static PyObject *
 sympy_needs_frame (PyObject *self, void *closure)
 {
   struct symbol *symbol = NULL;
-  volatile struct gdb_exception except;
   int result = 0;
 
   SYMPY_REQUIRE_VALID (self, symbol);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = symbol_read_needs_frame (symbol);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (result)
     Py_RETURN_TRUE;
@@ -246,7 +249,6 @@ sympy_value (PyObject *self, PyObject *args)
   struct frame_info *frame_info = NULL;
   PyObject *frame_obj = NULL;
   struct value *value = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "|O", &frame_obj))
     return NULL;
@@ -264,7 +266,7 @@ sympy_value (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (frame_obj != NULL)
 	{
@@ -278,7 +280,11 @@ sympy_value (PyObject *self, PyObject *args)
 
       value = read_var_value (symbol, frame_info);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (value);
 }
@@ -365,7 +371,6 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
   struct symbol *symbol = NULL;
   PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj;
   const struct block *block = NULL;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
 				     &block_object_type, &block_obj, &domain))
@@ -376,21 +381,28 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
   else
     {
       struct frame_info *selected_frame;
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  selected_frame = get_selected_frame (_("No frame selected."));
 	  block = get_frame_block (selected_frame, NULL);
 	}
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   ret_tuple = PyTuple_New (2);
   if (!ret_tuple)
@@ -430,17 +442,20 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
   static char *keywords[] = { "name", "domain", NULL };
   struct symbol *symbol = NULL;
   PyObject *sym_obj;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
 				     &domain))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       symbol = lookup_global_symbol (name, NULL, domain);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (symbol)
     {
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 72d4dcf..39376a1 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -341,15 +341,18 @@ typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
 {
   PyObject *py_type = self;
   PyObject *result = NULL, *iter = NULL;
-  volatile struct gdb_exception except;
   struct type *type = ((type_object *) py_type)->type;
   struct type *checked_type = type;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (checked_type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (checked_type != type)
     py_type = type_to_type_object (checked_type);
@@ -449,13 +452,16 @@ static PyObject *
 typy_strip_typedefs (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -466,15 +472,18 @@ typy_strip_typedefs (PyObject *self, PyObject *args)
 static struct type *
 typy_get_composite (struct type *type)
 {
-  volatile struct gdb_exception except;
 
   for (;;)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  CHECK_TYPEDEF (type);
 	}
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
 
       if (TYPE_CODE (type) != TYPE_CODE_PTR
 	  && TYPE_CODE (type) != TYPE_CODE_REF)
@@ -505,7 +514,6 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
   PyObject *n2_obj = NULL;
   struct type *array = NULL;
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "l|O", &n1, &n2_obj))
     return NULL;
@@ -535,13 +543,17 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       array = lookup_array_range_type (type, n1, n2);
       if (is_vector)
 	make_vector_type (array);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (array);
 }
@@ -567,13 +579,16 @@ static PyObject *
 typy_pointer (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_pointer_type (type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -648,13 +663,16 @@ static PyObject *
 typy_reference (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = lookup_reference_type (type);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -680,13 +698,16 @@ static PyObject *
 typy_const (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (1, 0, type, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -696,13 +717,16 @@ static PyObject *
 typy_volatile (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 1, type, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -712,13 +736,16 @@ static PyObject *
 typy_unqualified (PyObject *self, PyObject *args)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = make_cv_type (0, 0, type, NULL);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type_to_type_object (type);
 }
@@ -728,12 +755,16 @@ static PyObject *
 typy_get_sizeof (PyObject *self, void *closure)
 {
   struct type *type = ((type_object *) self)->type;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       check_typedef (type);
     }
+  CATCH (except, RETURN_MASK_ALL)
+    {
+    }
+  END_CATCH
+
   /* Ignore exceptions.  */
 
   return gdb_py_long_from_longest (TYPE_LENGTH (type));
@@ -743,9 +774,8 @@ static struct type *
 typy_lookup_typename (const char *type_name, const struct block *block)
 {
   struct type *type = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (startswith (type_name, "struct "))
 	type = lookup_struct (type_name + 7, NULL);
@@ -757,7 +787,11 @@ typy_lookup_typename (const char *type_name, const struct block *block)
 	type = lookup_typename (python_language, python_gdbarch,
 				type_name, block, 0);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return type;
 }
@@ -769,7 +803,6 @@ typy_lookup_type (struct demangle_component *demangled,
   struct type *type, *rtype = NULL;
   char *type_name = NULL;
   enum demangle_component_type demangled_type;
-  volatile struct gdb_exception except;
 
   /* Save the type: typy_lookup_type() may (indirectly) overwrite
      memory pointed by demangled.  */
@@ -784,7 +817,7 @@ typy_lookup_type (struct demangle_component *demangled,
       if (! type)
 	return NULL;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  /* If the demangled_type matches with one of the types
 	     below, run the corresponding function and save the type
@@ -806,7 +839,11 @@ typy_lookup_type (struct demangle_component *demangled,
 	      break;
 	    }
 	}
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
 
   /* If we have a type from the switch statement above, just return
@@ -837,7 +874,6 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
   const char *err;
   struct type *argtype;
   struct cleanup *cleanup;
-  volatile struct gdb_exception except;
 
   if (TYPE_NAME (type) == NULL)
     {
@@ -845,12 +881,16 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Note -- this is not thread-safe.  */
       info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (! info)
     {
@@ -903,7 +943,6 @@ typy_template_argument (PyObject *self, PyObject *args)
   PyObject *block_obj = NULL;
   struct symbol *sym;
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "i|O", &argno, &block_obj))
     return NULL;
@@ -919,13 +958,17 @@ typy_template_argument (PyObject *self, PyObject *args)
 	}
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (type);
       if (TYPE_CODE (type) == TYPE_CODE_REF)
 	type = check_typedef (TYPE_TARGET_TYPE (type));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* We might not have DW_TAG_template_*, so try to parse the type's
      name.  This is inefficient if we do not have a template type --
@@ -950,11 +993,15 @@ typy_template_argument (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val = value_of_variable (sym, block);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
@@ -962,12 +1009,11 @@ typy_template_argument (PyObject *self, PyObject *args)
 static PyObject *
 typy_str (PyObject *self)
 {
-  volatile struct gdb_exception except;
   char *thetype = NULL;
   long length = 0;
   PyObject *result;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *old_chain;
       struct ui_file *stb;
@@ -981,11 +1027,12 @@ typy_str (PyObject *self)
       thetype = ui_file_xstrdup (stb, &length);
       do_cleanups (old_chain);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (thetype);
       GDB_PY_HANDLE_EXCEPTION (except);
     }
+  END_CATCH
 
   result = PyUnicode_Decode (thetype, length, host_charset (), NULL);
   xfree (thetype);
@@ -1001,7 +1048,6 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
   int result = Py_NE;
   struct type *type1 = type_object_to_type (self);
   struct type *type2 = type_object_to_type (other);
-  volatile struct gdb_exception except;
 
   /* We can only compare ourselves to another Type object, and only
      for equality or inequality.  */
@@ -1015,13 +1061,17 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
     result = Py_EQ;
   else
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  result = types_deeply_equal (type1, type2);
 	}
-      /* If there is a GDB exception, a comparison is not capable
-	 (or trusted), so exit.  */
-      GDB_PY_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  /* If there is a GDB exception, a comparison is not capable
+	     (or trusted), so exit.  */
+	  GDB_PY_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
 
   if (op == (result ? Py_EQ : Py_NE))
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 58a5934..2e32f11 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -316,13 +316,16 @@ get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
 {
   if (gdbpy_is_value_object (obj))
     {
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  *addr = value_as_address (value_object_to_value (obj));
 	}
-      GDB_PY_SET_HANDLE_EXCEPTION (except);
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  GDB_PY_SET_HANDLE_EXCEPTION (except);
+	}
+      END_CATCH
     }
   else
     {
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 5a13777..6622d11 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -172,10 +172,9 @@ gdbpy_preserve_values (const struct extension_language_defn *extlang,
 static PyObject *
 valpy_dereference (PyObject *self, PyObject *args)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *res_val;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -184,7 +183,11 @@ valpy_dereference (PyObject *self, PyObject *args)
       result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -200,10 +203,9 @@ valpy_dereference (PyObject *self, PyObject *args)
 static PyObject *
 valpy_referenced_value (PyObject *self, PyObject *args)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *self_val, *res_val;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -225,7 +227,11 @@ valpy_referenced_value (PyObject *self, PyObject *args)
       result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -235,11 +241,10 @@ static PyObject *
 valpy_get_address (PyObject *self, void *closure)
 {
   value_object *val_obj = (value_object *) self;
-  volatile struct gdb_exception except;
 
   if (!val_obj->address)
     {
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  struct value *res_val;
 	  struct cleanup *cleanup
@@ -249,11 +254,12 @@ valpy_get_address (PyObject *self, void *closure)
 	  val_obj->address = value_to_value_object (res_val);
 	  do_cleanups (cleanup);
 	}
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ALL)
 	{
 	  val_obj->address = Py_None;
 	  Py_INCREF (Py_None);
 	}
+      END_CATCH
     }
 
   Py_XINCREF (val_obj->address);
@@ -283,7 +289,6 @@ static PyObject *
 valpy_get_dynamic_type (PyObject *self, void *closure)
 {
   value_object *obj = (value_object *) self;
-  volatile struct gdb_exception except;
   struct type *type = NULL;
 
   if (obj->dynamic_type != NULL)
@@ -292,7 +297,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
       return obj->dynamic_type;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *val = obj->value;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -331,7 +336,11 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (type == NULL)
     obj->dynamic_type = valpy_get_type (self, NULL);
@@ -358,13 +367,12 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
   const char *user_encoding = NULL;
   static char *keywords[] = { "encoding", "length", NULL };
   PyObject *str_obj = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG, keywords,
 				    &user_encoding, &length))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -377,7 +385,11 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return str_obj;
 }
@@ -394,7 +406,6 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
   int length = -1;
   gdb_byte *buffer;
   struct value *value = ((value_object *) self)->value;
-  volatile struct gdb_exception except;
   PyObject *unicode;
   const char *encoding = NULL;
   const char *errors = NULL;
@@ -407,11 +418,15 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
 				    &user_encoding, &errors, &length))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
   unicode = PyUnicode_Decode ((const char *) buffer,
@@ -429,7 +444,6 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
 {
   PyObject *type_obj, *result = NULL;
   struct type *type;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "O", &type_obj))
     return NULL;
@@ -442,7 +456,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
       return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *val = ((value_object *) self)->value;
       struct value *res_val;
@@ -461,7 +475,11 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
       result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -508,7 +526,6 @@ value_has_field (struct value *v, PyObject *field)
   struct type *parent_type, *val_type;
   enum type_code type_code;
   PyObject *type_object = PyObject_GetAttrString (field, "parent_type");
-  volatile struct gdb_exception except;
   int has_field = 0;
 
   if (type_object == NULL)
@@ -524,7 +541,7 @@ value_has_field (struct value *v, PyObject *field)
       return -1;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val_type = value_type (v);
       val_type = check_typedef (val_type);
@@ -539,7 +556,11 @@ value_has_field (struct value *v, PyObject *field)
       else
 	has_field = 0;
     }
-  GDB_PY_SET_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_SET_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return has_field;
 }
@@ -591,11 +612,11 @@ get_field_type (PyObject *field)
 static PyObject *
 valpy_getitem (PyObject *self, PyObject *key)
 {
+  struct gdb_exception except = exception_none;
   value_object *self_value = (value_object *) self;
   char *field = NULL;
   struct type *base_class_type = NULL, *field_type = NULL;
   long bitpos = -1;
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
   if (gdbpy_is_string (key))
@@ -673,7 +694,7 @@ valpy_getitem (PyObject *self, PyObject *key)
 	}
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *tmp = self_value->value;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -723,6 +744,11 @@ valpy_getitem (PyObject *self, PyObject *key)
 	result = value_to_value_object (res_val);
       do_cleanups (cleanup);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
 
   xfree (field);
   GDB_PY_HANDLE_EXCEPTION (except);
@@ -744,18 +770,21 @@ static PyObject *
 valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
 {
   Py_ssize_t args_count;
-  volatile struct gdb_exception except;
   struct value *function = ((value_object *) self)->value;
   struct value **vargs = NULL;
   struct type *ftype = NULL;
   struct value *mark = value_mark ();
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       ftype = check_typedef (value_type (function));
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (TYPE_CODE (ftype) != TYPE_CODE_FUNC)
     {
@@ -790,7 +819,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
 	}
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
       struct value *return_value;
@@ -799,7 +828,11 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
       result = value_to_value_object (return_value);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -812,12 +845,11 @@ valpy_str (PyObject *self)
   char *s = NULL;
   PyObject *result;
   struct value_print_options opts;
-  volatile struct gdb_exception except;
 
   get_user_print_options (&opts);
   opts.deref_ref = 0;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct ui_file *stb = mem_fileopen ();
       struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -828,7 +860,11 @@ valpy_str (PyObject *self)
 
       do_cleanups (old_chain);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
   xfree (s);
@@ -842,13 +878,16 @@ valpy_get_is_optimized_out (PyObject *self, void *closure)
 {
   struct value *value = ((value_object *) self)->value;
   int opt = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       opt = value_optimized_out (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (opt)
     Py_RETURN_TRUE;
@@ -862,13 +901,16 @@ valpy_get_is_lazy (PyObject *self, void *closure)
 {
   struct value *value = ((value_object *) self)->value;
   int opt = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       opt = value_lazy (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (opt)
     Py_RETURN_TRUE;
@@ -881,14 +923,17 @@ static PyObject *
 valpy_fetch_lazy (PyObject *self, PyObject *args)
 {
   struct value *value = ((value_object *) self)->value;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (value_lazy (value))
 	value_fetch_lazy (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -926,10 +971,9 @@ enum valpy_opcode
 static PyObject *
 valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *arg1, *arg2;
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -1049,7 +1093,11 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -1103,10 +1151,9 @@ valpy_power (PyObject *self, PyObject *other, PyObject *unused)
 static PyObject *
 valpy_negative (PyObject *self)
 {
-  volatile struct gdb_exception except;
   PyObject *result = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Perhaps overkill, but consistency has some virtue.  */
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@ -1116,7 +1163,11 @@ valpy_negative (PyObject *self)
       result = value_to_value_object (val);
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -1131,10 +1182,9 @@ static PyObject *
 valpy_absolute (PyObject *self)
 {
   struct value *value = ((value_object *) self)->value;
-  volatile struct gdb_exception except;
   int isabs = 1;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
 
@@ -1143,7 +1193,11 @@ valpy_absolute (PyObject *self)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   if (isabs)
     return valpy_positive (self);
@@ -1155,12 +1209,12 @@ valpy_absolute (PyObject *self)
 static int
 valpy_nonzero (PyObject *self)
 {
-  volatile struct gdb_exception except;
+  struct gdb_exception except = exception_none;
   value_object *self_value = (value_object *) self;
   struct type *type;
   int nonzero = 0; /* Appease GCC warning.  */
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type = check_typedef (value_type (self_value->value));
 
@@ -1176,6 +1230,12 @@ valpy_nonzero (PyObject *self)
 	/* All other values are True.  */
 	nonzero = 1;
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   /* This is not documented in the Python documentation, but if this
      function fails, return -1 as slot_nb_nonzero does (the default
      Python nonzero function).  */
@@ -1189,13 +1249,16 @@ static PyObject *
 valpy_invert (PyObject *self)
 {
   struct value *val = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       val = value_complement (((value_object *) self)->value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (val);
 }
@@ -1241,7 +1304,6 @@ static PyObject *
 valpy_richcompare (PyObject *self, PyObject *other, int op)
 {
   int result = 0;
-  volatile struct gdb_exception except;
 
   if (other == Py_None)
     /* Comparing with None is special.  From what I can tell, in Python
@@ -1262,7 +1324,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
 	return NULL;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct value *value_other, *mark = value_mark ();
       struct cleanup *cleanup;
@@ -1307,7 +1369,11 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* In this case, the Python exception has already been set.  */
   if (result < 0)
@@ -1327,16 +1393,19 @@ valpy_int (PyObject *self)
   struct value *value = ((value_object *) self)->value;
   struct type *type = value_type (value);
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (!is_integral_type (type))
 	error (_("Cannot convert value to int."));
 
       l = value_as_long (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdb_py_object_from_longest (l);
 }
@@ -1349,9 +1418,8 @@ valpy_long (PyObject *self)
   struct value *value = ((value_object *) self)->value;
   struct type *type = value_type (value);
   LONGEST l = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
 
@@ -1361,7 +1429,11 @@ valpy_long (PyObject *self)
 
       l = value_as_long (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return gdb_py_long_from_longest (l);
 }
@@ -1373,9 +1445,8 @@ valpy_float (PyObject *self)
   struct value *value = ((value_object *) self)->value;
   struct type *type = value_type (value);
   double d = 0;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       CHECK_TYPEDEF (type);
 
@@ -1384,7 +1455,11 @@ valpy_float (PyObject *self)
 
       d = value_as_double (value);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return PyFloat_FromDouble (d);
 }
@@ -1431,12 +1506,11 @@ struct value *
 convert_value_from_python (PyObject *obj)
 {
   struct value *value = NULL; /* -Wall */
-  volatile struct gdb_exception except;
   int cmp;
 
   gdb_assert (obj != NULL);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       if (PyBool_Check (obj))
 	{
@@ -1532,13 +1606,14 @@ convert_value_from_python (PyObject *obj)
 		      PyString_AsString (PyObject_Str (obj)));
 #endif
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       PyErr_Format (except.reason == RETURN_QUIT
 		    ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
 		    "%s", except.message);
       return NULL;
     }
+  END_CATCH
 
   return value;
 }
@@ -1549,16 +1624,19 @@ gdbpy_history (PyObject *self, PyObject *args)
 {
   int i;
   struct value *res_val = NULL;	  /* Initialize to appease gcc warning.  */
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "i", &i))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       res_val = access_value_history (i);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (res_val);
 }
diff --git a/gdb/python/python.c b/gdb/python/python.c
index c3ffbae..58c7c92 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -564,21 +564,27 @@ gdbpy_parameter_value (enum var_types type, void *var)
 PyObject *
 gdbpy_parameter (PyObject *self, PyObject *args)
 {
+  struct gdb_exception except = exception_none;
   struct cmd_list_element *alias, *prefix, *cmd;
   const char *arg;
   char *newarg;
   int found = -1;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "s", &arg))
     return NULL;
 
   newarg = concat ("show ", arg, (char *) NULL);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
+
   xfree (newarg);
   GDB_PY_HANDLE_EXCEPTION (except);
   if (!found)
@@ -619,7 +625,6 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
   const char *arg;
   PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
   int from_tty, to_string;
-  volatile struct gdb_exception except;
   static char *keywords[] = {"command", "from_tty", "to_string", NULL };
   char *result = NULL;
 
@@ -646,7 +651,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
       to_string = cmp;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       /* Copy the argument text in case the command modifies it.  */
       char *copy = xstrdup (arg);
@@ -666,7 +671,11 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
 
       do_cleanups (cleanup);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   /* Do any commands attached to breakpoint we stopped at.  */
   bpstat_do_actions ();
@@ -710,6 +719,7 @@ gdbpy_solib_name (PyObject *self, PyObject *args)
 static PyObject *
 gdbpy_decode_line (PyObject *self, PyObject *args)
 {
+  struct gdb_exception except = exception_none;
   struct symtabs_and_lines sals = { NULL, 0 }; /* Initialize to
 						  appease gcc.  */
   struct symtab_and_line sal;
@@ -719,7 +729,6 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   PyObject *result = NULL;
   PyObject *return_result = NULL;
   PyObject *unparsed = NULL;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTuple (args, "|s", &arg))
     return NULL;
@@ -727,7 +736,8 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   cleanups = make_cleanup (null_cleanup, NULL);
 
   sals.sals = NULL;
-  TRY_CATCH (except, RETURN_MASK_ALL)
+
+  TRY
     {
       if (arg)
 	{
@@ -743,6 +753,11 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
 	  sals.nelts = 1;
 	}
     }
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      except = ex;
+    }
+  END_CATCH
 
   if (sals.sals != NULL && sals.sals != &sal)
     {
@@ -824,16 +839,19 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args)
 {
   const char *expr_str;
   struct value *result = NULL;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "s", &expr_str))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       result = parse_and_eval (expr_str);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return value_to_value_object (result);
 }
@@ -845,13 +863,12 @@ static PyObject *
 gdbpy_find_pc_line (PyObject *self, PyObject *args)
 {
   gdb_py_ulongest pc_llu;
-  volatile struct gdb_exception except;
   PyObject *result = NULL; /* init for gcc -Wall */
 
   if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc_llu))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct symtab_and_line sal;
       CORE_ADDR pc;
@@ -860,7 +877,11 @@ gdbpy_find_pc_line (PyObject *self, PyObject *args)
       sal = find_pc_line (pc, 0);
       result = symtab_and_line_to_sal_object (sal);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   return result;
 }
@@ -1096,13 +1117,12 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
   const char *arg;
   static char *keywords[] = {"text", "stream", NULL };
   int stream_type = 0;
-  volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg,
 				     &stream_type))
     return NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       switch (stream_type)
         {
@@ -1120,7 +1140,11 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
           fprintf_filtered (gdb_stdout, "%s", arg);
         }
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  END_CATCH
 
   Py_RETURN_NONE;
 }
@@ -1165,7 +1189,6 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
 void
 gdbpy_print_stack (void)
 {
-  volatile struct gdb_exception except;
 
   /* Print "none", just clear exception.  */
   if (gdbpy_should_print_stack == python_excp_none)
@@ -1179,10 +1202,14 @@ gdbpy_print_stack (void)
       /* PyErr_Print doesn't necessarily end output with a newline.
 	 This works because Python's stdout/stderr is fed through
 	 printf_filtered.  */
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  begin_line ();
 	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
     }
   /* Print "message", just error print message.  */
   else
@@ -1196,7 +1223,7 @@ gdbpy_print_stack (void)
       msg = gdbpy_exception_to_string (ptype, pvalue);
       type = gdbpy_obj_to_string (ptype);
 
-      TRY_CATCH (except, RETURN_MASK_ALL)
+      TRY
 	{
 	  if (msg == NULL)
 	    {
@@ -1210,6 +1237,10 @@ gdbpy_print_stack (void)
 	    fprintf_filtered (gdb_stderr, "Python Exception %s %s: \n",
 			      type, msg);
 	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
 
       Py_XDECREF (ptype);
       Py_XDECREF (pvalue);
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index f2d35a3..6bd9d01 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -139,13 +139,15 @@ require_btrace (void)
 static void
 record_btrace_enable_warn (struct thread_info *tp)
 {
-  volatile struct gdb_exception error;
-
-  TRY_CATCH (error, RETURN_MASK_ERROR)
-    btrace_enable (tp, &record_btrace_conf);
-
-  if (error.message != NULL)
-    warning ("%s", error.message);
+  TRY
+    {
+      btrace_enable (tp, &record_btrace_conf);
+    }
+  CATCH (error, RETURN_MASK_ERROR)
+    {
+      warning ("%s", error.message);
+    }
+  END_CATCH
 }
 
 /* Callback function to disable branch tracing for one thread.  */
@@ -1140,7 +1142,6 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
 				 struct gdbarch *gdbarch,
 				 struct bp_target_info *bp_tgt)
 {
-  volatile struct gdb_exception except;
   const char *old;
   int ret;
 
@@ -1150,13 +1151,18 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
   replay_memory_access = replay_memory_access_read_write;
 
   ret = 0;
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+  TRY
+    {
+      ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+    }
 
   replay_memory_access = old;
 
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 
   return ret;
 }
@@ -1168,7 +1174,6 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
 				 struct gdbarch *gdbarch,
 				 struct bp_target_info *bp_tgt)
 {
-  volatile struct gdb_exception except;
   const char *old;
   int ret;
 
@@ -1178,13 +1183,18 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
   replay_memory_access = replay_memory_access_read_write;
 
   ret = 0;
-  TRY_CATCH (except, RETURN_MASK_ALL)
-    ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
+  TRY
+    {
+      ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
+    }
 
   replay_memory_access = old;
 
-  if (except.reason < 0)
-    throw_exception (except);
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      throw_exception (except);
+    }
+  END_CATCH
 
   return ret;
 }
@@ -1622,7 +1632,6 @@ record_btrace_find_resume_thread (ptid_t ptid)
 static struct btrace_insn_iterator *
 record_btrace_start_replaying (struct thread_info *tp)
 {
-  volatile struct gdb_exception except;
   struct btrace_insn_iterator *replay;
   struct btrace_thread_info *btinfo;
   int executing;
@@ -1649,7 +1658,7 @@ record_btrace_start_replaying (struct thread_info *tp)
      Since frames are computed differently when we're replaying, we need to
      recompute those stored frames and fix them up so we can still detect
      subroutines after we started replaying.  */
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       struct frame_info *frame;
       struct frame_id frame_id;
@@ -1701,7 +1710,7 @@ record_btrace_start_replaying (struct thread_info *tp)
   /* Restore the previous execution state.  */
   set_executing (tp->ptid, executing);
 
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ALL)
     {
       xfree (btinfo->replay);
       btinfo->replay = NULL;
@@ -1710,6 +1719,7 @@ record_btrace_start_replaying (struct thread_info *tp)
 
       throw_exception (except);
     }
+  END_CATCH
 
   return replay;
 }
@@ -2298,21 +2308,22 @@ init_record_btrace_ops (void)
 static void
 cmd_record_btrace_bts_start (char *args, int from_tty)
 {
-  volatile struct gdb_exception exception;
 
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
 
   record_btrace_conf.format = BTRACE_FORMAT_BTS;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
-    execute_command ("target record-btrace", from_tty);
-
-  if (exception.error != 0)
+  TRY
+    {
+      execute_command ("target record-btrace", from_tty);
+    }
+  CATCH (exception, RETURN_MASK_ALL)
     {
       record_btrace_conf.format = BTRACE_FORMAT_NONE;
       throw_exception (exception);
     }
+  END_CATCH
 }
 
 /* Alias for "target record".  */
@@ -2320,21 +2331,22 @@ cmd_record_btrace_bts_start (char *args, int from_tty)
 static void
 cmd_record_btrace_start (char *args, int from_tty)
 {
-  volatile struct gdb_exception exception;
 
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
 
   record_btrace_conf.format = BTRACE_FORMAT_BTS;
 
-  TRY_CATCH (exception, RETURN_MASK_ALL)
-    execute_command ("target record-btrace", from_tty);
-
-  if (exception.error == 0)
-    return;
-
-  record_btrace_conf.format = BTRACE_FORMAT_NONE;
-  throw_exception (exception);
+  TRY
+    {
+      execute_command ("target record-btrace", from_tty);
+    }
+  CATCH (exception, RETURN_MASK_ALL)
+    {
+      record_btrace_conf.format = BTRACE_FORMAT_NONE;
+      throw_exception (exception);
+    }
+  END_CATCH
 }
 
 /* The "set record btrace" command.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index eb1eb27..19f56a1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -497,7 +497,6 @@ remote_get_noisy_reply (char **buf_p,
 	  CORE_ADDR from, to, org_to;
 	  char *p, *pp;
 	  int adjusted_size = 0;
-	  volatile struct gdb_exception ex;
 	  int relocated = 0;
 
 	  p = buf + strlen ("qRelocInsn:");
@@ -512,12 +511,12 @@ remote_get_noisy_reply (char **buf_p,
 
 	  org_to = to;
 
-	  TRY_CATCH (ex, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      gdbarch_relocate_instruction (target_gdbarch (), &to, from);
 	      relocated = 1;
 	    }
-	  if (ex.reason < 0)
+	  CATCH (ex, RETURN_MASK_ALL)
 	    {
 	      if (ex.error == MEMORY_ERROR)
 		{
@@ -536,6 +535,7 @@ remote_get_noisy_reply (char **buf_p,
 		}
 	      putpkt ("E01");
 	    }
+	  END_CATCH
 
 	  if (relocated)
 	    {
@@ -4382,13 +4382,12 @@ remote_open_1 (const char *name, int from_tty,
      all the ``target ....'' commands to share a common callback
      function.  See cli-dump.c.  */
   {
-    volatile struct gdb_exception ex;
 
-    TRY_CATCH (ex, RETURN_MASK_ALL)
+    TRY
       {
 	remote_start_remote (from_tty, target, extended_p);
       }
-    if (ex.reason < 0)
+    CATCH (ex, RETURN_MASK_ALL)
       {
 	/* Pop the partially set up target - unless something else did
 	   already before throwing the exception.  */
@@ -4398,6 +4397,7 @@ remote_open_1 (const char *name, int from_tty,
 	  wait_forever_enabled_p = 1;
 	throw_exception (ex);
       }
+    END_CATCH
   }
 
   remote_btrace_reset ();
@@ -7835,15 +7835,14 @@ getpkt_or_notif_sane (char **buf, long *sizeof_buf, int forever,
 static void
 remote_kill (struct target_ops *ops)
 {
-  volatile struct gdb_exception ex;
 
   /* Catch errors so the user can quit from gdb even when we
      aren't on speaking terms with the remote system.  */
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       putpkt ("k");
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error == TARGET_CLOSE_ERROR)
 	{
@@ -7861,6 +7860,7 @@ remote_kill (struct target_ops *ops)
 	   user or higher layers decide what to do.  */
 	throw_exception (ex);
     }
+  END_CATCH
 
   /* We've killed the remote end, we get to mourn it.  Since this is
      target remote, single-process, mourning the inferior also
@@ -10948,7 +10948,6 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
   char *p = NULL;
   /* FIXME we need to get register block size some other way.  */
   extern int trace_regblock_size;
-  volatile struct gdb_exception ex;
   enum packet_result result;
 
   if (packet_support (PACKET_qTStatus) == PACKET_DISABLE)
@@ -10958,11 +10957,11 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
 
   putpkt ("qTStatus");
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       p = remote_get_noisy_reply (&target_buf, &target_buf_size);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != TARGET_CLOSE_ERROR)
 	{
@@ -10971,6 +10970,7 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
 	}
       throw_exception (ex);
     }
+  END_CATCH
 
   result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]);
 
@@ -11537,7 +11537,6 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
   struct remote_state *rs = get_remote_state ();
   char *buf = rs->buf;
   char *endbuf = rs->buf + get_remote_packet_size ();
-  volatile struct gdb_exception err;
 
   if (packet_config_support (packet) != PACKET_ENABLE)
     error (_("Target does not support branch tracing."));
@@ -11565,11 +11564,16 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
 
   /* If we fail to read the configuration, we lose some information, but the
      tracing itself is not impacted.  */
-  TRY_CATCH (err, RETURN_MASK_ERROR)
-    btrace_read_config (&tinfo->conf);
-
-  if (err.message != NULL)
-    warning ("%s", err.message);
+  TRY
+    {
+      btrace_read_config (&tinfo->conf);
+    }
+  CATCH (err, RETURN_MASK_ERROR)
+    {
+      if (err.message != NULL)
+	warning ("%s", err.message);
+    }
+  END_CATCH
 
   return tinfo;
 }
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 6940727..ca262e9 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -572,19 +572,20 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
     {
       CORE_ADDR pc = 0;
       struct obj_section *pc_section;
-      volatile struct gdb_exception e;
 
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
         {
           pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
         }
-      if (e.reason < 0)
+      CATCH (e, RETURN_MASK_ERROR)
         {
           /* An error occured during reading.  Probably a memory error
              due to the section not being loaded yet.  This address
              cannot be a function descriptor.  */
           return addr;
         }
+      END_CATCH
+
       pc_section = find_pc_section (pc);
 
       if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 16ffaff..a125000 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3355,7 +3355,6 @@ static const struct frame_unwind rs6000_frame_unwind =
 static struct rs6000_frame_cache *
 rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  volatile struct gdb_exception ex;
   struct rs6000_frame_cache *cache;
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -3367,7 +3366,7 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   (*this_cache) = cache;
   cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* At this point the stack looks as if we just entered the
 	 function, and the return address is stored in LR.  */
@@ -3382,11 +3381,12 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
       trad_frame_set_value (cache->saved_regs,
 			    gdbarch_pc_regnum (gdbarch), lr);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return cache;
 }
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 769ec9b..e33eb8e 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -1950,7 +1950,6 @@ static struct s390_unwind_cache *
 s390_frame_unwind_cache (struct frame_info *this_frame,
 			 void **this_prologue_cache)
 {
-  volatile struct gdb_exception ex;
   struct s390_unwind_cache *info;
 
   if (*this_prologue_cache)
@@ -1963,18 +1962,19 @@ s390_frame_unwind_cache (struct frame_info *this_frame,
   info->frame_base = -1;
   info->local_base = -1;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       /* Try to use prologue analysis to fill the unwind cache.
 	 If this fails, fall back to reading the stack backchain.  */
       if (!s390_prologue_frame_unwind_cache (this_frame, info))
 	s390_backchain_frame_unwind_cache (this_frame, info);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
 	throw_exception (ex);
     }
+  END_CATCH
 
   return info;
 }
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 685534f..7da5833 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -820,7 +820,6 @@ enable_break (void)
       CORE_ADDR addr;
       gdb_byte addr_buf[TIC6X_PTR_SIZE];
       struct int_elf32_dsbt_loadmap *ldm;
-      volatile struct gdb_exception ex;
       int ret;
 
       /* Read the contents of the .interp section into a local buffer;
@@ -834,10 +833,15 @@ enable_break (void)
 	 loaded so that we can load its symbols and place a breakpoint
 	 in the dynamic linker itself.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  tmp_bfd = solib_bfd_open (buf);
 	}
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       if (tmp_bfd == NULL)
 	{
 	  enable_break_failure_warning ();
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 76f6527..f7ef38b 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -539,7 +539,6 @@ enable_break2 (void)
       CORE_ADDR addr, interp_loadmap_addr;
       gdb_byte addr_buf[FRV_PTR_SIZE];
       struct int_elf32_fdpic_loadmap *ldm;
-      volatile struct gdb_exception ex;
 
       /* Read the contents of the .interp section into a local buffer;
          the contents specify the dynamic linker this program uses.  */
@@ -557,10 +556,15 @@ enable_break2 (void)
          be trivial on GNU/Linux).  Therefore, we have to try an alternate
          mechanism to find the dynamic linker's base address.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
         {
           tmp_bfd = solib_bfd_open (buf);
         }
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       if (tmp_bfd == NULL)
 	{
 	  enable_break_failure_warning ();
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index 3b0bf48..b133c12 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -163,18 +163,20 @@ ia64_hpux_at_dld_breakpoint_1_p (ptid_t ptid)
 int
 ia64_hpux_at_dld_breakpoint_p (ptid_t ptid)
 {
-  volatile struct gdb_exception e;
   ptid_t saved_ptid = inferior_ptid;
   int result = 0;
 
   inferior_ptid = ptid;
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       result = ia64_hpux_at_dld_breakpoint_1_p (ptid);
     }
   inferior_ptid = saved_ptid;
-  if (e.reason < 0)
-    warning (_("error while checking for dld breakpoint: %s"), e.message);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      warning (_("error while checking for dld breakpoint: %s"), e.message);
+    }
+  END_CATCH
 
   return result;
 }
@@ -277,17 +279,19 @@ ia64_hpux_handle_dld_breakpoint_1 (ptid_t ptid)
 void
 ia64_hpux_handle_dld_breakpoint (ptid_t ptid)
 {
-  volatile struct gdb_exception e;
   ptid_t saved_ptid = inferior_ptid;
 
   inferior_ptid = ptid;
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY
     {
       ia64_hpux_handle_dld_breakpoint_1 (ptid);
     }
   inferior_ptid = saved_ptid;
-  if (e.reason < 0)
-    warning (_("error detected while handling dld breakpoint: %s"), e.message);
+  CATCH (e, RETURN_MASK_ALL)
+    {
+      warning (_("error detected while handling dld breakpoint: %s"), e.message);
+    }
+  END_CATCH
 }
 
 /* Find the address of the code and data segments in ABFD, and update
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 3c8cd1a..250cf21 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -110,8 +110,7 @@ append_ocl_sos (struct so_list **link_ptr)
         {
 	  enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)?
 					 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
-	  volatile struct gdb_exception ex;
-	  TRY_CATCH (ex, RETURN_MASK_ALL)
+	  TRY
 	    {
 	      CORE_ADDR data =
 		read_memory_unsigned_integer (*ocl_program_addr_base,
@@ -134,7 +133,7 @@ append_ocl_sos (struct so_list **link_ptr)
 		  link_ptr = &newobj->next;
 		}
 	    }
-	  if (ex.reason < 0)
+	  CATCH (ex, RETURN_MASK_ALL)
 	    {
 	      /* Ignore memory errors.  */
 	      switch (ex.error)
@@ -146,6 +145,7 @@ append_ocl_sos (struct so_list **link_ptr)
 		  break;
 		}
 	    }
+	  END_CATCH
 	}
     }
 }
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 3fa8d6f..0cecc2a 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -874,15 +874,18 @@ solib_svr4_r_map (struct svr4_info *info)
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
   struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
   CORE_ADDR addr = 0;
-  volatile struct gdb_exception ex;
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
                                         ptr_type);
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ERROR)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
+
   return addr;
 }
 
@@ -2267,7 +2270,6 @@ enable_break (struct svr4_info *info, int from_tty)
       struct so_list *so;
       bfd *tmp_bfd = NULL;
       struct target_ops *tmp_bfd_target;
-      volatile struct gdb_exception ex;
 
       sym_addr = 0;
 
@@ -2280,10 +2282,15 @@ enable_break (struct svr4_info *info, int from_tty)
          be trivial on GNU/Linux).  Therefore, we have to try an alternate
          mechanism to find the dynamic linker's base address.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
         {
 	  tmp_bfd = solib_bfd_open (interp_name);
 	}
+      CATCH (ex, RETURN_MASK_ALL)
+	{
+	}
+      END_CATCH
+
       if (tmp_bfd == NULL)
 	goto bkpt_at_symbol;
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 98d5cfd..8417f88 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -613,11 +613,10 @@ solib_read_symbols (struct so_list *so, int flags)
     }
   else
     {
-      volatile struct gdb_exception e;
 
       flags |= current_inferior ()->symfile_flags;
 
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  struct section_addr_info *sap;
 
@@ -638,14 +637,17 @@ solib_read_symbols (struct so_list *so, int flags)
 						  NULL);
 	  so->objfile->addr_low = so->addr_low;
 	  free_section_addr_info (sap);
+
+	  so->symbols_loaded = 1;
+	}
+      CATCH (e, RETURN_MASK_ERROR)
+	{
+	  exception_fprintf (gdb_stderr, e, _("Error while reading shared"
+					      " library symbols for %s:\n"),
+			     so->so_name);
 	}
+      END_CATCH
 
-      if (e.reason < 0)
-	exception_fprintf (gdb_stderr, e, _("Error while reading shared"
-					    " library symbols for %s:\n"),
-			   so->so_name);
-      else
-	so->symbols_loaded = 1;
       return 1;
     }
 
@@ -814,12 +816,11 @@ update_solib_list (int from_tty, struct target_ops *target)
       /* Fill in the rest of each of the `struct so_list' nodes.  */
       for (i = inferior; i; i = i->next)
 	{
-	  volatile struct gdb_exception e;
 
 	  i->pspace = current_program_space;
 	  VEC_safe_push (so_list_ptr, current_program_space->added_solibs, i);
 
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      /* Fill in the rest of the `struct so_list' node.  */
 	      if (!solib_map_sections (i))
@@ -830,10 +831,13 @@ update_solib_list (int from_tty, struct target_ops *target)
 		}
 	    }
 
-	  if (e.reason < 0)
-	    exception_fprintf (gdb_stderr, e,
-			       _("Error while mapping shared "
-				 "library sections:\n"));
+	  CATCH (e, RETURN_MASK_ERROR)
+	    {
+	      exception_fprintf (gdb_stderr, e,
+				 _("Error while mapping shared "
+				   "library sections:\n"));
+	    }
+	  END_CATCH
 
 	  /* Notify any observer that the shared object has been
 	     loaded now that we've added it to GDB's tables.  */
@@ -1320,17 +1324,25 @@ reload_shared_libraries_1 (int from_tty)
 	  && (!was_loaded
 	      || filename_cmp (found_pathname, so->so_name) != 0))
 	{
-	  volatile struct gdb_exception e;
+	  int got_error = 0;
 
-	  TRY_CATCH (e, RETURN_MASK_ERROR)
-	    solib_map_sections (so);
+	  TRY
+	    {
+	      solib_map_sections (so);
+	    }
+
+	  CATCH (e, RETURN_MASK_ERROR)
+	    {
+	      exception_fprintf (gdb_stderr, e,
+				 _("Error while mapping "
+				   "shared library sections:\n"));
+	      got_error = 1;
+	    }
+	  END_CATCH
 
-	  if (e.reason < 0)
-	    exception_fprintf (gdb_stderr, e,
-			       _("Error while mapping "
-				 "shared library sections:\n"));
-	  else if (auto_solib_add || was_loaded || libpthread_solib_p (so))
-	    solib_read_symbols (so, flags);
+	    if (!got_error
+		&& (auto_solib_add || was_loaded || libpthread_solib_p (so)))
+	      solib_read_symbols (so, flags);
 	}
     }
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 5831999..76a2360 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -154,19 +154,22 @@ print_stack_frame (struct frame_info *frame, int print_level,
 		   enum print_what print_what,
 		   int set_current_sal)
 {
-  volatile struct gdb_exception e;
 
   /* For mi, alway print location and address.  */
   if (ui_out_is_mi_like_p (current_uiout))
     print_what = LOC_AND_ADDRESS;
 
-  TRY_CATCH (e, RETURN_MASK_ERROR)
+  TRY
     {
       print_frame_info (frame, print_level, print_what, 1 /* print_args */,
 			set_current_sal);
       if (set_current_sal)
 	set_current_sal_from_frame (frame);
     }
+  CATCH (e, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 }
 
 /* Print nameless arguments of frame FRAME on STREAM, where START is
@@ -210,9 +213,9 @@ static void
 print_frame_arg (const struct frame_arg *arg)
 {
   struct ui_out *uiout = current_uiout;
-  volatile struct gdb_exception except;
   struct cleanup *old_chain;
   struct ui_file *stb;
+  const char *error_message = NULL;
 
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
@@ -250,12 +253,10 @@ print_frame_arg (const struct frame_arg *arg)
   else
     {
       if (arg->error)
-	except.message = arg->error;
+	error_message = arg->error;
       else
 	{
-	  /* TRY_CATCH has two statements, wrap it in a block.  */
-
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      const struct language_defn *language;
 	      struct value_print_options opts;
@@ -284,10 +285,15 @@ print_frame_arg (const struct frame_arg *arg)
 
 	      common_val_print (arg->val, stb, 2, &opts, language);
 	    }
+	  CATCH (except, RETURN_MASK_ERROR)
+	    {
+	      error_message = except.message;
+	    }
+	  END_CATCH
 	}
-      if (except.message)
+      if (error_message != NULL)
 	fprintf_filtered (stb, _("<error reading variable: %s>"),
-			  except.message);
+			  error_message);
     }
 
   ui_out_field_stream (uiout, "value", stb);
@@ -306,17 +312,21 @@ void
 read_frame_local (struct symbol *sym, struct frame_info *frame,
 		  struct frame_arg *argp)
 {
-  volatile struct gdb_exception except;
   struct value *val = NULL;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  argp->sym = sym;
+  argp->val = NULL;
+  argp->error = NULL;
+
+  TRY
     {
-      val = read_var_value (sym, frame);
+      argp->val = read_var_value (sym, frame);
     }
-
-  argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
-  argp->sym = sym;
-  argp->val = val;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      argp->error = xstrdup (except.message);
+    }
+  END_CATCH
 }
 
 /* Read in inferior function parameter SYM at FRAME into ARGP.  Caller is
@@ -330,20 +340,20 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
   struct value *val = NULL, *entryval = NULL;
   char *val_error = NULL, *entryval_error = NULL;
   int val_equal = 0;
-  volatile struct gdb_exception except;
 
   if (print_entry_values != print_entry_values_only
       && print_entry_values != print_entry_values_preferred)
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  val = read_var_value (sym, frame);
 	}
-      if (!val)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  val_error = alloca (strlen (except.message) + 1);
 	  strcpy (val_error, except.message);
 	}
+      END_CATCH
     }
 
   if (SYMBOL_COMPUTED_OPS (sym) != NULL
@@ -352,25 +362,25 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
       && (print_entry_values != print_entry_values_if_needed
 	  || !val || value_optimized_out (val)))
     {
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  const struct symbol_computed_ops *ops;
 
 	  ops = SYMBOL_COMPUTED_OPS (sym);
 	  entryval = ops->read_variable_at_entry (sym, frame);
 	}
-      if (!entryval)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
-	  entryval_error = alloca (strlen (except.message) + 1);
-	  strcpy (entryval_error, except.message);
+	  if (except.error != NO_ENTRY_VALUE_ERROR)
+	    {
+	      entryval_error = (char *) alloca (strlen (except.message) + 1);
+	      strcpy (entryval_error, except.message);
+	    }
 	}
+      END_CATCH
 
-      if (except.error == NO_ENTRY_VALUE_ERROR
-	  || (entryval && value_optimized_out (entryval)))
-	{
-	  entryval = NULL;
-	  entryval_error = NULL;
-	}
+      if (entryval != NULL && value_optimized_out (entryval))
+	entryval = NULL;
 
       if (print_entry_values == print_entry_values_compact
 	  || print_entry_values == print_entry_values_default)
@@ -396,7 +406,7 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 		     dereferenced DW_AT_GNU_call_site_data_value does not
 		     differ.  */
 
-		  TRY_CATCH (except, RETURN_MASK_ERROR)
+		  TRY
 		    {
 		      struct type *type_deref;
 
@@ -417,19 +427,23 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
 						TYPE_LENGTH (type_deref)))
 			val_equal = 1;
 		    }
+		  CATCH (except, RETURN_MASK_ERROR)
+		    {
+		      /* If the dereferenced content could not be
+			 fetched do not display anything.  */
+		      if (except.error == NO_ENTRY_VALUE_ERROR)
+			val_equal = 1;
+		      else if (except.message != NULL)
+			{
+			  entryval_error = (char *) alloca (strlen (except.message) + 1);
+			  strcpy (entryval_error, except.message);
+			}
+		    }
+		  END_CATCH
 
 		  /* Value was not a reference; and its content matches.  */
 		  if (val == val_deref)
 		    val_equal = 1;
-		  /* If the dereferenced content could not be fetched do not
-		     display anything.  */
-		  else if (except.error == NO_ENTRY_VALUE_ERROR)
-		    val_equal = 1;
-		  else if (except.message)
-		    {
-		      entryval_error = alloca (strlen (except.message) + 1);
-		      strcpy (entryval_error, except.message);
-		    }
 
 		  if (val_equal)
 		    entryval = NULL;
@@ -455,15 +469,18 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
     {
       if (print_entry_values == print_entry_values_preferred)
 	{
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  gdb_assert (val == NULL);
+
+	  TRY
 	    {
 	      val = read_var_value (sym, frame);
 	    }
-	  if (!val)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      val_error = alloca (strlen (except.message) + 1);
 	      strcpy (val_error, except.message);
 	    }
+	  END_CATCH
 	}
       if (print_entry_values == print_entry_values_only
 	  || print_entry_values == print_entry_values_both
@@ -748,20 +765,20 @@ static void
 do_gdb_disassembly (struct gdbarch *gdbarch,
 		    int how_many, CORE_ADDR low, CORE_ADDR high)
 {
-  volatile struct gdb_exception exception;
 
-  TRY_CATCH (exception, RETURN_MASK_ERROR)
+  TRY
     {
       gdb_disassembly (gdbarch, current_uiout, 0,
 		       DISASSEMBLY_RAW_INSN, how_many,
 		       low, high);
     }
-  if (exception.reason < 0)
+  CATCH (exception, RETURN_MASK_ERROR)
     {
       /* If an exception was thrown while doing the disassembly, print
 	 the error message, to give the user a clue of what happened.  */
       exception_print (gdb_stderr, exception);
     }
+  END_CATCH
 }
 
 /* Print information about frame FRAME.  The output is format according
@@ -1188,7 +1205,6 @@ print_frame (struct frame_info *frame, int print_level,
       struct gdbarch *gdbarch = get_frame_arch (frame);
       int numargs;
       struct cleanup *args_list_chain;
-      volatile struct gdb_exception e;
 
       if (gdbarch_frame_num_args_p (gdbarch))
 	{
@@ -1199,10 +1215,15 @@ print_frame (struct frame_info *frame, int print_level,
 	numargs = -1;
     
       args_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "args");
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      TRY
 	{
 	  print_frame_args (func, frame, numargs, gdb_stdout);
 	}
+      CATCH (e, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
+
       /* FIXME: ARGS must be a list.  If one argument is a string it
 	  will have " that will not be properly escaped.  */
       /* Invoke ui_out_tuple_end.  */
@@ -1410,7 +1431,7 @@ frame_info (char *addr_exp, int from_tty)
   int frame_pc_p;
   /* Initialize it to avoid "may be used uninitialized" warning.  */
   CORE_ADDR caller_pc = 0;
-  volatile struct gdb_exception ex;
+  int caller_pc_p = 0;
 
   fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
   gdbarch = get_frame_arch (fi);
@@ -1498,11 +1519,12 @@ frame_info (char *addr_exp, int from_tty)
   wrap_here ("    ");
   printf_filtered ("saved %s = ", pc_regname);
 
-  TRY_CATCH (ex, RETURN_MASK_ERROR)
+  TRY
     {
       caller_pc = frame_unwind_caller_pc (fi);
+      caller_pc_p = 1;
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ERROR)
     {
       switch (ex.error)
 	{
@@ -1517,7 +1539,9 @@ frame_info (char *addr_exp, int from_tty)
 	  break;
 	}
     }
-  else
+  END_CATCH
+
+  if (caller_pc_p)
     fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
   printf_filtered ("\n");
 
@@ -2571,8 +2595,8 @@ get_frame_language (void)
 
   if (frame)
     {
-      volatile struct gdb_exception ex;
       CORE_ADDR pc = 0;
+      int pc_p = 0;
 
       /* We determine the current frame language by looking up its
          associated symtab.  To retrieve this symtab, we use the frame
@@ -2583,16 +2607,19 @@ get_frame_language (void)
          a PC that is guaranteed to be inside the frame's code
          block.  */
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  pc = get_frame_address_in_block (frame);
+	  pc_p = 1;
 	}
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  if (ex.error != NOT_AVAILABLE_ERROR)
 	    throw_exception (ex);
 	}
-      else
+      END_CATCH
+
+      if (pc_p)
 	{
 	  struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index aebe2d9..634cf97 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5500,21 +5500,21 @@ default_make_symbol_completion_list_break_on (const char *text,
 					      enum type_code code)
 {
   struct cleanup *back_to;
-  volatile struct gdb_exception except;
 
   return_val = NULL;
   back_to = make_cleanup (do_free_completion_list, &return_val);
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       default_make_symbol_completion_list_break_on_1 (text, word,
 						      break_on, code);
     }
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
 	throw_exception (except);
     }
+  END_CATCH
 
   discard_cleanups (back_to);
   return return_val;
diff --git a/gdb/target.c b/gdb/target.c
index d66560a..af94f48 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -814,9 +814,8 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
   if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
     {
       ptid_t ptid = inferior_ptid;
-      volatile struct gdb_exception ex;
 
-      TRY_CATCH (ex, RETURN_MASK_ALL)
+      TRY
 	{
 	  CORE_ADDR lm_addr;
 	  
@@ -829,7 +828,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 	}
       /* If an error occurred, print TLS related messages here.  Otherwise,
          throw the error to some higher catcher.  */
-      if (ex.reason < 0)
+      CATCH (ex, RETURN_MASK_ALL)
 	{
 	  int objfile_is_library = (objfile->flags & OBJF_SHARED);
 
@@ -878,6 +877,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 	      break;
 	    }
 	}
+      END_CATCH
     }
   /* It wouldn't be wrong here to try a gdbarch method, too; finding
      TLS is an ABI-specific thing.  But we don't do that yet.  */
diff --git a/gdb/top.c b/gdb/top.c
index 699a399..f746af8 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1465,7 +1465,6 @@ quit_force (char *args, int from_tty)
 {
   int exit_code = 0;
   struct qt_args qt;
-  volatile struct gdb_exception ex;
 
   /* An optional expression may be used to cause gdb to terminate with the 
      value of that expression.  */
@@ -1484,40 +1483,52 @@ quit_force (char *args, int from_tty)
   /* We want to handle any quit errors and exit regardless.  */
 
   /* Get out of tfind mode, and kill or detach all inferiors.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       disconnect_tracing ();
       iterate_over_inferiors (kill_or_detach, &qt);
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   /* Give all pushed targets a chance to do minimal cleanup, and pop
      them all out.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       pop_all_targets ();
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   /* Save the history information if it is appropriate to do so.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       if (write_history_p && history_filename
 	  && input_from_terminal_p ())
 	gdb_safe_append_history ();
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   /* Do any final cleanups before exiting.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       do_final_cleanups (all_cleanups ());
     }
-  if (ex.reason < 0)
-    exception_print (gdb_stderr, ex);
+  CATCH (ex, RETURN_MASK_ALL)
+    {
+      exception_print (gdb_stderr, ex);
+    }
+  END_CATCH
 
   exit (exit_code);
 }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 3ee7243..9747036 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -378,7 +378,6 @@ tfile_read (gdb_byte *readbuf, int size)
 static void
 tfile_open (const char *arg, int from_tty)
 {
-  volatile struct gdb_exception ex;
   char *temp;
   struct cleanup *old_chain;
   int flags;
@@ -443,7 +442,7 @@ tfile_open (const char *arg, int from_tty)
   ts->disconnected_tracing = 0;
   ts->circular_buffer = 0;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       /* Read through a section of newline-terminated lines that
 	 define things like tracepoints.  */
@@ -476,12 +475,13 @@ tfile_open (const char *arg, int from_tty)
       if (trace_regblock_size == 0)
 	error (_("No register block size recorded in trace file"));
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       /* Remove the partially set up target.  */
       unpush_target (&tfile_ops);
       throw_exception (ex);
     }
+  END_CATCH
 
   inferior_appeared (current_inferior (), TFILE_PID);
   inferior_ptid = pid_to_ptid (TFILE_PID);
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 0397ee9..9fac06e 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -90,11 +90,10 @@ static Keymap tui_readline_standard_keymap;
 static int
 tui_rl_switch_mode (int notused1, int notused2)
 {
-  volatile struct gdb_exception ex;
 
   /* Don't let exceptions escape.  We're in the middle of a readline
      callback that isn't prepared for that.  */
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       if (tui_active)
 	{
@@ -108,13 +107,14 @@ tui_rl_switch_mode (int notused1, int notused2)
 	  tui_enable ();
 	}
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       exception_print (gdb_stderr, ex);
 
       if (!tui_active)
 	rl_prep_terminal (0);
     }
+  END_CATCH
 
   /* Clear the readline in case switching occurred in middle of
      something.  */
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 234be7f..5a97ace 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -372,18 +372,20 @@ type_to_string (struct type *type)
   char *s = NULL;
   struct ui_file *stb;
   struct cleanup *old_chain;
-  volatile struct gdb_exception except;
 
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  TRY
     {
       type_print (type, "", stb, -1);
       s = ui_file_xstrdup (stb, NULL);
     }
-  if (except.reason < 0)
-    s = NULL;
+  CATCH (except, RETURN_MASK_ALL)
+    {
+      s = NULL;
+    }
+  END_CATCH
 
   do_cleanups (old_chain);
 
diff --git a/gdb/valops.c b/gdb/valops.c
index b096a51..66c63c1 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3601,13 +3601,12 @@ value_rtti_indirect_type (struct value *v, int *full,
     target = coerce_ref (v);
   else if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
-      volatile struct gdb_exception except;
 
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
         {
 	  target = value_ind (v);
         }
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  if (except.error == MEMORY_ERROR)
 	    {
@@ -3618,6 +3617,7 @@ value_rtti_indirect_type (struct value *v, int *full,
 	    }
 	  throw_exception (except);
 	}
+      END_CATCH
     }
   else
     return NULL;
@@ -3754,12 +3754,15 @@ struct value *
 value_of_this_silent (const struct language_defn *lang)
 {
   struct value *ret = NULL;
-  volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       ret = value_of_this (lang);
     }
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+    }
+  END_CATCH
 
   return ret;
 }
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 29a3473..9a70b2f 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -740,7 +740,6 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	   const struct value_print_options *options,
 	   const struct language_defn *language)
 {
-  volatile struct gdb_exception except;
   int ret = 0;
   struct value_print_options local_opts = *options;
   struct type *real_type = check_typedef (type);
@@ -782,14 +781,17 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       return;
     }
 
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       language->la_val_print (type, valaddr, embedded_offset, address,
 			      stream, recurse, val,
 			      &local_opts);
     }
-  if (except.reason < 0)
-    fprintf_filtered (stream, _("<error reading variable>"));
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      fprintf_filtered (stream, _("<error reading variable>"));
+    }
+  END_CATCH
 }
 
 /* Check whether the value VAL is printable.  Return 1 if it is;
diff --git a/gdb/value.c b/gdb/value.c
index b9a45ef..cb56849 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2545,7 +2545,6 @@ show_convenience (char *ignore, int from_tty)
   get_user_print_options (&opts);
   for (var = internalvars; var; var = var->next)
     {
-      volatile struct gdb_exception ex;
 
       if (!varseen)
 	{
@@ -2553,15 +2552,19 @@ show_convenience (char *ignore, int from_tty)
 	}
       printf_filtered (("$%s = "), var->name);
 
-      TRY_CATCH (ex, RETURN_MASK_ERROR)
+      TRY
 	{
 	  struct value *val;
 
 	  val = value_of_internalvar (gdbarch, var);
 	  value_print (val, gdb_stdout, &opts);
 	}
-      if (ex.reason < 0)
-	fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+	}
+      END_CATCH
+
       printf_filtered (("\n"));
     }
   if (!varseen)
diff --git a/gdb/varobj.c b/gdb/varobj.c
index ce80bc7..b220fd8 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -298,7 +298,6 @@ varobj_create (char *objname,
       const struct block *block;
       const char *p;
       struct value *value = NULL;
-      volatile struct gdb_exception except;
       CORE_ADDR pc;
 
       /* Parse and evaluate the expression, filling in as much of the
@@ -338,16 +337,17 @@ varobj_create (char *objname,
       innermost_block = NULL;
       /* Wrap the call to parse expression, so we can 
          return a sensible error.  */
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  var->root->exp = parse_exp_1 (&p, pc, block, 0);
 	}
 
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  do_cleanups (old_chain);
 	  return NULL;
 	}
+      END_CATCH
 
       /* Don't allow variables to be created for types.  */
       if (var->root->exp->elts[0].opcode == OP_TYPE
@@ -388,12 +388,11 @@ varobj_create (char *objname,
       /* We definitely need to catch errors here.
          If evaluate_expression succeeds we got the value we wanted.
          But if it fails, we still go on with a call to evaluate_type().  */
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  value = evaluate_expression (var->root->exp);
 	}
-
-      if (except.reason < 0)
+      CATCH (except, RETURN_MASK_ERROR)
 	{
 	  /* Error getting the value.  Try to at least get the
 	     right type.  */
@@ -401,14 +400,16 @@ varobj_create (char *objname,
 
 	  var->type = value_type (type_only_value);
 	}
-	else
-	  {
-	    int real_type_found = 0;
+      END_CATCH
 
-	    var->type = value_actual_type (value, 0, &real_type_found);
-	    if (real_type_found)
-	      value = value_cast (var->type, value);
-	  }
+      if (value != NULL)
+	{
+	  int real_type_found = 0;
+
+	  var->type = value_actual_type (value, 0, &real_type_found);
+	  if (real_type_found)
+	    value = value_cast (var->type, value);
+	}
 
       /* Set language info */
       var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
@@ -1103,23 +1104,23 @@ varobj_set_value (struct varobj *var, char *expression)
   struct value *value = NULL; /* Initialize to keep gcc happy.  */
   int saved_input_radix = input_radix;
   const char *s = expression;
-  volatile struct gdb_exception except;
 
   gdb_assert (varobj_editable_p (var));
 
   input_radix = 10;		/* ALWAYS reset to decimal temporarily.  */
   exp = parse_exp_1 (&s, 0, 0, 0);
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       value = evaluate_expression (exp);
     }
 
-  if (except.reason < 0)
+  CATCH (except, RETURN_MASK_ERROR)
     {
       /* We cannot proceed without a valid expression.  */
       xfree (exp);
       return 0;
     }
+  END_CATCH
 
   /* All types that are editable must also be changeable.  */
   gdb_assert (varobj_value_is_changeable_p (var));
@@ -1138,13 +1139,16 @@ varobj_set_value (struct varobj *var, char *expression)
 
   /* The new value may be lazy.  value_assign, or
      rather value_contents, will take care of this.  */
-  TRY_CATCH (except, RETURN_MASK_ERROR)
+  TRY
     {
       val = value_assign (var->value, value);
     }
 
-  if (except.reason < 0)
-    return 0;
+  CATCH (except, RETURN_MASK_ERROR)
+    {
+      return 0;
+    }
+  END_CATCH
 
   /* If the value has changed, record it, so that next -var-update can
      report this change.  If a variable had a value of '1', we've set it
@@ -1395,20 +1399,20 @@ install_new_value (struct varobj *var, struct value *value, int initial)
 	}
       else
 	{
-	  volatile struct gdb_exception except;
 
-	  TRY_CATCH (except, RETURN_MASK_ERROR)
+	  TRY
 	    {
 	      value_fetch_lazy (value);
 	    }
 
-	  if (except.reason < 0)
+	  CATCH (except, RETURN_MASK_ERROR)
 	    {
 	      /* Set the value to NULL, so that for the next -var-update,
 		 we don't try to compare the new value with this value,
 		 that we couldn't even read.  */
 	      value = NULL;
 	    }
+	  END_CATCH
 	}
     }
 
@@ -2369,14 +2373,17 @@ value_of_root_1 (struct varobj **var_handle)
 
   if (within_scope)
     {
-      volatile struct gdb_exception except;
 
       /* We need to catch errors here, because if evaluate
          expression fails we want to just return NULL.  */
-      TRY_CATCH (except, RETURN_MASK_ERROR)
+      TRY
 	{
 	  new_val = evaluate_expression (var->root->exp);
 	}
+      CATCH (except, RETURN_MASK_ERROR)
+	{
+	}
+      END_CATCH
     }
 
   do_cleanups (back_to);
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 4306c5c..9756acb 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -313,22 +313,22 @@ gdb_xml_start_element_wrapper (void *data, const XML_Char *name,
 			       const XML_Char **attrs)
 {
   struct gdb_xml_parser *parser = data;
-  volatile struct gdb_exception ex;
 
   if (parser->error.reason < 0)
     return;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       gdb_xml_start_element (data, name, attrs);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       parser->error = ex;
 #ifdef HAVE_XML_STOPPARSER
       XML_StopParser (parser->expat_parser, XML_FALSE);
 #endif
     }
+  END_CATCH
 }
 
 /* Handle the end of an element.  DATA is our local XML parser, and
@@ -396,22 +396,22 @@ static void
 gdb_xml_end_element_wrapper (void *data, const XML_Char *name)
 {
   struct gdb_xml_parser *parser = data;
-  volatile struct gdb_exception ex;
 
   if (parser->error.reason < 0)
     return;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       gdb_xml_end_element (data, name);
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       parser->error = ex;
 #ifdef HAVE_XML_STOPPARSER
       XML_StopParser (parser->expat_parser, XML_FALSE);
 #endif
     }
+  END_CATCH
 }
 
 /* Free a parser and all its associated state.  */
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks
  2015-02-09 23:50 ` [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks Pedro Alves
@ 2015-03-07 15:59   ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-03-07 15:59 UTC (permalink / raw)
  To: gdb-patches

On 02/09/2015 11:20 PM, Pedro Alves wrote:
> All these were caught by actually making TRY/CATCH use try/catch
> behind the scenes, which then resulted in the build failing because
> there was code between the try and catch blocks.
> 

I've added a ChangeLog entry, and pushed this in, as below.

----
From 6c63c96a22d216fb5d51c5d93646066d29e08ea1 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Sat, 7 Mar 2015 14:50:05 +0000
Subject: [PATCH 4/6] more making TRY/CATCH callers look more like real C++
 try/catch blocks

All these were caught by actually making TRY/CATCH use try/catch
behind the scenes, which then resulted in the build failing (on x86_64
Fedora 20) because there was code between the try and catch blocks.

gdb/ChangeLog:
2015-03-07  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (save_breakpoints): Adjust to avoid code between
	TRY and CATCH.
	* gdbtypes.c (safe_parse_type): Remove empty line.
	(types_deeply_equal):
	* guile/scm-frame.c (gdbscm_frame_name):
	* linux-thread-db.c (find_new_threads_once):
	* python/py-breakpoint.c (bppy_get_commands):
	* record-btrace.c (record_btrace_insert_breakpoint)
	(record_btrace_remove_breakpoint, record_btrace_start_replaying)
	(record_btrace_start_replaying): Adjust to avoid code between TRY
	and CATCH.
---
 gdb/ChangeLog              | 14 ++++++++++++++
 gdb/breakpoint.c           |  5 +++--
 gdb/gdbtypes.c             | 24 ++++++++++++++----------
 gdb/guile/scm-frame.c      |  9 +++------
 gdb/linux-thread-db.c      | 10 ++++++----
 gdb/python/py-breakpoint.c |  3 ++-
 gdb/record-btrace.c        | 20 ++++++++++----------
 7 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6df72f7..a18830f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
 2015-03-07  Pedro Alves  <palves@redhat.com>
 
+	* breakpoint.c (save_breakpoints): Adjust to avoid code between
+	TRY and CATCH.
+	* gdbtypes.c (safe_parse_type): Remove empty line.
+	(types_deeply_equal):
+	* guile/scm-frame.c (gdbscm_frame_name):
+	* linux-thread-db.c (find_new_threads_once):
+	* python/py-breakpoint.c (bppy_get_commands):
+	* record-btrace.c (record_btrace_insert_breakpoint)
+	(record_btrace_remove_breakpoint, record_btrace_start_replaying)
+	(record_btrace_start_replaying): Adjust to avoid code between TRY
+	and CATCH.
+
+2015-03-07  Pedro Alves  <palves@redhat.com>
+
 	* common/common-exceptions.c (struct catcher) <exception>: No
 	longer a pointer to volatile exception.  Now an exception value.
 	<mask>: Delete field.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0e59638..923523e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15926,6 +15926,7 @@ save_breakpoints (char *filename, int from_tty,
 
     if (tp->type != bp_dprintf && tp->commands)
       {
+	struct gdb_exception exception;
 
 	fprintf_unfiltered (fp, "  commands\n");
 	
@@ -15934,14 +15935,14 @@ save_breakpoints (char *filename, int from_tty,
 	  {
 	    print_command_lines (current_uiout, tp->commands->commands, 2);
 	  }
-	ui_out_redirect (current_uiout, NULL);
-
 	CATCH (ex, RETURN_MASK_ALL)
 	  {
+	    ui_out_redirect (current_uiout, NULL);
 	    throw_exception (ex);
 	  }
 	END_CATCH
 
+	ui_out_redirect (current_uiout, NULL);
 	fprintf_unfiltered (fp, "  end\n");
       }
 
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index af59d42..4cbbe95 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2309,7 +2309,6 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
     {
       type = parse_and_eval_type (p, length);
     }
-
   CATCH (except, RETURN_MASK_ERROR)
     {
       type = builtin_type (gdbarch)->builtin_void;
@@ -3237,6 +3236,7 @@ check_types_worklist (VEC (type_equality_entry_d) **worklist,
 int
 types_deeply_equal (struct type *type1, struct type *type2)
 {
+  struct gdb_exception except = exception_none;
   int result = 0;
   struct bcache *cache;
   VEC (type_equality_entry_d) *worklist = NULL;
@@ -3254,23 +3254,27 @@ types_deeply_equal (struct type *type1, struct type *type2)
   entry.type2 = type2;
   VEC_safe_push (type_equality_entry_d, worklist, &entry);
 
+  /* check_types_worklist calls several nested helper functions, some
+     of which can raise a GDB exception, so we just check and rethrow
+     here.  If there is a GDB exception, a comparison is not capable
+     (or trusted), so exit.  */
   TRY
     {
       result = check_types_worklist (&worklist, cache);
     }
-  /* check_types_worklist calls several nested helper functions,
-     some of which can raise a GDB Exception, so we just check
-     and rethrow here.  If there is a GDB exception, a comparison
-     is not capable (or trusted), so exit.  */
-  bcache_xfree (cache);
-  VEC_free (type_equality_entry_d, worklist);
-  /* Rethrow if there was a problem.  */
-  CATCH (except, RETURN_MASK_ALL)
+  CATCH (ex, RETURN_MASK_ALL)
     {
-      throw_exception (except);
+      except = ex;
     }
   END_CATCH
 
+  bcache_xfree (cache);
+  VEC_free (type_equality_entry_d, worklist);
+
+  /* Rethrow if there was a problem.  */
+  if (except.reason < 0)
+    throw_exception (except);
+
   return result;
 }
 \f
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 6189802..ea51d1b 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -426,7 +426,6 @@ gdbscm_frame_name (SCM self)
   enum language lang = language_minimal;
   struct frame_info *frame = NULL;
   SCM result;
-  struct gdb_exception except = exception_none;
 
   f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
 
@@ -436,15 +435,13 @@ gdbscm_frame_name (SCM self)
       if (frame != NULL)
 	find_frame_funname (frame, &name, &lang, NULL);
     }
-  CATCH (ex, RETURN_MASK_ALL)
+  CATCH (except, RETURN_MASK_ALL)
     {
-      except = ex;
+      xfree (name);
+      GDBSCM_HANDLE_GDB_EXCEPTION (except);
     }
   END_CATCH
 
-  xfree (name);
-  GDBSCM_HANDLE_GDB_EXCEPTION (except);
-
   if (frame == NULL)
     {
       gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 0669750..88094a7 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1702,16 +1702,18 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
 				    TD_SIGNO_MASK,
 				    TD_THR_ANY_USER_FLAGS);
     }
-
-  if (libthread_db_debug)
+  CATCH (except, RETURN_MASK_ERROR)
     {
-      CATCH (except, RETURN_MASK_ERROR)
+      if (libthread_db_debug)
 	{
 	  exception_fprintf (gdb_stdlog, except,
 			     "Warning: find_new_threads_once: ");
 	}
-      END_CATCH
+    }
+  END_CATCH
 
+  if (libthread_db_debug)
+    {
       fprintf_unfiltered (gdb_stdlog,
 			  _("Found %d new threads in iteration %d.\n"),
 			  data.new_threads, iteration);
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index dcf1d5a..42a8596 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -503,15 +503,16 @@ bppy_get_commands (PyObject *self, void *closure)
     {
       print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
-  ui_out_redirect (current_uiout, NULL);
   CATCH (except, RETURN_MASK_ALL)
     {
+      ui_out_redirect (current_uiout, NULL);
       do_cleanups (chain);
       gdbpy_convert_exception (except);
       return NULL;
     }
   END_CATCH
 
+  ui_out_redirect (current_uiout, NULL);
   cmdstr = ui_file_xstrdup (string_file, &length);
   make_cleanup (xfree, cmdstr);
   result = PyString_Decode (cmdstr, strlen (cmdstr), host_charset (), NULL);
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 6bd9d01..5eb5cf4 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1155,14 +1155,13 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
     {
       ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
     }
-
-  replay_memory_access = old;
-
   CATCH (except, RETURN_MASK_ALL)
     {
+      replay_memory_access = old;
       throw_exception (except);
     }
   END_CATCH
+  replay_memory_access = old;
 
   return ret;
 }
@@ -1187,14 +1186,13 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
     {
       ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt);
     }
-
-  replay_memory_access = old;
-
   CATCH (except, RETURN_MASK_ALL)
     {
+      replay_memory_access = old;
       throw_exception (except);
     }
   END_CATCH
+  replay_memory_access = old;
 
   return ret;
 }
@@ -1706,12 +1704,11 @@ record_btrace_start_replaying (struct thread_info *tp)
       if (upd_step_stack_frame_id)
 	tp->control.step_stack_frame_id = frame_id;
     }
-
-  /* Restore the previous execution state.  */
-  set_executing (tp->ptid, executing);
-
   CATCH (except, RETURN_MASK_ALL)
     {
+      /* Restore the previous execution state.  */
+      set_executing (tp->ptid, executing);
+
       xfree (btinfo->replay);
       btinfo->replay = NULL;
 
@@ -1721,6 +1718,9 @@ record_btrace_start_replaying (struct thread_info *tp)
     }
   END_CATCH
 
+  /* Restore the previous execution state.  */
+  set_executing (tp->ptid, executing);
+
   return replay;
 }
 
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-02-27 18:19 ` Pedro Alves
  2015-02-27 23:52   ` Patrick Palka
@ 2015-03-07 16:01   ` Pedro Alves
  2015-03-07 17:58     ` [all pushed] " Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-03-07 16:01 UTC (permalink / raw)
  To: gdb-patches

On 02/27/2015 06:19 PM, Pedro Alves wrote:
> 
> These are still pending:
> 
>     > [PATCH 29/36] Normalize TRY_CATCH exception handling block
>     > [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros
>     > [PATCH 31/36] Split TRY_CATCH into TRY + CATCH
>     > [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere
>     > [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions
>     > [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks
>     > [PATCH 35/36] kill volatile struct gdb_exception
>     > [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode

These are now in.

> I don't have time right now to rebase this part, but I'd like
> to move ahead with it sometime soon.  If anyone has comments on
> this, now's the time to send them out.

The remaining one is:

    > [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast

I'll post an alternative patch as soon as I have a chance.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-07 16:01   ` Pedro Alves
@ 2015-03-07 17:58     ` Pedro Alves
  2015-03-16  4:42       ` asmwarrior
  0 siblings, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-03-07 17:58 UTC (permalink / raw)
  To: GDB Patches

On 03/07/2015 04:01 PM, Pedro Alves wrote:

> The remaining one is:
> 
>     > [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast
> 
> I'll post an alternative patch as soon as I have a chance.

I've pushed the alternative, more correct fix now:

 [Fix struct sockaddr/sockaddr_in/sockaddr_un strict aliasing violations]
 https://sourceware.org/ml/gdb-patches/2015-03/msg00193.html

At this point, an '--enable-build-with-cxx --enable-targets=all'
configure builds (and works) on x86_64 Fedora 20 (g++ 4.8.3).

At this point, I'd like to invite others to try out --enable-build-with-cxx
on others hosts, and send in fixes for any errors that stumbles on.

To recap, there are a ton of warnings still.  Those will be subject
of another patch series, based on:

 https://github.com/palves/gdb/commits/palves/cxx-conversion-attempt-part-2-no-fpermissive

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-07 17:58     ` [all pushed] " Pedro Alves
@ 2015-03-16  4:42       ` asmwarrior
  2015-03-16  5:05         ` asmwarrior
  0 siblings, 1 reply; 100+ messages in thread
From: asmwarrior @ 2015-03-16  4:42 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

On 2015-3-8 1:58, Pedro Alves wrote:
> At this point, I'd like to invite others to try out --enable-build-with-cxx
> on others hosts, and send in fixes for any errors that stumbles on.

I tested it today on msys + mingw4.8 32bit, and I get a build error:

../../binutils-gdb/gdb/windows-nat.c: At global scope:
../../binutils-gdb/gdb/windows-nat.c:192:1: error: conflicting declaration 'typedef struct thread_info_struct thread_info'
 thread_info;
 ^
In file included from ../../binutils-gdb/gdb/windows-nat.c:52:0:
../../binutils-gdb/gdb/gdbthread.h:160:8: error: 'struct thread_info' has a previous declaration as 'struct thread_info'
 struct thread_info
        ^
It looks like windows-nat.c has its own thread_info which should overwrite the one in gdbthread.h, but I don't know how to fix it right now.
Any ideas?

Yuanhui Zhang

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16  4:42       ` asmwarrior
@ 2015-03-16  5:05         ` asmwarrior
  2015-03-16  5:22           ` asmwarrior
  2015-03-16 11:42           ` Pedro Alves
  0 siblings, 2 replies; 100+ messages in thread
From: asmwarrior @ 2015-03-16  5:05 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

On 2015-3-16 12:49, asmwarrior wrote:
> On 2015-3-8 1:58, Pedro Alves wrote:
>> At this point, I'd like to invite others to try out --enable-build-with-cxx
>> on others hosts, and send in fixes for any errors that stumbles on.
> 
> I tested it today on msys + mingw4.8 32bit, and I get a build error:
> 
> .../../binutils-gdb/gdb/windows-nat.c: At global scope:
> .../../binutils-gdb/gdb/windows-nat.c:192:1: error: conflicting declaration 'typedef struct thread_info_struct thread_info'
>  thread_info;
>  ^
> In file included from ../../binutils-gdb/gdb/windows-nat.c:52:0:
> .../../binutils-gdb/gdb/gdbthread.h:160:8: error: 'struct thread_info' has a previous declaration as 'struct thread_info'
>  struct thread_info
>         ^
> It looks like windows-nat.c has its own thread_info which should overwrite the one in gdbthread.h, but I don't know how to fix it right now.
> Any ideas?
> 
> Yuanhui Zhang
> 
> 
The patch below should fix this build error.
I just change the typedef name inside the windows-nat.c.


[-- Attachment #2: thread_info_windows.patch --]
[-- Type: text/x-c++, Size: 4688 bytes --]

 gdb/windows-nat.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 49c09d3..f812a2c 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -189,16 +189,16 @@ typedef struct thread_info_struct
     CONTEXT context;
     STACKFRAME sf;
   }
-thread_info;
+thread_info_windows;
 
-static thread_info thread_head;
+static thread_info_windows thread_head;
 
 /* The process and thread handles for the above context.  */
 
 static DEBUG_EVENT current_event;	/* The current debug event from
 					   WaitForDebugEvent */
 static HANDLE current_process_handle;	/* Currently executing process */
-static thread_info *current_thread;	/* Info on currently selected thread */
+static thread_info_windows *current_thread;	/* Info on currently selected thread */
 static DWORD main_thread_id;		/* Thread ID of the main thread */
 
 /* Counts of things.  */
@@ -291,10 +291,10 @@ check (BOOL ok, const char *file, int line)
 /* Find a thread record given a thread id.  If GET_CONTEXT is not 0,
    then also retrieve the context for this thread.  If GET_CONTEXT is
    negative, then don't suspend the thread.  */
-static thread_info *
+static thread_info_windows *
 thread_rec (DWORD id, int get_context)
 {
-  thread_info *th;
+  thread_info_windows *th;
 
   for (th = &thread_head; (th = th->next) != NULL;)
     if (th->id == id)
@@ -331,10 +331,10 @@ thread_rec (DWORD id, int get_context)
 }
 
 /* Add a thread to the thread list.  */
-static thread_info *
+static thread_info_windows *
 windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD id;
 
   gdb_assert (ptid_get_tid (ptid) != 0);
@@ -344,7 +344,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
   if ((th = thread_rec (id, FALSE)))
     return th;
 
-  th = XCNEW (thread_info);
+  th = XCNEW (thread_info_windows);
   th->id = id;
   th->h = h;
   th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
@@ -374,13 +374,13 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
 static void
 windows_init_thread_list (void)
 {
-  thread_info *th = &thread_head;
+  thread_info_windows *th = &thread_head;
 
   DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
   init_thread_list ();
   while (th->next != NULL)
     {
-      thread_info *here = th->next;
+      thread_info_windows *here = th->next;
       th->next = here->next;
       xfree (here);
     }
@@ -391,7 +391,7 @@ windows_init_thread_list (void)
 static void
 windows_delete_thread (ptid_t ptid, DWORD exit_code)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD id;
 
   gdb_assert (ptid_get_tid (ptid) != 0);
@@ -412,7 +412,7 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
 
   if (th->next != NULL)
     {
-      thread_info *here = th->next;
+      thread_info_windows *here = th->next;
       th->next = here->next;
       xfree (here);
     }
@@ -446,7 +446,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
       else
 #endif
 	{
-	  thread_info *th = current_thread;
+	  thread_info_windows *th = current_thread;
 	  th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
 	  CHECK (GetThreadContext (th->h, &th->context));
 	  /* Copy dr values from that thread.
@@ -1080,7 +1080,7 @@ display_selectors (char * args, int from_tty)
 static int
 handle_exception (struct target_waitstatus *ourstatus)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD code = current_event.u.Exception.ExceptionRecord.ExceptionCode;
 
   ourstatus->kind = TARGET_WAITKIND_STOPPED;
@@ -1211,7 +1211,7 @@ static BOOL
 windows_continue (DWORD continue_status, int id, int killed)
 {
   int i;
-  thread_info *th;
+  thread_info_windows *th;
   BOOL res;
 
   DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n",
@@ -1289,7 +1289,7 @@ static void
 windows_resume (struct target_ops *ops,
 		ptid_t ptid, int step, enum gdb_signal sig)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD continue_status = DBG_CONTINUE;
 
   /* A specific PTID means `step only this thread id'.  */
@@ -1412,8 +1412,8 @@ get_windows_debug_event (struct target_ops *ops,
 {
   BOOL debug_event;
   DWORD continue_status, event_code;
-  thread_info *th;
-  static thread_info dummy_thread_info;
+  thread_info_windows *th;
+  static thread_info_windows dummy_thread_info;
   int retval = 0;
 
   last_sig = GDB_SIGNAL_0;
@@ -2551,7 +2551,7 @@ static int
 windows_get_tib_address (struct target_ops *self,
 			 ptid_t ptid, CORE_ADDR *addr)
 {
-  thread_info *th;
+  thread_info_windows *th;
 
   th = thread_rec (ptid_get_tid (ptid), 0);
   if (th == NULL)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16  5:05         ` asmwarrior
@ 2015-03-16  5:22           ` asmwarrior
  2015-03-16  7:15             ` asmwarrior
  2015-03-16 11:42           ` Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: asmwarrior @ 2015-03-16  5:22 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

Now I see another build error which I don't know how to fix it.

g++ -fpermissive -O0 -g -D__USE_MINGW_ACCESS   -I. -I../../binutils-gdb/gdb -I../../binutils-gdb/gdb/common -I../../binutils-gdb/gdb/config -DLOCALEDIR="\"/mingw/share/locale\"" -DHAVE_CONFIG_H -I../../binutils-gdb/gdb/../include/opcode -I../../binutils-gdb/gdb/../opcodes/.. -I../../binutils-gdb/gdb/../readline/.. -I../bfd -I../../binutils-gdb/gdb/../bfd -I../../binutils-gdb/gdb/../include -I../libdecnumber -I../../binutils-gdb/gdb/../libdecnumber  -I../../binutils-gdb/gdb/gnulib/import -Ibuild-gnulib/import    -I/mingw/include  -IE:/code/python27/include -IE:/code/python27/include -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wno-format  -c -o dcache.o -MT dcache.o -MMD -MP -MF .deps/dcache.Tpo ../../binutils-gdb/gdb/dcache.c
In file included from ../../binutils-gdb/gdb/../include/splay-tree.h:43:0,
                 from ../../binutils-gdb/gdb/dcache.c:26:
build-gnulib/import/inttypes.h:57:3: error: #error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
   ^

I use 32bit Windows, 32 bit GCC compiler(MinGW-Build GCC 4.8.2)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16  5:22           ` asmwarrior
@ 2015-03-16  7:15             ` asmwarrior
  2015-03-16  8:20               ` asmwarrior
  0 siblings, 1 reply; 100+ messages in thread
From: asmwarrior @ 2015-03-16  7:15 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

On 2015-3-16 13:29, asmwarrior wrote:
> Now I see another build error which I don't know how to fix it.
> 
> g++ -fpermissive -O0 -g -D__USE_MINGW_ACCESS   -I. -I../../binutils-gdb/gdb -I../../binutils-gdb/gdb/common -I../../binutils-gdb/gdb/config -DLOCALEDIR="\"/mingw/share/locale\"" -DHAVE_CONFIG_H -I../../binutils-gdb/gdb/../include/opcode -I../../binutils-gdb/gdb/../opcodes/.. -I../../binutils-gdb/gdb/../readline/.. -I../bfd -I../../binutils-gdb/gdb/../bfd -I../../binutils-gdb/gdb/../include -I../libdecnumber -I../../binutils-gdb/gdb/../libdecnumber  -I../../binutils-gdb/gdb/gnulib/import -Ibuild-gnulib/import    -I/mingw/include  -IE:/code/python27/include -IE:/code/python27/include -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wno-format  -c -o dcache.o -MT dcache.o -MMD 
>  -MP -MF .deps/dcache.Tpo ../../binutils-gdb/gdb/dcache.c
> In file included from ../../binutils-gdb/gdb/../include/splay-tree.h:43:0,
>                  from ../../binutils-gdb/gdb/dcache.c:26:
> build-gnulib/import/inttypes.h:57:3: error: #error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
>  # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
>    ^
> 
> I use 32bit Windows, 32 bit GCC compiler(MinGW-Build GCC 4.8.2)
> 
The error comes from: inttypes.h, which is under my build directory: F:\build_gdb\mybuildcpp\gdb\build-gnulib\import
It has:

#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
#endif

I use some hack to see/print what's the value of those four macro definitions.
Methods comes from: http://stackoverflow.com/a/10227059/154911
so change code to
#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
/* definition to expand macro then apply to pragma message */
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "="  VALUE(var)

#pragma message(VAR_NAME_VALUE(INT_MAX))
#pragma message(VAR_NAME_VALUE(INT32_MAX))
#pragma message(VAR_NAME_VALUE(INT_MIN))
#pragma message(VAR_NAME_VALUE(INT32_MIN))

# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
#endif

Then I just run the command line, add "-E" to the command line, also remove the "-o .....", I get the result:
#pragma message("INT_MAX" "=" "2147483647")
#pragma message("INT32_MAX" "=" "INT32_MAX")
#pragma message("INT_MIN" "=" "(-2147483647 - 1)")
#pragma message("INT32_MIN" "=" "INT32_MIN")


It turns out that INT32_MIN and INT32_MAX is not defined.
Question: where do I need to add those definitions of INT32_MIN and INT32_MAX?

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16  7:15             ` asmwarrior
@ 2015-03-16  8:20               ` asmwarrior
  2015-03-16 11:43                 ` [pushed] stub-termcap.c: prototype tputs's parameter's parameter, for C++ mode (Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program) Pedro Alves
                                   ` (2 more replies)
  0 siblings, 3 replies; 100+ messages in thread
From: asmwarrior @ 2015-03-16  8:20 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

OK, I now successfully build gdb.exe and gdbserver.exe!
To handle the INT32_MAX and INT32_MIN macro definition issue, I just have:

#ifndef INT32_MIN
#define INT32_MIN INT_MIN
#endif

#ifndef INT32_MAX
#define INT32_MAX INT_MAX
#endif

Before
 
#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
#endif

In either:
mybuildcpp\gdb\gdbserver\build-gnulib-gdbserver\import\inttypes.h
and
mybuildcpp\gdb\build-gnulib\import\inttypes.h

The total patch I use is in attachment.

Yuanhui Zhang





[-- Attachment #2: 0001-build-fix-when-using-enable-build-with-cxx-option-un.patch --]
[-- Type: text/x-c++, Size: 6746 bytes --]

From d0a34a8b8491f3aae0a7e13e6a5f0a1969aac1dd Mon Sep 17 00:00:00 2001
From: asmwarrior <asmwarrior@gmail.com>
Date: Mon, 16 Mar 2015 16:23:38 +0800
Subject: [PATCH] build fix when using --enable-build-with-cxx option under
 MinGW.

---
 gdb/gdb_curses.h   |  2 +-
 gdb/stub-termcap.c | 22 ++++++++++++++--------
 gdb/windows-nat.c  | 38 +++++++++++++++++++-------------------
 3 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
index 9b3707a..d02cab3 100644
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -51,7 +51,7 @@
    of the termcap functions will be built from stub-termcap.c.  Readline
    provides its own extern declarations when there's no termcap.h; do the
    same here for the termcap functions used in GDB.  */
-extern int tgetnum (const char *);
+extern "C" int tgetnum (const char *);
 #endif
 
 /* SunOS's curses.h has a '#define reg register' in it.  Thank you Sun.  */
diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c
index cc8632c..a2e833a 100644
--- a/gdb/stub-termcap.c
+++ b/gdb/stub-termcap.c
@@ -23,14 +23,20 @@
 #include "defs.h"
 
 #include <stdlib.h>
-
+#ifdef __cplusplus
+extern "C" {
+#endif
 /* -Wmissing-prototypes */
-extern int tgetent (char *buffer, char *termtype);
-extern int tgetnum (char *name);
-extern int tgetflag (char *name);
-extern char* tgetstr (char *name, char **area);
-extern int tputs (char *string, int nlines, int (*outfun) ());
-extern char *tgoto (const char *cap, int col, int row);
+int tgetent (char *buffer, char *termtype);
+int tgetnum (char *name);
+int tgetflag (char *name);
+char* tgetstr (char *name, char **area);
+int tputs (char *string, int nlines, int (*outfun) (char *));
+char *tgoto (const char *cap, int col, int row);
+#ifdef __cplusplus
+}
+#endif
+
 
 /* Each of the files below is a minimal implementation of the standard
    termcap function with the same name, suitable for use in a Windows
@@ -61,7 +67,7 @@ tgetstr (char *name, char **area)
 }
 
 int
-tputs (char *string, int nlines, int (*outfun) ())
+tputs (char *string, int nlines, int (*outfun) (char *))
 {
   while (*string)
     outfun (*string++);
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 49c09d3..f812a2c 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -189,16 +189,16 @@ typedef struct thread_info_struct
     CONTEXT context;
     STACKFRAME sf;
   }
-thread_info;
+thread_info_windows;
 
-static thread_info thread_head;
+static thread_info_windows thread_head;
 
 /* The process and thread handles for the above context.  */
 
 static DEBUG_EVENT current_event;	/* The current debug event from
 					   WaitForDebugEvent */
 static HANDLE current_process_handle;	/* Currently executing process */
-static thread_info *current_thread;	/* Info on currently selected thread */
+static thread_info_windows *current_thread;	/* Info on currently selected thread */
 static DWORD main_thread_id;		/* Thread ID of the main thread */
 
 /* Counts of things.  */
@@ -291,10 +291,10 @@ check (BOOL ok, const char *file, int line)
 /* Find a thread record given a thread id.  If GET_CONTEXT is not 0,
    then also retrieve the context for this thread.  If GET_CONTEXT is
    negative, then don't suspend the thread.  */
-static thread_info *
+static thread_info_windows *
 thread_rec (DWORD id, int get_context)
 {
-  thread_info *th;
+  thread_info_windows *th;
 
   for (th = &thread_head; (th = th->next) != NULL;)
     if (th->id == id)
@@ -331,10 +331,10 @@ thread_rec (DWORD id, int get_context)
 }
 
 /* Add a thread to the thread list.  */
-static thread_info *
+static thread_info_windows *
 windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD id;
 
   gdb_assert (ptid_get_tid (ptid) != 0);
@@ -344,7 +344,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
   if ((th = thread_rec (id, FALSE)))
     return th;
 
-  th = XCNEW (thread_info);
+  th = XCNEW (thread_info_windows);
   th->id = id;
   th->h = h;
   th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
@@ -374,13 +374,13 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
 static void
 windows_init_thread_list (void)
 {
-  thread_info *th = &thread_head;
+  thread_info_windows *th = &thread_head;
 
   DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
   init_thread_list ();
   while (th->next != NULL)
     {
-      thread_info *here = th->next;
+      thread_info_windows *here = th->next;
       th->next = here->next;
       xfree (here);
     }
@@ -391,7 +391,7 @@ windows_init_thread_list (void)
 static void
 windows_delete_thread (ptid_t ptid, DWORD exit_code)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD id;
 
   gdb_assert (ptid_get_tid (ptid) != 0);
@@ -412,7 +412,7 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
 
   if (th->next != NULL)
     {
-      thread_info *here = th->next;
+      thread_info_windows *here = th->next;
       th->next = here->next;
       xfree (here);
     }
@@ -446,7 +446,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
       else
 #endif
 	{
-	  thread_info *th = current_thread;
+	  thread_info_windows *th = current_thread;
 	  th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
 	  CHECK (GetThreadContext (th->h, &th->context));
 	  /* Copy dr values from that thread.
@@ -1080,7 +1080,7 @@ display_selectors (char * args, int from_tty)
 static int
 handle_exception (struct target_waitstatus *ourstatus)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD code = current_event.u.Exception.ExceptionRecord.ExceptionCode;
 
   ourstatus->kind = TARGET_WAITKIND_STOPPED;
@@ -1211,7 +1211,7 @@ static BOOL
 windows_continue (DWORD continue_status, int id, int killed)
 {
   int i;
-  thread_info *th;
+  thread_info_windows *th;
   BOOL res;
 
   DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n",
@@ -1289,7 +1289,7 @@ static void
 windows_resume (struct target_ops *ops,
 		ptid_t ptid, int step, enum gdb_signal sig)
 {
-  thread_info *th;
+  thread_info_windows *th;
   DWORD continue_status = DBG_CONTINUE;
 
   /* A specific PTID means `step only this thread id'.  */
@@ -1412,8 +1412,8 @@ get_windows_debug_event (struct target_ops *ops,
 {
   BOOL debug_event;
   DWORD continue_status, event_code;
-  thread_info *th;
-  static thread_info dummy_thread_info;
+  thread_info_windows *th;
+  static thread_info_windows dummy_thread_info;
   int retval = 0;
 
   last_sig = GDB_SIGNAL_0;
@@ -2551,7 +2551,7 @@ static int
 windows_get_tib_address (struct target_ops *self,
 			 ptid_t ptid, CORE_ADDR *addr)
 {
-  thread_info *th;
+  thread_info_windows *th;
 
   th = thread_rec (ptid_get_tid (ptid), 0);
   if (th == NULL)
-- 
1.9.5.msysgit.0


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16  5:05         ` asmwarrior
  2015-03-16  5:22           ` asmwarrior
@ 2015-03-16 11:42           ` Pedro Alves
  2015-05-15  8:13             ` asmwarrior
  1 sibling, 1 reply; 100+ messages in thread
From: Pedro Alves @ 2015-03-16 11:42 UTC (permalink / raw)
  To: asmwarrior, GDB Patches

On 03/16/2015 05:11 AM, asmwarrior wrote:

> The patch below should fix this build error.
> I just change the typedef name inside the windows-nat.c.
> 
> 
> thread_info_windows.patch
> 
> 
>  gdb/windows-nat.c | 38 +++++++++++++++++++-------------------
>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 49c09d3..f812a2c 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -189,16 +189,16 @@ typedef struct thread_info_struct
>      CONTEXT context;
>      STACKFRAME sf;
>    }
> -thread_info;
> +thread_info_windows;
>  

Thanks!  I realized I have a mingw cross compiler handy,
so I indeed see this too.

I wrote a ChangeLog entry and pushed your patch in, as below.  I renamed
the structure to windows_thread_info instead, as everything Windows
target-specific in the file always uses windows_ as prefix, and gdbserver
also names its equivalent structure with a "win32_" as prefix, not suffix.
I also renamed the struct tag for consistency.

---
From 876d1cd7b5899e7927e298a7f7344a0da48425a9 Mon Sep 17 00:00:00 2001
From: Yuanhui Zhang <asmwarrior@gmail.com>
Date: Mon, 16 Mar 2015 11:31:31 +0000
Subject: [PATCH 1/3] windows-nat.c: conflicting declaration of struct
 thread_info in C++ mode

Building mingw GDB with --enable-build-with-cxx shows:

 ../../binutils-gdb/gdb/windows-nat.c: At global scope:
 ../../binutils-gdb/gdb/windows-nat.c:192:1: error: conflicting declaration 'typedef struct thread_info_struct thread_info'
  thread_info;
  ^
 In file included from ../../binutils-gdb/gdb/windows-nat.c:52:0:
 ../../binutils-gdb/gdb/gdbthread.h:160:8: error: 'struct thread_info' has a previous declaration as 'struct thread_info'
  struct thread_info
	 ^

Simply rename the structure to avoid the conflict.

gdb/ChangeLog:
2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
	    Pedro Alves  <palves@redhat.com>

	* windows-nat.c (struct thread_info_struct): Rename to ...
	(struct windows_thread_info_struct): ... this.
	(thread_info): Rename to ...
	(windows_thread_info): ... this.
	All users updated.
---
 gdb/ChangeLog     |  9 +++++++++
 gdb/windows-nat.c | 42 +++++++++++++++++++++---------------------
 2 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 043b783..8828635 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
+	    Pedro Alves  <palves@redhat.com>
+
+	* windows-nat.c (struct thread_info_struct): Rename to ...
+	(struct windows_thread_info_struct): ... this.
+	(thread_info): Rename to ...
+	(windows_thread_info): ... this.
+	All users updated.
+
 2015-03-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
 	    Pedro Alves  <palves@redhat.com>
 
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 42a6046..e5b28c1 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -177,9 +177,9 @@ static enum gdb_signal last_sig = GDB_SIGNAL_0;
 
 /* Thread information structure used to track information that is
    not available in gdb's thread structure.  */
-typedef struct thread_info_struct
+typedef struct windows_thread_info_struct
   {
-    struct thread_info_struct *next;
+    struct windows_thread_info_struct *next;
     DWORD id;
     HANDLE h;
     CORE_ADDR thread_local_base;
@@ -189,16 +189,16 @@ typedef struct thread_info_struct
     CONTEXT context;
     STACKFRAME sf;
   }
-thread_info;
+windows_thread_info;
 
-static thread_info thread_head;
+static windows_thread_info thread_head;
 
 /* The process and thread handles for the above context.  */
 
 static DEBUG_EVENT current_event;	/* The current debug event from
 					   WaitForDebugEvent */
 static HANDLE current_process_handle;	/* Currently executing process */
-static thread_info *current_thread;	/* Info on currently selected thread */
+static windows_thread_info *current_thread;	/* Info on currently selected thread */
 static DWORD main_thread_id;		/* Thread ID of the main thread */
 
 /* Counts of things.  */
@@ -291,10 +291,10 @@ check (BOOL ok, const char *file, int line)
 /* Find a thread record given a thread id.  If GET_CONTEXT is not 0,
    then also retrieve the context for this thread.  If GET_CONTEXT is
    negative, then don't suspend the thread.  */
-static thread_info *
+static windows_thread_info *
 thread_rec (DWORD id, int get_context)
 {
-  thread_info *th;
+  windows_thread_info *th;
 
   for (th = &thread_head; (th = th->next) != NULL;)
     if (th->id == id)
@@ -331,10 +331,10 @@ thread_rec (DWORD id, int get_context)
 }
 
 /* Add a thread to the thread list.  */
-static thread_info *
+static windows_thread_info *
 windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
 {
-  thread_info *th;
+  windows_thread_info *th;
   DWORD id;
 
   gdb_assert (ptid_get_tid (ptid) != 0);
@@ -344,7 +344,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
   if ((th = thread_rec (id, FALSE)))
     return th;
 
-  th = XCNEW (thread_info);
+  th = XCNEW (windows_thread_info);
   th->id = id;
   th->h = h;
   th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
@@ -374,13 +374,13 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
 static void
 windows_init_thread_list (void)
 {
-  thread_info *th = &thread_head;
+  windows_thread_info *th = &thread_head;
 
   DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
   init_thread_list ();
   while (th->next != NULL)
     {
-      thread_info *here = th->next;
+      windows_thread_info *here = th->next;
       th->next = here->next;
       xfree (here);
     }
@@ -391,7 +391,7 @@ windows_init_thread_list (void)
 static void
 windows_delete_thread (ptid_t ptid, DWORD exit_code)
 {
-  thread_info *th;
+  windows_thread_info *th;
   DWORD id;
 
   gdb_assert (ptid_get_tid (ptid) != 0);
@@ -412,7 +412,7 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
 
   if (th->next != NULL)
     {
-      thread_info *here = th->next;
+      windows_thread_info *here = th->next;
       th->next = here->next;
       xfree (here);
     }
@@ -446,7 +446,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
       else
 #endif
 	{
-	  thread_info *th = current_thread;
+	  windows_thread_info *th = current_thread;
 	  th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
 	  CHECK (GetThreadContext (th->h, &th->context));
 	  /* Copy dr values from that thread.
@@ -983,7 +983,7 @@ display_selectors (char * args, int from_tty)
 static int
 handle_exception (struct target_waitstatus *ourstatus)
 {
-  thread_info *th;
+  windows_thread_info *th;
   DWORD code = current_event.u.Exception.ExceptionRecord.ExceptionCode;
 
   ourstatus->kind = TARGET_WAITKIND_STOPPED;
@@ -1114,7 +1114,7 @@ static BOOL
 windows_continue (DWORD continue_status, int id, int killed)
 {
   int i;
-  thread_info *th;
+  windows_thread_info *th;
   BOOL res;
 
   DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n",
@@ -1192,7 +1192,7 @@ static void
 windows_resume (struct target_ops *ops,
 		ptid_t ptid, int step, enum gdb_signal sig)
 {
-  thread_info *th;
+  windows_thread_info *th;
   DWORD continue_status = DBG_CONTINUE;
 
   /* A specific PTID means `step only this thread id'.  */
@@ -1315,8 +1315,8 @@ get_windows_debug_event (struct target_ops *ops,
 {
   BOOL debug_event;
   DWORD continue_status, event_code;
-  thread_info *th;
-  static thread_info dummy_thread_info;
+  windows_thread_info *th;
+  static windows_thread_info dummy_thread_info;
   int retval = 0;
 
   last_sig = GDB_SIGNAL_0;
@@ -2450,7 +2450,7 @@ static int
 windows_get_tib_address (struct target_ops *self,
 			 ptid_t ptid, CORE_ADDR *addr)
 {
-  thread_info *th;
+  windows_thread_info *th;
 
   th = thread_rec (ptid_get_tid (ptid), 0);
   if (th == NULL)
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* [pushed] stub-termcap.c: prototype tputs's parameter's parameter, for C++ mode (Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program)
  2015-03-16  8:20               ` asmwarrior
@ 2015-03-16 11:43                 ` Pedro Alves
  2015-03-16 11:46                 ` [pushed] stub termcap, add extern "C" " Pedro Alves
  2015-03-16 11:55                 ` [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
  2 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-03-16 11:43 UTC (permalink / raw)
  To: asmwarrior, GDB Patches

On 03/16/2015 08:26 AM, asmwarrior wrote:
>  int
> -tputs (char *string, int nlines, int (*outfun) ())
> +tputs (char *string, int nlines, int (*outfun) (char *))
>  {
>    while (*string)
>      outfun (*string++);

Hmm, bitten by -fpedantic :-) :

/home/pedro/gdb/mygit/src/gdb/stub-termcap.c: In function 'int tputs(char*, int, int (*)(char*))':
/home/pedro/gdb/mygit/src/gdb/stub-termcap.c:75:22: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
     outfun (*string++);
                      ^

From "man tputs", the correct prototype is:

       int tputs(const char *str, int affcnt, int (*putc)(int));

I've pushed the patch below.  Thanks!

---
From b1a921c8c6f9e3d033629f32473c6470c360b43f Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 16 Mar 2015 11:28:23 +0000
Subject: [PATCH 2/3] stub-termcap.c: prototype tputs's parameter's parameter,
 for C++ mode

 src/gdb/stub-termcap.c: In function 'int tputs(char*, int, int (*)())':
 src/gdb/stub-termcap.c:67:22: error: too many arguments to function
      outfun (*string++);
		       ^

gdb/ChangeLog:
2015-03-16  Pedro Alves  <palves@redhat.com>
	    Yuanhui Zhang  <asmwarrior@gmail.com>

	* stub-termcap.c (tputs): Change prototype.
---
 gdb/ChangeLog      | 5 +++++
 gdb/stub-termcap.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8828635..54cb0b2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Pedro Alves  <palves@redhat.com>
+	    Yuanhui Zhang  <asmwarrior@gmail.com>
+
+	* stub-termcap.c (tputs): Change prototype.
+
 2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
 	    Pedro Alves  <palves@redhat.com>
 
diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c
index cc8632c..cecb3fb 100644
--- a/gdb/stub-termcap.c
+++ b/gdb/stub-termcap.c
@@ -29,7 +29,7 @@ extern int tgetent (char *buffer, char *termtype);
 extern int tgetnum (char *name);
 extern int tgetflag (char *name);
 extern char* tgetstr (char *name, char **area);
-extern int tputs (char *string, int nlines, int (*outfun) ());
+extern int tputs (char *string, int nlines, int (*outfun) (int));
 extern char *tgoto (const char *cap, int col, int row);
 
 /* Each of the files below is a minimal implementation of the standard
@@ -61,7 +61,7 @@ tgetstr (char *name, char **area)
 }
 
 int
-tputs (char *string, int nlines, int (*outfun) ())
+tputs (char *string, int nlines, int (*outfun) (int))
 {
   while (*string)
     outfun (*string++);
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* [pushed] stub termcap, add extern "C" (Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program)
  2015-03-16  8:20               ` asmwarrior
  2015-03-16 11:43                 ` [pushed] stub-termcap.c: prototype tputs's parameter's parameter, for C++ mode (Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program) Pedro Alves
@ 2015-03-16 11:46                 ` Pedro Alves
  2015-03-16 11:55                 ` [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
  2 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-03-16 11:46 UTC (permalink / raw)
  To: asmwarrior, GDB Patches

On 03/16/2015 08:26 AM, asmwarrior wrote:
> diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
> index 9b3707a..d02cab3 100644
> --- a/gdb/gdb_curses.h
> +++ b/gdb/gdb_curses.h
> @@ -51,7 +51,7 @@
>     of the termcap functions will be built from stub-termcap.c.  Readline
>     provides its own extern declarations when there's no termcap.h; do the
>     same here for the termcap functions used in GDB.  */
> -extern int tgetnum (const char *);
> +extern "C" int tgetnum (const char *);

This still needs to be plain "extern" in C mode.  We can use EXTERN_C
for this.

>  #endif
>  
>  /* SunOS's curses.h has a '#define reg register' in it.  Thank you Sun.  */
> diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c
> index cc8632c..a2e833a 100644
> --- a/gdb/stub-termcap.c
> +++ b/gdb/stub-termcap.c
> @@ -23,14 +23,20 @@
>  #include "defs.h"
>  
>  #include <stdlib.h>
> -
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
>  /* -Wmissing-prototypes */
> -extern int tgetent (char *buffer, char *termtype);
> -extern int tgetnum (char *name);
> -extern int tgetflag (char *name);
> -extern char* tgetstr (char *name, char **area);
> -extern int tputs (char *string, int nlines, int (*outfun) ());
> -extern char *tgoto (const char *cap, int col, int row);
> +int tgetent (char *buffer, char *termtype);
> +int tgetnum (char *name);
> +int tgetflag (char *name);
> +char* tgetstr (char *name, char **area);
> +int tputs (char *string, int nlines, int (*outfun) (char *));
> +char *tgoto (const char *cap, int col, int row);
> +#ifdef __cplusplus
> +}
> +#endif
> +

We can keep the externs.

Here's what I pushed.

Thanks!

---
From d053f6be557fa3bedd4ccbd969103dbb51a37439 Mon Sep 17 00:00:00 2001
From: Yuanhui Zhang <asmwarrior@gmail.com>
Date: Mon, 16 Mar 2015 11:28:24 +0000
Subject: [PATCH 3/3] stub termcap, add extern "C"

Fixes linking an --enable-build-with-cxx build on mingw:

 ../readline/terminal.c:278: undefined reference to `tgetnum'
 ../readline/terminal.c:297: undefined reference to `tgetnum'
 ../readline/libreadline.a(terminal.o): In function `get_term_capabilities':
 ../readline/terminal.c:427: undefined reference to `tgetstr'
 ../readline/libreadline.a(terminal.o): In function `_rl_init_terminal_io':
 [etc.]

gdb/ChangeLog:
2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb_curses.h (tgetnum): Mark with EXTERN_C.
	* stub-termcap.c (tgetent, tgetnum, tgetflag, tgetstr, tputs)
	(tgoto): Wrap with extern "C".
---
 gdb/ChangeLog      | 7 +++++++
 gdb/gdb_curses.h   | 2 +-
 gdb/stub-termcap.c | 8 ++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 54cb0b2..eb8ef87 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
+	    Pedro Alves  <palves@redhat.com>
+
+	* gdb_curses.h (tgetnum): Mark with EXTERN_C.
+	* stub-termcap.c (tgetent, tgetnum, tgetflag, tgetstr, tputs)
+	(tgoto): Wrap with extern "C".
+
 2015-03-16  Pedro Alves  <palves@redhat.com>
 	    Yuanhui Zhang  <asmwarrior@gmail.com>
 
diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
index 9b3707a..a89383f 100644
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -51,7 +51,7 @@
    of the termcap functions will be built from stub-termcap.c.  Readline
    provides its own extern declarations when there's no termcap.h; do the
    same here for the termcap functions used in GDB.  */
-extern int tgetnum (const char *);
+EXTERN_C int tgetnum (const char *);
 #endif
 
 /* SunOS's curses.h has a '#define reg register' in it.  Thank you Sun.  */
diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c
index cecb3fb..5897d89 100644
--- a/gdb/stub-termcap.c
+++ b/gdb/stub-termcap.c
@@ -24,6 +24,10 @@
 
 #include <stdlib.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* -Wmissing-prototypes */
 extern int tgetent (char *buffer, char *termtype);
 extern int tgetnum (char *name);
@@ -32,6 +36,10 @@ extern char* tgetstr (char *name, char **area);
 extern int tputs (char *string, int nlines, int (*outfun) (int));
 extern char *tgoto (const char *cap, int col, int row);
 
+#ifdef __cplusplus
+}
+#endif
+
 /* Each of the files below is a minimal implementation of the standard
    termcap function with the same name, suitable for use in a Windows
    console window.  */
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16  8:20               ` asmwarrior
  2015-03-16 11:43                 ` [pushed] stub-termcap.c: prototype tputs's parameter's parameter, for C++ mode (Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program) Pedro Alves
  2015-03-16 11:46                 ` [pushed] stub termcap, add extern "C" " Pedro Alves
@ 2015-03-16 11:55                 ` Pedro Alves
  2 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-03-16 11:55 UTC (permalink / raw)
  To: asmwarrior, GDB Patches

On 03/16/2015 08:26 AM, asmwarrior wrote:
> OK, I now successfully build gdb.exe and gdbserver.exe!
> To handle the INT32_MAX and INT32_MIN macro definition issue, I just have:
> 
> #ifndef INT32_MIN
> #define INT32_MIN INT_MIN
> #endif
> 
> #ifndef INT32_MAX
> #define INT32_MAX INT_MAX
> #endif
> 
> Before
>  
> #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
> # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
> #endif
> 
> In either:
> mybuildcpp\gdb\gdbserver\build-gnulib-gdbserver\import\inttypes.h
> and
> mybuildcpp\gdb\build-gnulib\import\inttypes.h

Putting the hack in common-defs.h instead worked for me.  It has
the advantage of being in the sources, so won't get lost by
a clean rebuild, which regenerates that file.

However, we should instead do what the error says, and report the
issue to bug-gnulib@gnu.org, fix the issue there, and then
pull in a newer gnulib.  Maybe the issue is already fixed there
even.    That last time we tried pulling in a newer gnulib we
stumbled on a windows.h conflict that will be to resolved
first though.  :-/

Thanks,
Pedro Alves

From 9f4ccd018230538d043eaa08858a6df2eae3cabd Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 16 Mar 2015 11:09:43 +0000
Subject: [PATCH] hack for missing INT32_MIN/INT32_MAX

---
 gdb/common/common-defs.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 62d9de5..72a65dd 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -27,6 +27,14 @@
 #include "build-gnulib/config.h"
 #endif
 
+#ifndef INT32_MIN
+#define INT32_MIN INT_MIN
+#endif
+
+#ifndef INT32_MAX
+#define INT32_MAX INT_MAX
+#endif
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-03-16 11:42           ` Pedro Alves
@ 2015-05-15  8:13             ` asmwarrior
  2015-05-15  8:24               ` asmwarrior
  2015-05-15 15:04               ` Pedro Alves
  0 siblings, 2 replies; 100+ messages in thread
From: asmwarrior @ 2015-05-15  8:13 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

Hi, Pedro, I just found another build issue when building gdb under g++.

Building mingw GDB with --enable-build-with-cxx shows:

../../binutils-gdb/gdb/python/py-unwind.c:500:45: error: cannot convert 'cached_frame_info::reg_info*' to 'pyuw_prev_register(frame_info*, void**, int)::reg_info*' in initialization
   struct reg_info *reg_info = cached_frame->reg;
                                             ^
../../binutils-gdb/gdb/python/py-unwind.c:501:60: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info_end = reg_info + cached_frame->reg_count;
                                                            ^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info = cached_frame->reg;
          ^
../../binutils-gdb/gdb/python/py-unwind.c:505:37: error: cannot increment a pointer to incomplete type 'pyuw_prev_register(frame_info*, void**, int)::reg_info'
   for (; reg_info < reg_info_end; ++reg_info)
                                     ^
../../binutils-gdb/gdb/python/py-unwind.c:507:29: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
       if (regnum == reg_info->number)
                             ^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info = cached_frame->reg;
          ^
../../binutils-gdb/gdb/python/py-unwind.c:508:68: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
         return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
                                                                    ^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info = cached_frame->reg;
          ^
../../binutils-gdb/gdb/python/py-unwind.c: In function 'int pyuw_sniffer(const frame_unwind*, frame_info*, void**)':
../../binutils-gdb/gdb/python/py-unwind.c:574:70: warning: invalid conversion from 'void*' to 'cached_frame_info*' [-fpermissive]
                             reg_count * sizeof (cached_frame->reg[0]));
                                                                      ^
../../binutils-gdb/gdb/python/py-unwind.c: In function 'void pyuw_on_new_gdbarch(gdbarch*)':
../../binutils-gdb/gdb/python/py-unwind.c:636:47: warning: invalid conversion from 'void*' to 'pyuw_gdbarch_data_type*' [-fpermissive]
       gdbarch_data (newarch, pyuw_gdbarch_data);
                                               ^
../../binutils-gdb/gdb/python/py-unwind.c:647:29: warning: invalid conversion from 'void*' to 'const frame_data*' [-fpermissive]
       unwinder->unwind_data = (void *) newarch;
                             ^
../../binutils-gdb/gdb/python/py-unwind.c: At global scope:
../../binutils-gdb/gdb/python/py-unwind.c:699:21: error: redefinition of 'PyTypeObject pending_frame_object_type'
 static PyTypeObject pending_frame_object_type =
                     ^
../../binutils-gdb/gdb/python/py-unwind.c:96:21: error: 'PyTypeObject pending_frame_object_type' previously declared here
 static PyTypeObject pending_frame_object_type
                     ^
../../binutils-gdb/gdb/python/py-unwind.c:749:21: error: redefinition of 'PyTypeObject unwind_info_object_type'
 static PyTypeObject unwind_info_object_type =
                     ^
../../binutils-gdb/gdb/python/py-unwind.c:99:21: error: 'PyTypeObject unwind_info_object_type' previously declared here
 static PyTypeObject unwind_info_object_type
                     ^


The first kind of error is caused by embedded struct definition, so I moved it out of the parent struct.
The second kind of error is caused by using static keyword on a CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF decoreated variable, I see that all other files use extern, so I changed to extern.


Here is the patch:

43f2422c2dea00287eff57bd2b3aaa478e6de88d
 gdb/python/py-unwind.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index bcfea4b..10b5731 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -72,6 +72,15 @@ typedef struct
 /* The data we keep for a frame we can unwind: frame ID and an array of
    (register_number, register_value) pairs.  */
 
+struct reg_info
+{
+  /* Register number.  */
+  int number;
+
+  /* Register data bytes pointer.  */
+  gdb_byte data[MAX_REGISTER_SIZE];
+};
+
 typedef struct
 {
   /* Frame ID.  */
@@ -83,20 +92,13 @@ typedef struct
   /* Length of the `reg' array below.  */
   int reg_count;
 
-  struct reg_info
-  {
-    /* Register number.  */
-    int number;
-
-    /* Register data bytes pointer.  */
-    gdb_byte data[MAX_REGISTER_SIZE];
-  } reg[];
+  struct reg_info reg[];
 } cached_frame_info;
 
-static PyTypeObject pending_frame_object_type
+extern PyTypeObject pending_frame_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object");
 
-static PyTypeObject unwind_info_object_type
+extern PyTypeObject unwind_info_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object");
 
 static unsigned int pyuw_debug = 0;

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-05-15  8:13             ` asmwarrior
@ 2015-05-15  8:24               ` asmwarrior
  2015-05-15 15:09                 ` Pedro Alves
  2015-05-15 15:04               ` Pedro Alves
  1 sibling, 1 reply; 100+ messages in thread
From: asmwarrior @ 2015-05-15  8:24 UTC (permalink / raw)
  To: Pedro Alves, GDB Patches

There is another one build error:

In file included from ../../../binutils-gdb/gdb/gdbserver/server.h:61:0,
                 from ../../../binutils-gdb/gdb/gdbserver/server.c:19:
../../../binutils-gdb/gdb/gdbserver/target.h:442:50: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
    (*the_target->handle_new_gdb_connection) () : 0)
                                                  ^

The second operand is a function call which return void, so I have a simply changed the third operand like below: (maybe, we just need a simple if statement instead the conditional operator)

Yuanhui Zhang

Here is the patch:

 gdb/gdbserver/target.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 8d23383..4affedf 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -439,7 +439,7 @@ int kill_inferior (int);
 
 #define target_handle_new_gdb_connection() \
   (the_target->handle_new_gdb_connection ? \
-   (*the_target->handle_new_gdb_connection) () : 0)
+   (*the_target->handle_new_gdb_connection) () : (void)0)
 
 #define detach_inferior(pid) \
   (*the_target->detach) (pid)


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-05-15  8:13             ` asmwarrior
  2015-05-15  8:24               ` asmwarrior
@ 2015-05-15 15:04               ` Pedro Alves
  1 sibling, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-05-15 15:04 UTC (permalink / raw)
  To: asmwarrior, GDB Patches

On 05/15/2015 09:21 AM, asmwarrior wrote:
> Hi, Pedro, I just found another build issue when building gdb under g++.

Thanks!

> 
> Building mingw GDB with --enable-build-with-cxx shows:
> 
> ../../binutils-gdb/gdb/python/py-unwind.c:500:45: error: cannot convert 'cached_frame_info::reg_info*' to 'pyuw_prev_register(frame_info*, void**, int)::reg_info*' in initialization
>    struct reg_info *reg_info = cached_frame->reg;
>                                              ^
> ../../binutils-gdb/gdb/python/py-unwind.c:501:60: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
>    struct reg_info *reg_info_end = reg_info + cached_frame->reg_count;
>                                                             ^
> ../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
>    struct reg_info *reg_info = cached_frame->reg;
>           ^
> ../../binutils-gdb/gdb/python/py-unwind.c:505:37: error: cannot increment a pointer to incomplete type 'pyuw_prev_register(frame_info*, void**, int)::reg_info'
>    for (; reg_info < reg_info_end; ++reg_info)
>                                      ^
> ../../binutils-gdb/gdb/python/py-unwind.c:507:29: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
>        if (regnum == reg_info->number)
>                              ^
> ../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
>    struct reg_info *reg_info = cached_frame->reg;
>           ^
> ../../binutils-gdb/gdb/python/py-unwind.c:508:68: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
>          return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
>                                                                     ^
> ../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
>    struct reg_info *reg_info = cached_frame->reg;
>           ^
> ../../binutils-gdb/gdb/python/py-unwind.c: In function 'int pyuw_sniffer(const frame_unwind*, frame_info*, void**)':
> ../../binutils-gdb/gdb/python/py-unwind.c:574:70: warning: invalid conversion from 'void*' to 'cached_frame_info*' [-fpermissive]
>                              reg_count * sizeof (cached_frame->reg[0]));
>                                                                       ^
> ../../binutils-gdb/gdb/python/py-unwind.c: In function 'void pyuw_on_new_gdbarch(gdbarch*)':
> ../../binutils-gdb/gdb/python/py-unwind.c:636:47: warning: invalid conversion from 'void*' to 'pyuw_gdbarch_data_type*' [-fpermissive]
>        gdbarch_data (newarch, pyuw_gdbarch_data);
>                                                ^
> ../../binutils-gdb/gdb/python/py-unwind.c:647:29: warning: invalid conversion from 'void*' to 'const frame_data*' [-fpermissive]
>        unwinder->unwind_data = (void *) newarch;
>                              ^
> ../../binutils-gdb/gdb/python/py-unwind.c: At global scope:
> ../../binutils-gdb/gdb/python/py-unwind.c:699:21: error: redefinition of 'PyTypeObject pending_frame_object_type'
>  static PyTypeObject pending_frame_object_type =
>                      ^
> ../../binutils-gdb/gdb/python/py-unwind.c:96:21: error: 'PyTypeObject pending_frame_object_type' previously declared here
>  static PyTypeObject pending_frame_object_type
>                      ^
> ../../binutils-gdb/gdb/python/py-unwind.c:749:21: error: redefinition of 'PyTypeObject unwind_info_object_type'
>  static PyTypeObject unwind_info_object_type =
>                      ^
> ../../binutils-gdb/gdb/python/py-unwind.c:99:21: error: 'PyTypeObject unwind_info_object_type' previously declared here
>  static PyTypeObject unwind_info_object_type
>                      ^
> 
> 
> The first kind of error is caused by embedded struct definition, so I moved it out of the parent struct.

That's the right fix.  

> The second kind of error is caused by using static keyword on a CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF decoreated variable, I see that all other files use extern, so I changed to extern.

That too, is the right fix, though the problem isn't caused by
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF.  The problem is that with C we
can "forward declare" variables like this:

static int foo;

void
use_foo (void)
{
  if (foo == 2)
    bar ();
}

static int foo = 3;


But that's not valid C++ (and a link error with C and -fno-common).

So we need to fix the definition too, though, otherwise we have a
static / extern mismatch.  G++ warns about it, but until we get rid
of -fpermissive and enable -Werror in C++ mode, it's easy to
miss.  Building in C mode does catch that with an error though.

Here's what I pushed.

From 13fa0398d7dd8d2b468acf0aba5610ce014709a6 Mon Sep 17 00:00:00 2001
From: Yuanhui Zhang <asmwarrior@gmail.com>
Date: Fri, 15 May 2015 16:00:40 +0100
Subject: [PATCH] Fix a couple C++ build issues

Building mingw GDB with --enable-build-with-cxx shows:

../../binutils-gdb/gdb/python/py-unwind.c:500:45: error: cannot convert 'cached_frame_info::reg_info*' to 'pyuw_prev_register(frame_info*, void**, int)::reg_info*' in initialization
   struct reg_info *reg_info = cached_frame->reg;
                                             ^
../../binutils-gdb/gdb/python/py-unwind.c:501:60: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info_end = reg_info + cached_frame->reg_count;
                                                            ^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info = cached_frame->reg;
          ^
../../binutils-gdb/gdb/python/py-unwind.c:505:37: error: cannot increment a pointer to incomplete type 'pyuw_prev_register(frame_info*, void**, int)::reg_info'
   for (; reg_info < reg_info_end; ++reg_info)
                                     ^
../../binutils-gdb/gdb/python/py-unwind.c:507:29: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
       if (regnum == reg_info->number)
                             ^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info = cached_frame->reg;
          ^
../../binutils-gdb/gdb/python/py-unwind.c:508:68: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
         return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
                                                                    ^
../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info'
   struct reg_info *reg_info = cached_frame->reg;
          ^
../../binutils-gdb/gdb/python/py-unwind.c: In function 'int pyuw_sniffer(const frame_unwind*, frame_info*, void**)':
../../binutils-gdb/gdb/python/py-unwind.c:574:70: warning: invalid conversion from 'void*' to 'cached_frame_info*' [-fpermissive]
                             reg_count * sizeof (cached_frame->reg[0]));
                                                                      ^
../../binutils-gdb/gdb/python/py-unwind.c: In function 'void pyuw_on_new_gdbarch(gdbarch*)':
../../binutils-gdb/gdb/python/py-unwind.c:636:47: warning: invalid conversion from 'void*' to 'pyuw_gdbarch_data_type*' [-fpermissive]
       gdbarch_data (newarch, pyuw_gdbarch_data);
                                               ^
../../binutils-gdb/gdb/python/py-unwind.c:647:29: warning: invalid conversion from 'void*' to 'const frame_data*' [-fpermissive]
       unwinder->unwind_data = (void *) newarch;
                             ^
../../binutils-gdb/gdb/python/py-unwind.c: At global scope:
../../binutils-gdb/gdb/python/py-unwind.c:699:21: error: redefinition of 'PyTypeObject pending_frame_object_type'
 static PyTypeObject pending_frame_object_type =
                     ^
../../binutils-gdb/gdb/python/py-unwind.c:96:21: error: 'PyTypeObject pending_frame_object_type' previously declared here
 static PyTypeObject pending_frame_object_type
                     ^
../../binutils-gdb/gdb/python/py-unwind.c:749:21: error: redefinition of 'PyTypeObject unwind_info_object_type'
 static PyTypeObject unwind_info_object_type =
                     ^
../../binutils-gdb/gdb/python/py-unwind.c:99:21: error: 'PyTypeObject unwind_info_object_type' previously declared here
 static PyTypeObject unwind_info_object_type
                     ^

The first kind of error is caused by the embedded struct definition,
so move it out of the parent struct.

The second kind of error is caused by forward declaring a static
global variable, which works in C, but not in C++ (or C with
-fno-common).  Make it using extern instead, like done in other
similar cases.

gdb/ChangeLog:
2015-05-15  Yuanhui Zhang  <asmwarrior@gmail.com>

	* python/py-unwind.c (struct reg_info): Move out of ...
	(struct cached_frame_info): ... this scope.
	(pending_frame_object_type, unwind_info_object_type): Make extern.
---
 gdb/ChangeLog          |  6 ++++++
 gdb/python/py-unwind.c | 26 ++++++++++++++------------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1492981..1fdc4f4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-15  Yuanhui Zhang  <asmwarrior@gmail.com>
+
+	* python/py-unwind.c (struct reg_info): Move out of ...
+	(struct cached_frame_info): ... this scope.
+	(pending_frame_object_type, unwind_info_object_type): Make extern.
+
 2015-05-15  Joel Brobecker  <brobecker@adacore.com>
 
 	* ada-lang.c (ada_value_primitive_packed_val): Make sure
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index bcfea4b..b6e8a75 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -72,6 +72,15 @@ typedef struct
 /* The data we keep for a frame we can unwind: frame ID and an array of
    (register_number, register_value) pairs.  */
 
+struct reg_info
+{
+  /* Register number.  */
+  int number;
+
+  /* Register data bytes pointer.  */
+  gdb_byte data[MAX_REGISTER_SIZE];
+};
+
 typedef struct
 {
   /* Frame ID.  */
@@ -83,20 +92,13 @@ typedef struct
   /* Length of the `reg' array below.  */
   int reg_count;
 
-  struct reg_info
-  {
-    /* Register number.  */
-    int number;
-
-    /* Register data bytes pointer.  */
-    gdb_byte data[MAX_REGISTER_SIZE];
-  } reg[];
+  struct reg_info reg[];
 } cached_frame_info;
 
-static PyTypeObject pending_frame_object_type
+extern PyTypeObject pending_frame_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object");
 
-static PyTypeObject unwind_info_object_type
+extern PyTypeObject unwind_info_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object");
 
 static unsigned int pyuw_debug = 0;
@@ -696,7 +698,7 @@ static PyMethodDef pending_frame_object_methods[] =
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject pending_frame_object_type =
+PyTypeObject pending_frame_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.PendingFrame",             /* tp_name */
@@ -746,7 +748,7 @@ static PyMethodDef unwind_info_object_methods[] =
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject unwind_info_object_type =
+PyTypeObject unwind_info_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.UnwindInfo",               /* tp_name */
-- 
1.9.3


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
  2015-05-15  8:24               ` asmwarrior
@ 2015-05-15 15:09                 ` Pedro Alves
  0 siblings, 0 replies; 100+ messages in thread
From: Pedro Alves @ 2015-05-15 15:09 UTC (permalink / raw)
  To: asmwarrior, GDB Patches

On 05/15/2015 09:32 AM, asmwarrior wrote:
> There is another one build error:
> 
> In file included from ../../../binutils-gdb/gdb/gdbserver/server.h:61:0,
>                  from ../../../binutils-gdb/gdb/gdbserver/server.c:19:
> ../../../binutils-gdb/gdb/gdbserver/target.h:442:50: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
>     (*the_target->handle_new_gdb_connection) () : 0)
>                                                   ^
> 
> The second operand is a function call which return void, so I have a simply changed the third operand like below: (maybe, we just need a simple if statement instead the conditional operator)

Yes, we do that already for a few other target methods.
Below's what I pushed.

I apologize if we've been through this before, but, do you have
a copyright assignment in place?  I couldn't seem to find it on
record.  If you do, it would make sense to get you commit access
so you could push changes yourself.  Let me know and we'll set
that up.

Thanks again!

----------
From: Pedro Alves <palves@redhat.com>
Date: 2015-05-15 16:00:42 +0100

More C++ build fixing

Fixes:

In file included from ../../../binutils-gdb/gdb/gdbserver/server.h:61:0,
                 from ../../../binutils-gdb/gdb/gdbserver/server.c:19:
../../../binutils-gdb/gdb/gdbserver/target.h:442:50: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
    (*the_target->handle_new_gdb_connection) () : 0)
                                                  ^

Reported by Yuanhui Zhang.

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

	* target.h (target_handle_new_gdb_connection): Rewrite using if
	wrapped in do/while.

---

 gdb/gdbserver/ChangeLog |    5 +++++
 gdb/gdbserver/target.h  |    9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 1fc24be..0f30c66 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-15  Pedro Alves  <palves@redhat.com>
+
+	* target.h (target_handle_new_gdb_connection): Rewrite using if
+	wrapped in do/while.
+
 2015-05-14  Joel Brobecker  <brobecker@adacore.com>

 	* configure.ac: Add prfpregset_t BFD_HAVE_SYS_PROCFS_TYPE check.
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 8d23383..e9c6be0 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -437,9 +437,12 @@ int kill_inferior (int);
   (the_target->supports_vfork_events ? \
    (*the_target->supports_vfork_events) () : 0)

-#define target_handle_new_gdb_connection() \
-  (the_target->handle_new_gdb_connection ? \
-   (*the_target->handle_new_gdb_connection) () : 0)
+#define target_handle_new_gdb_connection()		 \
+  do							 \
+    {							 \
+      if (the_target->handle_new_gdb_connection != NULL) \
+	(*the_target->handle_new_gdb_connection) ();	 \
+    } while (0)

 #define detach_inferior(pid) \
   (*the_target->detach) (pid)

^ permalink raw reply	[flat|nested] 100+ messages in thread

end of thread, other threads:[~2015-05-15 15:09 UTC | newest]

Thread overview: 100+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09 23:20 [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
2015-02-09 23:20 ` [PATCH 02/36] Add --enable-build-with-cxx configure switch Pedro Alves
2015-02-10 22:11   ` Yao Qi
2015-02-27 13:24     ` Pedro Alves
2015-02-27 14:20       ` Yao Qi
2015-02-27 16:29         ` Pedro Alves
2015-02-09 23:21 ` [PATCH 16/36] x86 Linux/ptrace: fix offsetof usage in C++ mode Pedro Alves
2015-02-09 23:21 ` [PATCH 11/36] Make functions and variables exported by the IPA be extern "C" Pedro Alves
2015-02-09 23:21 ` [PATCH 04/36] Fix struct, union, and enum nesting in C++ Pedro Alves
2015-02-09 23:21 ` [PATCH 15/36] Don't forward declare enum target_hw_bp_type Pedro Alves
2015-02-09 23:21 ` [PATCH 26/36] Adjust self tests to cope with GDB built as a C++ program Pedro Alves
2015-02-09 23:21 ` [PATCH 19/36] Exported const objects Pedro Alves
2015-02-09 23:21 ` [PATCH 12/36] proc-service, extern "C" Pedro Alves
2015-02-09 23:21 ` [PATCH 25/36] python/python-internal.h: enum ‘ext_lang_rc’ not defined Pedro Alves
2015-02-09 23:21 ` [PATCH 23/36] gdbarch.h: include regcache.h Pedro Alves
2015-02-09 23:21 ` [PATCH 08/36] elf-bfd.h: Wrap in extern "C" Pedro Alves
2015-02-09 23:33   ` Andrew Pinski
2015-02-10 12:05     ` [PATCH v2] Wrap BFD headers " Pedro Alves
2015-02-11  0:36       ` Alan Modra
2015-02-11 10:08         ` Pedro Alves
2015-02-09 23:21 ` [PATCH 31/36] Split TRY_CATCH into TRY + CATCH Pedro Alves
2015-03-07 15:58   ` Pedro Alves
2015-02-09 23:21 ` [PATCH 22/36] Remove duplicate const Pedro Alves
2015-02-09 23:21 ` [PATCH 13/36] target.h: Include infrun.h Pedro Alves
2015-02-09 23:21 ` [PATCH 29/36] Normalize TRY_CATCH exception handling block Pedro Alves
2015-02-09 23:21 ` [PATCH 03/36] C++ keyword cleanliness, mostly auto-generated Pedro Alves
2015-02-11  7:57   ` Joel Brobecker
2015-02-11  8:52     ` Phil Muldoon
2015-02-11 10:27     ` Pedro Alves
2015-02-11 10:51       ` Pedro Alves
2015-02-12 12:19         ` Joel Brobecker
2015-02-12 13:14           ` Pedro Alves
2015-02-12 14:43             ` Pedro Alves
2015-02-12 14:59               ` Joel Brobecker
2015-02-27 17:41         ` Pedro Alves
2015-02-09 23:21 ` [PATCH 21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict Pedro Alves
2015-02-10 15:05   ` Michael Eager
2015-02-10 18:11     ` Pedro Alves
2015-02-09 23:21 ` [PATCH 17/36] mi/mi-cmd-stack.c|frame filters: print_values <-> ext_lang_frame_args Pedro Alves
2015-02-09 23:21 ` [PATCH 05/36] Fix redefinition errors in C++ mode Pedro Alves
2015-02-11 10:09   ` Yao Qi
2015-02-11 11:30     ` Pedro Alves
2015-02-11 11:39       ` [PATCH] xcoffread.c: delete 'within_function' definition (Re: [PATCH 05/36] Fix redefinition errors in C++ mode) Pedro Alves
2015-02-09 23:21 ` [PATCH 28/36] Move exception_none to common code, and use it Pedro Alves
2015-02-09 23:21 ` [PATCH 20/36] gdbserver/tracepoint: Add cast sockaddr_un/sockaddr cast Pedro Alves
2015-02-09 23:21 ` [PATCH 09/36] floatformat.h: Wrap in extern "C" Pedro Alves
2015-02-09 23:35   ` Andrew Pinski
2015-02-09 23:49     ` Pedro Alves
2015-02-12 11:49       ` Pedro Alves
2015-02-18 19:55         ` Jakub Jelinek
2015-02-14 17:29       ` Doug Evans
2015-02-14 18:36         ` Pedro Alves
2015-02-14 22:46           ` Doug Evans
2015-02-09 23:21 ` [PATCH 27/36] catch_command_errors: Remove 'mask' parameter Pedro Alves
2015-02-09 23:22 ` [PATCH 36/36] Make TRY/CATCH use real C++ try/catch in C++ mode Pedro Alves
2015-02-09 23:22 ` [PATCH 33/36] TRY_CATCH -> TRY+CATCH+END_CATCH, the manual conversions Pedro Alves
2015-02-09 23:22 ` [PATCH 32/36] TRY_CATCH -> TRY+CATCH+END_CATCH everywhere Pedro Alves
2015-02-09 23:35 ` [PATCH 18/36] Rename struct lzma_stream to avoid clash with system header Pedro Alves
2015-02-09 23:45 ` [PATCH 06/36] record-btrace.c: Remove redefinitions Pedro Alves
2015-02-09 23:46 ` [PATCH 35/36] kill volatile struct gdb_exception Pedro Alves
2015-02-09 23:49 ` [PATCH 00/36] Support building GDB as a C++ program Doug Evans
2015-02-09 23:50 ` [PATCH 34/36] more making TRY/CATCH callers look more like real C++ try/catch blocks Pedro Alves
2015-03-07 15:59   ` Pedro Alves
2015-02-09 23:51 ` [PATCH 07/36] Make array object extern Pedro Alves
2015-02-27 22:47   ` Simon Marchi
2015-02-27 22:58     ` Pedro Alves
2015-02-27 23:04       ` Simon Marchi
2015-02-09 23:51 ` [PATCH 14/36] Do not do arithmetic on enum types Pedro Alves
2015-02-09 23:53 ` [PATCH 01/36] Create libiberty/libiberty.m4, have GDB and GDBserver use it Pedro Alves
2015-02-09 23:35   ` Pedro Alves
2015-02-27 16:23   ` Pedro Alves
2015-02-09 23:54 ` [PATCH 10/36] Add extern "C" to declarations of C symbols Pedro Alves
2015-02-11 11:51   ` Pedro Alves
2015-02-09 23:54 ` [PATCH 30/36] quit_force: Replace TRY_CATCH wrapper macros Pedro Alves
2015-02-10  0:21 ` [PATCH 24/36] breakpoint.h: move enum ‘print_stop_action’ Pedro Alves
2015-02-11 12:28   ` Yao Qi
2015-02-10 15:07 ` [PATCH 00/36] Support building GDB as a C++ program Michael Eager
2015-02-11 17:15 ` Yao Qi
2015-02-12 11:34   ` Pedro Alves
2015-02-17 23:19 ` Patrick Palka
2015-02-18 21:54   ` Yao Qi
2015-02-18 23:49     ` Patrick Palka
2015-02-27 18:19 ` Pedro Alves
2015-02-27 23:52   ` Patrick Palka
2015-02-28  0:09     ` Pedro Alves
2015-03-07 16:01   ` Pedro Alves
2015-03-07 17:58     ` [all pushed] " Pedro Alves
2015-03-16  4:42       ` asmwarrior
2015-03-16  5:05         ` asmwarrior
2015-03-16  5:22           ` asmwarrior
2015-03-16  7:15             ` asmwarrior
2015-03-16  8:20               ` asmwarrior
2015-03-16 11:43                 ` [pushed] stub-termcap.c: prototype tputs's parameter's parameter, for C++ mode (Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program) Pedro Alves
2015-03-16 11:46                 ` [pushed] stub termcap, add extern "C" " Pedro Alves
2015-03-16 11:55                 ` [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program Pedro Alves
2015-03-16 11:42           ` Pedro Alves
2015-05-15  8:13             ` asmwarrior
2015-05-15  8:24               ` asmwarrior
2015-05-15 15:09                 ` Pedro Alves
2015-05-15 15:04               ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).