qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 0/3] add QEMU_WARN_NONNULL_ARGS() macro
@ 2018-01-17 13:18 Philippe Mathieu-Daudé
  2018-01-17 13:18 ` [Qemu-devel] [RFC PATCH 1/3] compiler: add QEMU_WARN_NONNULL_ARGS() Philippe Mathieu-Daudé
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-17 13:18 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: Philippe Mathieu-Daudé, qemu-devel, Peter Maydell,
	Paolo Bonzini, Stefan Hajnoczi, Luiz Capitulino, Stefan Weil

Some old PoC series I remember after reading
http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg03545.html

I had few more changes but then I found the code was harder to read
so I didn't continue further.
Only 2 patches are included as example.

This might still be useful in few cases, so I'm still sending as RFC
to have different thoughts.

This macro is, however, helpful to the Clang static analizer (reducing
false positive).

BTW another useful macro for the static analizer I used is:

    #define QEMU_FALLTHROUGH __attribute__((fallthrough))

It replaces the /* fall through */ comment, i.e.:

    switch (rap) {
    case BCR_SWS:
        if (!(CSR_STOP(s) || CSR_SPND(s)))
            return;
        val &= ~0x0300;
        QEMU_FALLTHROUGH;
    case BCR_LNKST:
    case BCR_LED1:
    case BCR_LED2:
    case BCR_LED3:
    case BCR_MC:
    case BCR_FDC:
    case BCR_BSBC:
    case BCR_EECAS:
    case BCR_PLAT:
        s->bcr[rap] = val;
        break;

Regards,

Phil.

Philippe Mathieu-Daudé (3):
  compiler: add QEMU_WARN_NONNULL_ARGS()
  virtio: let virtio_add/clear_feature() use QEMU_WARN_NONNULL_ARGS()
  utils: let qemu_find_file() use QEMU_WARN_NONNULL_ARGS()

 include/hw/virtio/virtio.h | 2 ++
 include/qemu-common.h      | 2 +-
 include/qemu/compiler.h    | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.15.1

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

end of thread, other threads:[~2018-01-17 15:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-17 13:18 [Qemu-devel] [RFC PATCH 0/3] add QEMU_WARN_NONNULL_ARGS() macro Philippe Mathieu-Daudé
2018-01-17 13:18 ` [Qemu-devel] [RFC PATCH 1/3] compiler: add QEMU_WARN_NONNULL_ARGS() Philippe Mathieu-Daudé
2018-01-17 13:32   ` Daniel P. Berrange
2018-01-17 14:33     ` Philippe Mathieu-Daudé
2018-01-17 14:39       ` Daniel P. Berrange
2018-01-17 14:56         ` Eric Blake
2018-01-17 15:02           ` Philippe Mathieu-Daudé
2018-01-17 13:18 ` [Qemu-devel] [RFC PATCH 2/3] virtio: let virtio_add/clear_feature() use QEMU_WARN_NONNULL_ARGS() Philippe Mathieu-Daudé
2018-01-17 13:18 ` [Qemu-devel] [RFC PATCH 3/3] utils: let qemu_find_file() " Philippe Mathieu-Daudé
2018-01-17 14:44 ` [Qemu-devel] [RFC PATCH 0/3] add QEMU_WARN_NONNULL_ARGS() macro Philippe Mathieu-Daudé
2018-01-17 15:36 ` Richard Henderson
2018-01-17 15:45   ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).