subgroups: Fix Wformat warnings (#1549)

The main source of warnings was the use of `%d` for printing a
templated type `T`, where `T` could be any cl_ scalar or vector type.

Introduce `print_expected_obtained`.  It takes const references to
handle alignment of the cl_ types.

Define `operator<<` for all types used by the subgroup tests.  Ideally
those would be template functions enabled by TypeManager data, but
that requires some more work on the TypeManager (which we'd ideally do
after more warnings have been enabled).  So for now, define the
`operator<<` instances using preprocessor defines.

Also fix a few instances where the wrong format specifier was used for
`size_t` types.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2022-11-15 17:12:31 +00:00
committed by GitHub
parent 2110e45cce
commit fc4260bdae
6 changed files with 126 additions and 13 deletions

View File

@@ -744,9 +744,12 @@ template <typename Ty, BallotOp operation> struct SMASK
{
log_error("ERROR: get_sub_group_%s_mask... mismatch "
"for local id %d in sub group %d in group "
"%d, obtained %d, expected %d\n",
"%d, %s\n",
operation_names(operation), wi_id, sb_id,
wg_id, device_result, expected_result);
wg_id,
print_expected_obtained(expected_result,
device_result)
.c_str());
return TEST_FAIL;
}
}