Errors of doing "make install-tools" with xen-4.2-unstable?

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Errors of doing "make install-tools" with xen-4.2-unstable?

BEI GUAN
Hi,

When I do the "make install-tools" with xen-4.2-unstable, there are some errors about "warn_unused_result".
Is it the error in code or the error in the compiling environment? Thank you so much.


gcc  -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -g -Wno-unused -fno-strict-aliasing -I../include -I../drivers -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-queue.o tapdisk-queue.c
cc1: warnings being treated as errors
tapdisk-queue.c: In function ‘tapdisk_lio_ack_event’:
tapdisk-queue.c:438: error: ignoring return value of ‘read’, declared with attribute warn_unused_result
make[5]: *** [tapdisk-queue.o] Error 1
make[5]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
make[4]: *** [subdir-install-drivers] Error 2
make[4]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
make[3]: *** [subdirs-install] Error 2
make[3]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
make[2]: *** [subdir-install-blktap2] Error 2
make[2]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
make: *** [install-tools] Error 2
------
root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-log.o tapdisk-log.c
cc1: warnings being treated as errors
tapdisk-log.c: In function ‘tlog_flush’:
tapdisk-log.c:250: error: ignoring return value of ‘write’, declared with attribute warn_unused_result
------
/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk2.o tapdisk2.c
cc1: warnings being treated as errors
tapdisk2.c: In function ‘main’:
tapdisk2.c:82: error: ignoring return value of ‘chdir’, declared with attribute warn_unused_result
------
cc1: warnings being treated as errors
tapdisk-stream.c: In function ‘tapdisk_stream_poll_clear’:
tapdisk-stream.c:148: error: ignoring return value of ‘read’, declared with attribute warn_unused_result
tapdisk-stream.c: In function ‘tapdisk_stream_poll_set’:
tapdisk-stream.c:158: error: ignoring return value of ‘write’, declared with attribute warn_unused_result
tapdisk-stream.c: In function ‘tapdisk_stream_print_request’:
tapdisk-stream.c:206: error: ignoring return value of ‘write’, declared with attribute warn_unused_result



Best Regards,
Bei Guan


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Ian Campbell-10
On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> When I do the "make install-tools" with xen-4.2-unstable, there are
> some errors about "warn_unused_result".
> Is it the error in code or the error in the compiling environment?
> Thank you so much.

This commit
        changeset:   25275:27d63b9f111a
        user:        Keir Fraser <[hidden email]>
        date:        Thu May 10 11:22:18 2012 +0100
        summary:     blktap2: Do not build with -O0
has caused more warnings to be generated by the compiler, which in turn
leads to build failures. Since this is a compiler specific thing we are
still tracking them all down.

Can you confirm which versionof xen-unstable.hg you are using -- there
have been several fixup patches since the above. If you are completely
up to date and you still see errors we can dig into whatever is left.

Ian. (starting to think that this change wasn't suitable during a
feature freeze....)

>
>
> gcc  -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing
> -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
> -D__XEN_TOOLS__ -MMD -MF .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -g
> -Wno-unused -fno-strict-aliasing -I../include -I../drivers
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-queue.o tapdisk-queue.c
> cc1: warnings being treated as errors
> tapdisk-queue.c: In function ‘tapdisk_lio_ack_event’:
> tapdisk-queue.c:438: error: ignoring return value of ‘read’, declared
> with attribute warn_unused_result
> make[5]: *** [tapdisk-queue.o] Error 1
> make[5]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
> make[4]: *** [subdir-install-drivers] Error 2
> make[4]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[3]: *** [subdirs-install] Error 2
> make[3]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[2]: *** [subdir-install-blktap2] Error 2
> make[2]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make[1]: *** [subdirs-install] Error 2
> make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make: *** [install-tools] Error 2
> ------
> root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-log.o tapdisk-log.c
> cc1: warnings being treated as errors
> tapdisk-log.c: In function ‘tlog_flush’:
> tapdisk-log.c:250: error: ignoring return value of ‘write’, declared
> with attribute warn_unused_result
> ------
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk2.o tapdisk2.c
> cc1: warnings being treated as errors
> tapdisk2.c: In function ‘main’:
> tapdisk2.c:82: error: ignoring return value of ‘chdir’, declared with
> attribute warn_unused_result
> ------
> cc1: warnings being treated as errors
> tapdisk-stream.c: In function ‘tapdisk_stream_poll_clear’:
> tapdisk-stream.c:148: error: ignoring return value of ‘read’, declared
> with attribute warn_unused_result
> tapdisk-stream.c: In function ‘tapdisk_stream_poll_set’:
> tapdisk-stream.c:158: error: ignoring return value of ‘write’,
> declared with attribute warn_unused_result
> tapdisk-stream.c: In function ‘tapdisk_stream_print_request’:
> tapdisk-stream.c:206: error: ignoring return value of ‘write’,
> declared with attribute warn_unused_result
>
>
>
> Best Regards,
> Bei Guan
>



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Olaf Hering-2
In reply to this post by BEI GUAN
On Fri, May 11, Bei Guan wrote:

> Hi,
>
> When I do the "make install-tools" with xen-4.2-unstable, there are some errors
> about "warn_unused_result".
> Is it the error in code or the error in the compiling environment? Thank you so
> much.

I suggest to remove all -Werror from the Makefiles and introduce a
--disable-Werror/--enable-Werror configure option, similar to what
binutils and other projects have (not sure what the exact configure
option name is in those projects).

Olaf

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

BEI GUAN
In reply to this post by Ian Campbell-10

2012/5/11 Ian Campbell <[hidden email]>
On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> When I do the "make install-tools" with xen-4.2-unstable, there are
> some errors about "warn_unused_result".
> Is it the error in code or the error in the compiling environment?
> Thank you so much.

This commit
       changeset:   25275:27d63b9f111a
       user:        Keir Fraser <[hidden email]>
       date:        Thu May 10 11:22:18 2012 +0100
       summary:     blktap2: Do not build with -O0
has caused more warnings to be generated by the compiler, which in turn
leads to build failures. Since this is a compiler specific thing we are
still tracking them all down.

Can you confirm which versionof xen-unstable.hg you are using -- there
have been several fixup patches since the above. If you are completely
up to date and you still see errors we can dig into whatever is left.

Thank you for your reply. I have used "hg pull; hg update" to update to the latest Xen and it is the version info:

