Skip to content

Commit

Permalink
renamed macro
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Jul 11, 2022
1 parent a96c8aa commit d4ad5f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/orm/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TINY_SYSTEM_HEADER
mapped_type (value) in the std::unordered_map. */
#if defined(__GNUG__) && defined(_GLIBCXX_RELEASE) && defined(__GLIBCXX__) && \
_GLIBCXX_RELEASE < 12 && __GLIBCXX__ < 20220513
# define _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
# define TINY_NO_INCOMPLETE_UNORDERED_MAP
#endif

#endif // ORM_CONFIG_HPP
24 changes: 12 additions & 12 deletions include/orm/tiny/concerns/hasrelationships.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "orm/macros/systemheader.hpp"
TINY_SYSTEM_HEADER

#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
# include <map>
#else
# include <unordered_map>
Expand Down Expand Up @@ -131,15 +131,15 @@ namespace Concerns

/*! Get all the loaded relations for the instance. */
inline
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
const std::map<QString, RelationsType<AllRelations...>> &
#else
const std::unordered_map<QString, RelationsType<AllRelations...>> &
#endif
getRelations() const;
/*! Get all the loaded relations for the instance. */
inline
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
std::map<QString, RelationsType<AllRelations...>> &
#else
std::unordered_map<QString, RelationsType<AllRelations...>> &
Expand Down Expand Up @@ -169,15 +169,15 @@ namespace Concerns

/*! Set the entire relations hash on the model. */
Derived &setRelations(
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
const std::map<QString, RelationsType<AllRelations...>> &relations);
#else
const std::unordered_map<QString,
RelationsType<AllRelations...>> &relations);
#endif
/*! Set the entire relations hash on the model. */
Derived &setRelations(
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
std::map<QString, RelationsType<AllRelations...>> &&relations);
#else
std::unordered_map<QString, RelationsType<AllRelations...>> &&relations);
Expand Down Expand Up @@ -229,7 +229,7 @@ namespace Concerns
// BUG std::unordered_map can not be instantiated with the incomplete value type, reproducible only on the Linux GCC/Clang (GCC >=12.1 fixed, Clang 14 don't), MSYS2 and msvc don't have any problem with the incomplete type ✨🚀 ; added section to the NOTES.txt how to reproduce ; OLD - std::unordered_map prevents to compile on GCC, if I comment out std::optional<AllRelations>... in the RelationsType<AllRelations...>, or I change it to the QHash, then it compile, I'm absolutelly lost why this is happening 😞😭, I can't change to the QHash because of 25734deb, I have created simple test project gcc_trivial_bug_test in merydeye-gentoo, but std::map works so it is a big win, because now I can compile whole project on gcc silverqx
/* The libstdc++ shipped with the GCC <12.1 doesn't allow an incomplete
mapped_type (value) in the std::unordered_map. */
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
/*! The loaded relationships for the model. */
std::map<QString, RelationsType<AllRelations...>> m_relations;
#else
Expand Down Expand Up @@ -329,7 +329,7 @@ namespace Concerns

/*! Replace relations in the m_relation. */
void replaceRelations(
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
std::map<QString, RelationsType<AllRelations...>> &relations,
#else
std::unordered_map<QString, RelationsType<AllRelations...>> &relations,
Expand Down Expand Up @@ -635,7 +635,7 @@ namespace Concerns
}

template<typename Derived, AllRelationsConcept ...AllRelations>
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
const std::map<QString, RelationsType<AllRelations...>> &
#else
const std::unordered_map<QString, RelationsType<AllRelations...>> &
Expand All @@ -646,7 +646,7 @@ namespace Concerns
}

template<typename Derived, AllRelationsConcept ...AllRelations>
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
std::map<QString, RelationsType<AllRelations...>> &
#else
std::unordered_map<QString, RelationsType<AllRelations...>> &
Expand Down Expand Up @@ -710,7 +710,7 @@ namespace Concerns
template<typename Derived, AllRelationsConcept ...AllRelations>
Derived &
HasRelationships<Derived, AllRelations...>::setRelations(
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
const std::map<QString, RelationsType<AllRelations...>> &relations)
#else
const std::unordered_map<QString, RelationsType<AllRelations...>> &relations)
Expand All @@ -724,7 +724,7 @@ namespace Concerns
template<typename Derived, AllRelationsConcept ...AllRelations>
Derived &
HasRelationships<Derived, AllRelations...>::setRelations(
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
std::map<QString, RelationsType<AllRelations...>> &&relations)
#else
std::unordered_map<QString, RelationsType<AllRelations...>> &&relations)
Expand Down Expand Up @@ -1191,7 +1191,7 @@ namespace Concerns

template<typename Derived, AllRelationsConcept ...AllRelations>
void HasRelationships<Derived, AllRelations...>::replaceRelations(
#ifdef _TINYORM_NO_INCOMPLETE_UNORDERED_MAP
#ifdef TINY_NO_INCOMPLETE_UNORDERED_MAP
std::map<QString, RelationsType<AllRelations...>> &relations,
#else
std::unordered_map<QString, RelationsType<AllRelations...>> &relations,
Expand Down

0 comments on commit d4ad5f4

Please sign in to comment.