diff --git a/src/Magnum/Resource.h b/src/Magnum/Resource.h index 56b24a0f0..71bfdac3d 100644 --- a/src/Magnum/Resource.h +++ b/src/Magnum/Resource.h @@ -66,7 +66,10 @@ namespace Magnum { @see @ref Resource::state(), @ref ResourceManager::state() */ -enum class CORRADE_DEPRECATED_ENUM("the ResourceManager class is obsolete") ResourceState: UnsignedByte { +/* No CORRADE_DEPRECATED_ENUM() here, as it's already on the declaration in + Magnum.h and GCC stupidly warns that "type attributes ignored after type is + already defined". Happens for the other Resource* enums as well. */ +enum class ResourceState: UnsignedByte { /** The resource is not yet loaded (and no fallback is available). */ NotLoaded, @@ -179,15 +182,21 @@ class * Creates empty resource. Resources are acquired from the manager by * calling @ref ResourceManager::get(). */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ explicit Resource(): _manager{nullptr}, _lastCheck{0}, _state{ResourceState::Final}, _data{nullptr} {} + CORRADE_IGNORE_DEPRECATED_POP /** @brief Copy constructor */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ Resource(const Resource& other): _manager{other._manager}, _key{other._key}, _lastCheck{other._lastCheck}, _state{other._state}, _data{other._data} { if(_manager) _manager->incrementReferenceCount(_key); } + CORRADE_IGNORE_DEPRECATED_POP /** @brief Move constructor */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ Resource(Resource&& other) noexcept; + CORRADE_IGNORE_DEPRECATED_POP /** @brief Destructor */ ~Resource() { @@ -195,15 +204,21 @@ class } /** @brief Copy assignment */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ Resource& operator=(const Resource& other); + CORRADE_IGNORE_DEPRECATED_POP /** @brief Move assignment */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ Resource& operator=(Resource&& other) noexcept; + CORRADE_IGNORE_DEPRECATED_POP /** @brief Equality comparison */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ bool operator==(const Resource& other) const { return _manager == other._manager && _key == other._key; } + CORRADE_IGNORE_DEPRECATED_POP /** @brief Equality comparison with other types is explicitly disallowed */ CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ @@ -211,9 +226,11 @@ class CORRADE_IGNORE_DEPRECATED_POP /** @brief Non-equality comparison */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ bool operator!=(const Resource& other) const { return !operator==(other); } + CORRADE_IGNORE_DEPRECATED_POP /** @brief Non-equality comparison with other types is explicitly disallowed */ CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here */ diff --git a/src/Magnum/ResourceManager.h b/src/Magnum/ResourceManager.h index da92c0627..6eca0afd2 100644 --- a/src/Magnum/ResourceManager.h +++ b/src/Magnum/ResourceManager.h @@ -60,7 +60,10 @@ namespace Magnum { @see @ref ResourceManager::set(), @ref ResourceState */ CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns for ResourceState usage */ -enum class CORRADE_DEPRECATED_ENUM("the ResourceManager class is obsolete") ResourceDataState: UnsignedByte { +/* No CORRADE_DEPRECATED_ENUM() here, as it's already on the declaration in + Magnum.h and GCC stupidly warns that "type attributes ignored after type is + already defined". Happens for the other Resource* enums as well. */ +enum class ResourceDataState: UnsignedByte { /** * The resource is currently loading. Parameter @p data in * @ref ResourceManager::set() should be set to @cpp nullptr @ce. @@ -99,7 +102,10 @@ CORRADE_IGNORE_DEPRECATED_POP @see @ref ResourceManager::set(), @ref ResourceManager::free() */ -enum class CORRADE_DEPRECATED_ENUM("the ResourceManager class is obsolete") ResourcePolicy: UnsignedByte { +/* No CORRADE_DEPRECATED_ENUM() here, as it's already on the declaration in + Magnum.h and GCC stupidly warns that "type attributes ignored after type is + already defined". Happens for the other Resource* enums as well. */ +enum class ResourcePolicy: UnsignedByte { /** The resource will stay resident for whole lifetime of resource manager. */ Resident, @@ -386,42 +392,52 @@ template class CORRADE_DEPRECATED("the ResourceManager class is * @brief Set fallback for not found resources * @return Reference to self (for method chaining) */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& setFallback(T* data) { this->Implementation::ResourceManagerData::setFallback(data); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** * @overload * @m_since{2019,10} */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& setFallback(Containers::Pointer&& data) { setFallback(data.release()); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** @overload */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& setFallback(U&& data) { return setFallback(new typename std::decay::type(std::forward(data))); } + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Free all resources of given type which are not referenced * @return Reference to self (for method chaining) */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& free() { this->Implementation::ResourceManagerData::free(); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Free all resources which are not referenced * @return Reference to self (for method chaining) */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ ResourceManager& free() { freeInternal(Implementation::ResourceTypePack{}); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Clear all resources of given type @@ -430,10 +446,12 @@ template class CORRADE_DEPRECATED("the ResourceManager class is * Unlike @ref free() this function assumes that no resource is * referenced. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& clear() { this->Implementation::ResourceManagerData::clear(); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Clear all resources @@ -442,10 +460,12 @@ template class CORRADE_DEPRECATED("the ResourceManager class is * Unlike @ref free() this function assumes that no resource is * referenced. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ ResourceManager& clear() { clearInternal(Implementation::ResourceTypePack{}); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** @brief Loader for given type of resources */ template AbstractResourceLoader* loader() { @@ -467,15 +487,19 @@ template class CORRADE_DEPRECATED("the ResourceManager class is * @attention The loader is deleted on destruction before unloading * all resources. */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& setLoader(AbstractResourceLoader* loader) { this->Implementation::ResourceManagerData::setLoader(loader); return *this; } + CORRADE_IGNORE_DEPRECATED_POP /** @overload */ + CORRADE_IGNORE_DEPRECATED_PUSH /* GCC except for 4.8 (!) warns here */ template ResourceManager& setLoader(Containers::Pointer>&& loader) { return setLoader(loader.release()); } + CORRADE_IGNORE_DEPRECATED_POP private: template void freeInternal(Implementation::ResourceTypePack) {