Skip to content

Commit 07ed85d

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
patch annoying clang17 enum print format issue (#476)
Summary: Its no longer kocher to have enums implicitly transformed to their underlying type. We now have to explicitly cast. Also fixed up some places the errors werent getting printed in hex while I was here Differential Revision: D49549284
1 parent a89017d commit 07ed85d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

runtime/executor/method.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class BackendDelegate final {
101101
if (!handle.ok()) {
102102
ET_LOG(
103103
Error,
104-
"Init failed for backend %s: %" PRIu32,
104+
"Init failed for backend %s: 0x%" PRIx32,
105105
backend_id,
106106
static_cast<uint32_t>(handle.error()));
107107
out->segment_.Free();
@@ -341,7 +341,7 @@ Error Method::parse_values() {
341341
if (!t.ok()) {
342342
ET_LOG(
343343
Error,
344-
"Failed parsing tensor at index %zu: %" PRIu32,
344+
"Failed parsing tensor at index %zu: 0x%" PRIx32,
345345
i,
346346
static_cast<uint32_t>(t.error()));
347347
return t.error();
@@ -358,7 +358,7 @@ Error Method::parse_values() {
358358
if (!tensors.ok()) {
359359
ET_LOG(
360360
Error,
361-
"Failed parsing tensor list at index %zu: %" PRIu32,
361+
"Failed parsing tensor list at index %zu: 0x%" PRIx32,
362362
i,
363363
static_cast<uint32_t>(tensors.error()));
364364
return tensors.error();
@@ -375,7 +375,7 @@ Error Method::parse_values() {
375375
if (!tensors.ok()) {
376376
ET_LOG(
377377
Error,
378-
"Failed parsing optional tensor list at index %zu: %" PRIu32,
378+
"Failed parsing optional tensor list at index %zu: 0x%" PRIx32,
379379
i,
380380
static_cast<uint32_t>(tensors.error()));
381381
return tensors.error();
@@ -687,17 +687,18 @@ Method::set_input(const EValue& input_evalue, size_t input_idx) {
687687
ET_CHECK_OR_RETURN_ERROR(
688688
e.isTensor() || e.isScalar(),
689689
InvalidArgument,
690-
"The %zu-th input in method is expected Tensor or prim, but received %u",
690+
"The %zu-th input in method is expected Tensor or prim, but received %" PRIu32,
691691
input_idx,
692692
static_cast<uint32_t>(e.tag));
693693

694694
ET_CHECK_OR_RETURN_ERROR(
695695
e.tag == input_evalue.tag,
696696
InvalidArgument,
697-
"The %zu-th input of method should have the same type as the input_evalue, but get tag %u and tag %u",
697+
"The %zu-th input of method should have the same type as the input_evalue, but get tag %" PRIu32
698+
" and tag %" PRIu32,
698699
input_idx,
699700
static_cast<uint32_t>(e.tag),
700-
(unsigned int)input_evalue.tag);
701+
static_cast<uint32_t>(input_evalue.tag));
701702

702703
if (e.isTensor()) {
703704
const auto& t_dst = e.toTensor();
@@ -959,7 +960,7 @@ Error Method::execute_instruction() {
959960
if (err != Error::Ok) {
960961
ET_LOG(
961962
Error,
962-
"CALL_DELEGATE execute failed at instruction %zu: %" PRIu32,
963+
"CALL_DELEGATE execute failed at instruction %zu: 0x%" PRIx32,
963964
step_state_.instr_idx,
964965
static_cast<uint32_t>(err));
965966
return err;

0 commit comments

Comments
 (0)