binutils-gdb/gdb/python
Yuanhui Zhang 13fa0398d7 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.
2015-05-15 16:00:40 +01:00
..
lib/gdb [PR python/18291] Fix printing of "disabled" status of xmethod matchers. 2015-05-08 07:20:04 -07:00
py-arch.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-auto-load.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
py-block.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-bpevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-breakpoint.c more making TRY/CATCH callers look more like real C++ try/catch blocks 2015-03-07 15:19:57 +00:00
py-cmd.c Remove --xdb 2015-04-11 19:49:03 +02:00
py-continueevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-event.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
py-event.h Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-events.h Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
py-evtregistry.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-evts.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
py-exitedevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-finishbreakpoint.c infcall: stop_registers -> register_dummy_frame_dtor 2015-05-13 20:49:08 +02:00
py-frame.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-framefilter.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-function.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-gdb-readline.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-inferior.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-infevents.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-infthread.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-lazy-string.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-linetable.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-newobjfileevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-objfile.c Add support for writing unwinders in Python. 2015-04-01 11:49:12 -07:00
py-param.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-prettyprint.c PR python/18089 2015-04-28 21:53:54 -07:00
py-progspace.c Add support for writing unwinders in Python. 2015-04-01 11:49:12 -07:00
py-signalevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-stopevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-stopevent.h Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
py-symbol.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-symtab.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-threadevent.c Fix redefinition errors in C++ mode 2015-02-11 11:20:21 +00:00
py-type.c Add gdb.Type.optimized_out method. 2015-04-28 17:41:09 -07:00
py-unwind.c Fix a couple C++ build issues 2015-05-15 16:00:40 +01:00
py-utils.c Split TRY_CATCH into TRY + CATCH 2015-03-07 15:14:14 +00:00
py-value.c [Python] Add methods reference_value and const_value to gdb.Value. 2015-05-09 17:30:35 -07:00
py-varobj.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
py-xmethods.c PR python/18285 2015-04-29 13:24:21 -07:00
python-config.py Add support for Python 3. 2012-12-12 16:47:30 +00:00
python-internal.h PR python/18285 2015-04-29 13:24:21 -07:00
python.c PR python/18285 2015-04-29 13:24:21 -07:00
python.h Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00