Skip to content

Commit 098e39f

Browse files
committed
Refactor Session::deprecated function to be non-static
1 parent dcb7066 commit 098e39f

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

runtime/onert/api/nnfw/src/APIImpl.cc

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ NNFW_STATUS nnfw_register_custom_op_info(nnfw_session *session, const char *id,
170170
return reinterpret_cast<Session *>(session)->register_custom_operation(id, info->eval_function);
171171
}
172172

173-
NNFW_STATUS nnfw_apply_tensorinfo(nnfw_session *, uint32_t, nnfw_tensorinfo)
173+
NNFW_STATUS nnfw_apply_tensorinfo(nnfw_session *session, uint32_t, nnfw_tensorinfo)
174174
{
175-
return Session::deprecated("nnfw_apply_tensorinfo: Deprecated");
175+
NNFW_RETURN_ERROR_IF_NULL(session);
176+
return reinterpret_cast<Session *>(session)->deprecated("nnfw_apply_tensorinfo: Deprecated");
176177
}
177178

178179
NNFW_STATUS nnfw_set_input_tensorinfo(nnfw_session *session, uint32_t index,
@@ -188,9 +189,10 @@ NNFW_STATUS nnfw_set_available_backends(nnfw_session *session, const char *backe
188189
return reinterpret_cast<Session *>(session)->set_available_backends(backends);
189190
}
190191

191-
NNFW_STATUS nnfw_set_op_backend(nnfw_session *, const char *, const char *)
192+
NNFW_STATUS nnfw_set_op_backend(nnfw_session *session, const char *, const char *)
192193
{
193-
return Session::deprecated("nnfw_set_op_backend: Deprecated");
194+
NNFW_RETURN_ERROR_IF_NULL(session);
195+
return reinterpret_cast<Session *>(session)->deprecated("nnfw_set_op_backend: Deprecated");
194196
}
195197

196198
NNFW_STATUS nnfw_query_info_u32(nnfw_session *session, NNFW_INFO_ID id, uint32_t *val)
@@ -230,19 +232,22 @@ NNFW_STATUS nnfw_set_backends_per_operation(nnfw_session *session, const char *b
230232
return reinterpret_cast<Session *>(session)->set_backends_per_operation(backend_settings);
231233
}
232234

233-
NNFW_STATUS nnfw_prepare_pipeline(nnfw_session *, const char *)
235+
NNFW_STATUS nnfw_prepare_pipeline(nnfw_session *session, const char *)
234236
{
235-
return Session::deprecated("nnfw_prepare_pipeline: Deprecated");
237+
NNFW_RETURN_ERROR_IF_NULL(session);
238+
return reinterpret_cast<Session *>(session)->deprecated("nnfw_prepare_pipeline: Deprecated");
236239
}
237240

238-
NNFW_STATUS nnfw_push_pipeline_input(nnfw_session *, void *, void *)
241+
NNFW_STATUS nnfw_push_pipeline_input(nnfw_session *session, void *, void *)
239242
{
240-
return Session::deprecated("nnfw_push_pipeline_input: Deprecated");
243+
NNFW_RETURN_ERROR_IF_NULL(session);
244+
return reinterpret_cast<Session *>(session)->deprecated("nnfw_push_pipeline_input: Deprecated");
241245
}
242246

243-
NNFW_STATUS nnfw_pop_pipeline_output(nnfw_session *, void *)
247+
NNFW_STATUS nnfw_pop_pipeline_output(nnfw_session *session, void *)
244248
{
245-
return Session::deprecated("nnfw_pop_pipeline_output: Deprecated");
249+
NNFW_RETURN_ERROR_IF_NULL(session);
250+
return reinterpret_cast<Session *>(session)->deprecated("nnfw_pop_pipeline_output: Deprecated");
246251
}
247252

248253
NNFW_STATUS nnfw_set_workspace(nnfw_session *session, const char *dir)

runtime/onert/api/nnfw/src/Session.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ struct Session
138138
NNFW_STATUS configure_signature(const char *signature);
139139
NNFW_STATUS set_signature_run(const char *signature);
140140

141-
static NNFW_STATUS deprecated(const char *msg);
141+
NNFW_STATUS deprecated(const char *msg);
142142

143143
//
144144
// Internal-only API

0 commit comments

Comments
 (0)