Skip to content

Commit 1fcba99

Browse files
authored
Address compiler switch errors/warnings (ExecuteTorch)
Differential Revision: D86070193 Pull Request resolved: #15543
1 parent 9c568d7 commit 1fcba99

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

runtime/core/exec_aten/util/scalar_type_util.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -913,21 +913,23 @@ struct promote_types {
913913
}
914914
#endif
915915

916-
#define ET_INTERNAL_SWITCH(TYPE, CONTEXT, NAME, ...) \
917-
[&] { \
918-
const auto& _st = TYPE; \
919-
constexpr const char* et_switch_name = NAME; \
920-
(void)et_switch_name; /* Suppress unused var */ \
921-
switch (_st) { \
922-
__VA_ARGS__ \
923-
default: \
924-
CONTEXT.fail(torch::executor::Error::InvalidArgument); \
925-
ET_LOG( \
926-
Error, \
927-
"Unhandled dtype %s for %s", \
928-
::executorch::runtime::toString(_st), \
929-
et_switch_name); \
930-
} \
916+
#define ET_INTERNAL_SWITCH(TYPE, CONTEXT, NAME, ...) \
917+
[&] { \
918+
const auto& _st = TYPE; \
919+
constexpr const char* et_switch_name = NAME; \
920+
(void)et_switch_name; /* Suppress unused var */ \
921+
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wswitch-enum") \
922+
switch (_st) { \
923+
__VA_ARGS__ \
924+
default: \
925+
CONTEXT.fail(torch::executor::Error::InvalidArgument); \
926+
ET_LOG( \
927+
Error, \
928+
"Unhandled dtype %s for %s", \
929+
::executorch::runtime::toString(_st), \
930+
et_switch_name); \
931+
} \
932+
C10_DIAGNOSTIC_POP() \
931933
}()
932934

933935
#define ET_INTERNAL_SWITCH_CASE_INT_TYPES(CTYPE_ALIAS, ...) \

0 commit comments

Comments
 (0)