Commit 8570ffb5649e5f80e284e4985441cfcfd59c44dc

Authored by Henry Schreiner
Committed by GitHub
1 parent 417a978a

Check for switch enum (#393)

* Check for switch enum

* Add missing cases
CMakeLists.txt
... ... @@ -62,7 +62,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
62 62 target_compile_options(CLI11_warnings INTERFACE "/WX")
63 63 endif()
64 64 else()
65   - target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow -Wsign-conversion)
  65 + target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow -Wsign-conversion -Wswitch-enum)
66 66 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
67 67 if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
68 68 # GCC 4.8 has a false positive
... ...
include/CLI/Validators.hpp
... ... @@ -283,6 +283,13 @@ inline path_type check_path(const char *file) noexcept {
283 283 return path_type::nonexistant;
284 284 case std::filesystem::file_type::directory:
285 285 return path_type::directory;
  286 + case std::filesystem::file_type::symlink:
  287 + case std::filesystem::file_type::block:
  288 + case std::filesystem::file_type::character:
  289 + case std::filesystem::file_type::fifo:
  290 + case std::filesystem::file_type::socket:
  291 + case std::filesystem::file_type::regular:
  292 + case std::filesystem::file_type::unknown:
286 293 default:
287 294 return path_type::file;
288 295 }
... ...