]> git.proxmox.com Git - mirror_zfs.git/commit
libspl: cast to uintptr_t instead of !!ing
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 25 Jan 2022 01:05:42 +0000 (02:05 +0100)
committerGitHub <noreply@github.com>
Tue, 25 Jan 2022 01:05:42 +0000 (17:05 -0800)
commita9e2788ffe8f45c190ad442dda2e83e719cfb14f
tree22a851583295bcbbc9bea28fb769fe22ad47564d
parentcd26b217dcc136d025b845e61692bb34cf37552b
libspl: cast to uintptr_t instead of !!ing

This led to these two warning types:
  debug.h:139:67: warning: the address of ‘ARC_anon’
  will always evaluate as ‘true’ [-Waddress]
    139 | #define ASSERT3P(x, y, z)
              ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
        |                                               ^
  arc.c:1591:2: note: in expansion of macro ‘ASSERT3P’
   1591 |  ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon);
        |  ^~~~~~~~
and
  arc.h:66:44: warning: ‘<<’ in boolean context,
  did you mean ‘<’? [-Wint-in-bool-context]
     66 | #define HDR_GET_LSIZE(hdr)
              ((hdr)->b_lsize << SPA_MINBLOCKSHIFT)
  debug.h:138:46: note: in definition of macro ‘ASSERT3U’
    138 | #define ASSERT3U(x, y, z)
              ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
        |                        ^
  arc.c:1760:12: note: in expansion of macro ‘HDR_GET_LSIZE’
   1760 |   ASSERT3U(HDR_GET_LSIZE(hdr), !=, 0);
        |            ^~~~~~~~~~~~~

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13009
include/os/freebsd/spl/sys/debug.h
include/os/linux/spl/sys/debug.h
lib/libspl/include/assert.h