Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [OB] Fix build error in ui-file.c
@ 2011-05-14  3:41 Hui Zhu
  2011-05-14 17:12 ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Hui Zhu @ 2011-05-14  3:41 UTC (permalink / raw)
  To: gdb-patches ml

Get error with trunk:
gcc -g -O2   -I. -I../../src/gdb -I../../src/gdb/common
-I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\""
-DHAVE_CONFIG_H -I../../src/gdb/../include/opcode
-I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd
-I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber
-I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib -Ignulib
-DMI_OUT=1 -DTUI=1  -DGDBTK -I/usr/include/python2.6
-I/usr/include/python2.6 -Wall -Wdeclaration-after-statement
-Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused
-Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts
-Werror -c -o ui-file.o -MT ui-file.o -MMD -MP -MF .deps/ui-file.Tpo
../../src/gdb/ui-file.c
cc1: warnings being treated as errors
../../src/gdb/ui-file.c: In function ‘stdio_file_write_async_safe’:
../../src/gdb/ui-file.c:583: error: ignoring return value of ‘write’,
declared with attribute warn_unused_result

Fix it like others in this file.

2011-05-14  Hui Zhu  <teawater@gmail.com>

	* ui-file.c (stdio_file_write_async_safe): Add empty check for build.

===================================================================
RCS file: /cvs/src/src/gdb/ui-file.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- src/gdb/ui-file.c	2011/05/13 17:28:20	1.27
+++ src/gdb/ui-file.c	2011/05/14 03:37:18	1.28
@@ -580,7 +580,8 @@
       return;
     }

-  write (stdio->fd, buf, length_buf);
+  if (write (stdio->fd, buf, length_buf))
+    ;
 }

 static void


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OB] Fix build error in ui-file.c
  2011-05-14  3:41 [OB] Fix build error in ui-file.c Hui Zhu
@ 2011-05-14 17:12 ` Joel Brobecker
  2011-05-15  2:59   ` Hui Zhu
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2011-05-14 17:12 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches ml

> Fix it like others in this file.
> 
> 2011-05-14  Hui Zhu  <teawater@gmail.com>
> 
> 	* ui-file.c (stdio_file_write_async_safe): Add empty check for build.

Personally, I think we're just sweeping the problem under the rug.
I'd rather have something like this:

> -  write (stdio->fd, buf, length_buf);
> +  if (write (stdio->fd, buf, length_buf))
> +    ;

    if (write (stdio->fd, buf, length_buf) < 0)
      /* Ignore this error *because*... */; 

-- 
Joel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OB] Fix build error in ui-file.c
  2011-05-14 17:12 ` Joel Brobecker
@ 2011-05-15  2:59   ` Hui Zhu
  2011-05-16 16:08     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Hui Zhu @ 2011-05-15  2:59 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches ml

Hi Joel,

What about add comments like other functions in this file?

static void
stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
{
  struct stdio_file *stdio = ui_file_data (file);

  if (stdio->magic != &stdio_file_magic)
    internal_error (__FILE__, __LINE__,
		    _("stdio_file_write: bad magic number"));
  /* Calling error crashes when we are called from the exception framework.  */
  if (fwrite (buf, length_buf, 1, stdio->file))
    ;
}

Thanks,
Hui

On Sun, May 15, 2011 at 01:12, Joel Brobecker <brobecker@adacore.com> wrote:
>> Fix it like others in this file.
>>
>> 2011-05-14  Hui Zhu  <teawater@gmail.com>
>>
>>       * ui-file.c (stdio_file_write_async_safe): Add empty check for build.
>
> Personally, I think we're just sweeping the problem under the rug.
> I'd rather have something like this:
>
>> -  write (stdio->fd, buf, length_buf);
>> +  if (write (stdio->fd, buf, length_buf))
>> +    ;
>
>    if (write (stdio->fd, buf, length_buf) < 0)
>      /* Ignore this error *because*... */;
>
> --
> Joel
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OB] Fix build error in ui-file.c
  2011-05-15  2:59   ` Hui Zhu
@ 2011-05-16 16:08     ` Tom Tromey
  2011-05-16 18:26       ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2011-05-16 16:08 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Joel Brobecker, gdb-patches ml

>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:

>> What about add comments like other functions in this file?

It seems like a good idea, if you are so inclined.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OB] Fix build error in ui-file.c
  2011-05-16 16:08     ` Tom Tromey
@ 2011-05-16 18:26       ` Doug Evans
  0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2011-05-16 18:26 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Hui Zhu, Joel Brobecker, gdb-patches ml

On Mon, May 16, 2011 at 9:07 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:
>
>>> What about add comments like other functions in this file?
>
> It seems like a good idea, if you are so inclined.
>
> Tom
>

I wouldn't mind comments to the other invocations either.

http://sourceware.org/ml/gdb-patches/2011-05/msg00335.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-16 18:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14  3:41 [OB] Fix build error in ui-file.c Hui Zhu
2011-05-14 17:12 ` Joel Brobecker
2011-05-15  2:59   ` Hui Zhu
2011-05-16 16:08     ` Tom Tromey
2011-05-16 18:26       ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox