Hurd, C++: Mach/Hurd headers and MIG stubs are not yet fit for C++
authorThomas Schwinge <thomas@codesourcery.com>
Mon, 5 Dec 2016 10:59:03 +0000 (11:59 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Thu, 8 Dec 2016 07:29:39 +0000 (08:29 +0100)
..., so handle these in "C" mode still:

gdb/
* config/i386/i386gnu.mh (%_S.o %_U.o): Add "-x c" to
"COMPILE.post".
* gnu-nat.c: #include Mach/Hurd headers before all others.  Wrap
Mach/Hurd headers and MIG stubs' prototypes in 'extern "C"'.
* i386-gnu-nat.c: Likewise.

gdb/ChangeLog
gdb/config/i386/i386gnu.mh
gdb/gnu-nat.c
gdb/i386-gnu-nat.c

index a40eb297652b7b6d9831381bab2a943175acd2bf..171d03a23d6e7d571a3502e75696d40a46754e4f 100644 (file)
@@ -1,5 +1,11 @@
 2016-12-08  Thomas Schwinge  <thomas@codesourcery.com>
 
+       * config/i386/i386gnu.mh (%_S.o %_U.o): Add "-x c" to
+       "COMPILE.post".
+       * gnu-nat.c: #include Mach/Hurd headers before all others.  Wrap
+       Mach/Hurd headers and MIG stubs' prototypes in 'extern "C"'.
+       * i386-gnu-nat.c: Likewise.
+
        * gnu-nat.c (proc_get_exception_port, proc_set_exception_port)
        (INF_RESUME_MSGPORT_RPC, proc_get_state, _proc_get_exc_port)
        (proc_steal_exc_port, proc_restore_exc_port, make_proc)
index 24e817eff512940ede69aa18ead0edc414abae40..070497ffc4185c14aa8d91508b1d1f6c48b298fb 100644 (file)
@@ -32,6 +32,9 @@ MIGCOM = $(MIG) -cc cat - /dev/null
        $(CPP) $(CPPFLAGS) $($*-MIGUFLAGS) -x c $< \
        | $(MIGCOM) -sheader /dev/null -server /dev/null -user $*_U.c -header $*_U.h
 
+# MIG stubs are not yet ready for C++ compilation.
+%_S.o %_U.o : COMPILE.post += -x c
+
 NAT_GENERATED_FILES = notify_S.h notify_S.c \
        process_reply_S.h process_reply_S.c \
        msg_reply_S.h msg_reply_S.c msg_U.h msg_U.c \
index ae4430d7545d6dccf7f486e87b13a0c1710bc88a..5fd59a26fd8d740ec8e02e5cc019b5678817a497 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "defs.h"
-
-#include <ctype.h>
-#include <limits.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <sys/ptrace.h>
-
+/* Mach/Hurd headers are not yet ready for C++ compilation.  */
+extern "C"
+{
 #include <mach.h>
 #include <mach_error.h>
 #include <mach/exception.h>
 #include <hurd/sigpreempt.h>
 
 #include <portinfo.h>
+}
+
+#include "defs.h"
+
+#include <ctype.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <sys/ptrace.h>
 
 #include "inferior.h"
 #include "symtab.h"
 #include "gnu-nat.h"
 #include "inf-child.h"
 
+/* MIG stubs are not yet ready for C++ compilation.  */
+extern "C"
+{
 #include "exc_request_S.h"
 #include "notify_S.h"
 #include "process_reply_S.h"
 #include "msg_reply_S.h"
 #include "exc_request_U.h"
 #include "msg_U.h"
+}
 
 static process_t proc_server = MACH_PORT_NULL;
 
@@ -1443,6 +1451,12 @@ struct inf *gnu_current_inf = 0;
    multi-threaded, we don't bother to lock this.  */
 struct inf *waiting_inf;
 
+/* MIG stubs are not yet ready for C++ compilation.  */
+extern "C" int exc_server (mach_msg_header_t *, mach_msg_header_t *);
+extern "C" int msg_reply_server (mach_msg_header_t *, mach_msg_header_t *);
+extern "C" int notify_server (mach_msg_header_t *, mach_msg_header_t *);
+extern "C" int process_reply_server (mach_msg_header_t *, mach_msg_header_t *);
+
 /* Wait for something to happen in the inferior, returning what in STATUS.  */
 static ptid_t
 gnu_wait (struct target_ops *ops,
@@ -1458,11 +1472,6 @@ gnu_wait (struct target_ops *ops,
   struct proc *thread;
   struct inf *inf = gnu_current_inf;
 
-  extern int exc_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int msg_reply_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int process_reply_server (mach_msg_header_t *, mach_msg_header_t *);
-
   gdb_assert (inf->task);
 
   if (!inf->threads && !inf->pending_execs)
index add0aa4171fcda30b2828236fa0508961588fe39..77081b8d6f2a7c7c17a9a0c65409b509ab615e25 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* Mach/Hurd headers are not yet ready for C++ compilation.  */
+extern "C"
+{
+#include <mach.h>
+#include <mach_error.h>
+#include <mach/message.h>
+#include <mach/exception.h>
+}
+
 #include "defs.h"
 #include "x86-nat.h"
 #include "inferior.h"
 #include "floatformat.h"
 #include "regcache.h"
 
-#include <mach.h>
-#include <mach_error.h>
-#include <mach/message.h>
-#include <mach/exception.h>
-
 #include "i386-tdep.h"
 
 #include "gnu-nat.h"
This page took 0.031722 seconds and 4 git commands to generate.