From 9efa3c3e639a720f22e424c37ad55046922306eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christophe=20Thi=C3=A9ry?= Date: Tue, 15 Nov 2011 18:57:13 +0100 Subject: [PATCH] Nobody uses MSG_get_errno and wants useless calls to SIMIX_process_self --- include/msg/msg.h | 2 +- src/msg/msg_gos.c | 22 ++++++++++++---------- src/msg/msg_private.h | 8 ++++++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/msg/msg.h b/include/msg/msg.h index 2053b4e20a..fb3aebd4e1 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -156,7 +156,6 @@ XBT_PUBLIC(int) MSG_task_Iprobe(m_channel_t channel); XBT_PUBLIC(int) MSG_task_probe_from(m_channel_t channel); XBT_PUBLIC(int) MSG_task_probe_from_host(int channel, m_host_t host); XBT_PUBLIC(MSG_error_t) MSG_process_sleep(double nb_sec); -XBT_PUBLIC(MSG_error_t) MSG_get_errno(void); XBT_PUBLIC(double) MSG_task_get_compute_duration(m_task_t task); XBT_PUBLIC(void) MSG_task_set_compute_duration(m_task_t task, @@ -237,6 +236,7 @@ MSG_error_t MSG_action_trace_run(char *path); MSG_mailbox_put_with_timeout(mailbox, task, timeout) #define MSG_process_change_host(h) MSG_process_migrate(MSG_process_self(),h); +XBT_PUBLIC(MSG_error_t) MSG_get_errno(void); #endif #include "instr/instr.h" diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index ff040cac1a..608d9d51db 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -14,16 +14,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg, "Logging specific to MSG (gos)"); -/** \ingroup msg_gos_functions - * - * \brief Return the last value returned by a MSG function (except - * MSG_get_errno...). - */ -MSG_error_t MSG_get_errno(void) -{ - return PROCESS_GET_ERRNO(); -} - /** \ingroup msg_gos_functions * \brief Executes a task and waits for its termination. * @@ -982,3 +972,15 @@ int MSG_task_listen_from(const char *alias) return MSG_process_get_PID(task->simdata->sender); } + +#ifdef MSG_USE_DEPRECATED +/** \ingroup msg_gos_functions + * + * \brief Return the last value returned by a MSG function (except + * MSG_get_errno...). + */ +MSG_error_t MSG_get_errno(void) +{ + return PROCESS_GET_ERRNO(); +} +#endif diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index c08ac683ad..cf9f97519d 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -93,15 +93,19 @@ XBT_PUBLIC_DATA(MSG_Global_t) msg_global; /*************************************************************/ -#define PROCESS_SET_ERRNO(val) \ +#ifdef MSG_USE_DEPRECATED +# define PROCESS_SET_ERRNO(val) \ (((simdata_process_t) SIMIX_process_self_get_data(SIMIX_process_self()))->last_errno=val) -#define PROCESS_GET_ERRNO() \ +# define PROCESS_GET_ERRNO() \ (((simdata_process_t) SIMIX_process_self_get_data(SIMIX_process_self()))->last_errno) #define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0) /* #define CHECK_ERRNO() ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */ /*#define CHECK_HOST() xbt_assert(SIMIX_req_host_get_state(SIMIX_host_self())==1,\ "Host failed, you cannot call this function. (state=%d)",SIMIX_req_host_get_state(SIMIX_host_self()))*/ +#else +# define MSG_RETURN(val) return(val) +#endif #define CHECK_HOST() m_host_t __MSG_host_create(smx_host_t workstation, void *data); -- 2.20.1