root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
changeset:   25287:54c8c9eaee92
tag:         tip
user:        Dietmar Hahn <[hidden email]>
date:        Fri Apr 27 11:09:26 2012 +0200
summary:     docs: add vpmu description to xen-command-line.markdown

But, it still has the same errors.


Thanks,
Bei Guan

 

Ian. (starting to think that this change wasn't suitable during a
feature freeze....)

>
>
> gcc  -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing
> -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
> -D__XEN_TOOLS__ -MMD -MF .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -g
> -Wno-unused -fno-strict-aliasing -I../include -I../drivers
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-queue.o tapdisk-queue.c
> cc1: warnings being treated as errors
> tapdisk-queue.c: In function ‘tapdisk_lio_ack_event’:
> tapdisk-queue.c:438: error: ignoring return value of ‘read’, declared
> with attribute warn_unused_result
> make[5]: *** [tapdisk-queue.o] Error 1
> make[5]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
> make[4]: *** [subdir-install-drivers] Error 2
> make[4]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[3]: *** [subdirs-install] Error 2
> make[3]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[2]: *** [subdir-install-blktap2] Error 2
> make[2]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make[1]: *** [subdirs-install] Error 2
> make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make: *** [install-tools] Error 2
> ------
> root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-log.o tapdisk-log.c
> cc1: warnings being treated as errors
> tapdisk-log.c: In function ‘tlog_flush’:
> tapdisk-log.c:250: error: ignoring return value of ‘write’, declared
> with attribute warn_unused_result
> ------
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk2.o tapdisk2.c
> cc1: warnings being treated as errors
> tapdisk2.c: In function ‘main’:
> tapdisk2.c:82: error: ignoring return value of ‘chdir’, declared with
> attribute warn_unused_result
> ------
> cc1: warnings being treated as errors
> tapdisk-stream.c: In function ‘tapdisk_stream_poll_clear’:
> tapdisk-stream.c:148: error: ignoring return value of ‘read’, declared
> with attribute warn_unused_result
> tapdisk-stream.c: In function ‘tapdisk_stream_poll_set’:
> tapdisk-stream.c:158: error: ignoring return value of ‘write’,
> declared with attribute warn_unused_result
> tapdisk-stream.c: In function ‘tapdisk_stream_print_request’:
> tapdisk-stream.c:206: error: ignoring return value of ‘write’,
> declared with attribute warn_unused_result
>
>
>
> Best Regards,
> Bei Guan
>





--
Best Regards,
Bei Guan


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

BEI GUAN
In reply to this post by Olaf Hering-2


2012/5/11 Olaf Hering <[hidden email]>
On Fri, May 11, Bei Guan wrote:

> Hi,
>
> When I do the "make install-tools" with xen-4.2-unstable, there are some errors
> about "warn_unused_result".
> Is it the error in code or the error in the compiling environment? Thank you so
> much.

I suggest to remove all -Werror from the Makefiles and introduce a
--disable-Werror/--enable-Werror configure option, similar to what
binutils and other projects have (not sure what the exact configure
option name is in those projects).
Thank you so much for your reply too.
It is better to have such as a choice to enable or disable -Werror option. But, now it doesn't have in the configure file.


Thanks,
Bei Guan

 

Olaf

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel



--
Best Regards,
Bei Guan


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Ian Campbell-10
In reply to this post by BEI GUAN
On Fri, 2012-05-11 at 16:12 +0100, Bei Guan wrote:

>
> 2012/5/11 Ian Campbell <[hidden email]>
>         On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
>         > When I do the "make install-tools" with xen-4.2-unstable,
>         there are
>         > some errors about "warn_unused_result".
>         > Is it the error in code or the error in the compiling
>         environment?
>         > Thank you so much.
>        
>        
>         This commit
>                changeset:   25275:27d63b9f111a
>                user:        Keir Fraser <[hidden email]>
>                date:        Thu May 10 11:22:18 2012 +0100
>                summary:     blktap2: Do not build with -O0
>         has caused more warnings to be generated by the compiler,
>         which in turn
>         leads to build failures. Since this is a compiler specific
>         thing we are
>         still tracking them all down.
>        
>         Can you confirm which versionof xen-unstable.hg you are using
>         -- there
>         have been several fixup patches since the above. If you are
>         completely
>         up to date and you still see errors we can dig into whatever
>         is left.
>
> Thank you for your reply. I have used "hg pull; hg update" to update
> to the latest Xen and it is the version info:
>
> root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
> changeset:   25287:54c8c9eaee92
> tag:         tip
> user:        Dietmar Hahn <[hidden email]>
> date:        Fri Apr 27 11:09:26 2012 +0200
> summary:     docs: add vpmu description to xen-command-line.markdown
>
> But, it still has the same errors.

Thanks, looks like we still need to fix these errors then.

I'm not really happy with the following, but it's no worse than things
are today...

Bei, I don't see these build failures, does this work for you?

8<------------------------------------------------------

# HG changeset patch
# User Ian Campbell <[hidden email]>
# Date 1336751175 -3600
# Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
# Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
blktap: avoid attribute warn_unused_result build failures.

I'm not proud of this, but since none of these callers of read/write have any
other error handling and return void themselves (for several links up the call
chain AFAICT) and because I don't really want to get into a massive reworking
of blktap2 I suppose it is at least pragmatic

Signed-off-by: Ian Campbell <[hidden email]>

diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-log.c
--- a/tools/blktap2/drivers/tapdisk-log.c Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-log.c Fri May 11 16:46:15 2012 +0100
@@ -247,7 +247,7 @@ tlog_flush(void)
  wsize = ((size + 511) & (~511));
 
  memset(tapdisk_log.buf + size, '\n', wsize - size);
- write(fd, tapdisk_log.buf, wsize);
+ (void)write(fd, tapdisk_log.buf, wsize);
 
  tapdisk_log.p = tapdisk_log.buf;
 
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-queue.c
--- a/tools/blktap2/drivers/tapdisk-queue.c Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-queue.c Fri May 11 16:46:15 2012 +0100
@@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
  uint64_t val;
 
  if (lio->flags & LIO_FLAG_EVENTFD)
- read(lio->event_fd, &val, sizeof(val));
+ (void)read(lio->event_fd, &val, sizeof(val));
 }
 
 static void
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-stream.c
--- a/tools/blktap2/drivers/tapdisk-stream.c Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-stream.c Fri May 11 16:46:15 2012 +0100
@@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
 {
  int dummy;
 
- read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
+ (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
  p->set = 0;
 }
 
@@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
  int dummy = 0;
 
  if (!p->set) {
- write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
+ (void)write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
  p->set = 1;
  }
 }
