qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Handling of fall through code (was: [PATCH v8 04/87] ta


From: Stefan Weil
Subject: Re: [Qemu-devel] Handling of fall through code (was: [PATCH v8 04/87] target/mips: Mark switch fallthroughs with interpretable comments
Date: Mon, 8 Jul 2019 14:04:27 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

Am 08.07.2019 um 10:14 schrieb Aleksandar Markovic:
>
> On Jul 7, 2019 10:26 PM, "Stefan Weil" <address@hidden
> <mailto:address@hidden>> wrote:
> > - There is also fallthrough code which is obviously not correct
> (even in target/mips/translate.c).
>
> Can you please be more specific about those cases from
> target/mips/translate.c?
>

Hi Aleksandar,

this is the list of warnings for target/mips/translate.c:

/home/debian/src/github/qemu/qemu/target/mips/translate.c:10047:13:
warning: this statement may fall through [-Wimplicit-fallthrough=]
/home/debian/src/github/qemu/qemu/target/mips/translate.c:10056:13:
warning: this statement may fall through [-Wimplicit-fallthrough=]
/home/debian/src/github/qemu/qemu/target/mips/translate.c:20138:13:
warning: this statement may fall through [-Wimplicit-fallthrough=]
/home/debian/src/github/qemu/qemu/target/mips/translate.c:20144:13:
warning: this statement may fall through [-Wimplicit-fallthrough=]
/home/debian/src/github/qemu/qemu/target/mips/translate.c:6739:9:
warning: this statement may fall through [-Wimplicit-fallthrough=]
/home/debian/src/github/qemu/qemu/target/mips/translate.c:9820:13:
warning: this statement may fall through [-Wimplicit-fallthrough=]
/home/debian/src/github/qemu/qemu/target/mips/translate.c:9829:13:
warning: this statement may fall through [-Wimplicit-fallthrough=]

I have built using

    ../configure --disable-werror '--extra-cflags=-Wextra
-Wimplicit-fallthrough=2'

The build process produced warnings for 79 fallthrough locations. See
build protocol:

    https://qemu.weilnetz.de/results/build-20190708.txt (116 MiB !)

Sometimes the fallthrough comment is misplaced in the following case
statement or followed by code, so the compiler (correctly) won't accept
it. Maybe there exist also fallthrough comments although there is no
fallthrough code.

The protocol also shows 18 warnings [-Wcast-function-type] which might
indicate bugs:

/home/debian/src/github/qemu/qemu/chardev/char-fe.c:372:32: warning:
cast between incompatible function types from ‘GIOFunc’ {aka ‘int
(*)(struct _GIOChannel *, enum <anonymous>,  void *)’} to ‘gboolean
(*)(void *)’ {aka ‘int (*)(void *)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/chardev/char-io.c:92:20: warning: cast
between incompatible function types from ‘QIOChannelFunc’ {aka ‘int
(*)(struct QIOChannel *, enum <anonymous>,  void *)’} to ‘gboolean
(*)(void *)’ {aka ‘int (*)(void *)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/chardev/char-socket.c:606:42: warning:
cast between incompatible function types from ‘gboolean (*)(QIOChannel
*, GIOCondition,  void *)’ {aka ‘int (*)(struct QIOChannel *, enum
<anonymous>,  void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void
*)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/contrib/libvhost-user/libvhost-user-glib.c:59:6:
warning: cast between incompatible function types from ‘GSourceFunc’
{aka ‘int (*)(void *)’} to ‘void (*)(VuDev *, int,  void *)’ {aka ‘void
(*)(struct VuDev *, int,  void *)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/contrib/libvhost-user/libvhost-user-glib.c:85:33:
warning: cast between incompatible function types from ‘vu_watch_cb’
{aka ‘void (*)(struct VuDev *, int,  void *)’} to ‘gboolean (*)(void *)’
{aka ‘int (*)(void *)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/channel-buffer.c:182:27: warning:
cast between incompatible function types from ‘GSourceFunc’ {aka ‘int
(*)(void *)’} to ‘gboolean (*)(QIOChannel *, GIOCondition,  void *)’
{aka ‘int (*)(struct QIOChannel *, enum <anonymous>,  void *)’}
[-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/channel.c:315:35: warning: cast
between incompatible function types from ‘QIOChannelFunc’ {aka ‘int
(*)(struct QIOChannel *, enum <anonymous>,  void *)’} to ‘gboolean
(*)(void *)’ {aka ‘int (*)(void *)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/channel.c:507:27: warning: cast
between incompatible function types from ‘gboolean (*)(QIOChannel *,
GIOCondition,  void *)’ {aka ‘int (*)(struct QIOChannel *, enum
<anonymous>,  void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void
*)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/channel-watch.c:216:27: warning:
cast between incompatible function types from ‘GSourceFunc’ {aka ‘int
(*)(void *)’} to ‘gboolean (*)(QIOChannel *, GIOCondition,  void *)’
{aka ‘int (*)(struct QIOChannel *, enum <anonymous>,  void *)’}
[-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/channel-watch.c:81:27: warning:
cast between incompatible function types from ‘GSourceFunc’ {aka ‘int
(*)(void *)’} to ‘gboolean (*)(QIOChannel *, GIOCondition,  void *)’
{aka ‘int (*)(struct QIOChannel *, enum <anonymous>,  void *)’}
[-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/channel-websock.c:1258:27: warning:
cast between incompatible function types from ‘GSourceFunc’ {aka ‘int
(*)(void *)’} to ‘gboolean (*)(QIOChannel *, GIOCondition,  void *)’
{aka ‘int (*)(struct QIOChannel *, enum <anonymous>,  void *)’}
[-Wcast-function-type]
/home/debian/src/github/qemu/qemu/io/net-listener.c:236:31: warning:
cast between incompatible function types from ‘gboolean (*)(QIOChannel
*, GIOCondition,  void *)’ {aka ‘int (*)(struct QIOChannel *, enum
<anonymous>,  void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void
*)’} [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/target/i386/translate.c:2850:16:
warning: cast between incompatible function types from ‘void (*)(struct
TCGv_ptr_d *, struct TCGv_ptr_d *, struct TCGv_ptr_d *, struct
TCGv_i32_d *)’ to ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *,
struct TCGv_ptr_d *)’ [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/target/i386/translate.c:2850:16:
warning: cast between incompatible function types from ‘void (*)(struct
TCGv_ptr_d *, struct TCGv_ptr_d *, struct TCGv_ptr_d *, struct
TCGv_i64_d *)’ to ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *,
struct TCGv_ptr_d *)’ [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/target/i386/translate.c:2851:16:
warning: cast between incompatible function types from ‘void (*)(struct
TCGv_ptr_d *, struct TCGv_ptr_d *, struct TCGv_ptr_d *, struct
TCGv_i32_d *)’ to ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *,
struct TCGv_ptr_d *)’ [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/target/i386/translate.c:2851:16:
warning: cast between incompatible function types from ‘void (*)(struct
TCGv_ptr_d *, struct TCGv_ptr_d *, struct TCGv_ptr_d *, struct
TCGv_i64_d *)’ to ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *,
struct TCGv_ptr_d *)’ [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/target/i386/translate.c:4469:27:
warning: cast between incompatible function types from ‘SSEFunc_0_epp’
{aka ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *, struct
TCGv_ptr_d *)’} to ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *,
struct TCGv_ptr_d *, struct TCGv_i32_d *)’ [-Wcast-function-type]
/home/debian/src/github/qemu/qemu/target/i386/translate.c:4469:27:
warning: cast between incompatible function types from ‘SSEFunc_0_epp’
{aka ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *, struct
TCGv_ptr_d *)’} to ‘void (*)(struct TCGv_ptr_d *, struct TCGv_ptr_d *,
struct TCGv_ptr_d *, struct TCGv_i64_d *)’ [-Wcast-function-type]

Daniel, here is one possible fix (I am not sure how important that is):

diff --git a/crypto/hash-nettle.c b/crypto/hash-nettle.c
index 96f186f442..074cece468 100644
--- a/crypto/hash-nettle.c
+++ b/crypto/hash-nettle.c
@@ -28,10 +28,10 @@
 
 typedef void (*qcrypto_nettle_init)(void *ctx);
 typedef void (*qcrypto_nettle_write)(void *ctx,
-                                     unsigned int len,
+                                     size_t len,
                                      const uint8_t *buf);
 typedef void (*qcrypto_nettle_result)(void *ctx,
-                                      unsigned int len,
+                                      size_t len,
                                       uint8_t *buf);

Regards
Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]