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
+6 -5
View File
@@ -39,11 +39,12 @@ vdev_indirect_mapping_verify(vdev_indirect_mapping_t *vim)
EQUIV(vim->vim_phys->vimp_num_entries > 0,
vim->vim_entries != NULL);
if (vim->vim_phys->vimp_num_entries > 0) {
ASSERTV(vdev_indirect_mapping_entry_phys_t *last_entry =
&vim->vim_entries[vim->vim_phys->vimp_num_entries - 1]);
ASSERTV(uint64_t offset =
DVA_MAPPING_GET_SRC_OFFSET(last_entry));
ASSERTV(uint64_t size = DVA_GET_ASIZE(&last_entry->vimep_dst));
vdev_indirect_mapping_entry_phys_t *last_entry __maybe_unused =
&vim->vim_entries[vim->vim_phys->vimp_num_entries - 1];
uint64_t offset __maybe_unused =
DVA_MAPPING_GET_SRC_OFFSET(last_entry);
uint64_t size __maybe_unused =
DVA_GET_ASIZE(&last_entry->vimep_dst);
ASSERT3U(vim->vim_phys->vimp_max_offset, >=, offset + size);
}