From 86bb60deeeb7c26d85e352e99b40014357f8066c Mon Sep 17 00:00:00 2001 From: Christoph Weiss Date: Tue, 20 Oct 2020 13:10:43 +0200 Subject: [PATCH] Add -Wsuggest-override We also add the suggested `override` keyword. --- CMakeLists.txt | 2 +- include/cxxopts.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3098445..feec2cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wshadow -Weffc++ -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wshadow -Weffc++ -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion -Wsuggest-override") endif() add_library(cxxopts INTERFACE) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 88e8a02..6ec7998 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -951,7 +951,7 @@ namespace cxxopts CXXOPTS_NODISCARD std::shared_ptr - clone() const + clone() const override { return std::make_shared>(*this); }