From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25718 invoked by alias); 30 Jan 2007 10:37:29 -0000 Received: (qmail 25708 invoked by uid 22791); 30 Jan 2007 10:37:28 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 30 Jan 2007 10:37:24 +0000 Received: (qmail 6765 invoked from network); 30 Jan 2007 10:37:21 -0000 Received: from unknown (HELO ?172.17.202.220?) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Jan 2007 10:37:21 -0000 From: Vladimir Prus To: gdb-patches@sources.redhat.com Subject: [ob] fix mingw compilation User-Agent: KMail/1.9.1 MIME-Version: 1.0 Date: Tue, 30 Jan 2007 10:37:00 -0000 Content-Type: Multipart/Mixed; boundary="Boundary-00=_a/xvFNyOOaEUVe8" Message-Id: <200701301337.14436.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00595.txt.bz2 --Boundary-00=_a/xvFNyOOaEUVe8 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 256 At the moment, mainline does not build for mingw, because: 1. Compiler flags include -Wdeclaration-after-statement and -Werror 2. ser-mingw32.c has some declarations in the middle of functions. This patch fixes it, committed as obvious. - Volodya --Boundary-00=_a/xvFNyOOaEUVe8 Content-Type: text/x-diff; charset="us-ascii"; name="mingw_compile.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mingw_compile.diff" Content-length: 2598 Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.8147 diff -u -p -r1.8147 ChangeLog --- ChangeLog 29 Jan 2007 17:31:05 -0000 1.8147 +++ ChangeLog 30 Jan 2007 09:12:07 -0000 @@ -1,3 +1,9 @@ +2006-01-30 Vladimir Prus + + * ser-mingw.c (pipe_windows_open) + (pipe_windows_read, pipe_windows_write): Declare + variables at the top of the function. + 2007-01-29 Daniel Jacobowitz * doublest.c (floatformat_from_length): Use the right element from Index: ser-mingw.c =================================================================== RCS file: /cvs/src/src/gdb/ser-mingw.c,v retrieving revision 1.5 diff -u -p -r1.5 ser-mingw.c --- ser-mingw.c 9 Jan 2007 17:58:58 -0000 1.5 +++ ser-mingw.c 30 Jan 2007 09:12:08 -0000 @@ -696,12 +696,15 @@ cleanup_pipe_state (void *untyped) static int pipe_windows_open (struct serial *scb, const char *name) { + struct pipe_state *ps; + char **argv = buildargv (name); struct cleanup *back_to = make_cleanup_freeargv (argv); if (! argv[0] || argv[0][0] == '\0') error ("missing child command"); - struct pipe_state *ps = make_pipe_state (); + + ps = make_pipe_state (); make_cleanup (cleanup_pipe_state, ps); ps->pex = pex_init (PEX_USE_PIPES, "target remote pipe", NULL); @@ -765,18 +768,20 @@ pipe_windows_close (struct serial *scb) static int pipe_windows_read (struct serial *scb, size_t count) { - HANDLE pipeline_out = (HANDLE) _get_osfhandle (scb->fd); + HANDLE pipeline_out; + DWORD available; + DWORD bytes_read; + + pipeline_out = (HANDLE) _get_osfhandle (scb->fd); if (pipeline_out == INVALID_HANDLE_VALUE) return -1; - DWORD available; if (! PeekNamedPipe (pipeline_out, NULL, 0, NULL, &available, NULL)) return -1; if (count > available) count = available; - DWORD bytes_read; if (! ReadFile (pipeline_out, scb->buf, count, &bytes_read, NULL)) return -1; @@ -788,15 +793,17 @@ static int pipe_windows_write (struct serial *scb, const void *buf, size_t count) { struct pipe_state *ps = scb->state; + HANDLE pipeline_in; + DWORD written; + int pipeline_in_fd = fileno (ps->input); if (pipeline_in_fd < 0) return -1; - HANDLE pipeline_in = (HANDLE) _get_osfhandle (pipeline_in_fd); + pipeline_in = (HANDLE) _get_osfhandle (pipeline_in_fd); if (pipeline_in == INVALID_HANDLE_VALUE) return -1; - DWORD written; if (! WriteFile (pipeline_in, buf, count, &written, NULL)) return -1; --Boundary-00=_a/xvFNyOOaEUVe8--