Skip to content

Commit f3ba03b

Browse files
committed
Cleanup warnings (level 3)
Tune up build options
1 parent 5ab3c43 commit f3ba03b

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES
2929
endif ()
3030
else ()
3131
# MSVC
32-
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14")
3332

3433
if (NOT DEFINED MSVC_RUNTIME_TYPE)
3534
if (NOT WITH_TESTS)

cmake/build_thirdparty.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
macro (BuildThirdparty TargetName ThirdpartySrcPath ThirdpartyOutFile)
1+
macro (BuildThirdparty TargetName ThirdpartySrcPath ThirdpartyOutFile ExtraBuildOptions)
22

33
set (BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TargetName}/build)
44
set (INST_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TargetName}/install)
@@ -7,7 +7,7 @@ macro (BuildThirdparty TargetName ThirdpartySrcPath ThirdpartyOutFile)
77

88
add_custom_command (
99
OUTPUT ${BUILD_DIR}/CMakeCache.txt
10-
COMMAND ${CMAKE_COMMAND} ARGS -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX="${INST_DIR}" -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} "${ThirdpartySrcPath}"
10+
COMMAND ${CMAKE_COMMAND} ARGS -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX="${INST_DIR}" -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} "${ThirdpartySrcPath}" ${ExtraBuildOptions}
1111
WORKING_DIRECTORY ${BUILD_DIR}
1212
COMMENT "Prebuild ${TargetName} library"
1313
)

include/jinja2cpp/reflected_value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct ContainerReflector
116116
Value GetValueByIndex(int64_t idx) const override
117117
{
118118
auto p = m_value.begin();
119-
std::advance(p, idx);
119+
std::advance(p, static_cast<size_t>(idx));
120120
return Reflect(*p);
121121
}
122122
};

src/expression_evaluator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ Value CallExpression::CallGlobalRange(RenderContext& values)
278278

279279
size_t GetSize() const override
280280
{
281-
size_t count = (m_stop - m_start);
282-
return count / m_step;
281+
size_t count = static_cast<size_t>(m_stop - m_start);
282+
return static_cast<size_t>(count / m_step);
283283
}
284284
Value GetValueByIndex(int64_t idx) const
285285
{
@@ -304,7 +304,7 @@ Value CallExpression::CallLoopCycle(RenderContext& values)
304304

305305
const ValuesMap* loop = boost::get<ValuesMap>(&loopValP->second.data());
306306
int64_t baseIdx = boost::apply_visitor(visitors::IntegerEvaluator(), (*loop).at("index0").data());
307-
auto idx = baseIdx % m_params.posParams.size();
307+
auto idx = static_cast<size_t>(baseIdx % m_params.posParams.size());
308308
return m_params.posParams[idx]->Evaluate(values);
309309
}
310310

src/lexertk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ namespace lexertk
119119
{
120120
return std::isdigit(c, get_locale());
121121
}
122-
static bool is_letter_or_digit(const char c)
122+
static bool is_letter_or_digit(CharT c)
123123
{
124124
return std::isalnum(c, get_locale());
125125
}

src/statements.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct ValuesListAdaptorCreator : public boost::static_visitor<std::function<con
1414
}
1515

1616
size_t GetSize() const override {return m_list->size();}
17-
Value GetValueByIndex(int64_t idx) const override {return (*m_list)[idx];};
17+
Value GetValueByIndex(int64_t idx) const override {return (*m_list)[static_cast<size_t>(idx)];};
1818

1919
const ValuesList* m_list;
2020
};

thirdparty/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,18 @@ list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
55

66
include (build_thirdparty)
77

8-
BuildThirdparty(gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest include/gmock/gmock.h )
8+
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
9+
message (STATUS "######### <<<<<<<<< !!!!!!!!!!!!")
10+
if (MSVC_RUNTIME_TYPE STREQUAL "/MD" OR NOT MSVC_RUNTIME_TYPE)
11+
set (GTEST_EXTRA_OPTIONS "-Dgtest_force_shared_crt=TRUE")
12+
else ()
13+
set (GTEST_EXTRA_OPTIONS "-Dgtest_force_shared_crt=TRUE")
14+
endif ()
15+
else ()
16+
message (STATUS "######### <<<<<<<<< ????????")
17+
endif ()
18+
19+
message (STATUS "#### CMAKE_CXX_COMPILER_ID: '${CMAKE_CXX_COMPILER_ID}'")
20+
message (STATUS "#### GTEST_EXTRA_OPTIONS: ${GTEST_EXTRA_OPTIONS}")
21+
22+
BuildThirdparty(gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest include/gmock/gmock.h "${GTEST_EXTRA_OPTIONS}")

0 commit comments

Comments
 (0)