linux-user: Export use is_error(), use it to avoid warnings
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Mon, 4 Jun 2018 15:37:21 +0000 (12:37 -0300)
committerLaurent Vivier <laurent@vivier.eu>
Mon, 11 Jun 2018 12:40:11 +0000 (14:40 +0200)
This fixes:

  linux-user/flatload.c:740:9: warning: Loss of sign in implicit conversion
      if (res > (unsigned long)-4096)
          ^~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180604153722.24956-2-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/qemu.h
linux-user/syscall.c

index 6fa1e968db35900488d6f5c822e15c942c32dc89..793cd4df047803dc5c44259315476d6810b80280 100644 (file)
@@ -618,6 +618,11 @@ static inline void *lock_user_string(abi_ulong guest_addr)
 
 #include <pthread.h>
 
+static inline int is_error(abi_long ret)
+{
+    return (abi_ulong)ret >= (abi_ulong)(-4096);
+}
+
 /* Include target-specific struct and function definitions;
  * they may need access to the target-independent structures
  * above, so include them last.
index 7b9ac3b408605dcd76ead4cad35341f90f223f28..2117fb13b4a0ae6f706f920ce72ab6bdf1bf2500 100644 (file)
@@ -906,11 +906,6 @@ static inline abi_long get_errno(abi_long ret)
         return ret;
 }
 
-static inline int is_error(abi_long ret)
-{
-    return (abi_ulong)ret >= (abi_ulong)(-4096);
-}
-
 const char *target_strerror(int err)
 {
     if (err == TARGET_ERESTARTSYS) {