Patchwork tests/tcg: fix a few warnings

login
register
mail settings
Submitter Catalin Patulea
Date Oct. 22, 2012, 11:18 p.m.
Message ID <1350947915-8213-1-git-send-email-catalinp@google.com>
Download mbox | patch
Permalink /patch/193300/
State New
Headers show

Comments

Catalin Patulea - Oct. 22, 2012, 11:18 p.m.
Signed-off-by: Catalin Patulea <catalinp@google.com>
---
This leaves a few of these:
warning: ignoring return value of 'write', declared with attribute warn_unused_result

How interesting is it to fix these? (Perhaps by asserting that the full write completed?)

 tests/tcg/hello-i386.c |    3 ++-
 tests/tcg/test-i386.c  |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Blue Swirl - Oct. 27, 2012, 4:53 p.m.
Thanks, applied.

On Mon, Oct 22, 2012 at 11:18 PM, Catalin Patulea <catalinp@google.com> wrote:
>
> Signed-off-by: Catalin Patulea <catalinp@google.com>
> ---
> This leaves a few of these:
> warning: ignoring return value of 'write', declared with attribute warn_unused_result
>
> How interesting is it to fix these? (Perhaps by asserting that the full write completed?)
>
>  tests/tcg/hello-i386.c |    3 ++-
>  tests/tcg/test-i386.c  |    2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tests/tcg/hello-i386.c b/tests/tcg/hello-i386.c
> index 86afc34..fa00380 100644
> --- a/tests/tcg/hello-i386.c
> +++ b/tests/tcg/hello-i386.c
> @@ -1,6 +1,6 @@
>  #include <asm/unistd.h>
>
> -static inline volatile void exit(int status)
> +static inline void exit(int status)
>  {
>    int __res;
>    __asm__ volatile ("movl %%ecx,%%ebx\n"\
> @@ -17,6 +17,7 @@ static inline int write(int fd, const char * buf, int len)
>                     "popl %%ebx\n"\
>                     : "=a" (status) \
>                     : "0" (__NR_write),"S" ((long)(fd)),"c" ((long)(buf)),"d" ((long)(len)));
> +  return status;
>  }
>
>  void _start(void)
> diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c
> index 64d929e..40392ac 100644
> --- a/tests/tcg/test-i386.c
> +++ b/tests/tcg/test-i386.c
> @@ -785,7 +785,7 @@ void fpu_clear_exceptions(void)
>          long double fpregs[8];
>      } float_env32;
>
> -    asm volatile ("fnstenv %0\n" : : "m" (float_env32));
> +    asm volatile ("fnstenv %0\n" : "=m" (float_env32));
>      float_env32.fpus &= ~0x7f;
>      asm volatile ("fldenv %0\n" : : "m" (float_env32));
>  }
> --
> 1.7.7.3
>
>

Patch

diff --git a/tests/tcg/hello-i386.c b/tests/tcg/hello-i386.c
index 86afc34..fa00380 100644
--- a/tests/tcg/hello-i386.c
+++ b/tests/tcg/hello-i386.c
@@ -1,6 +1,6 @@ 
 #include <asm/unistd.h>
 
-static inline volatile void exit(int status)
+static inline void exit(int status)
 {
   int __res;
   __asm__ volatile ("movl %%ecx,%%ebx\n"\
@@ -17,6 +17,7 @@  static inline int write(int fd, const char * buf, int len)
 		    "popl %%ebx\n"\
 		    : "=a" (status) \
 		    : "0" (__NR_write),"S" ((long)(fd)),"c" ((long)(buf)),"d" ((long)(len)));
+  return status;
 }
 
 void _start(void)
diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c
index 64d929e..40392ac 100644
--- a/tests/tcg/test-i386.c
+++ b/tests/tcg/test-i386.c
@@ -785,7 +785,7 @@  void fpu_clear_exceptions(void)
         long double fpregs[8];
     } float_env32;
 
-    asm volatile ("fnstenv %0\n" : : "m" (float_env32));
+    asm volatile ("fnstenv %0\n" : "=m" (float_env32));
     float_env32.fpus &= ~0x7f;
     asm volatile ("fldenv %0\n" : : "m" (float_env32));
 }