All of lore.kernel.org
 help / color / mirror / Atom feed
* new compile error in gx_comm.c in xen-unstable
@ 2010-11-02 10:34 Olaf Hering
  2010-11-02 16:11 ` [PATCH]: gdbsx: Check return of write() Gianni Tedesco
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2010-11-02 10:34 UTC (permalink / raw)
  To: xen-devel


Hello,

there is a regression between xen-unstable rev 22314 and 22344,
gx_comm.c does not compile anymore due to -Werror, see below.
I think a simpe 'if (write(args..)) perror("write");' will be good enough.

Olaf

gcc  -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2  -funwind-tables 
-fasynchronous-unwind-tables -O1 -fno-omit-frame-pointer 
-fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 
-Wall -Wstrict-prototypes -Wno-unused-value 
-Wdeclaration-after-statement  -O1 -fno-omit-frame-pointer 
-fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 
-Wall -Wstrict-prototypes -Wno-unused-value 
-Wdeclaration-after-statement  -O1 -fno-omit-frame-pointer 
-fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 
-Wall -Wstrict-prototypes -Wno-unused-value 
-Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF 
.subdirs-install.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -O1 
-fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -g 
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes 
-Wno-unused-value -Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD 
-MF .gdbsx.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -O1 
-fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -g 
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes 
-Wno-unused-value -Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD 
-MF .all.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -Werror 
-Wmissing-prototypes  -O1 -fno-omit-frame-pointer 
-fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 
-Wall -Wstrict-prototypes -Wno-unused-value 
-Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF .gx_comm.o.d  
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -Werror -Wmissing-prototypes 
 -c -o gx_comm.o gx_comm.c
cc1: warnings being treated as errors
gx_comm.c: In function 'gx_getpkt':
gx_comm.c:230: error: ignoring return value of 'write', declared with attribute warn_unused_result
gx_comm.c:236: error: ignoring return value of 'write', declared with attribute warn_unused_result

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

* [PATCH]: gdbsx: Check return of write()
  2010-11-02 10:34 new compile error in gx_comm.c in xen-unstable Olaf Hering
@ 2010-11-02 16:11 ` Gianni Tedesco
  2010-11-02 23:29   ` Bruce Edge
  2010-11-03 11:59   ` Ian Jackson
  0 siblings, 2 replies; 7+ messages in thread
From: Gianni Tedesco @ 2010-11-02 16:11 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Ian, xen-devel@lists.xensource.com, Jackson

On Tue, 2010-11-02 at 10:34 +0000, Olaf Hering wrote:
> Hello,
> 
> there is a regression between xen-unstable rev 22314 and 22344,
> gx_comm.c does not compile anymore due to -Werror, see below.
> I think a simpe 'if (write(args..)) perror("write");' will be good enough.
> 
> Olaf

FYI: it doesn't look like a regression but perhaps a compiler/library
update?

---8<-------------8<--------------8<--------------------
This leads to warn_unused_result checks triggering in some libraries and
compilers. Combined with -Werror this breaks the build.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>

diff -r ee4d52f0d16a tools/debugger/gdbsx/gx/gx_comm.c
--- a/tools/debugger/gdbsx/gx/gx_comm.c	Tue Nov 02 07:35:52 2010 +0000
+++ b/tools/debugger/gdbsx/gx/gx_comm.c	Tue Nov 02 16:06:43 2010 +0000
@@ -227,13 +227,15 @@ gx_getpkt (char *buf)
         
         gxprt("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
               (c1 << 4) + c2, csum, buf);
-        write(remote_fd, "-", 1);
+        if ( write(remote_fd, "-", 1) != 1 )
+            perror("write");
     }
     if (gx_remote_dbg) {
         gxprt("getpkt (\"%s\");  [sending ack] \n", buf);
     }
         
