Skip to content

Commit

Permalink
fix some waning in MSVC 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Mar 24, 2019
1 parent 03247f5 commit db5a76c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
global:
- LANG="zh_CN.UTF-8"
- CMAKE_PREFIX=$HOME/prebuilt/cmake ;
- CMAKE_LINUX_URL=https://cmake.org/files/v3.13/cmake-3.13.1-Linux-x86_64.sh ;
- CMAKE_LINUX_URL=https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.sh ;
- PANDOC_PREFIX=$HOME/prebuilt/pandoc ;
- PANDOC_LINUX_URL=https://github.com/jgm/pandoc/releases/download/2.5/pandoc-2.5-linux.tar.gz
- DOXYGEN_PREFIX=$HOME/prebuilt/doxygen
Expand Down
14 changes: 11 additions & 3 deletions cmake_dev.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
mkdir build_windows_msvc
cd build_windows_msvc
@echo off

cmake .. -G "Visual Studio 15 2017 Win64" -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
mkdir %~dp0\build_jobs_vs2019
cd %~dp0\build_jobs_vs2019

cmake .. -G "Visual Studio 16 2019" -A x64 -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON

if %ERRORLEVEL% == 0 GOTO no_error

pause

:no_error
2 changes: 1 addition & 1 deletion cmake_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CMAKE_OPTIONS="-DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJ
CMAKE_CLANG_TIDY="";
CMAKE_CLANG_ANALYZER=0;
CMAKE_CLANG_ANALYZER_PATH="";
BUILD_DIR=$(echo "build_$SYS_NAME" | tr '[:upper:]' '[:lower:]');
BUILD_DIR=$(echo "build_jobs_$SYS_NAME" | tr '[:upper:]' '[:lower:]');
CMAKE_BUILD_TYPE=Debug;
CPPCHECK_PLATFORM=unix64;

Expand Down
12 changes: 6 additions & 6 deletions include/libcopp/coroutine/coroutine_context_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace copp {
/**
* @brief create and init coroutine with specify runner and specify stack size
* @param runner runner
* @param stack_size stack size
* @param stack_sz stack size
* @param private_buffer_size private buffer size
* @param coroutine_size extend buffer before coroutine
* @return COPP_EC_SUCCESS or error code
Expand All @@ -68,10 +68,10 @@ namespace copp {
#else
const callback_t &runner,
#endif
allocator_type &alloc, size_t stack_size = 0, size_t private_buffer_size = 0, size_t coroutine_size = 0) UTIL_CONFIG_NOEXCEPT {
allocator_type &alloc, size_t stack_sz = 0, size_t private_buffer_size = 0, size_t coroutine_size = 0) UTIL_CONFIG_NOEXCEPT {
ptr_t ret;
if (0 == stack_size) {
stack_size = stack_traits::default_size();
if (0 == stack_sz) {
stack_sz = stack_traits::default_size();
}

// padding to sizeof size_t
Expand All @@ -80,12 +80,12 @@ namespace copp {
coroutine_size += this_align_size;
private_buffer_size = coroutine_context::align_private_data_size(private_buffer_size);

if (stack_size <= coroutine_size + private_buffer_size) {
if (stack_sz <= coroutine_size + private_buffer_size) {
return ret;
}

stack_context callee_stack;
alloc.allocate(callee_stack, stack_size);
alloc.allocate(callee_stack, stack_sz);

if (NULL == callee_stack.sp) {
return ret;
Expand Down
4 changes: 3 additions & 1 deletion include/libcopp/utils/config/compiler_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# undef UTIL_CONFIG_COMPILER_IS_zOS
# define UTIL_CONFIG_COMPILER_IS_zOS 1

#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
#elif defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)
# undef UTIL_CONFIG_COMPILER_IS_XL
# define UTIL_CONFIG_COMPILER_IS_XL 1

Expand Down Expand Up @@ -642,6 +642,8 @@

# if defined(UTIL_CONFIG_COMPILER_CXX_NULLPTR) && UTIL_CONFIG_COMPILER_CXX_NULLPTR
# define UTIL_CONFIG_NULLPTR nullptr
# elif UTIL_CONFIG_COMPILER_IS_GNU
# define UTIL_CONFIG_NULLPTR __null
# else
# define UTIL_CONFIG_NULLPTR 0
# endif
Expand Down
2 changes: 1 addition & 1 deletion include/libcotask/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace cotask {
* @brief constuctor
* @note should not be called directly
*/
task(size_t stack_size) : stack_size_(stack_size), action_destroy_fn_(UTIL_CONFIG_NULLPTR) {
task(size_t stack_sz) : stack_size_(stack_sz), action_destroy_fn_(UTIL_CONFIG_NULLPTR) {
id_allocator_t id_alloc_;
id_ = id_alloc_.allocate();
ref_count_.store(0);
Expand Down
4 changes: 2 additions & 2 deletions include/libcotask/task_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ namespace cotask {

// add timeout controller
if (0 != timeout_sec || 0 != timeout_nsec) {
typedef typename std::multimap<detail::tickspec_t, id_t>::value_type pair_type;
task_timeout_checkpoints_.insert(pair_type(task_node.expired_time_, task_id));
typedef typename std::multimap<detail::tickspec_t, id_t>::value_type timer_pair_type;
task_timeout_checkpoints_.insert(timer_pair_type(task_node.expired_time_, task_id));
}

return copp::COPP_EC_SUCCESS;
Expand Down

0 comments on commit db5a76c

Please sign in to comment.