Check for switch enum (#393)

* Check for switch enum

* Add missing cases
This commit is contained in:
Henry Schreiner
2020-01-08 10:17:36 -05:00
committed by GitHub
parent 417a978aba
commit 8570ffb564
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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;
}