From 0e1abd96e8dae119ad9db19d6ece8d542aa5d36b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 29 Apr 2017 23:42:06 +0200 Subject: [PATCH] Hide a gcc attribute that drives doxygen nuts --- include/simgrid/s4u/Mutex.hpp | 4 ++-- src/mc/PageStore.cpp | 3 +-- src/mc/PageStore.hpp | 20 ++++++++------------ src/mc/mc_mmu.h | 15 +++++---------- src/mc/mc_snapshot.h | 21 ++++++++------------- 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index a0f8c0c246..3603d18359 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -22,9 +22,9 @@ class ConditionVariable; /** @brief A classical mutex, but blocking in the simulation world * @ingroup s4u_api * - * It is strictly impossible to use a real mutex (such as + * It is strictly impossible to use a real mutex, such as * [std::mutex](http://en.cppreference.com/w/cpp/thread/mutex) - * or [pthread_mutex_t](http://pubs.opengroup.org/onlinepubs/007908775/xsh/pthread_mutex_lock.html)), + * or [pthread_mutex_t](http://pubs.opengroup.org/onlinepubs/007908775/xsh/pthread_mutex_lock.html), * because it would block the whole simulation. * Instead, you should use the present class, that is a drop-in replacement of * [std::mutex](http://en.cppreference.com/w/cpp/thread/mutex). diff --git a/src/mc/PageStore.cpp b/src/mc/PageStore.cpp index 90bfa3e130..a8e149aeb4 100644 --- a/src/mc/PageStore.cpp +++ b/src/mc/PageStore.cpp @@ -36,8 +36,7 @@ namespace mc { * @param data Memory page * @return hash off the page */ -static inline __attribute__ ((always_inline)) -PageStore::hash_type mc_hash_page(const void* data) +static XBT_ALWAYS_INLINE PageStore::hash_type mc_hash_page(const void* data) { const std::uint64_t* values = (const uint64_t*) data; std::size_t n = xbt_pagesize / sizeof(uint64_t); diff --git a/src/mc/PageStore.hpp b/src/mc/PageStore.hpp index bb6be392b0..640e63c9e4 100644 --- a/src/mc/PageStore.hpp +++ b/src/mc/PageStore.hpp @@ -157,37 +157,33 @@ public: // Debug/test methods }; -inline __attribute__((always_inline)) -void PageStore::unref_page(std::size_t pageno) { +XBT_ALWAYS_INLINE void PageStore::unref_page(std::size_t pageno) +{ if ((--this->page_counts_[pageno]) == 0) this->remove_page(pageno); } -inline __attribute__((always_inline)) -void PageStore::ref_page(size_t pageno) +XBT_ALWAYS_INLINE void PageStore::ref_page(size_t pageno) { ++this->page_counts_[pageno]; } -inline __attribute__((always_inline)) -const void* PageStore::get_page(std::size_t pageno) const +XBT_ALWAYS_INLINE const void* PageStore::get_page(std::size_t pageno) const { return (void*) simgrid::mc::mmu::join(pageno, (std::uintptr_t) this->memory_); } -inline __attribute__((always_inline)) -std::size_t PageStore::get_ref(std::size_t pageno) +XBT_ALWAYS_INLINE std::size_t PageStore::get_ref(std::size_t pageno) { return this->page_counts_[pageno]; } -inline __attribute__((always_inline)) -std::size_t PageStore::size() { +XBT_ALWAYS_INLINE std::size_t PageStore::size() +{ return this->top_index_ - this->free_pages_.size(); } -inline __attribute__((always_inline)) -std::size_t PageStore::capacity() +XBT_ALWAYS_INLINE std::size_t PageStore::capacity() { return this->capacity_; } diff --git a/src/mc/mc_mmu.h b/src/mc/mc_mmu.h index eb6d33708c..9e2aaa5180 100644 --- a/src/mc/mc_mmu.h +++ b/src/mc/mc_mmu.h @@ -31,8 +31,7 @@ static int chunkSize() * @param size Byte size * @return Number of memory pages */ -static inline __attribute__ ((always_inline)) -std::size_t chunkCount(std::size_t size) +static XBT_ALWAYS_INLINE std::size_t chunkCount(std::size_t size) { size_t page_count = size >> xbt_pagebits; if (size & (xbt_pagesize-1)) @@ -41,8 +40,7 @@ std::size_t chunkCount(std::size_t size) } /** @brief Split into chunk number and remaining offset */ -static inline __attribute__ ((always_inline)) -std::pair split(std::uintptr_t offset) +static XBT_ALWAYS_INLINE std::pair split(std::uintptr_t offset) { return { offset >> xbt_pagebits, @@ -51,20 +49,17 @@ std::pair split(std::uintptr_t offset) } /** Merge chunk number and remaining offset info a global offset */ -static inline __attribute__ ((always_inline)) -std::uintptr_t join(std::size_t page, std::uintptr_t offset) +static XBT_ALWAYS_INLINE std::uintptr_t join(std::size_t page, std::uintptr_t offset) { return ((std::uintptr_t) page << xbt_pagebits) + offset; } -static inline __attribute__ ((always_inline)) -std::uintptr_t join(std::pair value) +static XBT_ALWAYS_INLINE std::uintptr_t join(std::pair value) { return join(value.first, value.second); } -static inline __attribute__ ((always_inline)) -bool sameChunk(std::uintptr_t a, std::uintptr_t b) +static XBT_ALWAYS_INLINE bool sameChunk(std::uintptr_t a, std::uintptr_t b) { return (a >> xbt_pagebits) == (b >> xbt_pagebits); } diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h index 8fbba24c69..c217c97590 100644 --- a/src/mc/mc_snapshot.h +++ b/src/mc/mc_snapshot.h @@ -34,8 +34,7 @@ SG_BEGIN_DECL() XBT_PRIVATE void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_region_t reg); -static inline __attribute__((always_inline)) -void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region) +static XBT_ALWAYS_INLINE void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region) { auto split = simgrid::mc::mmu::split(addr - region->start().address()); auto pageno = split.first; @@ -44,8 +43,7 @@ void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region return (char*) snapshot_page + offset; } -static inline __attribute__((always_inline)) -void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region, int process_index) +static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region, int process_index) { switch (region->storage_type()) { case simgrid::mc::StorageType::NoData: @@ -156,8 +154,8 @@ public: // To be private extern "C" { -static inline __attribute__ ((always_inline)) -mc_mem_region_t mc_get_region_hinted(void* addr, simgrid::mc::Snapshot* snapshot, int process_index, mc_mem_region_t region) +static XBT_ALWAYS_INLINE mc_mem_region_t mc_get_region_hinted(void* addr, simgrid::mc::Snapshot* snapshot, + int process_index, mc_mem_region_t region) { if (region->contain(simgrid::mc::remote(addr))) return region; @@ -198,8 +196,7 @@ XBT_PRIVATE int MC_snapshot_memcmp( const void* addr1, simgrid::mc::Snapshot* snapshot1, const void* addr2, simgrid::mc::Snapshot* snapshot2, int process_index, std::size_t size); -static inline __attribute__ ((always_inline)) -const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot) +static XBT_ALWAYS_INLINE const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot) { if(snapshot==nullptr) xbt_die("snapshot is nullptr"); @@ -214,9 +211,8 @@ const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot) * @param size Size of the data to read in bytes * @return Pointer where the data is located (target buffer of original location) */ -static inline __attribute__((always_inline)) -const void* MC_region_read( - mc_mem_region_t region, void* target, const void* addr, std::size_t size) +static XBT_ALWAYS_INLINE const void* MC_region_read(mc_mem_region_t region, void* target, const void* addr, + std::size_t size) { xbt_assert(region); @@ -254,8 +250,7 @@ const void* MC_region_read( } } -static inline __attribute__ ((always_inline)) -void* MC_region_read_pointer(mc_mem_region_t region, const void* addr) +static XBT_ALWAYS_INLINE void* MC_region_read_pointer(mc_mem_region_t region, const void* addr) { void* res; return *(void**) MC_region_read(region, &res, addr, sizeof(void*)); -- 2.20.1