-    write(remote_fd, "+", 1);
+    if ( write(remote_fd, "+", 1) != 1 )
+        perror("write");
         
     if (gx_remote_dbg) {
         gxprt("[sent ack]\n");

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

* Re: [PATCH]: gdbsx: Check return of write()
  2010-11-02 16:11 ` [PATCH]: gdbsx: Check return of write() Gianni Tedesco
@ 2010-11-02 23:29   ` Bruce Edge
  2010-11-03  8:09     ` Olaf Hering
  2010-11-03 11:59   ` Ian Jackson
  1 sibling, 1 reply; 7+ messages in thread
From: Bruce Edge @ 2010-11-02 23:29 UTC (permalink / raw)
  To: Gianni Tedesco; +Cc: Olaf Hering, xen-devel@lists.xensource.com, Jackson


[-- Attachment #1.1: Type: text/plain, Size: 2249 bytes --]

On Tue, Nov 2, 2010 at 9:11 AM, Gianni Tedesco <gianni.tedesco@citrix.com>wrote:

> On Tue, 2010-11-02 at 10:34 +0000, Olaf Hering wrote:
> > Hello,
> >
> > there is a regression between xen-unstable rev 22314 and 22344,
> > gx_comm.c does not compile anymore due to -Werror, see below.
> > I think a simpe 'if (write(args..)) perror("write");' will be good
> enough.
> >
> > Olaf
>
> FYI: it doesn't look like a regression but perhaps a compiler/library
> update?
>
> ---8<-------------8<--------------8<--------------------
> This leads to warn_unused_result checks triggering in some libraries and
> compilers. Combined with -Werror this breaks the build.
>
> Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
>
> diff -r ee4d52f0d16a tools/debugger/gdbsx/gx/gx_comm.c
> --- a/tools/debugger/gdbsx/gx/gx_comm.c Tue Nov 02 07:35:52 2010 +0000
> +++ b/tools/debugger/gdbsx/gx/gx_comm.c Tue Nov 02 16:06:43 2010 +0000
> @@ -227,13 +227,15 @@ gx_getpkt (char *buf)
>
>         gxprt("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
>               (c1 << 4) + c2, csum, buf);
> -        write(remote_fd, "-", 1);
> +        if ( write(remote_fd, "-", 1) != 1 )
> +            perror("write");
>     }
>     if (gx_remote_dbg) {
>         gxprt("getpkt (\"%s\");  [sending ack] \n", buf);
>     }
>
> -    write(remote_fd, "+", 1);
> +    if ( write(remote_fd, "+", 1) != 1 )
> +        perror("write");
>
>     if (gx_remote_dbg) {
>         gxprt("[sent ack]\n");
>
>
> Confirming the same problem:

o-unused-value -Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF
.gx_local.o.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -Werror
-Wmissing-prototypes  -c -o gx_local.o gx_local.c
cc1: warnings being treated as errors
gx_comm.c: In function ‘gx_getpkt’:
gx_comm.c:230: error: ignoring return value of ‘write’, declared with
attribute warn_unused_result
gx_comm.c:236: error: ignoring return value of ‘write’, declared with
attribute warn_unused_result

%> gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

-Bruce


>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>

[-- Attachment #1.2: Type: text/html, Size: 3119 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH]: gdbsx: Check return of write()
  2010-11-02 23:29   ` Bruce Edge
@ 2010-11-03  8:09     ` Olaf Hering
  0 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2010-11-03  8:09 UTC (permalink / raw)
  To: Bruce Edge; +Cc: xen-devel@lists.xensource.com, Jackson, Gianni Tedesco

On Tue, Nov 02, Bruce Edge wrote:

> o-unused-value -Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF
> .gx_local.o.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -Werror
> -Wmissing-prototypes  -c -o gx_local.o gx_local.c
> cc1: warnings being treated as errors
> gx_comm.c: In function ‘gx_getpkt’:
> gx_comm.c:230: error: ignoring return value of ‘write’, declared with
> attribute warn_unused_result
> gx_comm.c:236: error: ignoring return value of ‘write’, declared with
> attribute warn_unused_result

With the patch applied, the line number 236 should be 237.
Please apply the suggested patch, its not upstream yet.

Olaf

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

* Re: [PATCH]: gdbsx: Check return of write()
  2010-11-02 16:11 ` [PATCH]: gdbsx: Check return of write() Gianni Tedesco
  2010-11-02 23:29   ` Bruce Edge
@ 2010-11-03 11:59   ` Ian Jackson
  2010-11-03 14:10     ` Bruce Edge
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Jackson @ 2010-11-03 11:59 UTC (permalink / raw)
  To: Gianni Tedesco; +Cc: Olaf Hering, xen-devel@lists.xensource.com

Gianni Tedesco writes ("[PATCH]: gdbsx: Check return of write()"):
> -        write(remote_fd, "-", 1);
> +        if ( write(remote_fd, "-", 1) != 1 )
> +            perror("write");

Thanks.  I've applied this.  I fixed the formatting to be constent
with the other parts of the same file, and also arranged for errors to
actually cause the function to return -1 as the head comment suggests
it should.

Ian.

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

* Re: Re: [PATCH]: gdbsx: Check return of write()
  2010-11-03 11:59   ` Ian Jackson
@ 2010-11-03 14:10     ` Bruce Edge
  2010-11-03 14:16       ` Olaf Hering
  0 siblings, 1 reply; 7+ messages in thread
From: Bruce Edge @ 2010-11-03 14:10 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Olaf Hering, xen-devel@lists.xensource.com, Gianni Tedesco


[-- Attachment #1.1: Type: text/plain, Size: 769 bytes --]

On Wed, Nov 3, 2010 at 4:59 AM, Ian Jackson <Ian.Jackson@eu.citrix.com>wrote:

> Gianni Tedesco writes ("[PATCH]: gdbsx: Check return of write()"):
> > -        write(remote_fd, "-", 1);
> > +        if ( write(remote_fd, "-", 1) != 1 )
> > +            perror("write");
>
> Thanks.  I've applied this.  I fixed the formatting to be constent
> with the other parts of the same file, and also arranged for errors to
> actually cause the function to return -1 as the head comment suggests
> it should.
>
> What branch is this applied to?
I'm not seeing it in http://xenbits.xensource.com/xen-unstable.hg

-Bruce


> Ian.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>

[-- Attachment #1.2: Type: text/html, Size: 1600 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: Re: [PATCH]: gdbsx: Check return of write()
  2010-11-03 14:10     ` Bruce Edge
@ 2010-11-03 14:16       ` Olaf Hering
  0 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2010-11-03 14:16 UTC (permalink / raw)
  To: Bruce Edge; +Cc: xen-devel@lists.xensource.com, Ian Jackson, Gianni Tedesco

On Wed, Nov 03, Bruce Edge wrote:

> What branch is this applied to?
> I'm not seeing it in http://xenbits.xensource.com/xen-unstable.hg

Its in staging now:

http://xenbits.xen.org/staging/xen-unstable.hg

staging is syned to the other url on a regular base, look for the PUSHED
mails that get send out a few times the week.


Olaf

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

end of thread, other threads:[~2010-11-03 14:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02 10:34 new compile error in gx_comm.c in xen-unstable Olaf Hering
2010-11-02 16:11 ` [PATCH]: gdbsx: Check return of write() Gianni Tedesco
2010-11-02 23:29   ` Bruce Edge
2010-11-03  8:09     ` Olaf Hering
2010-11-03 11:59   ` Ian Jackson
2010-11-03 14:10     ` Bruce Edge
2010-11-03 14:16       ` Olaf Hering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.