Increase warning level

* Set warning level to /W3 for MSVC to catch more warnings
* remove several excluded checks for clang
* removed several unused variables
* Hide warnings qwt
* add missing parentheses in logical expressions
* Remove double check on same logical expression
This commit is contained in:
Magne Sjaastad
2023-04-17 15:57:39 +02:00
committed by GitHub
parent 0f0cc4c5a8
commit b7f8d0e0f1
60 changed files with 155 additions and 225 deletions

View File

@@ -22,6 +22,12 @@ add_executable(
cafPdmScriptingBasicTest.cpp
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(
cafPdmScripting_UnitTests PRIVATE -Wno-delete-abstract-non-virtual-dtor
)
endif()
target_link_libraries(
${PROJECT_NAME} cafPdmScripting ${QT_LIBRARIES} ${THREAD_LIBRARY}
)

View File

@@ -37,6 +37,14 @@ set(PROJECT_FILES
# add the executable
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(
cafPdmCore_UnitTests PRIVATE -Wno-ambiguous-reversed-operator
-Wno-invalid-source-encoding
)
endif()
source_group("" FILES ${PROJECT_FILES})
if(Qt5Core_FOUND)

View File

@@ -26,6 +26,13 @@ set(PROJECT_FILES cafPdmBasicTest.cpp cafProjectDataModel_UnitTests.cpp
# add the executable
add_executable(${PROJECT_NAME} ${PROJECT_FILES} gtest/gtest-all.cpp)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(
cafProjectDataModel_UnitTests PRIVATE -Wno-ambiguous-reversed-operator
-Wno-invalid-source-encoding
)
endif()
target_link_libraries(
${PROJECT_NAME} cafProjectDataModel ${QT_LIBRARIES} ${THREAD_LIBRARY}
)

View File

@@ -30,7 +30,9 @@ public:
caf::PdmField<std::vector<cvf::Vec3d>> m_vecArrayField;
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute );
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
};

View File

@@ -45,6 +45,5 @@ template<> Vector2<double> const Vector2<double>::UNDEFINED(UNDEFINED_DOUBLE, UN
template<> Vector2<float> const Vector2<float>::UNDEFINED(UNDEFINED_FLOAT, UNDEFINED_FLOAT);
template<> Vector2<int> const Vector2<int>::UNDEFINED(UNDEFINED_INT, UNDEFINED_INT);
} // namespace cvf

View File

@@ -113,21 +113,6 @@ TEST(ObjectTest, AddRefAndRelease)
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
#if CVF_ENABLE_TIGHT_ASSERTS == 1
TEST(ObjectDeathTest, AddRefAndReleaseBehaviorOnNullPointer)
{
Object* obj = NULL;
EXPECT_DEATH(obj->addRef(), "Assertion");
EXPECT_DEATH(obj->refCount(), "Assertion");
// Release is OK on NULL pointer
EXPECT_EQ(0, obj->release());
}
#endif
//--------------------------------------------------------------------------------------------------

View File

@@ -606,18 +606,10 @@ TEST(StringTest, Number)
EXPECT_STREQ("1.234", s1.toAscii().ptr());
EXPECT_STREQ("-123000", s2.toAscii().ptr());
#ifdef WIN32
EXPECT_STREQ("5.4e+013", s3.toAscii().ptr());
#else
EXPECT_STREQ("5.4e+13", s3.toAscii().ptr());
#endif
String s4 = String::number(-1.2375e5f, 'e', 2);
#ifdef WIN32
EXPECT_STREQ("-1.24e+005", s4.toAscii().ptr());
#else
EXPECT_STREQ("-1.24e+05", s4.toAscii().ptr());
#endif
String s5 = String::number(-1.2375e5f, 'f', 2);
EXPECT_STREQ("-123750.00", s5.toAscii().ptr());
@@ -633,19 +625,11 @@ TEST(StringTest, Number)
EXPECT_STREQ("1.234", s11.toAscii().ptr());
EXPECT_STREQ("-123000", s12.toAscii().ptr());
#ifdef WIN32
EXPECT_STREQ("5.4e+013", s13.toAscii().ptr());
#else
EXPECT_STREQ("5.4e+13", s13.toAscii().ptr());
#endif
String s14 = String::number(-1.2375e5, 'e', 2);
#ifdef WIN32
EXPECT_STREQ("-1.24e+005", s14.toAscii().ptr());
#else
EXPECT_STREQ("-1.24e+05", s14.toAscii().ptr());
#endif
String s15 = String::number(-1.2375e5, 'f', 2);
EXPECT_STREQ("-123750.00", s15.toAscii().ptr());
@@ -975,11 +959,7 @@ TEST(StringTest, StringBuilding)
s11 += String(dfps);
s11 += " (fps)";
#ifdef WIN32
EXPECT_STREQ("Framerate: 1.23457e+014 (fps)", s11.toAscii().ptr());
#else
EXPECT_STREQ("Framerate: 1.23457e+14 (fps)", s11.toAscii().ptr());
#endif
String s13 = "Framerate: " + String::number(dfps, 'f', 1) + " (fps)";
EXPECT_STREQ("Framerate: 123456789012345.6 (fps)", s13.toAscii().ptr());