From bca77374637638d9a039faf55481a1e4ba968dad Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Wed, 3 Mar 2010 05:30:06 +0000 Subject: [PATCH] Updated to remove most of the warnings in Visual Studio. (There's still the one about all control paths returning a value left.) Fixed one warning (when an istream converts to void * to then convert to bool), and disabled three. --- CMakeLists.txt | 5 +++++ include/conversion.h | 3 ++- include/node.h | 2 +- include/nodereadimpl.h | 3 ++- include/parser.h | 2 +- parse.vcproj | 2 ++ test.vcproj | 2 ++ yamlcpp.vcproj | 2 ++ 8 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f21473..60119d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,11 @@ if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS "-O2 -Wall -Wextra -pedantic -Wno-long-long ${CMAKE_CXX_FLAGS}") endif(CMAKE_COMPILER_IS_GNUCC) +if(MSVC) + set(LIB_TYPE) # I can't figure out how CMake handles Windows shared libraries + set(CMAKE_CXX_FLAGS "/W3 /wd4127 /wd4355 /D_SCL_SECURE_NO_WARNINGS ${CMAKE_CXX_FLAGS}") +endif(MSVC) + set(YAML_CPP_VERSION_MAJOR "0") set(YAML_CPP_VERSION_MINOR "2") set(YAML_CPP_VERSION_PATCH "4") diff --git a/include/conversion.h b/include/conversion.h index 13add1c..3a03053 100644 --- a/include/conversion.h +++ b/include/conversion.h @@ -23,7 +23,8 @@ namespace YAML inline bool Convert(const std::string& input, T& output, typename enable_if >::type * = 0) { std::stringstream stream(input); stream.unsetf(std::ios::dec); - return stream >> output; + stream >> output; + return !!stream; } } diff --git a/include/node.h b/include/node.h index 097ccd8..b059748 100644 --- a/include/node.h +++ b/include/node.h @@ -20,7 +20,7 @@ namespace YAML class Content; class Scanner; class Emitter; - class ParserState; + struct ParserState; enum CONTENT_TYPE { CT_NONE, CT_SCALAR, CT_SEQUENCE, CT_MAP }; diff --git a/include/nodereadimpl.h b/include/nodereadimpl.h index 9ec024a..d315660 100644 --- a/include/nodereadimpl.h +++ b/include/nodereadimpl.h @@ -52,9 +52,10 @@ namespace YAML int operator,(flag, flag); template - void operator,(flag, T const&); + char operator,(flag, T const&); char operator,(int, flag); + int operator,(char, flag); } template diff --git a/include/parser.h b/include/parser.h index cd61c1c..fec63ea 100644 --- a/include/parser.h +++ b/include/parser.h @@ -15,7 +15,7 @@ namespace YAML { class Scanner; - class ParserState; + struct ParserState; struct Token; class Parser: private noncopyable diff --git a/parse.vcproj b/parse.vcproj index 1663a6f..23ef07c 100644 --- a/parse.vcproj +++ b/parse.vcproj @@ -39,6 +39,7 @@ />