From patchwork Thu Dec 8 07:50:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 18280 Received: (qmail 18353 invoked by alias); 8 Dec 2016 07:51:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18296 invoked by uid 89); 8 Dec 2016 07:51:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=1721, H*r:PST X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Dec 2016 07:51:00 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1cEtTe-0000vz-1b from Thomas_Schwinge@mentor.com ; Wed, 07 Dec 2016 23:50:50 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Wed, 7 Dec 2016 23:50:49 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 44282C23E1; Wed, 7 Dec 2016 23:50:49 -0800 (PST) From: Thomas Schwinge To: CC: , Thomas Schwinge Subject: [PATCH 5/5] Hurd, C++: Mach/Hurd headers and MIG stubs are not yet fit for C++ Date: Thu, 8 Dec 2016 08:50:36 +0100 Message-ID: <20161208075036.1517-6-thomas@codesourcery.com> In-Reply-To: <20161208075036.1517-1-thomas@codesourcery.com> References: <87eg1z93za.fsf@euler.schwinge.homeip.net> <20161208075036.1517-1-thomas@codesourcery.com> MIME-Version: 1.0 ..., 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 | 6 ++++++ gdb/config/i386/i386gnu.mh | 3 +++ gdb/gnu-nat.c | 35 ++++++++++++++++++++++------------- gdb/i386-gnu-nat.c | 14 +++++++++----- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a40eb29..171d03a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2016-12-08 Thomas Schwinge + * 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) diff --git a/gdb/config/i386/i386gnu.mh b/gdb/config/i386/i386gnu.mh index 24e817e..070497f 100644 --- a/gdb/config/i386/i386gnu.mh +++ b/gdb/config/i386/i386gnu.mh @@ -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 \ diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index ae4430d..5fd59a2 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -20,14 +20,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "defs.h" - -#include -#include -#include -#include -#include - +/* Mach/Hurd headers are not yet ready for C++ compilation. */ +extern "C" +{ #include #include #include @@ -48,6 +43,15 @@ #include #include +} + +#include "defs.h" + +#include +#include +#include +#include +#include #include "inferior.h" #include "symtab.h" @@ -63,12 +67,16 @@ #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) diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c index add0aa4..77081b8 100644 --- a/gdb/i386-gnu-nat.c +++ b/gdb/i386-gnu-nat.c @@ -17,17 +17,21 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/* Mach/Hurd headers are not yet ready for C++ compilation. */ +extern "C" +{ +#include +#include +#include +#include +} + #include "defs.h" #include "x86-nat.h" #include "inferior.h" #include "floatformat.h" #include "regcache.h" -#include -#include -#include -#include - #include "i386-tdep.h" #include "gnu-nat.h"