From patchwork Thu Jul 21 12:26:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 13904 Received: (qmail 56761 invoked by alias); 21 Jul 2016 12:26:35 -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 56744 invoked by uid 89); 21 Jul 2016 12:26:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 21 Jul 2016 12:26:33 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03803C049E18 for ; Thu, 21 Jul 2016 12:26:32 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6LCQUPv017375 for ; Thu, 21 Jul 2016 08:26:31 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH] Fix djgpp gdb build Date: Thu, 21 Jul 2016 13:26:30 +0100 Message-Id: <1469103990-8482-1-git-send-email-palves@redhat.com> - A few missing casts required by C++, resulting in: ../../src/gdb/ser-go32.c:795:21: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive] etc. - dos_noop has an incompatible prototype with struct serial_ops's setparity, resulting in: ../../src/gdb/ser-go32.c:874:1: error: invalid conversion from 'int (*)(serial*)' to 'int (*)(serial*, int)' [-fpermissive] (I thought of calling the ser-base.c default methods, but djgpp doesn't include ser-base.c in the build.) gdb/ChangeLog: 2016-07-21 Pedro Alves * go32-nat.c (go32_create_inferior): Add cast. * ser-go32.c (dos_noop): Delete. (dos_flush_output, dos_setparity, dos_drain_output): New functions. (dos_write): Add cast. (dos_ops): Use dos_flush_output, dos_setparity and dos_drain_output. * top.c (do_chdir_cleanup): Add cast. --- gdb/go32-nat.c | 2 +- gdb/ser-go32.c | 27 ++++++++++++++++++++++----- gdb/top.c | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 91c6d1e..6e608e2 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -677,7 +677,7 @@ go32_create_inferior (struct target_ops *ops, char *exec_file, if (cmdlen > 1024*1024) error (_("Command line too long.")); - cmdline = xmalloc (cmdlen + 4); + cmdline = (char *) xmalloc (cmdlen + 4); strcpy (cmdline + 1, args); /* If the command-line length fits into DOS 126-char limits, use the DOS command tail format; otherwise, tell v2loadimage to pass it diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c index 10c79ba..a9c3d91 100644 --- a/gdb/ser-go32.c +++ b/gdb/ser-go32.c @@ -593,9 +593,26 @@ dos_close (struct serial *scb) } +/* Implementation of the serial_ops flush_output method. */ static int -dos_noop (struct serial *scb) +dos_flush_output (struct serial *scb) +{ + return 0; +} + +/* Implementation of the serial_ops setparity method. */ + +static int +dos_setparity (struct serial *scb, int parity) +{ + return 0; +} + +/* Implementation of the serial_ops drain_output method. */ + +static int +dos_drain_output (struct serial *scb) { return 0; } @@ -792,7 +809,7 @@ dos_write (struct serial *scb, const void *buf, size_t count) size_t fifosize = port->fifo ? 16 : 1; long then; size_t cnt; - const char *str = buf; + const char *str = (const char *) buf; while (count > 0) { @@ -857,7 +874,7 @@ static const struct serial_ops dos_ops = NULL, /* fdopen, not implemented */ dos_readchar, dos_write, - dos_noop, /* flush output */ + dos_flush_output, dos_flush_input, dos_sendbreak, dos_raw, @@ -868,8 +885,8 @@ static const struct serial_ops dos_ops = dos_noflush_set_tty_state, dos_setbaudrate, dos_setstopbits, - dos_noop, - dos_noop, /* Wait for output to drain. */ + dos_setparity, + dos_drain_output, (void (*)(struct serial *, int))NULL /* Change into async mode. */ }; diff --git a/gdb/top.c b/gdb/top.c index 3174f3c..d566677 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -470,7 +470,7 @@ void (*pre_init_ui_hook) (void); static void do_chdir_cleanup (void *old_dir) { - chdir (old_dir); + chdir ((const char *) old_dir); xfree (old_dir); } #endif