Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use standard __func__ instead of __FUNCTION__.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 7 Nov 2023 09:23:31 +0000 (10:23 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 7 Nov 2023 09:23:31 +0000 (10:23 +0100)
examples/sthread/stdobject/stdobject.cpp
src/kernel/activity/CommImpl.cpp
src/s4u/s4u_Comm.cpp
src/s4u/s4u_Mess.cpp
src/sthread/sthread_impl.cpp

index 246095e..c2af786 100644 (file)
@@ -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<void*>(obj), #obj, __FILE__, __LINE__, __FUNCTION__) || true;     \
-       first; sthread_access_end(static_cast<void*>(obj), #obj, __FILE__, __LINE__, __FUNCTION__), first = false)
+  for (bool first = sthread_access_begin(static_cast<void*>(obj), #obj, __FILE__, __LINE__, __func__) || true; first;  \
+       sthread_access_end(static_cast<void*>(obj), #obj, __FILE__, __LINE__, __func__), first = false)
 
 static void thread_code()
 {
index 72f114d..f264993 100644 (file)
@@ -168,7 +168,7 @@ CommImpl* CommImpl::start()
 
 std::vector<s4u::Link*> 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<s4u::Link*> vlinks;
   XBT_ATTRIB_UNUSED double res = 0;
index ab9fefb..5d27168 100644 (file)
@@ -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();
index 9799ad1..0a8da79 100644 (file)
@@ -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_) {
index 9dbf789..c1b58b2 100644 (file)
@@ -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<sg4::Mutex*>(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<sg4::Mutex*>(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<sg4::Mutex*>(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<sg4::Mutex*>(mutex->mutex));
   return 0;
 }