Skip to content

Commit

Permalink
Always compile the body of xnn_datatype_to_string.
Browse files Browse the repository at this point in the history
This will allow tests compiled in optmimized builds to rely on that function to
generate parametrized test names.

PiperOrigin-RevId: 684832474
  • Loading branch information
qukhan authored and xnnpack-bot committed Oct 11, 2024
1 parent d5d572e commit 5dd39aa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions src/enums/datatype-strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


// This function is defined inline when logging is disabled
#if XNN_LOG_LEVEL > 0
const char* xnn_datatype_to_string(enum xnn_datatype type) {
switch (type) {
case xnn_datatype_invalid:
Expand Down Expand Up @@ -45,4 +44,3 @@ const char* xnn_datatype_to_string(enum xnn_datatype type) {
XNN_UNREACHABLE;
return NULL;
}
#endif // XNN_LOG_LEVEL > 0
8 changes: 1 addition & 7 deletions src/xnnpack/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ extern "C" {
void xnn_vlog_fatal(const char* format, va_list args);
#endif

#if XNN_LOG_LEVEL == XNN_LOG_NONE
inline static const char* xnn_datatype_to_string(enum xnn_datatype type) {
return "Unknown";
}
#else
const char* xnn_datatype_to_string(enum xnn_datatype type);
#endif
const char* xnn_datatype_to_string(enum xnn_datatype type);

#ifdef __cplusplus
} // extern "C"
Expand Down

0 comments on commit 5dd39aa

Please sign in to comment.