From: Arnaud Giersch Date: Tue, 7 Nov 2023 09:23:31 +0000 (+0100) Subject: Use standard __func__ instead of __FUNCTION__. X-Git-Tag: v3.35~87^2~8 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0ad22c246cffa73ee274c6521b78956c4bac0dc4 Use standard __func__ instead of __FUNCTION__. --- diff --git a/examples/sthread/stdobject/stdobject.cpp b/examples/sthread/stdobject/stdobject.cpp index 246095eaef..c2af786d2c 100644 --- a/examples/sthread/stdobject/stdobject.cpp +++ b/examples/sthread/stdobject/stdobject.cpp @@ -13,8 +13,8 @@ extern void sthread_access_end(void* addr, const char* objname, const char* file } #define STHREAD_ACCESS(obj) \ - for (bool first = sthread_access_begin(static_cast(obj), #obj, __FILE__, __LINE__, __FUNCTION__) || true; \ - first; sthread_access_end(static_cast(obj), #obj, __FILE__, __LINE__, __FUNCTION__), first = false) + for (bool first = sthread_access_begin(static_cast(obj), #obj, __FILE__, __LINE__, __func__) || true; first; \ + sthread_access_end(static_cast(obj), #obj, __FILE__, __LINE__, __func__), first = false) static void thread_code() { diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 72f114d072..f264993204 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -168,7 +168,7 @@ CommImpl* CommImpl::start() std::vector CommImpl::get_traversed_links() const { - xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __FUNCTION__, + xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __func__, get_state_str()); std::vector vlinks; XBT_ATTRIB_UNUSED double res = 0; diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index ab9fefbdfc..5d27168a0f 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -214,7 +214,7 @@ Host* Comm::get_destination() const CommPtr Comm::set_rate(double rate) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); rate_ = rate; return this; } @@ -222,7 +222,7 @@ CommPtr Comm::set_rate(double rate) CommPtr Comm::set_mailbox(Mailbox* mailbox) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); mailbox_ = mailbox; return this; } @@ -230,7 +230,7 @@ CommPtr Comm::set_mailbox(Mailbox* mailbox) CommPtr Comm::set_src_data(void* buff) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(dst_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); src_buff_ = buff; return this; @@ -239,7 +239,7 @@ CommPtr Comm::set_src_data(void* buff) CommPtr Comm::set_src_data_size(size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); src_buff_size_ = size; return this; } @@ -247,7 +247,7 @@ CommPtr Comm::set_src_data_size(size_t size) CommPtr Comm::set_src_data(void* buff, size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(dst_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); src_buff_ = buff; @@ -258,7 +258,7 @@ CommPtr Comm::set_src_data(void* buff, size_t size) CommPtr Comm::set_dst_data(void** buff) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(src_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); dst_buff_ = buff; return this; @@ -267,7 +267,7 @@ CommPtr Comm::set_dst_data(void** buff) CommPtr Comm::set_dst_data(void** buff, size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(src_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); dst_buff_ = buff; @@ -317,7 +317,7 @@ bool Comm::is_assigned() const Comm* Comm::do_start() { xbt_assert(get_state() == State::INITED || get_state() == State::STARTING, - "You cannot use %s() once your communication started (not implemented)", __FUNCTION__); + "You cannot use %s() once your communication started (not implemented)", __func__); auto myself = kernel::actor::ActorImpl::self(); @@ -388,7 +388,7 @@ Comm* Comm::do_start() Comm* Comm::detach() { xbt_assert(state_ == State::INITED || state_ == State::STARTING, - "You cannot use %s() once your communication is %s (not implemented)", __FUNCTION__, get_state_str()); + "You cannot use %s() once your communication is %s (not implemented)", __func__, get_state_str()); xbt_assert(dst_buff_ == nullptr && dst_buff_size_ == 0, "You can only detach sends, not recvs"); detached_ = true; start(); diff --git a/src/s4u/s4u_Mess.cpp b/src/s4u/s4u_Mess.cpp index 9799ad1eb7..0a8da79d37 100644 --- a/src/s4u/s4u_Mess.cpp +++ b/src/s4u/s4u_Mess.cpp @@ -35,7 +35,7 @@ MessPtr Mess::set_payload(void* payload) MessPtr Mess::set_dst_data(void** buff, size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); dst_buff_ = buff; dst_buff_size_ = size; @@ -61,7 +61,7 @@ Actor* Mess::get_receiver() const Mess* Mess::do_start() { xbt_assert(get_state() == State::INITED || get_state() == State::STARTING, - "You cannot use %s() once your message exchange has started (not implemented)", __FUNCTION__); + "You cannot use %s() once your message exchange has started (not implemented)", __func__); auto myself = kernel::actor::ActorImpl::self(); if (myself == sender_) { diff --git a/src/sthread/sthread_impl.cpp b/src/sthread/sthread_impl.cpp index 9dbf78913e..c1b58b2699 100644 --- a/src/sthread/sthread_impl.cpp +++ b/src/sthread/sthread_impl.cpp @@ -181,7 +181,7 @@ int sthread_mutex_lock(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); static_cast(mutex->mutex)->lock(); return 0; } @@ -192,7 +192,7 @@ int sthread_mutex_trylock(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); if (static_cast(mutex->mutex)->try_lock()) return 0; return EBUSY; @@ -204,7 +204,7 @@ int sthread_mutex_unlock(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); static_cast(mutex->mutex)->unlock(); return 0; } @@ -214,7 +214,7 @@ int sthread_mutex_destroy(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); intrusive_ptr_release(static_cast(mutex->mutex)); return 0; }