@@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
 {
  unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s, sreq);
  char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
- write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
+ (void)write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
 }
 
 static void
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk2.c
--- a/tools/blktap2/drivers/tapdisk2.c Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk2.c Fri May 11 16:46:15 2012 +0100
@@ -79,7 +79,12 @@ main(int argc, char *argv[])
  if (optind != argc)
  usage(argv[0], EINVAL);
 
- chdir("/");
+ if (chdir("/")) {
+ DPRINTF("failed to chdir(/): %d\n", errno);
+ err = 1;
+ goto out;
+ }
+
  tapdisk_start_logging("tapdisk2");
 
  err = tapdisk_server_init();



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

BEI GUAN


2012/5/11 Ian Campbell <[hidden email]>
On Fri, 2012-05-11 at 16:12 +0100, Bei Guan wrote:
>
> 2012/5/11 Ian Campbell <[hidden email]>
>         On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
>         > When I do the "make install-tools" with xen-4.2-unstable,
>         there are
>         > some errors about "warn_unused_result".
>         > Is it the error in code or the error in the compiling
>         environment?
>         > Thank you so much.
>
>
>         This commit
>                changeset:   25275:27d63b9f111a
>                user:        Keir Fraser <[hidden email]>
>                date:        Thu May 10 11:22:18 2012 +0100
>                summary:     blktap2: Do not build with -O0
>         has caused more warnings to be generated by the compiler,
>         which in turn
>         leads to build failures. Since this is a compiler specific
>         thing we are
>         still tracking them all down.
>
>         Can you confirm which versionof xen-unstable.hg you are using
>         -- there
>         have been several fixup patches since the above. If you are
>         completely
>         up to date and you still see errors we can dig into whatever
>         is left.
>
> Thank you for your reply. I have used "hg pull; hg update" to update
> to the latest Xen and it is the version info:
>
> root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
> changeset:   25287:54c8c9eaee92
> tag:         tip
> user:        Dietmar Hahn <[hidden email]>
> date:        Fri Apr 27 11:09:26 2012 +0200
> summary:     docs: add vpmu description to xen-command-line.markdown
>
> But, it still has the same errors.

Thanks, looks like we still need to fix these errors then.

I'm not really happy with the following, but it's no worse than things
are today...

Bei, I don't see these build failures, does this work for you?

No, it doesn't work for me. There is the same error.
My environment and gcc version are like this:

root@gavin-desktop:~# uname -a
Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC 2011 x86_64 GNU/Linux

root@gavin-desktop:~# gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)




Thanks,
Bei Guan



 

8<------------------------------------------------------

# HG changeset patch
# User Ian Campbell <[hidden email]>
# Date 1336751175 -3600
# Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
# Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
blktap: avoid attribute warn_unused_result build failures.

I'm not proud of this, but since none of these callers of read/write have any
other error handling and return void themselves (for several links up the call
chain AFAICT) and because I don't really want to get into a massive reworking
of blktap2 I suppose it is at least pragmatic

Signed-off-by: Ian Campbell <[hidden email]>

diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-log.c
--- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:46:15 2012 +0100
@@ -247,7 +247,7 @@ tlog_flush(void)
       wsize = ((size + 511) & (~511));

       memset(tapdisk_log.buf + size, '\n', wsize - size);
-       write(fd, tapdisk_log.buf, wsize);
+       (void)write(fd, tapdisk_log.buf, wsize);

       tapdisk_log.p = tapdisk_log.buf;

diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-queue.c
--- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:46:15 2012 +0100
@@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
       uint64_t val;

       if (lio->flags & LIO_FLAG_EVENTFD)
-               read(lio->event_fd, &val, sizeof(val));
+               (void)read(lio->event_fd, &val, sizeof(val));
 }

 static void
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-stream.c
--- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:46:15 2012 +0100
@@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
 {
       int dummy;

-       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
+       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
       p->set = 0;
 }

@@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
       int dummy = 0;

       if (!p->set) {
-               write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
+               (void)write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
               p->set = 1;
       }
 }
@@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
 {
       unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s, sreq);
       char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
-       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
+       (void)write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
 }

 static void
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk2.c
--- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15 2012 +0100
@@ -79,7 +79,12 @@ main(int argc, char *argv[])
       if (optind != argc)
               usage(argv[0], EINVAL);

-       chdir("/");
+       if (chdir("/")) {
+               DPRINTF("failed to chdir(/): %d\n", errno);
+               err = 1;
+               goto out;
+       }
+
       tapdisk_start_logging("tapdisk2");

       err = tapdisk_server_init();





--
Best Regards,
Bei Guan


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Keir Fraser-5
In reply to this post by Ian Campbell-10
On 11/05/2012 15:16, "Ian Campbell" <[hidden email]> wrote:

> On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> When I do the "make
> install-tools" with xen-4.2-unstable, there are
> some errors about
> "warn_unused_result".
> Is it the error in code or the error in the compiling
> environment?
> Thank you so much.

This commit
        changeset:
> 25275:27d63b9f111a
        user:        Keir Fraser <[hidden email]>

> date:        Thu May 10 11:22:18 2012 +0100
        summary:     blktap2: Do
> not build with -O0
has caused more warnings to be generated by the compiler,
> which in turn
leads to build failures. Since this is a compiler specific thing
> we are
still tracking them all down.

Can you confirm which versionof
> xen-unstable.hg you are using -- there
have been several fixup patches since
> the above. If you are completely
up to date and you still see errors we can
> dig into whatever is left.

Ian. (starting to think that this change wasn't
> suitable during a
feature freeze....)

The original reason for making this fix now was build failure on Fedora 17,
due to -O0 implying -D_FORTIFY_SOURCE=2, and some kind of fall-out from
that. A simpler feature-freeze fix might be to simply disable -Werror for
subtrees that are using -O0. Since this needs backport for 4.0 and 4.1 as
well. Or perhaps we are nearly at the end of the bug tail. ;-)

 -- Keir

