Skip to content

Commit

Permalink
Enable warnings as error and W4 on MSVC (#83)
Browse files Browse the repository at this point in the history
This commit increase warning level from `W3` to `W4` on MSVC and sets
warnings as errors. Exclusion is made for a specific warning (C4189).
  • Loading branch information
bhardwajs committed Mar 30, 2022
1 parent 5227291 commit 555d2d4
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -47,7 +47,8 @@ if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
target_compile_options(${PICT_BUILD_OPTIONS}
INTERFACE
/W3
/W4 /WX
/wd4189 # DOUT(arg) has unused parameters. Suppressing the warning here.
)

target_compile_definitions(${PICT_BUILD_OPTIONS}
Expand Down
2 changes: 1 addition & 1 deletion api-usage/pictapi-sample.cpp
Expand Up @@ -34,14 +34,14 @@ void __cdecl wmain()
PICT_RET_CODE ret = PICT_SUCCESS;

PICT_HANDLE task = PictCreateTask();
checkNull( task );

//
// In a general case, models might form a tree-like hierarchy
// Let's try with only one model for now, pairwise is default
//

PICT_HANDLE model = PictCreateModel();
checkNull( task );
checkNull( model );

//
Expand Down
2 changes: 1 addition & 1 deletion api/generator.h
Expand Up @@ -270,7 +270,7 @@ class Exclusion
}

// for inserter() to work we need two-param insert
iterator insert( iterator pos, const ExclusionTerm& Term )
iterator insert( iterator, const ExclusionTerm& Term )
{
return insert( Term ).first;
}
Expand Down
3 changes: 0 additions & 3 deletions cli/ctokenizer.cpp
Expand Up @@ -532,9 +532,6 @@ RelationType ConstraintsTokenizer::getRelationType()
else throw CSyntaxError( SyntaxErrorType::UnknownRelation, _currentPosition );
}
else throw CSyntaxError( SyntaxErrorType::UnknownRelation, _currentPosition );

assert( false );
return ( RelationType::Unknown );
}

//
Expand Down
3 changes: 2 additions & 1 deletion cli/gcdmodel.cpp
Expand Up @@ -162,7 +162,8 @@ ErrorCode CGcdData::TranslateToGCD()
{
CModelParameter& param = _modelData.Parameters[ index ];

Parameter* gcdParam = new Parameter( UNDEFINED_ORDER, index, static_cast<int>( param.Values.size() ),
Parameter* gcdParam = new Parameter( UNDEFINED_ORDER, static_cast<int>(index),
static_cast<int>( param.Values.size() ),
param.Name, param.IsResultParameter );

// find out and assign weights to values
Expand Down
2 changes: 1 addition & 1 deletion cli/model.h
Expand Up @@ -61,7 +61,7 @@ class CModelParameter
CModelParameter() :
Name(L""),
IsResultParameter(false),
Order(UNDEFINED_ORDER),
Order(static_cast<unsigned int>(UNDEFINED_ORDER)),
GcdPointer(nullptr){}

int GetValueOrdinal( IN std::wstring& name, IN bool caseSensitive );
Expand Down
2 changes: 1 addition & 1 deletion cli/mparser.cpp
Expand Up @@ -134,7 +134,7 @@ bool CModelData::readParameter( wstring& line )

wstring name = trim( line.substr( 0, paramSep ));

unsigned int order = UNDEFINED_ORDER;
unsigned int order = static_cast<unsigned int>(UNDEFINED_ORDER);

//check if this param has custom-order defined
wstrings nameAndOrder;
Expand Down
4 changes: 2 additions & 2 deletions clidll/dllmain.cpp
@@ -1,9 +1,9 @@
#if defined(_WIN32)
#include "windows.h"

BOOL APIENTRY DllMain( HMODULE hModule,
BOOL APIENTRY DllMain( HMODULE /*hModule*/,
DWORD ul_reason_for_call,
LPVOID lpReserved
LPVOID /*lpReserved*/
)
{
switch (ul_reason_for_call)
Expand Down

0 comments on commit 555d2d4

Please sign in to comment.