diff options
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/app/maze.tpp | 3 | ||||
-rw-r--r-- | src/mazerator.cpp | 5 |
3 files changed, 17 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b23ae1..e7b43c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,15 @@ target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Wshadow - -Wold-style-cast -Wcast-align -Wunused - -Wconversion -pedantic -fsanitize=address + -Wold-style-cast -Wcast-align -Wno-unused + -Wconversion -Wcast-qual -Wctor-dtor-privacy + -Wdisabled-optimization -Wformat=2 -Winit-self + -Wlogical-op -Wmissing-declarations + -Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual + -Wredundant-decls -Wsign-conversion -Wsign-promo + -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default + -Wundef -Werror + -pedantic -fsanitize=address ) target_include_directories(${PROJECT_NAME} PRIVATE src) diff --git a/src/app/maze.tpp b/src/app/maze.tpp index f0098a1..12422c3 100644 --- a/src/app/maze.tpp +++ b/src/app/maze.tpp @@ -8,6 +8,8 @@ #include <utility> #include <vector> +namespace +{ /** * Returns the neighbours of a position in a maze. * @@ -97,6 +99,7 @@ void pos_to_between(const std::shared_ptr<Vector2> &between_pos, unsigned int co *between_pos -= diff; } } +} // namespace template <typename Element> void matrix_to_maze(Matrix<Element> *matrix, std::shared_ptr<Vector2> start_pos, diff --git a/src/mazerator.cpp b/src/mazerator.cpp index a884bbd..6a0d1aa 100644 --- a/src/mazerator.cpp +++ b/src/mazerator.cpp @@ -16,6 +16,8 @@ constexpr unsigned int DEFAULT_MAZE_HEIGHT = 20U; constexpr std::string_view DEFAULT_MAZE_WALL = "█"; +namespace +{ void optarg_error(int arg, const std::string &error) { std::cout << "Error: Invalid option argument for -" << arg << ". " << error @@ -46,6 +48,7 @@ void parse_uint_arg(unsigned int *num_dst, int arg, bool check_zero = false) optarg_error(arg, std::string(error)); } } +} // namespace const std::array<option, 8> options = { option({"width", required_argument, nullptr, 'w'}), @@ -149,6 +152,8 @@ int main(int argc, char *argv[]) << std::endl; return EXIT_FAILURE; } + default: + abort(); } } |