>
>
> gcc  -O1
> -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing
> -std=gnu99 -Wall
> -Wstrict-prototypes -Wdeclaration-after-statement
> -D__XEN_TOOLS__ -MMD -MF
> .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE
> -fno-optimize-sibling-calls -Werror -g
> -Wno-unused -fno-strict-aliasing
> -I../include -I../drivers
>
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include
> -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c
> -o tapdisk-queue.o tapdisk-queue.c
> cc1: warnings being treated as errors
>
> tapdisk-queue.c: In function Œtapdisk_lio_ack_event¹:
> tapdisk-queue.c:438:
> error: ignoring return value of Œread¹, declared
> with attribute
> warn_unused_result
> make[5]: *** [tapdisk-queue.o] Error 1
> make[5]: Leaving
> directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
> make[4]: ***
> [subdir-install-drivers] Error 2
> make[4]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[3]: *** [subdirs-install]
> Error 2
> make[3]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[2]: ***
> [subdir-install-blktap2] Error 2
> make[2]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools'
> make[1]: *** [subdirs-install] Error 2
>
> make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make: ***
> [install-tools] Error 2
> ------
>
> root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c
> -o tapdisk-log.o tapdisk-log.c
> cc1: warnings being treated as errors
>
> tapdisk-log.c: In function Œtlog_flush¹:
> tapdisk-log.c:250: error: ignoring
> return value of Œwrite¹, declared
> with attribute warn_unused_result
>
> ------
>
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c
> -o tapdisk2.o tapdisk2.c
> cc1: warnings being treated as errors
>
> tapdisk2.c: In function Œmain¹:
> tapdisk2.c:82: error: ignoring return value
> of Œchdir¹, declared with
> attribute warn_unused_result
> ------
> cc1:
> warnings being treated as errors
> tapdisk-stream.c: In function
> Œtapdisk_stream_poll_clear¹:
> tapdisk-stream.c:148: error: ignoring return
> value of Œread¹, declared
> with attribute warn_unused_result
>
> tapdisk-stream.c: In function Œtapdisk_stream_poll_set¹:
>
> tapdisk-stream.c:158: error: ignoring return value of Œwrite¹,
> declared with
> attribute warn_unused_result
> tapdisk-stream.c: In function
> Œtapdisk_stream_print_request¹:
> tapdisk-stream.c:206: error: ignoring return
> value of Œwrite¹,
> declared with attribute warn_unused_result
>
>
>
> Best
> Regards,
> Bei Guan
>
>



_______________________________________________
Xen-devel mailing
> list
[hidden email]
http://lists.xen.org/xen-devel




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Keir Fraser-5
In reply to this post by BEI GUAN
On 11/05/2012 17:10, "Bei Guan" <[hidden email]> wrote:

> 2012/5/11 Ian Campbell <[hidden email]>
>> On Fri, 2012-05-11 at 16:12 +0100, Bei Guan wrote:
>>>
>>> 2012/5/11 Ian Campbell <[hidden email]>

>>>
>>> Thank you for your reply. I have used "hg pull; hg update" to update
>>> to the latest Xen and it is the version info:
>>>
>>> root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
>>> changeset:   25287:54c8c9eaee92
>>> tag:         tip
>>> user:        Dietmar Hahn <[hidden email]>
>>> date:        Fri Apr 27 11:09:26 2012 +0200
>>> summary:     docs: add vpmu description to xen-command-line.markdown
>>>
>>> But, it still has the same errors.
>>
>> Thanks, looks like we still need to fix these errors then.
>>
>> I'm not really happy with the following, but it's no worse than things
>> are today...
>>
>> Bei, I don't see these build failures, does this work for you?
>
> No, it doesn't work for me. There is the same error.
> My environment and gcc version are like this:

I think the problem is that casting the function result to void doesn't work
around this warning. You actually have to do something with the return code.
:-(

 -- Keir

> root@gavin-desktop:~# uname -a
> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC 2011
> x86_64 GNU/Linux
>
> root@gavin-desktop:~# gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
> --enable-multiarch --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
> --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>
>
>
>
> Thanks,
> Bei Guan
>
>
>
>  
>>
>> 8<------------------------------------------------------
>>
>> # HG changeset patch
>> # User Ian Campbell <[hidden email]>
>> # Date 1336751175 -3600
>> # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>> # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>> blktap: avoid attribute warn_unused_result build failures.
>>
>> I'm not proud of this, but since none of these callers of read/write have any
>> other error handling and return void themselves (for several links up the
>> call
>> chain AFAICT) and because I don't really want to get into a massive reworking
>> of blktap2 I suppose it is at least pragmatic
>>
>> Signed-off-by: Ian Campbell <[hidden email]>
>>
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-log.c
>> --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:19:16 2012
>> +0100
>> +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:46:15 2012
>> +0100
>> @@ -247,7 +247,7 @@ tlog_flush(void)
>>         wsize = ((size + 511) & (~511));
>>
>>         memset(tapdisk_log.buf + size, '\n', wsize - size);
>> -       write(fd, tapdisk_log.buf, wsize);
>> +       (void)write(fd, tapdisk_log.buf, wsize);
>>
>>         tapdisk_log.p = tapdisk_log.buf;
>>
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-queue.c
>> --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:19:16 2012
>> +0100
>> +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:46:15 2012
>> +0100
>> @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>         uint64_t val;
>>
>>         if (lio->flags & LIO_FLAG_EVENTFD)
>> -               read(lio->event_fd, &val, sizeof(val));
>> +               (void)read(lio->event_fd, &val, sizeof(val));
>>  }
>>
>>  static void
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-stream.c
>> --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:19:16 2012
>> +0100
>> +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:46:15 2012
>> +0100
>> @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>  {
>>         int dummy;
>>
>> -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>> +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>         p->set = 0;
>>  }
>>
>> @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>         int dummy = 0;
>>
>>         if (!p->set) {
>> -               write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
>> +               (void)write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
>>                 p->set = 1;
>>         }
>>  }
>> @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>  {
>>         unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s,
>> sreq);
>>         char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
>> -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>> +       (void)write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>  }
>>
>>  static void
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk2.c
>> --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16 2012 +0100
>> +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15 2012 +0100
>> @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>         if (optind != argc)
>>                 usage(argv[0], EINVAL);
>>
>> -       chdir("/");
>> +       if (chdir("/")) {
>> +               DPRINTF("failed to chdir(/): %d\n", errno);
>> +               err = 1;
>> +               goto out;
>> +       }
>> +
>>         tapdisk_start_logging("tapdisk2");
>>
>>         err = tapdisk_server_init();
>>
>>
>
>



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Ian Campbell-10
In reply to this post by BEI GUAN
On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:


> No, it doesn't work for me. There is the same error.

Hrm. Since you can reproduce would you mind experimenting a bit to
figure out the correct fix for this?

