Browse Source

fixed warnings for msvc build

cl-refactor
arkpar 10 years ago
parent
commit
72628e8f32
  1. 13
      cmake/EthCompilerSettings.cmake
  2. 2
      libserpent/rewriteutils.cpp
  3. 2
      libserpent/util.cpp
  4. 0
      libsolidity/AST.h
  5. 4
      libsolidity/CompilerContext.cpp
  6. 6
      libsolidity/CompilerContext.h
  7. 2
      libsolidity/CompilerStack.cpp
  8. 2
      libsolidity/Types.h
  9. 6
      libsolidity/Utils.h
  10. 4
      test/SolidityEndToEndTest.cpp
  11. 2
      test/boostTest.cpp
  12. 2
      test/vm.cpp

13
cmake/EthCompilerSettings.cmake

@ -28,8 +28,17 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# specify Exception Handling Model in msvc
set(CMAKE_C_FLAGS "/EHsc")
set(CMAKE_CXX_FLAGS "/EHsc")
# disable unknown pragma warning (4068)
# disable unsafe function warning (4996)
# disable decorated name length exceeded, name was truncated (4503)
# disable warning C4535: calling _set_se_translator() requires /EHa (for boost tests)
# declare Windows XP requirement
add_compile_options(/EHsc /wd4068 /wd4996 /wd4503 -D_WIN32_WINNT=0x0501)
# disable empty object file warning
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
# warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification
# warning LNK4099: pdb was not found with lib
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099,4075")
# windows likes static
set(ETH_STATIC 1)

2
libserpent/rewriteutils.cpp

@ -54,7 +54,7 @@ bool isValidFunctionName(std::string f) {
vfMap[validFunctions[i][0]] = true;
}
}
return vfMap.count(f);
return vfMap.count(f) != 0;
}
// Cool function for debug purposes (named cerrStringList to make

2
libserpent/util.cpp

@ -260,7 +260,7 @@ std::string get_file_contents(std::string filename)
{
std::string contents;
in.seekg(0, std::ios::end);
contents.resize(in.tellg());
contents.resize((unsigned)in.tellg());
in.seekg(0, std::ios::beg);
in.read(&contents[0], contents.size());
in.close();

0
libsolidity/AST.h

4
libsolidity/CompilerContext.cpp

@ -53,8 +53,8 @@ void CompilerContext::addAndInitializeVariable(VariableDeclaration const& _decla
{
addVariable(_declaration);
unsigned const size = _declaration.getType()->getSizeOnStack();
for (unsigned i = 0; i < size; ++i)
int const size = _declaration.getType()->getSizeOnStack();
for (int i = 0; i < size; ++i)
*this << u256(0);
m_asm.adjustDeposit(-size);
}

6
libsolidity/CompilerContext.h

@ -51,10 +51,10 @@ public:
void adjustStackOffset(int _adjustment) { m_asm.adjustDeposit(_adjustment); }
bool isMagicGlobal(Declaration const* _declaration) const { return m_magicGlobals.count(_declaration); }
bool isFunctionDefinition(Declaration const* _declaration) const { return m_functionEntryLabels.count(_declaration); }
bool isMagicGlobal(Declaration const* _declaration) const { return m_magicGlobals.count(_declaration) != 0; }
bool isFunctionDefinition(Declaration const* _declaration) const { return m_functionEntryLabels.count(_declaration) != 0; }
bool isLocalVariable(Declaration const* _declaration) const;
bool isStateVariable(Declaration const* _declaration) const { return m_stateVariables.count(_declaration); }
bool isStateVariable(Declaration const* _declaration) const { return m_stateVariables.count(_declaration) != 0; }
eth::AssemblyItem getFunctionEntryLabel(FunctionDefinition const& _function) const;
/// Returns the distance of the given local variable from the top of the local variable stack.

2
libsolidity/CompilerStack.cpp

@ -39,7 +39,7 @@ namespace solidity
bool CompilerStack::addSource(string const& _name, string const& _content)
{
bool existed = m_sources.count(_name);
bool existed = m_sources.count(_name) != 0;
reset(true);
m_sources[_name].scanner = make_shared<Scanner>(CharStream(_content), _name);
return existed;

2
libsolidity/Types.h

@ -178,7 +178,7 @@ public:
int getNumBits() const { return m_bits; }
bool isHash() const { return m_modifier == Modifier::HASH || m_modifier == Modifier::ADDRESS; }
bool isAddress() const { return m_modifier == Modifier::ADDRESS; }
int isSigned() const { return m_modifier == Modifier::SIGNED; }
bool isSigned() const { return m_modifier == Modifier::SIGNED; }
static const MemberList AddressMemberList;

6
libsolidity/Utils.h

@ -45,5 +45,11 @@ inline void solAssertAux(bool _condition, std::string const& _errorDescription,
<< ::boost::throw_line(_line));
}
inline void solAssertAux(void const* _pointer, std::string const& _errorDescription, unsigned _line,
char const* _file, char const* _function)
{
solAssertAux(_pointer != nullptr, _errorDescription, _line, _file, _function);
}
}
}

4
test/SolidityEndToEndTest.cpp

@ -28,6 +28,10 @@
#include <libdevcrypto/SHA3.h>
#include <test/solidityExecutionFramework.h>
#ifdef _MSC_VER
#pragma warning(disable: 4307) //integral constant overflow for high_bits_cleaning
#endif
using namespace std;
namespace dev

2
test/boostTest.cpp

@ -23,6 +23,6 @@
#define BOOST_TEST_MODULE EthereumTests
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#define BOOST_DISABLE_WIN32 //disables SEH warning
#include <boost/test/included/unit_test.hpp>
#pragma warning(pop)
#pragma GCC diagnostic pop

2
test/vm.cpp

@ -345,7 +345,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
output = vm->go(fev, fev.simpleTrace()).toBytes();
gas = vm->gas();
}
catch (VMException const& _e)
catch (VMException const&)
{
cnote << "Safe VM Exception";
vmExceptionOccured = true;

Loading…
Cancel
Save