From 1e2bfbd6b203b62ceb990c2b595e372ea108f139 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 11 Nov 2020 21:55:38 +0000 Subject: [PATCH] Enable the -Wextra-semi warning --- cmake/EthCompilerSettings.cmake | 7 +++++++ libsolidity/analysis/ControlFlowGraph.h | 2 +- libsolidity/codegen/ir/IRGenerationContext.h | 2 +- libyul/optimiser/OptimiserStep.h | 2 +- test/Common.h | 2 +- tools/yulPhaser/ProgramCache.h | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 653c5fdc3..be569ad17 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -52,6 +52,13 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA add_compile_options(-Wimplicit-fallthrough) add_compile_options(-Wsign-conversion) + # While this should work on CMake 3.3+, it fails on Ubuntu 18 + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16) + eth_add_cxx_compiler_flag_if_supported( + $<$:-Wextra-semi> + ) + endif() + # Configuration-specific compiler settings. set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") diff --git a/libsolidity/analysis/ControlFlowGraph.h b/libsolidity/analysis/ControlFlowGraph.h index 7d51f2196..6bdf01c09 100644 --- a/libsolidity/analysis/ControlFlowGraph.h +++ b/libsolidity/analysis/ControlFlowGraph.h @@ -76,7 +76,7 @@ public: } VariableDeclaration const& declaration() const { return m_declaration; } - Kind kind() const { return m_occurrenceKind; }; + Kind kind() const { return m_occurrenceKind; } std::optional const& occurrence() const { return m_occurrence; } private: /// Declaration of the occurring variable. diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index 3e9e96a54..78c7c8be7 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -135,7 +135,7 @@ public: /// @returns a new copy of the utility function generator (but using the same function set). YulUtilFunctions utils(); - langutil::EVMVersion evmVersion() const { return m_evmVersion; }; + langutil::EVMVersion evmVersion() const { return m_evmVersion; } ABIFunctions abiFunctions(); diff --git a/libyul/optimiser/OptimiserStep.h b/libyul/optimiser/OptimiserStep.h index 70ed098a8..7dc2d3ea2 100644 --- a/libyul/optimiser/OptimiserStep.h +++ b/libyul/optimiser/OptimiserStep.h @@ -84,7 +84,7 @@ public: return Step::invalidInCurrentEnvironment(); else return std::nullopt; - }; + } }; diff --git a/test/Common.h b/test/Common.h index e745ac6ac..d83ee166d 100644 --- a/test/Common.h +++ b/test/Common.h @@ -71,7 +71,7 @@ struct CommonOptions: boost::noncopyable static void setSingleton(std::unique_ptr&& _instance); CommonOptions(std::string caption = ""); - virtual ~CommonOptions() {}; + virtual ~CommonOptions() {} protected: boost::program_options::options_description options; diff --git a/tools/yulPhaser/ProgramCache.h b/tools/yulPhaser/ProgramCache.h index d0e51a37e..4c145d537 100644 --- a/tools/yulPhaser/ProgramCache.h +++ b/tools/yulPhaser/ProgramCache.h @@ -121,7 +121,7 @@ public: CacheStats gatherStats() const; - std::map const& entries() const { return m_entries; }; + std::map const& entries() const { return m_entries; } Program const& program() const { return m_program; } size_t currentRound() const { return m_currentRound; }