Perhaps adding -Wno-unused-result to C flags helps (google suggests it
may not)?

Or maybe just assigning to a dummy variable.

Ian.

> My environment and gcc version are like this:
>
> root@gavin-desktop:~# uname -a
> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> 2011 x86_64 GNU/Linux
>
> root@gavin-desktop:~# gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.3-4ubuntu5'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>
>
>
>
> Thanks,
> Bei Guan
>
>
>
>  
>        
>         8<------------------------------------------------------
>        
>         # HG changeset patch
>         # User Ian Campbell <[hidden email]>
>         # Date 1336751175 -3600
>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>         blktap: avoid attribute warn_unused_result build failures.
>        
>         I'm not proud of this, but since none of these callers of
>         read/write have any
>         other error handling and return void themselves (for several
>         links up the call
>         chain AFAICT) and because I don't really want to get into a
>         massive reworking
>         of blktap2 I suppose it is at least pragmatic
>        
>         Signed-off-by: Ian Campbell <[hidden email]>
>        
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-log.c
>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>         16:46:15 2012 +0100
>         @@ -247,7 +247,7 @@ tlog_flush(void)
>                wsize = ((size + 511) & (~511));
>        
>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>         -       write(fd, tapdisk_log.buf, wsize);
>         +       (void)write(fd, tapdisk_log.buf, wsize);
>        
>                tapdisk_log.p = tapdisk_log.buf;
>        
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-queue.c
>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>         16:46:15 2012 +0100
>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>                uint64_t val;
>        
>                if (lio->flags & LIO_FLAG_EVENTFD)
>         -               read(lio->event_fd, &val, sizeof(val));
>         +               (void)read(lio->event_fd, &val, sizeof(val));
>          }
>        
>          static void
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-stream.c
>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>         16:46:15 2012 +0100
>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>          {
>                int dummy;
>        
>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>                p->set = 0;
>          }
>        
>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>                int dummy = 0;
>        
>                if (!p->set) {
>         -               write(p->pipe[POLL_WRITE], &dummy,
>         sizeof(dummy));
>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>         sizeof(dummy));
>                        p->set = 1;
>                }
>          }
>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>          {
>                unsigned long idx = (unsigned
>         long)tapdisk_stream_request_idx(s, sreq);
>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>         idx, 0);
>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>         +       (void)write(s->out_fd, buf, sreq->secs <<
>         SECTOR_SHIFT);
>          }
>        
>          static void
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk2.c
>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>         2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>         2012 +0100
>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>                if (optind != argc)
>                        usage(argv[0], EINVAL);
>        
>         -       chdir("/");
>         +       if (chdir("/")) {
>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>         +               err = 1;
>         +               goto out;
>         +       }
>         +
>                tapdisk_start_logging("tapdisk2");
>        
>                err = tapdisk_server_init();
>        
>        
>
>
>
> --
> Best Regards,
> Bei Guan
>



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

BEI GUAN


2012/5/12 Ian Campbell <[hidden email]>
On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:


> No, it doesn't work for me. There is the same error.

Hrm. Since you can reproduce would you mind experimenting a bit to
figure out the correct fix for this?

Perhaps adding -Wno-unused-result to C flags helps (google suggests it
may not)?
Yes, I add this option to Makefile. And now it works well. The patch is as the following. Thank you very much.


diff -r 54c8c9eaee92 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile    Fri Apr 27 11:09:26 2012 +0200
+++ b/tools/blktap2/drivers/Makefile    Sat May 12 00:31:12 2012 +0800
@@ -11,6 +11,7 @@
 
 CFLAGS    += -Werror -g
 CFLAGS    += -Wno-unused
+CFLAGS    += -Wno-unused-result
 CFLAGS    += -fno-strict-aliasing
 CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
 CFLAGS    += $(CFLAGS_libxenctrl)




Thanks,
Bei Guan



 

Or maybe just assigning to a dummy variable.

Ian.

> My environment and gcc version are like this:
>
> root@gavin-desktop:~# uname -a
> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> 2011 x86_64 GNU/Linux
>
> root@gavin-desktop:~# gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.3-4ubuntu5'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>
>
>
>
> Thanks,
> Bei Guan
>
>
>
>
>
>         8<------------------------------------------------------
>
>         # HG changeset patch
>         # User Ian Campbell <[hidden email]>
>         # Date 1336751175 -3600
>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>         blktap: avoid attribute warn_unused_result build failures.
>
>         I'm not proud of this, but since none of these callers of
>         read/write have any
>         other error handling and return void themselves (for several
>         links up the call
>         chain AFAICT) and because I don't really want to get into a
>         massive reworking
>         of blktap2 I suppose it is at least pragmatic
>
>         Signed-off-by: Ian Campbell <[hidden email]>
>
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-log.c
>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>         16:46:15 2012 +0100
>         @@ -247,7 +247,7 @@ tlog_flush(void)
>                wsize = ((size + 511) & (~511));
>
>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>         -       write(fd, tapdisk_log.buf, wsize);
>         +       (void)write(fd, tapdisk_log.buf, wsize);
>
>                tapdisk_log.p = tapdisk_log.buf;
>
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-queue.c
>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>         16:46:15 2012 +0100
>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>                uint64_t val;
>
>                if (lio->flags & LIO_FLAG_EVENTFD)
>         -               read(lio->event_fd, &val, sizeof(val));
>         +               (void)read(lio->event_fd, &val, sizeof(val));
>          }
>
>          static void
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-stream.c
>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>         16:46:15 2012 +0100
>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>          {
>                int dummy;
>
>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>                p->set = 0;
>          }
>
>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>                int dummy = 0;
>
>                if (!p->set) {
>         -               write(p->pipe[POLL_WRITE], &dummy,
>         sizeof(dummy));
>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>         sizeof(dummy));
>                        p->set = 1;
>                }
>          }
>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>          {
>                unsigned long idx = (unsigned
>         long)tapdisk_stream_request_idx(s, sreq);
>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>         idx, 0);
>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>         +       (void)write(s->out_fd, buf, sreq->secs <<
>         SECTOR_SHIFT);
>          }
>
>          static void
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk2.c
>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>         2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>         2012 +0100
>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>                if (optind != argc)
>                        usage(argv[0], EINVAL);
>
>         -       chdir("/");
>         +       if (chdir("/")) {
>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>         +               err = 1;
>         +               goto out;
>         +       }
>         +
>                tapdisk_start_logging("tapdisk2");
>
>                err = tapdisk_server_init();
>
>
>
>
>
> --
> Best Regards,
> Bei Guan
>





