mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enable more C++ compiler warnings
This commit is contained in:
@@ -30,6 +30,9 @@ namespace po = boost::program_options;
|
||||
namespace solidity::test
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
/// If non-empty returns the value of the env. variable ETH_TEST_PATH, otherwise
|
||||
/// it tries to find a path that contains the directories "libsolidity/syntaxTests"
|
||||
/// and returns it if found.
|
||||
@@ -84,6 +87,8 @@ std::string envOrDefaultPath(std::string const& env_name, std::string const& lib
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CommonOptions::CommonOptions(std::string _caption):
|
||||
options(_caption,
|
||||
po::options_description::m_default_line_length,
|
||||
|
||||
@@ -148,6 +148,10 @@ void initializeOptions()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Prototype -- why isn't this declared in the boost headers?
|
||||
// TODO: replace this with a (global) fixture.
|
||||
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] );
|
||||
|
||||
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
|
||||
{
|
||||
master_test_suite_t& master = framework::master_test_suite();
|
||||
|
||||
@@ -19,4 +19,4 @@ target_sources(evmc INTERFACE
|
||||
${PROJECT_SOURCE_DIR}/test/evmc/utils.h
|
||||
)
|
||||
target_include_directories(evmc INTERFACE ${PROJECT_SOURCE_DIR}/test/)
|
||||
target_link_libraries(evmc INTERFACE evmc_loader)
|
||||
target_link_libraries(evmc INTERFACE evmc_loader)
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace solidity::frontend::test
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(SemVerMatcher)
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
SemVerMatchExpression parseExpression(string const& _input)
|
||||
{
|
||||
Scanner scanner{CharStream(_input, "")};
|
||||
@@ -62,6 +65,8 @@ SemVerMatchExpression parseExpression(string const& _input)
|
||||
return expression;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(positive_range)
|
||||
{
|
||||
// Positive range tests
|
||||
|
||||
@@ -39,6 +39,9 @@ namespace solidity::frontend::test
|
||||
using fmt = ExecutionFramework;
|
||||
using Mode = FunctionCall::DisplayMode;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
vector<FunctionCall> parse(string const& _source)
|
||||
{
|
||||
istringstream stream{_source, ios_base::out};
|
||||
@@ -86,6 +89,8 @@ void testFunctionCall(
|
||||
BOOST_REQUIRE_EQUAL(_call.kind == FunctionCall::Kind::Library, _isLibrary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestFileParserTest)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(smoke_test)
|
||||
|
||||
@@ -34,6 +34,9 @@ namespace solidity::util::test
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(SwarmHash, *boost::unit_test::label("nooptions"))
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
string bzzr0HashHex(string const& _input)
|
||||
{
|
||||
return toHex(bzzr0Hash(_input).asBytes());
|
||||
@@ -52,6 +55,8 @@ bytes sequence(size_t _length)
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_zeros)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(bzzr0HashHex(string()), string("011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce"));
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace po = boost::program_options;
|
||||
namespace solidity::test
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
auto const description = R"(isoltest, tool for interactively managing test contracts.
|
||||
Usage: isoltest [Options]
|
||||
Interactively validates test contracts.
|
||||
@@ -51,6 +54,8 @@ std::string editorPath()
|
||||
return std::string{};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IsolTestOptions::IsolTestOptions(std::string* _editor):
|
||||
CommonOptions(description)
|
||||
{
|
||||
|
||||
@@ -52,4 +52,4 @@ DEFINE_PROTO_FUZZER(Contract const& _contract)
|
||||
solAssert(encodeStatus, "Isabelle abicoder fuzzer: Encoding failed");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,13 @@ add_dependencies(ossfuzz
|
||||
strictasm_assembly_ossfuzz
|
||||
)
|
||||
|
||||
|
||||
if (OSSFUZZ)
|
||||
add_custom_target(ossfuzz_proto)
|
||||
add_dependencies(ossfuzz_proto
|
||||
sol_proto_ossfuzz
|
||||
yul_proto_ossfuzz
|
||||
yul_proto_diff_ossfuzz
|
||||
yul_proto_diff_custom_mutate_ossfuzz
|
||||
sol_proto_ossfuzz
|
||||
yul_proto_ossfuzz
|
||||
yul_proto_diff_ossfuzz
|
||||
yul_proto_diff_custom_mutate_ossfuzz
|
||||
)
|
||||
|
||||
add_custom_target(ossfuzz_abiv2)
|
||||
@@ -85,7 +84,7 @@ if (OSSFUZZ)
|
||||
protobuf.a
|
||||
)
|
||||
set_target_properties(yul_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(yul_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
target_compile_options(yul_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion -Wno-suggest-destructor-override -Wno-inconsistent-missing-destructor-override)
|
||||
|
||||
add_executable(yul_proto_diff_ossfuzz yulProto_diff_ossfuzz.cpp yulFuzzerCommon.cpp protoToYul.cpp yulProto.pb.cc)
|
||||
target_include_directories(yul_proto_diff_ossfuzz PRIVATE /usr/include/libprotobuf-mutator)
|
||||
@@ -96,7 +95,7 @@ if (OSSFUZZ)
|
||||
protobuf.a
|
||||
)
|
||||
set_target_properties(yul_proto_diff_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(yul_proto_diff_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
target_compile_options(yul_proto_diff_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion -Wno-suggest-destructor-override -Wno-inconsistent-missing-destructor-override)
|
||||
|
||||
add_executable(yul_proto_diff_custom_mutate_ossfuzz
|
||||
yulProto_diff_ossfuzz.cpp
|
||||
@@ -113,7 +112,7 @@ if (OSSFUZZ)
|
||||
protobuf.a
|
||||
)
|
||||
set_target_properties(yul_proto_diff_custom_mutate_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(yul_proto_diff_custom_mutate_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
target_compile_options(yul_proto_diff_custom_mutate_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion -Wno-suggest-destructor-override -Wno-inconsistent-missing-destructor-override)
|
||||
|
||||
add_executable(abiv2_proto_ossfuzz
|
||||
../../EVMHost.cpp
|
||||
@@ -133,7 +132,7 @@ if (OSSFUZZ)
|
||||
protobuf.a
|
||||
)
|
||||
set_target_properties(abiv2_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(abiv2_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
target_compile_options(abiv2_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion -Wno-suggest-destructor-override -Wno-inconsistent-missing-destructor-override)
|
||||
|
||||
add_executable(abiv2_isabelle_ossfuzz
|
||||
../../EVMHost.cpp
|
||||
@@ -155,7 +154,7 @@ if (OSSFUZZ)
|
||||
gmp
|
||||
)
|
||||
set_target_properties(abiv2_isabelle_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(abiv2_isabelle_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
target_compile_options(abiv2_isabelle_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion -Wno-suggest-destructor-override -Wno-inconsistent-missing-destructor-override)
|
||||
|
||||
add_executable(sol_proto_ossfuzz
|
||||
solProtoFuzzer.cpp
|
||||
@@ -175,7 +174,7 @@ if (OSSFUZZ)
|
||||
protobuf.a
|
||||
)
|
||||
set_target_properties(sol_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
|
||||
target_compile_options(sol_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
|
||||
target_compile_options(sol_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion -Wno-suggest-destructor-override -Wno-inconsistent-missing-destructor-override)
|
||||
else()
|
||||
add_library(solc_opt_ossfuzz
|
||||
solc_opt_ossfuzz.cpp
|
||||
|
||||
@@ -24,10 +24,9 @@
|
||||
using namespace std;
|
||||
using namespace solidity::test::fuzzer;
|
||||
|
||||
namespace
|
||||
{
|
||||
/// Forward declare libFuzzer's default mutator definition
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" size_t LLVMFuzzerMutate(uint8_t* _data, size_t _size, size_t _maxSize);
|
||||
extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* _data, size_t size, size_t _maxSize, unsigned int seed);
|
||||
|
||||
/// Define Solidity's custom mutator by implementing libFuzzer's
|
||||
/// custom mutator external interface.
|
||||
@@ -42,7 +41,6 @@ extern "C" size_t LLVMFuzzerCustomMutator(
|
||||
return LLVMFuzzerMutate(_data, _size, _maxSize);
|
||||
return SolidityCustomMutatorInterface{_data, _size, _maxSize, _seed}.generate();
|
||||
}
|
||||
}
|
||||
|
||||
SolidityCustomMutatorInterface::SolidityCustomMutatorInterface(
|
||||
uint8_t* _data,
|
||||
|
||||
@@ -32,4 +32,4 @@ string SolidityGenerator::generateTestProgram()
|
||||
return Whiskers(R"(pragma <directive>;)")
|
||||
("directive", "solidity >= 0.0.0")
|
||||
.render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,4 @@ private:
|
||||
/// Random number generator
|
||||
RandomEngine const m_rand;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,4 +79,4 @@ evmc::result AbiV2Utility::deployContract(EVMHost& _hostContext, bytes const& _c
|
||||
evmc_message message = initializeMessage(_code);
|
||||
message.kind = EVMC_CREATE;
|
||||
return _hostContext.call(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
if (_size <= 250)
|
||||
@@ -28,4 +31,4 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
FuzzerUtil::testConstantOptimizer(input, /*quiet=*/true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
using namespace solidity::frontend::test;
|
||||
using namespace std;
|
||||
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
if (_size <= 600)
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
using namespace solidity::frontend::test;
|
||||
using namespace std;
|
||||
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
if (_size <= 600)
|
||||
|
||||
@@ -24,6 +24,9 @@ using namespace solidity;
|
||||
using namespace solidity::yul;
|
||||
using namespace std;
|
||||
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
if (_size > 600)
|
||||
|
||||
@@ -44,6 +44,9 @@ using namespace solidity::util;
|
||||
using namespace solidity::langutil;
|
||||
using namespace solidity::yul::test::yul_fuzzer;
|
||||
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
if (_size > 600)
|
||||
|
||||
@@ -24,6 +24,9 @@ using namespace solidity::util;
|
||||
using namespace solidity::yul;
|
||||
using namespace std;
|
||||
|
||||
// Prototype as we can't use the FuzzerInterface.h header.
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
if (_size > 600)
|
||||
|
||||
Reference in New Issue
Block a user