Skip to content

Commit 555d2d4

Browse files
authored
Enable warnings as error and W4 on MSVC (#83)
This commit increase warning level from `W3` to `W4` on MSVC and sets warnings as errors. Exclusion is made for a specific warning (C4189).
1 parent 5227291 commit 555d2d4

8 files changed

Lines changed: 10 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ if (MSVC)
4747
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
4848
target_compile_options(${PICT_BUILD_OPTIONS}
4949
INTERFACE
50-
/W3
50+
/W4 /WX
51+
/wd4189 # DOUT(arg) has unused parameters. Suppressing the warning here.
5152
)
5253

5354
target_compile_definitions(${PICT_BUILD_OPTIONS}

api-usage/pictapi-sample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ void __cdecl wmain()
3434
PICT_RET_CODE ret = PICT_SUCCESS;
3535

3636
PICT_HANDLE task = PictCreateTask();
37-
checkNull( task );
3837

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

4443
PICT_HANDLE model = PictCreateModel();
44+
checkNull( task );
4545
checkNull( model );
4646

4747
//

api/generator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class Exclusion
270270
}
271271

272272
// for inserter() to work we need two-param insert
273-
iterator insert( iterator pos, const ExclusionTerm& Term )
273+
iterator insert( iterator, const ExclusionTerm& Term )
274274
{
275275
return insert( Term ).first;
276276
}

cli/ctokenizer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,6 @@ RelationType ConstraintsTokenizer::getRelationType()
532532
else throw CSyntaxError( SyntaxErrorType::UnknownRelation, _currentPosition );
533533
}
534534
else throw CSyntaxError( SyntaxErrorType::UnknownRelation, _currentPosition );
535-
536-
assert( false );
537-
return ( RelationType::Unknown );
538535
}
539536

540537
//

cli/gcdmodel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ ErrorCode CGcdData::TranslateToGCD()
162162
{
163163
CModelParameter& param = _modelData.Parameters[ index ];
164164

165-
Parameter* gcdParam = new Parameter( UNDEFINED_ORDER, index, static_cast<int>( param.Values.size() ),
165+
Parameter* gcdParam = new Parameter( UNDEFINED_ORDER, static_cast<int>(index),
166+
static_cast<int>( param.Values.size() ),
166167
param.Name, param.IsResultParameter );
167168

168169
// find out and assign weights to values

cli/model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class CModelParameter
6161
CModelParameter() :
6262
Name(L""),
6363
IsResultParameter(false),
64-
Order(UNDEFINED_ORDER),
64+
Order(static_cast<unsigned int>(UNDEFINED_ORDER)),
6565
GcdPointer(nullptr){}
6666

6767
int GetValueOrdinal( IN std::wstring& name, IN bool caseSensitive );

cli/mparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ bool CModelData::readParameter( wstring& line )
134134

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

137-
unsigned int order = UNDEFINED_ORDER;
137+
unsigned int order = static_cast<unsigned int>(UNDEFINED_ORDER);
138138

139139
//check if this param has custom-order defined
140140
wstrings nameAndOrder;

clidll/dllmain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#if defined(_WIN32)
22
#include "windows.h"
33

4-
BOOL APIENTRY DllMain( HMODULE hModule,
4+
BOOL APIENTRY DllMain( HMODULE /*hModule*/,
55
DWORD ul_reason_for_call,
6-
LPVOID lpReserved
6+
LPVOID /*lpReserved*/
77
)
88
{
99
switch (ul_reason_for_call)

0 commit comments

Comments
 (0)