--
Best Regards,
Bei Guan


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Keir Fraser-4
In reply to this post by Ian Campbell-10
On 11/05/2012 17:24, "Ian Campbell" <[hidden email]> wrote:

> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
>
>
>> No, it doesn't work for me. There is the same error.
>
> Hrm. Since you can reproduce would you mind experimenting a bit to
> figure out the correct fix for this?
>
> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> may not)?
>
> Or maybe just assigning to a dummy variable.
Bei, Please try the attached patch.

 -- Keir

> Ian.
>
>> My environment and gcc version are like this:
>>
>> root@gavin-desktop:~# uname -a
>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
>> 2011 x86_64 GNU/Linux
>>
>> root@gavin-desktop:~# gcc -v
>> Using built-in specs.
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>> 4.4.3-4ubuntu5'
>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>> --enable-shared --enable-multiarch --enable-linker-build-id
>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
>> --disable-werror --with-arch-32=i486 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>>
>>
>>
>>
>> Thanks,
>> Bei Guan
>>
>>
>>
>>  
>>        
>>         8<------------------------------------------------------
>>        
>>         # HG changeset patch
>>         # User Ian Campbell <[hidden email]>
>>         # Date 1336751175 -3600
>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>>         blktap: avoid attribute warn_unused_result build failures.
>>        
>>         I'm not proud of this, but since none of these callers of
>>         read/write have any
>>         other error handling and return void themselves (for several
>>         links up the call
>>         chain AFAICT) and because I don't really want to get into a
>>         massive reworking
>>         of blktap2 I suppose it is at least pragmatic
>>        
>>         Signed-off-by: Ian Campbell <[hidden email]>
>>        
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-log.c
>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -247,7 +247,7 @@ tlog_flush(void)
>>                wsize = ((size + 511) & (~511));
>>        
>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>>         -       write(fd, tapdisk_log.buf, wsize);
>>         +       (void)write(fd, tapdisk_log.buf, wsize);
>>        
>>                tapdisk_log.p = tapdisk_log.buf;
>>        
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-queue.c
>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>                uint64_t val;
>>        
>>                if (lio->flags & LIO_FLAG_EVENTFD)
>>         -               read(lio->event_fd, &val, sizeof(val));
>>         +               (void)read(lio->event_fd, &val, sizeof(val));
>>          }
>>        
>>          static void
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-stream.c
>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>          {
>>                int dummy;
>>        
>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>                p->set = 0;
>>          }
>>        
>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>                int dummy = 0;
>>        
>>                if (!p->set) {
>>         -               write(p->pipe[POLL_WRITE], &dummy,
>>         sizeof(dummy));
>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>>         sizeof(dummy));
>>                        p->set = 1;
>>                }
>>          }
>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>          {
>>                unsigned long idx = (unsigned
>>         long)tapdisk_stream_request_idx(s, sreq);
>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>>         idx, 0);
>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>         +       (void)write(s->out_fd, buf, sreq->secs <<
>>         SECTOR_SHIFT);
>>          }
>>        
>>          static void
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk2.c
>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>>         2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>>         2012 +0100
>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>                if (optind != argc)
>>                        usage(argv[0], EINVAL);
>>        
>>         -       chdir("/");
>>         +       if (chdir("/")) {
>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>>         +               err = 1;
>>         +               goto out;
>>         +       }
>>         +
>>                tapdisk_start_logging("tapdisk2");
>>        
>>                err = tapdisk_server_init();
>>        
>>        
>>
>>
>>
>> --
>> Best Regards,
>> Bei Guan
>>
>
>

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel

00-tapdisk-check-io-result (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Keir Fraser-4
In reply to this post by BEI GUAN
On 11/05/2012 17:33, "Bei Guan" <[hidden email]> wrote:

> 2012/5/12 Ian Campbell <[hidden email]>
>> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
>>
>>
>>> No, it doesn't work for me. There is the same error.
>>
>> Hrm. Since you can reproduce would you mind experimenting a bit to
>> figure out the correct fix for this?
>>
>> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
>> may not)?
> Yes, I add this option to Makefile. And now it works well. The patch is as the
> following. Thank you very much.

I'd be worried about more command-line meddling causing even more fallout.
Particularly because we haven't used that option anywhere else so far, so
it's untested by us. E.g., do all gcc support -Wno-unused-result?

 -- Keir

