diff --git a/cmake/CommonModules/TinyQtCommon.cmake b/cmake/CommonModules/TinyQtCommon.cmake index 42227adfb..b2a98d1b8 100644 --- a/cmake/CommonModules/TinyQtCommon.cmake +++ b/cmake/CommonModules/TinyQtCommon.cmake @@ -73,11 +73,8 @@ function(tiny_qt_common target alias) # Standards-conforming behavior /Zc:wchar_t,rvalueCast,inline,strictStrings /Zc:throwingNew,referenceBinding,ternary -# /external:anglebrackets /external:W0 /external:templates- -# /external:anglebrackets /external:W0 -# /Wall -# /W4 /wd4127 - /WX /W3 /w34100 /w34189 /w44996 /w44456 /w44457 /w44458 /wd4577 /wd4467 + /external:anglebrackets /external:W0 + /WX /W4 ) target_link_options(${target} INTERFACE diff --git a/conf.pri.example b/conf.pri.example index 1139a7057..bbf10a433 100644 --- a/conf.pri.example +++ b/conf.pri.example @@ -21,7 +21,7 @@ else:win32-msvc* { else:unix { # Includes # range-v3 - QMAKE_CXXFLAGS += -isystem "/home/silverqx/Code/c/vcpkg/installed/x64-linux/include" + QMAKE_CXXFLAGS += -isystem $$quote(/home/xyz/vcpkg/installed/x64-linux/include) # Libraries # MySQL C library diff --git a/include/orm/exceptions/runtimeerror.hpp b/include/orm/exceptions/runtimeerror.hpp index 7eeeb09bf..19ee275e2 100644 --- a/include/orm/exceptions/runtimeerror.hpp +++ b/include/orm/exceptions/runtimeerror.hpp @@ -19,6 +19,7 @@ namespace Orm::Exceptions class SHAREDLIB_EXPORT RuntimeError : public std::runtime_error { public: + // CUR make all this ctors char * noexcept silverqx /*! const char * constructor. */ explicit RuntimeError(const char *message); /*! QString constructor. */ @@ -28,6 +29,7 @@ namespace Orm::Exceptions const QString &message() const; protected: + // BUG FIXIT, this will be pain, verify all the const data member, they prevent generation of default copy/move assignment operators, you can not assign or move to the const data member silverqx /*! Exception message. */ const QString m_message {what()}; }; diff --git a/include/orm/tiny/concerns/hasrelationstore.hpp b/include/orm/tiny/concerns/hasrelationstore.hpp index 61c84caf8..d88a46e56 100644 --- a/include/orm/tiny/concerns/hasrelationstore.hpp +++ b/include/orm/tiny/concerns/hasrelationstore.hpp @@ -520,6 +520,11 @@ namespace Concerns RelationStoreType::BELONGSTOMANY_RELATED_TABLE) {} +/* Code generation warnings 4700-4999 can be disabled only this way, the suppress + doesn't work, it is described here: + https://docs.microsoft.com/en-us/cpp/preprocessor/warning?view=msvc-160 */ +#pragma warning(push) +#pragma warning(disable : 4702) template template void HasRelationStore::BelongsToManyRelatedTableStore @@ -530,7 +535,9 @@ namespace Concerns if constexpr (!std::is_base_of_v) return; + // TODO mystery, warning: C4702: unreachable code, I don't know what cause it, I think I'm missing some forward declaration of model in some other model, but who knows silverqx m_result = typename Relation::RelatedType().getTable(); +#pragma warning(pop) } /* diff --git a/include/orm/tiny/model.hpp b/include/orm/tiny/model.hpp index 4cb3e8042..84082d8a1 100644 --- a/include/orm/tiny/model.hpp +++ b/include/orm/tiny/model.hpp @@ -88,7 +88,6 @@ namespace Relations { // CUR try this clang's UndefinedBehaviorSanitizer at https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html silverqx // CUR try clang-include-fixer at https://clang.llvm.org/extra/clang-include-fixer.html silverqx // CUR try iwyu at https://include-what-you-use.org/ silverqx - // CUR enable /W4 on msvc silverqx // CUR constraint Qt min version and also msvc min version silverqx // CUR move testdata to tests/ folder or tests/scripts/ folder silverqx // CUR unify one version number/file for cmake and qmake silverqx @@ -97,6 +96,8 @@ namespace Relations { // CUR qmake, also check QMAKE_LFLAGS_BSYMBOLIC_FUNC, bsymbolic_functions, reduce-relocations, reduce_relocations silverqx // CUR cmake use gold linker option, https://github.com/frobware/c-hacks/blob/master/cmake/use-gold-linker.cmake silverqx // CUR don't forget about conf.pri in playground and also port all warnings and changes silverqx + // CUR do not forget to add new compiler/linker flags also to qmake build silverqx + // CUR use #pragma system_header when I will tune playground, https://docs.microsoft.com/en-us/cpp/preprocessor/system-header-pragma?view=msvc-160 silverqx /*! Base model class. */ template class Model : diff --git a/include/orm/tiny/relations/belongstomany.hpp b/include/orm/tiny/relations/belongstomany.hpp index c170a06c0..f2631f1ab 100644 --- a/include/orm/tiny/relations/belongstomany.hpp +++ b/include/orm/tiny/relations/belongstomany.hpp @@ -1804,9 +1804,9 @@ namespace Orm::Tiny::Relations const bool touch) const { int affected = 0; + const auto idsAreEmpty = ids.isEmpty(); - if (!std::is_same_v - && !detachAll && !ids.isEmpty() + if (!detachAll && !idsAreEmpty && !std::is_same_v // && m_pivotWheres.isEmpty() // && m_pivotWhereIns.isEmpty() // && m_pivotWhereNulls.isEmpty() @@ -1822,7 +1822,7 @@ namespace Orm::Tiny::Relations We'll return the numbers of affected rows when we do the deletes. */ if (!detachAll) { // Nothing to delete/detach - if (ids.isEmpty()) + if (idsAreEmpty) return 0; query->whereIn(m_relatedPivotKey, ids); diff --git a/qmake/winconf.pri b/qmake/winconf.pri index 93f743f4e..87d5a7924 100644 --- a/qmake/winconf.pri +++ b/qmake/winconf.pri @@ -19,7 +19,7 @@ win32-msvc* { # strict-c++ does not enable -permissive- on MSVC QMAKE_CXXFLAGS += -guard:cf -bigobj -permissive- -Zc:ternary QMAKE_CXXFLAGS_DEBUG += -RTC1 - QMAKE_CXXFLAGS_WARN_ON *= -WX + QMAKE_CXXFLAGS_WARN_ON = -external:anglebrackets -external:W0 -WX -W4 QMAKE_LFLAGS += /guard:cf /WX - QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF=5 + QMAKE_LFLAGS_RELEASE += /OPT:REF,ICF=5 }