From 8570ffb5649e5f80e284e4985441cfcfd59c44dc Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 8 Jan 2020 10:17:36 -0500 Subject: [PATCH] Check for switch enum (#393) * Check for switch enum * Add missing cases --- CMakeLists.txt | 2 +- include/CLI/Validators.hpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 400e946c..67fca85b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) target_compile_options(CLI11_warnings INTERFACE "/WX") endif() else() - target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow -Wsign-conversion) + target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow -Wsign-conversion -Wswitch-enum) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) # GCC 4.8 has a false positive diff --git a/include/CLI/Validators.hpp b/include/CLI/Validators.hpp index 2137e952..d51d6b3a 100644 --- a/include/CLI/Validators.hpp +++ b/include/CLI/Validators.hpp @@ -283,6 +283,13 @@ inline path_type check_path(const char *file) noexcept { return path_type::nonexistant; case std::filesystem::file_type::directory: return path_type::directory; + case std::filesystem::file_type::symlink: + case std::filesystem::file_type::block: + case std::filesystem::file_type::character: + case std::filesystem::file_type::fifo: + case std::filesystem::file_type::socket: + case std::filesystem::file_type::regular: + case std::filesystem::file_type::unknown: default: return path_type::file; }