fixed: win32 warnings.

This commit is contained in:
Nick Bolton 2014-02-25 15:50:06 +00:00
parent c44971b43d
commit 78ecdf4c6e
6 changed files with 37 additions and 40 deletions

View File

@ -46,10 +46,10 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# for unix, put debug files in a separate bin "debug" dir. # for unix, put debug files in a separate bin "debug" dir.
# release bin files should stay in the root of the bin dir. # release bin files should stay in the root of the bin dir.
if (CMAKE_GENERATOR STREQUAL "Unix Makefiles") if (CMAKE_GENERATOR STREQUAL "Unix Makefiles")
if (CMAKE_BUILD_TYPE STREQUAL Debug) if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/debug) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/debug)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/debug) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/debug)
endif() endif()
endif() endif()
# Set some easy to type variables. # Set some easy to type variables.
@ -69,8 +69,7 @@ if (UNIX)
# warnings as errors: # warnings as errors:
# we have a problem with people checking in code with warnings. # we have a problem with people checking in code with warnings.
set(CMAKE_CXX_FLAGS "-Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
# For config.h, detect the libraries, functions, etc. # For config.h, detect the libraries, functions, etc.
include(CheckIncludeFiles) include(CheckIncludeFiles)
@ -254,11 +253,11 @@ if (UNIX)
list(APPEND libs Xrandr) list(APPEND libs Xrandr)
endif() endif()
# this was outside of the linux scope, # this was outside of the linux scope,
# not sure why, moving it back inside. # not sure why, moving it back inside.
if(HAVE_Xi) if(HAVE_Xi)
list(APPEND libs Xi) list(APPEND libs Xi)
endif() endif()
endif() endif()
@ -313,39 +312,26 @@ add_subdirectory(src)
add_subdirectory(tools) add_subdirectory(tools)
if (WIN32) if (WIN32)
# add /analyze in order to unconver potential bugs in the source code # TODO: consider using /analyze to uncover potential bugs in the source code.
# Details: http://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx
# add /FR to generate browse information (ncb files) usefull for using IDE
#define _BIND_TO_CURRENT_CRT_VERSION 1 # /WX - warnings as errors (we have a problem with people checking in code with warnings).
#define _BIND_TO_CURRENT_ATL_VERSION 1 # /FR - generate browse information (ncb files) useful for using IDE.
#define _BIND_TO_CURRENT_MFC_VERSION 1 # /MP - use multi cores to compile.
#define _BIND_TO_CURRENT_OPENMP_VERSION 1 # /D _BIND_TO_CURRENT_VCLIBS_VERSION - TODO: explain why.
# next line replaced the previous 4 ones: # /D _SECURE_SCL=1 - find bugs with iterators.
#define _BIND_TO_CURRENT_VCLIBS_VERSION 1; set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX /FR /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1 /D _SECURE_SCL=1")
# compiler: /MP - use multi cores to compile # /MD - use multi-core libraries.
# added _SECURE_SCL=1 for finding bugs with iterators - http://msdn.microsoft.com/en-us/library/aa985965.aspx # /O2 - get the fastest code.
# /Ob2 - expand inline functions (auto-inlining).
# common args between all vs builds set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2")
set(VS_ARGS "/FR /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1 /D _SECURE_SCL=1 ${VS_ARGS_EXTRA}")
# we may use `cmake -D VS_ARGS_EXTRA="/analyze"` for example to specify
# analyze mode (since we don't always want to use it; e.g. on non-team
# or non-x86 compiler editions where there's no support)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${VS_ARGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${VS_ARGS}")
# this line removes "/D NDEBUG" from release, we want them in order to
# find bugs even on release builds.
set(CMAKE_CXX_FLAGS_RELEASE "/MD /O2 /Ob2")
endif() endif()
if (CONF_CPACK) if (CONF_CPACK)
if (WIN32) if (WIN32)
message(FATAL_ERROR "CPack support for Windows has been removed.") message(FATAL_ERROR "CPack support for Windows has been removed.")
endif() endif()
if (UNIX) if (UNIX)

View File

@ -800,7 +800,7 @@ CClient::dragInfoReceived(UInt32 fileNum, CString data)
CDragInformation::parseDragInfo(m_dragFileList, fileNum, data); CDragInformation::parseDragInfo(m_dragFileList, fileNum, data);
LOG((CLOG_DEBUG "drag info received, total drag file number: %i", m_dragFileList.size())); LOG((CLOG_DEBUG "drag info received, total drag file number: %i", m_dragFileList.size()));
for (int i = 0; i < m_dragFileList.size(); ++i) { for (size_t i = 0; i < m_dragFileList.size(); ++i) {
LOG((CLOG_DEBUG2 "dragging file %i name: %s", i + 1, m_dragFileList.at(i).c_str())); LOG((CLOG_DEBUG2 "dragging file %i name: %s", i + 1, m_dragFileList.at(i).c_str()));
} }

View File

@ -20,14 +20,20 @@
#include "ECryptoMode.h" #include "ECryptoMode.h"
#include "CString.h" #include "CString.h"
#if SYSAPI_UNIX
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtautological-compare" #pragma GCC diagnostic ignored "-Wtautological-compare"
#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include <cryptopp562/gcm.h> #include <cryptopp562/gcm.h>
#include <cryptopp562/modes.h> #include <cryptopp562/modes.h>
#include <cryptopp562/aes.h> #include <cryptopp562/aes.h>
#if SYSAPI_UNIX
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
//! Encapsulation of modes //! Encapsulation of modes
/*! /*!

View File

@ -21,12 +21,17 @@
#include "CStreamFilter.h" #include "CStreamFilter.h"
#include "CCryptoMode.h" #include "CCryptoMode.h"
#if SYSAPI_UNIX
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall" #pragma GCC diagnostic ignored "-Wall"
#endif
#include <cryptopp562/osrng.h> #include <cryptopp562/osrng.h>
#include <cryptopp562/sha.h> #include <cryptopp562/sha.h>
#if SYSAPI_UNIX
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
class CCryptoOptions; class CCryptoOptions;

View File

@ -2350,7 +2350,7 @@ CServer::dragInfoReceived(UInt32 fileNum, CString content)
CDragInformation::parseDragInfo(m_dragFileList, fileNum, content); CDragInformation::parseDragInfo(m_dragFileList, fileNum, content);
LOG((CLOG_DEBUG "drag info received, total drag file number: %i", m_dragFileList.size())); LOG((CLOG_DEBUG "drag info received, total drag file number: %i", m_dragFileList.size()));
for (int i = 0; i < m_dragFileList.size(); ++i) { for (size_t i = 0; i < m_dragFileList.size(); ++i) {
LOG((CLOG_DEBUG "dragging file %i name: %s", i + 1, m_dragFileList.at(i).c_str())); LOG((CLOG_DEBUG "dragging file %i name: %s", i + 1, m_dragFileList.at(i).c_str()));
} }

View File

@ -472,7 +472,7 @@ newMockData(size_t size)
data += headSize; data += headSize;
size_t times = (size - headSize - tailSize) / synergyRocksSize; size_t times = (size - headSize - tailSize) / synergyRocksSize;
for (SInt32 i = 0; i < times; ++i) { for (size_t i = 0; i < times; ++i) {
memcpy(data, synergyRocks, synergyRocksSize); memcpy(data, synergyRocks, synergyRocksSize);
data += synergyRocksSize; data += synergyRocksSize;
} }