From b251df09ddf33ec98315ed0ab07f18b8f2ffa095 Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <joseph@walton-rivers.uk> Date: Wed, 12 Jul 2023 23:00:52 +0100 Subject: [PATCH] small code cleanup to remove linting warnings --- .../core/include}/fggl/audio/audio.hpp | 0 .../core/include/fggl/services/module.hpp | 1 + components/core/src/filesystem/module.cpp | 2 +- components/core/src/services/factory.cpp | 3 ++- fggl/assets/pipeline/loader.cpp | 1 - fggl/audio/CMakeLists.txt | 4 --- fggl/audio/types.cpp | 25 ------------------- include/fggl/util/guid.hpp | 14 +++++------ 8 files changed, 11 insertions(+), 39 deletions(-) rename {include => components/core/include}/fggl/audio/audio.hpp (100%) delete mode 100644 fggl/audio/types.cpp diff --git a/include/fggl/audio/audio.hpp b/components/core/include/fggl/audio/audio.hpp similarity index 100% rename from include/fggl/audio/audio.hpp rename to components/core/include/fggl/audio/audio.hpp diff --git a/components/core/include/fggl/services/module.hpp b/components/core/include/fggl/services/module.hpp index 6278cfd..2b51535 100644 --- a/components/core/include/fggl/services/module.hpp +++ b/components/core/include/fggl/services/module.hpp @@ -44,6 +44,7 @@ }; using ModuleID = util::OpaqueName<std::string_view, struct ModuleTag>; + template<typename T> concept ModuleAPI = requires(T* type) { { T::MODULE_ID }; diff --git a/components/core/src/filesystem/module.cpp b/components/core/src/filesystem/module.cpp index 0a630fd..b596af5 100644 --- a/components/core/src/filesystem/module.cpp +++ b/components/core/src/filesystem/module.cpp @@ -22,7 +22,7 @@ namespace fggl::filesystem { - services::Module::ServiceList NativeBacked::getProvides() const { + auto NativeBacked::getProvides() const -> services::Module::ServiceList { return { MODULE_ID, API::MODULE_ID }; } diff --git a/components/core/src/services/factory.cpp b/components/core/src/services/factory.cpp index 658c2fb..a9dd10e 100644 --- a/components/core/src/services/factory.cpp +++ b/components/core/src/services/factory.cpp @@ -22,7 +22,8 @@ namespace fggl::services { namespace { - void dumpFactories( const std::map<ServiceName, std::shared_ptr<ServiceBinding>>& factories ){ + [[maybe_unused]] + void dump_factories( const std::map<ServiceName, std::shared_ptr<ServiceBinding>>& factories ){ std::cerr << "BEGIN registered factories" << std::endl; for ( auto& factory : factories ) { std::cerr << "\t" << factory.first.get() << std::endl; diff --git a/fggl/assets/pipeline/loader.cpp b/fggl/assets/pipeline/loader.cpp index bd1c1d0..9895e5d 100644 --- a/fggl/assets/pipeline/loader.cpp +++ b/fggl/assets/pipeline/loader.cpp @@ -21,7 +21,6 @@ #include <memory> #include <set> #include <map> -#include <concepts> #include "fggl/util/guid.hpp" diff --git a/fggl/audio/CMakeLists.txt b/fggl/audio/CMakeLists.txt index bb05710..7cda4a7 100644 --- a/fggl/audio/CMakeLists.txt +++ b/fggl/audio/CMakeLists.txt @@ -1,7 +1,3 @@ -target_sources(fggl - PRIVATE - types.cpp - ) add_subdirectory(openal) add_subdirectory(fallback) \ No newline at end of file diff --git a/fggl/audio/types.cpp b/fggl/audio/types.cpp deleted file mode 100644 index ade96e0..0000000 --- a/fggl/audio/types.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of FGGL. - * - * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with FGGL. - * If not, see <https://www.gnu.org/licenses/>. - */ - -#include "fggl/data/storage.hpp" -#include "fggl/audio/audio.hpp" - - -namespace fggl::audio { - -} // namespace fggl::audio - -namespace fggl::data { - -} // namespace fggl::data diff --git a/include/fggl/util/guid.hpp b/include/fggl/util/guid.hpp index 25c3861..47d38bc 100644 --- a/include/fggl/util/guid.hpp +++ b/include/fggl/util/guid.hpp @@ -41,7 +41,7 @@ namespace fggl::util { * @param str the string to hash. * @return the hashed value */ - constexpr uint32_t hash_fnv1a_32(const char *str) { + constexpr auto hash_fnv1a_32(const char *str) -> uint32_t { assert(str != nullptr); uint32_t hash = FNV_OFFSET_BASIS_32; for (int i = 0; str[i] != '\0'; i++) { @@ -57,7 +57,7 @@ namespace fggl::util { * @param str the string to be hashed * @return the hashed value */ - constexpr uint64_t hash_fnv1a_64(const char *str) { + constexpr auto hash_fnv1a_64(const char *str) -> uint64_t { assert(str != nullptr); uint64_t hash = FNV_OFFSET_BASIS_64; for (int i = 0; str[i] != '\0'; i++) { @@ -90,15 +90,15 @@ namespace fggl::util { // debug-only functions #ifndef NDEBUG - GUID intern_string(const char *str); - std::string guid_to_string(GUID guid); + auto intern_string(const char *str) -> GUID; + auto guid_to_string(GUID guid) -> std::string; #endif - constexpr GUID make_guid(const char *str) { + constexpr auto make_guid(const char *str) -> GUID { return GUID(hash_fnv1a_64(str)); } - inline GUID make_guid_rt(const char* str) { + inline auto make_guid_rt(const char* str) -> GUID { #ifndef NDEBUG return intern_string(str); #else @@ -106,7 +106,7 @@ namespace fggl::util { #endif } - inline GUID make_guid_rt(const std::string &str) { + inline auto make_guid_rt(const std::string &str) -> GUID { return make_guid_rt(str.c_str()); } -- GitLab