From b0aae2349c92ac7a802fc853c7fd09874e30220d Mon Sep 17 00:00:00 2001 From: Liareth Date: Wed, 9 Aug 2017 17:36:40 +0100 Subject: [PATCH] Added the /WX flag, which treats compiler warnings as errors in MSVC. * This required a minor change to CMakeLists.txt. * Also updated two occurrences in code where compilation failed due to implicit narrowing conversions. --- easy_profiler_core/CMakeLists.txt | 4 ++++ easy_profiler_core/easy_socket.cpp | 2 +- easy_profiler_core/include/easy/reader.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/easy_profiler_core/CMakeLists.txt b/easy_profiler_core/CMakeLists.txt index ed31c86..82ab580 100644 --- a/easy_profiler_core/CMakeLists.txt +++ b/easy_profiler_core/CMakeLists.txt @@ -131,6 +131,10 @@ if (MINGW) target_compile_definitions(easy_profiler PRIVATE -DSTRSAFE_NO_DEPRECATE) endif () +if (MSVC) + target_compile_options(easy_profiler PRIVATE /WX) +endif() + if (APPLE) target_compile_options(easy_profiler PUBLIC -std=gnu++11) else () diff --git a/easy_profiler_core/easy_socket.cpp b/easy_profiler_core/easy_socket.cpp index f19b685..64ee7e6 100644 --- a/easy_profiler_core/easy_socket.cpp +++ b/easy_profiler_core/easy_socket.cpp @@ -248,7 +248,7 @@ int EasySocket::accept() fdexcl = fdread; tv.tv_sec = 0; tv.tv_usec = 500; - int rc =select (m_socket+1, &fdread, &fdwrite, &fdexcl, &tv); + int rc =select ((int)m_socket+1, &fdread, &fdwrite, &fdexcl, &tv); if(rc <= 0){ //there is no connection for accept diff --git a/easy_profiler_core/include/easy/reader.h b/easy_profiler_core/include/easy/reader.h index 25d905d..cd930a7 100644 --- a/easy_profiler_core/include/easy/reader.h +++ b/easy_profiler_core/include/easy/reader.h @@ -370,7 +370,7 @@ namespace profiler { other.m_size = m_size; m_data = d; - m_size = sz; + m_size = (size_t)sz; } private: