Add --enable-build-with-cxx

This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ compiler.
-Werror=narrowing

Too many of these warnings:

/home/pedro/gdb/mygit/src/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]
/home/pedro/gdb/mygit/src/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]
/home/pedro/gdb/mygit/src/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]
 };

Suppress the warning for now, we're targetting C++98/03.
c++ keyword cleanliness, auto-generated

merged with:

fix "this" in gdbarch.sh; this was botched earlier
fix struct, union, and enum nesting
remove duplicate declaration errors
/home/pedro/gdb/mygit/src/gdb/python/python.c: At global scope:
/home/pedro/gdb/mygit/src/gdb/python/python.c:106:31: error: storage size of ‘GdbMethods’ isn’t known
 static PyMethodDef GdbMethods[];
                               ^
Make GDB build with both g++ and gcc, on x86_64 Fedora 20
move exception_none to common code
mask argument not necessary
a
replace TRY_CATCH wrapper macros
Make GDB's TRY_CATCH more similar C++'s try/catch

Split TRY_CATCH into TRY and CATCH macros, so we can pass the
exception and mask to the CATCH part.

This still requires allocating an exception object on the stack, but
will allow making TRY/CATCH use real try/catch behind the scenes when
building with C++, and still use setjmp/longjmp when building in C
mode.  This means that we can push this change and fix call sites
before we can build the whole of GDB as C++.

Add END_CATCH

This allows creating an exception object local to the CATCH block,
thus allows getting rid of the manually allocated exception object all
over the place.  One we require a C++ compiler, END_CATCH can be
eliminated again.

This patch converts the framework, but doesn't adjust any caller yet.
Subsequent patches will do that.
a
TRY_CATCH calls to TRY+CATCH

This converts TRY_CATCH callers that look like this:

~~~
  volatile gdb_exception ex;

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

into:

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

Thus 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.

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 wouldn't be valid with C++'s try/catch.

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, we build with C90, which
doesn't allow declaring variables like that.

IMO, this still makes the codebase clearer, 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.
TRY_CATCH -> TRY+CATCH, the manual conversions

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.

FIXME: These should actually be done _before_ running the script, and
then the script rerun.
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

One place expects "break;" to break out of the "try" block.  I've
wrapped that with do while (0) so it still works, but perhaps tweaking
the code to not rely on "break" would be cleaner.  Look for FIXME in
the patch.
a
Make TRY/CATCH use real try/catch in C++ mode

This allows RAII and cleanups to coexist while we phase out the later
instead of requiring a flag day.
a
/home/pedro/gdb/mygit/src/gdb/target.h:753:10: error: use of enum ‘exec_direction_kind’ without previous declaration