HomeFreeBSD

Fix gcc -Warray-bounds check for dump_object() in zdb

Description

Fix gcc -Warray-bounds check for dump_object() in zdb

As of gcc 6.1.1 20160621 (Red Hat 6.1.1-3) an array bounds warnings
is detected in the zdb the dump_object() function. The analysis is
correct but difficult to interpret because this is implemented as a
macro. Rework the ZDB_OT_NAME in to a function and remove the case
detected by gcc which is a side effect of the DMU_OT_IS_VALID() macro.

zdb.c: In function ‘dump_object’:
zdb.c:1931:288: error: array subscript is outside array bounds
    [-Werror=array-bounds]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Closes #4907

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Aug 1 2016, 5:42 PM
Parents
rGefe7978d89f8: Fix gcc self-comparison warning
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGf3c9cac14355: Fix gcc -Warray-bounds check for dump_object() in zdb (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Aug 2 2016, 8:14 PM