mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix multiple evaluations of VERIFY() and ASSERT() on failures
Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: DHE <git@dehacked.net> Closes #684 Closes #685
This commit is contained in:
parent
48ef8ba070
commit
2b5cd5990f
@ -63,12 +63,15 @@ void spl_dumpstack(void);
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"%s", "VERIFY(" #cond ") failed\n"))
|
||||
|
||||
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \
|
||||
(void) ((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (" FMT " " #OP " " FMT ")\n", \
|
||||
CAST (LEFT), CAST (RIGHT)))
|
||||
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) do { \
|
||||
TYPE _verify3_left = (TYPE)(LEFT); \
|
||||
TYPE _verify3_right = (TYPE)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (" FMT " " #OP " " FMT ")\n", \
|
||||
CAST (_verify3_left), CAST (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3B(x,y,z) VERIFY3_IMPL(x, y, z, boolean_t, "%d", (boolean_t))
|
||||
#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long))
|
||||
|
Loading…
Reference in New Issue
Block a user