Replace ASSERTV macro with compiler annotation

Remove the ASSERTV macro and handle suppressing unused 
compiler warnings for variables only in ASSERTs using the 
__attribute__((unused)) compiler annotation.  The annotation
is understood by both gcc and clang.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9671
This commit is contained in:
Matthew Macy
2019-12-05 12:37:00 -08:00
committed by Brian Behlendorf
parent 12395c7b0b
commit 2a8ba608d3
28 changed files with 66 additions and 61 deletions
+3 -3
View File
@@ -279,7 +279,7 @@ feature_get_refcount_from_disk(spa_t *spa, zfeature_info_t *feature,
static int
feature_get_enabled_txg(spa_t *spa, zfeature_info_t *feature, uint64_t *res)
{
ASSERTV(uint64_t enabled_txg_obj = spa->spa_feat_enabled_txg_obj);
uint64_t enabled_txg_obj __maybe_unused = spa->spa_feat_enabled_txg_obj;
ASSERT(zfeature_depends_on(feature->fi_feature,
SPA_FEATURE_ENABLED_TXG));
@@ -397,9 +397,9 @@ feature_do_action(spa_t *spa, spa_feature_t fid, feature_action_t action,
{
uint64_t refcount = 0;
zfeature_info_t *feature = &spa_feature_table[fid];
ASSERTV(uint64_t zapobj =
uint64_t zapobj __maybe_unused =
(feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj);
spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj;
ASSERT(VALID_FEATURE_FID(fid));
ASSERT(0 != zapobj);