Skip to content

Commit

Permalink
Surpress deprecation warnings in ur_print.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacault committed Feb 19, 2025
1 parent 36e02a9 commit e3e33aa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
32 changes: 16 additions & 16 deletions unified-runtime/include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2823,10 +2823,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
os << "UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES";
break;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
case UR_DEVICE_INFO_BFLOAT16:
os << "UR_DEVICE_INFO_BFLOAT16";
break;
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
case UR_DEVICE_INFO_BFLOAT16:
os << "UR_DEVICE_INFO_BFLOAT16";
break;
#pragma GCC diagnostic pop
case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES:
os << "UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES";
Expand Down Expand Up @@ -4301,20 +4301,20 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr,
os << ")";
} break;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
case UR_DEVICE_INFO_BFLOAT16: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size
<< ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
case UR_DEVICE_INFO_BFLOAT16: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size
<< ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;
os << *tptr;

os << ")";
} break;
os << ")";
} break;
#pragma GCC diagnostic pop
case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: {
const uint32_t *tptr = (const uint32_t *)ptr;
Expand Down
14 changes: 14 additions & 0 deletions unified-runtime/scripts/templates/print.hpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,18 @@ template <typename T> inline ${x}_result_t printTagged(std::ostream &os, const v
inline std::ostream &operator<<(std::ostream &os, enum ${th.make_enum_name(n, tags, obj)} value) {
switch (value) {
%for n, item in enumerate(obj['etors']):
%if th.etor_traits.is_deprecated_etor(item):
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
%endif
<%
ename = th.make_etor_name(n, tags, obj['name'], item['name'])
%>case ${ename}:
os << "${ename}";
break;
%if th.etor_traits.is_deprecated_etor(item):
#pragma GCC diagnostic pop
%endif
%endfor
default:
os << "unknown enumerator";
Expand All @@ -217,6 +224,10 @@ template <typename T> inline ${x}_result_t printTagged(std::ostream &os, const v

switch (value) {
%for n, item in enumerate(obj['etors']):
%if th.etor_traits.is_deprecated_etor(item):
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
%endif
<%
ename = th.make_etor_name(n, tags, obj['name'], item['name'])
vtype = th.etor_get_associated_type(n, tags, item)
Expand Down Expand Up @@ -260,6 +271,9 @@ template <typename T> inline ${x}_result_t printTagged(std::ostream &os, const v
os << ")";
%endif
} break;
%if th.etor_traits.is_deprecated_etor(item):
#pragma GCC diagnostic pop
%endif
%endfor
default:
os << "unknown enumerator";
Expand Down

0 comments on commit e3e33aa

Please sign in to comment.