enabled W4 warning level on msvc

Used /external:anglebrackets for external/system header files
This commit is contained in:
silverqx
2021-09-04 14:55:05 +02:00
parent d6379e3dc3
commit 8abc955261
7 changed files with 19 additions and 12 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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()};
};

View File

@@ -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<typename Derived, typename ...AllRelations>
template<typename Method>
void HasRelationStore<Derived, AllRelations...>::BelongsToManyRelatedTableStore
@@ -530,7 +535,9 @@ namespace Concerns
if constexpr (!std::is_base_of_v<Relations::PivotRelation, Relation>)
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)
}
/*

View File

@@ -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<typename Derived, AllRelationsConcept ...AllRelations>
class Model :

View File

@@ -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<PivotType, Pivot>
&& !detachAll && !ids.isEmpty()
if (!detachAll && !idsAreEmpty && !std::is_same_v<PivotType, Pivot>
// && 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);

View File

@@ -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
}