* [ob] fix mingw compilation
@ 2007-01-30 10:37 Vladimir Prus
2007-01-30 20:24 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Prus @ 2007-01-30 10:37 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
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
[-- Attachment #2: mingw_compile.diff --]
[-- Type: text/x-diff, Size: 2598 bytes --]
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 <vladimir@codesourcery.com>
+
+ * 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 <dan@codesourcery.com>
* 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;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ob] fix mingw compilation
2007-01-30 10:37 [ob] fix mingw compilation Vladimir Prus
@ 2007-01-30 20:24 ` Eli Zaretskii
2007-02-08 16:25 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2007-01-30 20:24 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb-patches
> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Tue, 30 Jan 2007 13:37:14 +0300
>
> @@ -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;
This one-line change is unnecessary; please put back the original
code, it's perfectly valid C, and shouldn't trigger any warnings or
errors from GCC.
The other changes are okay.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ob] fix mingw compilation
2007-01-30 20:24 ` Eli Zaretskii
@ 2007-02-08 16:25 ` Daniel Jacobowitz
2007-02-09 15:27 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-02-08 16:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Vladimir Prus, gdb-patches
On Tue, Jan 30, 2007 at 10:23:33PM +0200, Eli Zaretskii wrote:
> > From: Vladimir Prus <vladimir@codesourcery.com>
> > Date: Tue, 30 Jan 2007 13:37:14 +0300
> >
> > @@ -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;
>
> This one-line change is unnecessary; please put back the original
> code, it's perfectly valid C, and shouldn't trigger any warnings or
> errors from GCC.
>
> The other changes are okay.
>
> Thanks.
It's valid either way, of course. In the interests of all getting
along, I checked this in (to get the message out of my todo queue :-).
--
Daniel Jacobowitz
CodeSourcery
2007-02-08 Daniel Jacobowitz <dan@codesourcery.com>
* ser-mingw.c (pipe_windows_close): Move variable initialization back
up.
Index: ser-mingw.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-mingw.c,v
retrieving revision 1.6
diff -u -p -r1.6 ser-mingw.c
--- ser-mingw.c 30 Jan 2007 09:12:43 -0000 1.6
+++ ser-mingw.c 8 Feb 2007 16:21:01 -0000
@@ -768,11 +768,10 @@ pipe_windows_close (struct serial *scb)
static int
pipe_windows_read (struct serial *scb, size_t count)
{
- HANDLE pipeline_out;
+ HANDLE pipeline_out = (HANDLE) _get_osfhandle (scb->fd);
DWORD available;
DWORD bytes_read;
- pipeline_out = (HANDLE) _get_osfhandle (scb->fd);
if (pipeline_out == INVALID_HANDLE_VALUE)
return -1;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ob] fix mingw compilation
2007-02-08 16:25 ` Daniel Jacobowitz
@ 2007-02-09 15:27 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2007-02-09 15:27 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: vladimir, gdb-patches
> Date: Thu, 8 Feb 2007 11:25:12 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Vladimir Prus <vladimir@codesourcery.com>,
> gdb-patches@sources.redhat.com
>
> > > - HANDLE pipeline_out = (HANDLE) _get_osfhandle (scb->fd);
> > > + HANDLE pipeline_out;
> >
> > This one-line change is unnecessary; please put back the original
> > code, it's perfectly valid C, and shouldn't trigger any warnings or
> > errors from GCC.
>
> It's valid either way, of course.
Sure, but I don't like unnecessary changes.
> In the interests of all getting along, I checked this in (to get the
> message out of my todo queue :-).
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-02-09 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-30 10:37 [ob] fix mingw compilation Vladimir Prus
2007-01-30 20:24 ` Eli Zaretskii
2007-02-08 16:25 ` Daniel Jacobowitz
2007-02-09 15:27 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox