Enable more C++ compiler warnings

This commit is contained in:
Alex Beregszaszi
2020-12-10 21:03:58 +00:00
parent 90c693be09
commit bd641a5206
27 changed files with 96 additions and 26 deletions
+5
View File
@@ -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)
{
+1 -1
View File
@@ -52,4 +52,4 @@ DEFINE_PROTO_FUZZER(Contract const& _contract)
solAssert(encodeStatus, "Isabelle abicoder fuzzer: Encoding failed");
}
return;
}
}
+10 -11
View File
@@ -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,
+1 -1
View File
@@ -32,4 +32,4 @@ string SolidityGenerator::generateTestProgram()
return Whiskers(R"(pragma <directive>;)")
("directive", "solidity >= 0.0.0")
.render();
}
}
+1 -1
View File
@@ -39,4 +39,4 @@ private:
/// Random number generator
RandomEngine const m_rand;
};
}
}
+1 -1
View File
@@ -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);
}
}
+4 -1
View File
@@ -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)
+3
View File
@@ -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)