>
> diff -r 54c8c9eaee92 tools/blktap2/drivers/Makefile
> --- a/tools/blktap2/drivers/Makefile    Fri Apr 27 11:09:26 2012 +0200
> +++ b/tools/blktap2/drivers/Makefile    Sat May 12 00:31:12 2012 +0800
> @@ -11,6 +11,7 @@
>  
>  CFLAGS    += -Werror -g
>  CFLAGS    += -Wno-unused
> +CFLAGS    += -Wno-unused-result
>  CFLAGS    += -fno-strict-aliasing
>  CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
>  CFLAGS    += $(CFLAGS_libxenctrl)
>
>
>
>
> Thanks,
> Bei Guan
>
>
>
>  
>>
>> Or maybe just assigning to a dummy variable.
>>
>> Ian.
>>
>>> My environment and gcc version are like this:
>>>
>>> root@gavin-desktop:~# uname -a
>>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
>>> 2011 x86_64 GNU/Linux
>>>
>>> root@gavin-desktop:~# gcc -v
>>> Using built-in specs.
>>> Target: x86_64-linux-gnu
>>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>>> 4.4.3-4ubuntu5'
>>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
>>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>>> --enable-shared --enable-multiarch --enable-linker-build-id
>>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
>>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
>>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
>>> --disable-werror --with-arch-32=i486 --with-tune=generic
>>> --enable-checking=release --build=x86_64-linux-gnu
>>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>>> Thread model: posix
>>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>>>
>>>
>>>
>>>
>>> Thanks,
>>> Bei Guan
>>>
>>>
>>>
>>>
>>>
>>>         8<------------------------------------------------------
>>>
>>>         # HG changeset patch
>>>         # User Ian Campbell <[hidden email]>
>>>         # Date 1336751175 -3600
>>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>>>         blktap: avoid attribute warn_unused_result build failures.
>>>
>>>         I'm not proud of this, but since none of these callers of
>>>         read/write have any
>>>         other error handling and return void themselves (for several
>>>         links up the call
>>>         chain AFAICT) and because I don't really want to get into a
>>>         massive reworking
>>>         of blktap2 I suppose it is at least pragmatic
>>>
>>>         Signed-off-by: Ian Campbell <[hidden email]>
>>>
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk-log.c
>>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>>         16:19:16 2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>>         16:46:15 2012 +0100
>>>         @@ -247,7 +247,7 @@ tlog_flush(void)
>>>                wsize = ((size + 511) & (~511));
>>>
>>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>>>         -       write(fd, tapdisk_log.buf, wsize);
>>>         +       (void)write(fd, tapdisk_log.buf, wsize);
>>>
>>>                tapdisk_log.p = tapdisk_log.buf;
>>>
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk-queue.c
>>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>>         16:19:16 2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>>         16:46:15 2012 +0100
>>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>>                uint64_t val;
>>>
>>>                if (lio->flags & LIO_FLAG_EVENTFD)
>>>         -               read(lio->event_fd, &val, sizeof(val));
>>>         +               (void)read(lio->event_fd, &val, sizeof(val));
>>>          }
>>>
>>>          static void
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk-stream.c
>>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>>         16:19:16 2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>>         16:46:15 2012 +0100
>>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>>          {
>>>                int dummy;
>>>
>>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>>                p->set = 0;
>>>          }
>>>
>>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>>                int dummy = 0;
>>>
>>>                if (!p->set) {
>>>         -               write(p->pipe[POLL_WRITE], &dummy,
>>>         sizeof(dummy));
>>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>>>         sizeof(dummy));
>>>                        p->set = 1;
>>>                }
>>>          }
>>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>>          {
>>>                unsigned long idx = (unsigned
>>>         long)tapdisk_stream_request_idx(s, sreq);
>>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>>>         idx, 0);
>>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>>         +       (void)write(s->out_fd, buf, sreq->secs <<
>>>         SECTOR_SHIFT);
>>>          }
>>>
>>>          static void
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk2.c
>>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>>>         2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>>>         2012 +0100
>>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>>                if (optind != argc)
>>>                        usage(argv[0], EINVAL);
>>>
>>>         -       chdir("/");
>>>         +       if (chdir("/")) {
>>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>>>         +               err = 1;
>>>         +               goto out;
>>>         +       }
>>>         +
>>>                tapdisk_start_logging("tapdisk2");
>>>
>>>                err = tapdisk_server_init();
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Bei Guan
>>>
>>
>>
>
>



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

BEI GUAN
In reply to this post by Keir Fraser-4


2012/5/12 Keir Fraser <[hidden email]>
On 11/05/2012 17:24, "Ian Campbell" <[hidden email]> wrote:

> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
>
>
>> No, it doesn't work for me. There is the same error.
>
> Hrm. Since you can reproduce would you mind experimenting a bit to
> figure out the correct fix for this?
>
> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> may not)?
>
> Or maybe just assigning to a dummy variable.

Bei, Please try the attached patch.
It works now. Thank you.


Thanks,
Bei Guan
 

 -- Keir

> Ian.
>
>> My environment and gcc version are like this:
>>
>> root@gavin-desktop:~# uname -a
>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
>> 2011 x86_64 GNU/Linux
>>
>> root@gavin-desktop:~# gcc -v
>> Using built-in specs.
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>> 4.4.3-4ubuntu5'
>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>> --enable-shared --enable-multiarch --enable-linker-build-id
>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
>> --disable-werror --with-arch-32=i486 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>>
>>
>>
>>
>> Thanks,
>> Bei Guan
>>
>>
>>
>>
>>
>>         8<------------------------------------------------------
>>
>>         # HG changeset patch
>>         # User Ian Campbell <[hidden email]>
>>         # Date 1336751175 -3600
>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>>         blktap: avoid attribute warn_unused_result build failures.
>>
>>         I'm not proud of this, but since none of these callers of
>>         read/write have any
>>         other error handling and return void themselves (for several
>>         links up the call
>>         chain AFAICT) and because I don't really want to get into a
>>         massive reworking
>>         of blktap2 I suppose it is at least pragmatic
>>
>>         Signed-off-by: Ian Campbell <[hidden email]>
>>
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-log.c
>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -247,7 +247,7 @@ tlog_flush(void)
>>                wsize = ((size + 511) & (~511));
>>
>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>>         -       write(fd, tapdisk_log.buf, wsize);
>>         +       (void)write(fd, tapdisk_log.buf, wsize);
>>
>>                tapdisk_log.p = tapdisk_log.buf;
>>
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-queue.c
>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>                uint64_t val;
>>
>>                if (lio->flags & LIO_FLAG_EVENTFD)
>>         -               read(lio->event_fd, &val, sizeof(val));
>>         +               (void)read(lio->event_fd, &val, sizeof(val));
>>          }
>>
>>          static void
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-stream.c
>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>          {
>>                int dummy;
>>
>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>                p->set = 0;
>>          }
>>
>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>                int dummy = 0;
>>
>>                if (!p->set) {
>>         -               write(p->pipe[POLL_WRITE], &dummy,
>>         sizeof(dummy));
>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>>         sizeof(dummy));
>>                        p->set = 1;
>>                }
>>          }
>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>          {
>>                unsigned long idx = (unsigned
>>         long)tapdisk_stream_request_idx(s, sreq);
>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>>         idx, 0);
>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>         +       (void)write(s->out_fd, buf, sreq->secs <<
>>         SECTOR_SHIFT);
>>          }
>>
>>          static void
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk2.c
>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>>         2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>>         2012 +0100
>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>                if (optind != argc)
>>                        usage(argv[0], EINVAL);
>>
>>         -       chdir("/");
>>         +       if (chdir("/")) {
>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>>         +               err = 1;
>>         +               goto out;
>>         +       }
>>         +
>>                tapdisk_start_logging("tapdisk2");
>>
>>                err = tapdisk_server_init();
>>
>>
>>
>>
>>
>> --
>> Best Regards,
>> Bei Guan
>>
>
>




--
Best Regards,
Bei Guan


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Ian Jackson-2
In reply to this post by Keir Fraser-4
~Keir Fraser writes ("Re: [Xen-devel] Errors of doing "make install-tools" with xen-4.2-unstable?"):
> On 11/05/2012 17:33, "Bei Guan" <[hidden email]> wrote:
 > Yes, I add this option to Makefile. And now it works well. The patch is as the
