Make warnings stricter on windows and clean up all legit warnings in our code.

This commit is contained in:
Jason Turner 2010-07-30 18:06:17 +00:00
parent b9ae4cd528
commit b971ee44ad
6 changed files with 23 additions and 20 deletions

View File

@ -48,11 +48,7 @@ else(READLINE_LIBRARY)
endif(READLINE_LIBRARY) endif(READLINE_LIBRARY)
IF(MSVC) IF(MSVC)
IF (CMAKE_BUILD_TYPE MATCHES "Debug") ADD_DEFINITIONS(/W4)
ADD_DEFINITIONS(/W4 /Wall)
ELSE()
ADD_DEFINITIONS(/W3)
ENDIF()
ELSE() ELSE()
ADD_DEFINITIONS(-Wall -Wextra) ADD_DEFINITIONS(-Wall -Wextra)
ENDIF() ENDIF()

View File

@ -146,7 +146,14 @@ namespace chaiscript
template<typename Ret, typename L> template<typename Ret, typename L>
Ret unary_minus(L l) Ret unary_minus(L l)
{ {
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4146)
return (-l); return (-l);
#pragma warning(pop)
#else
return (-1);
#endif
} }
template<typename Ret, typename L, typename R> template<typename Ret, typename L, typename R>

View File

@ -306,7 +306,7 @@ namespace chaiscript
std::vector<Boxed_Value> args; std::vector<Boxed_Value> args;
while (true) while (!(parg == params.end() && barg == m_args.end()))
{ {
while (barg != m_args.end() while (barg != m_args.end()
&& !(barg->get_type_info() == detail::Get_Type_Info<Placeholder_Object>::get())) && !(barg->get_type_info() == detail::Get_Type_Info<Placeholder_Object>::get()))
@ -326,11 +326,6 @@ namespace chaiscript
{ {
++barg; ++barg;
} }
if (parg == params.end() && barg == m_args.end())
{
break;
}
} }
return args; return args;
} }

View File

@ -7,13 +7,6 @@
#ifndef _CHAISCRIPT_COMMON_HPP #ifndef _CHAISCRIPT_COMMON_HPP
#define _CHAISCRIPT_COMMON_HPP #define _CHAISCRIPT_COMMON_HPP
#ifdef BOOST_HAS_DECLSPEC
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
#else
#define CHAISCRIPT_MODULE_EXPORT extern "C"
#endif
namespace chaiscript namespace chaiscript
{ {
typedef ModulePtr (*Create_Module_Func)(); typedef ModulePtr (*Create_Module_Func)();

View File

@ -15,7 +15,9 @@
#ifdef _POSIX_VERSION #ifdef _POSIX_VERSION
#include <dlfcn.h> #include <dlfcn.h>
#else #else
#ifdef WIN32 #ifdef BOOST_WINDOWS
#define VC_EXTRA_LEAN
#define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#endif #endif
#endif #endif

View File

@ -17,7 +17,6 @@
#include <chaiscript/chaiscript.hpp> #include <chaiscript/chaiscript.hpp>
void print_help() { void print_help() {
std::cout << "ChaiScript evaluator. To evaluate an expression, type it and press <enter>." << std::endl; std::cout << "ChaiScript evaluator. To evaluate an expression, type it and press <enter>." << std::endl;
std::cout << "Additionally, you can inspect the runtime system using:" << std::endl; std::cout << "Additionally, you can inspect the runtime system using:" << std::endl;
@ -58,8 +57,19 @@ int main(int argc, char *argv[]) {
std::vector<std::string> usepaths; std::vector<std::string> usepaths;
std::vector<std::string> modulepaths; std::vector<std::string> modulepaths;
// Disable deprecation warning for getenv call.
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
const char *usepath = getenv("CHAI_USE_PATH"); const char *usepath = getenv("CHAI_USE_PATH");
const char *modulepath = getenv("CHAI_MODULE_PATH"); const char *modulepath = getenv("CHAI_MODULE_PATH");
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
usepaths.push_back(""); usepaths.push_back("");