> > following. Thank you very much.
>
> I'd be worried about more command-line meddling causing even more fallout.
> Particularly because we haven't used that option anywhere else so far, so
> it's untested by us. E.g., do all gcc support -Wno-unused-result?

Checking the manuals (which are all online), gcc 4.0 doesn't support
it.  So no, relevant gccs don't.

However the tools build now uses autoconf.  I would accept a patch
which used autoconf to determine whether gcc accepts
-Wno-unused-result and to supply it in the blktap2 Makefile if it
does.

Ian.

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: Errors of doing "make install-tools" with xen-4.2-unstable?

Ian Campbell-10
In reply to this post by Keir Fraser-4
On Fri, 2012-05-11 at 17:47 +0100, Keir Fraser wrote:

> On 11/05/2012 17:33, "Bei Guan" <[hidden email]> wrote:
>
> > 2012/5/12 Ian Campbell <[hidden email]>
> >> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
> >>
> >>
> >>> No, it doesn't work for me. There is the same error.
> >>
> >> Hrm. Since you can reproduce would you mind experimenting a bit to
> >> figure out the correct fix for this?
> >>
> >> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> >> may not)?
> > Yes, I add this option to Makefile. And now it works well. The patch is as the
> > following. Thank you very much.
>
> I'd be worried about more command-line meddling causing even more fallout.
> Particularly because we haven't used that option anywhere else so far, so
> it's untested by us. E.g., do all gcc support -Wno-unused-result?

We could have used cc-option, but your {read,write}_exact patch looks
like a better fix anyway.

Ian.

>
>  -- Keir
>
> >
> > diff -r 54c8c9eaee92 tools/blktap2/drivers/Makefile
> > --- a/tools/blktap2/drivers/Makefile    Fri Apr 27 11:09:26 2012 +0200
> > +++ b/tools/blktap2/drivers/Makefile    Sat May 12 00:31:12 2012 +0800
> > @@ -11,6 +11,7 @@
> >  
> >  CFLAGS    += -Werror -g
> >  CFLAGS    += -Wno-unused
> > +CFLAGS    += -Wno-unused-result
> >  CFLAGS    += -fno-strict-aliasing
> >  CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
> >  CFLAGS    += $(CFLAGS_libxenctrl)
> >
> >
> >
> >
> > Thanks,
> > Bei Guan
> >
> >
> >
> >  
> >>
> >> Or maybe just assigning to a dummy variable.
> >>
> >> Ian.
> >>
> >>> My environment and gcc version are like this:
> >>>
> >>> root@gavin-desktop:~# uname -a
> >>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> >>> 2011 x86_64 GNU/Linux
> >>>
> >>> root@gavin-desktop:~# gcc -v
> >>> Using built-in specs.
> >>> Target: x86_64-linux-gnu
> >>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> >>> 4.4.3-4ubuntu5'
> >>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> >>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> >>> --enable-shared --enable-multiarch --enable-linker-build-id
> >>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> >>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> >>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> >>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> >>> --disable-werror --with-arch-32=i486 --with-tune=generic
> >>> --enable-checking=release --build=x86_64-linux-gnu
> >>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> >>> Thread model: posix
> >>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
> >>>
> >>>
> >>>
> >>>
> >>> Thanks,
> >>> Bei Guan
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>         8<------------------------------------------------------
> >>>
> >>>         # HG changeset patch
> >>>         # User Ian Campbell <[hidden email]>
> >>>         # Date 1336751175 -3600
> >>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
> >>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
> >>>         blktap: avoid attribute warn_unused_result build failures.
> >>>
> >>>         I'm not proud of this, but since none of these callers of
> >>>         read/write have any
> >>>         other error handling and return void themselves (for several
> >>>         links up the call
> >>>         chain AFAICT) and because I don't really want to get into a
> >>>         massive reworking
> >>>         of blktap2 I suppose it is at least pragmatic
> >>>
> >>>         Signed-off-by: Ian Campbell <[hidden email]>
> >>>
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk-log.c
> >>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >>>         16:19:16 2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >>>         16:46:15 2012 +0100
> >>>         @@ -247,7 +247,7 @@ tlog_flush(void)
> >>>                wsize = ((size + 511) & (~511));
> >>>
> >>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
> >>>         -       write(fd, tapdisk_log.buf, wsize);
> >>>         +       (void)write(fd, tapdisk_log.buf, wsize);
> >>>
> >>>                tapdisk_log.p = tapdisk_log.buf;
> >>>
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk-queue.c
> >>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >>>         16:19:16 2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >>>         16:46:15 2012 +0100
> >>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
> >>>                uint64_t val;
> >>>
> >>>                if (lio->flags & LIO_FLAG_EVENTFD)
> >>>         -               read(lio->event_fd, &val, sizeof(val));
> >>>         +               (void)read(lio->event_fd, &val, sizeof(val));
> >>>          }
> >>>
> >>>          static void
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk-stream.c
> >>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >>>         16:19:16 2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >>>         16:46:15 2012 +0100
> >>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
> >>>          {
> >>>                int dummy;
> >>>
> >>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >>>                p->set = 0;
> >>>          }
> >>>
> >>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
> >>>                int dummy = 0;
> >>>
> >>>                if (!p->set) {
> >>>         -               write(p->pipe[POLL_WRITE], &dummy,
> >>>         sizeof(dummy));
> >>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
> >>>         sizeof(dummy));
> >>>                        p->set = 1;
> >>>                }
> >>>          }
> >>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
> >>>          {
> >>>                unsigned long idx = (unsigned
> >>>         long)tapdisk_stream_request_idx(s, sreq);
> >>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
> >>>         idx, 0);
> >>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
> >>>         +       (void)write(s->out_fd, buf, sreq->secs <<
> >>>         SECTOR_SHIFT);
> >>>          }
> >>>
> >>>          static void
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk2.c
> >>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
> >>>         2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
> >>>         2012 +0100
> >>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
> >>>                if (optind != argc)
> >>>                        usage(argv[0], EINVAL);
> >>>
> >>>         -       chdir("/");
> >>>         +       if (chdir("/")) {
> >>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
> >>>         +               err = 1;
> >>>         +               goto out;
> >>>         +       }
> >>>         +
> >>>                tapdisk_start_logging("tapdisk2");
> >>>
> >>>                err = tapdisk_server_init();
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Best Regards,
> >>> Bei Guan
> >>>
> >>
> >>
> >
> >
>
>



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xen.org/xen-devel