Skip to content

Commit

Permalink
Merge pull request #13 from threeal/modify-cxx-flags
Browse files Browse the repository at this point in the history
Modify C++ Compiler Flags
  • Loading branch information
threeal authored Dec 21, 2022
2 parents 83124f8 + 9f0ef8a commit a7b06e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: pip3 install cmake-format

- name: Configure CMake
run: cmake . -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja -DBUILD_TESTING=ON
run: cmake . -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS='-Werror'

- name: Check code formatting
run: cmake --build build --target check-format
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.14)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wpedantic")

project(result)

Expand All @@ -12,10 +13,10 @@ target_include_directories(result INTERFACE include)

if(BUILD_TESTING)
enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -coverage -g -O0")

find_package(Catch2 REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fPIC -O0")
add_executable(result_test test/result_test.cpp test/result_or_test.cpp)
target_link_libraries(result_test PRIVATE result Catch2::Catch2WithMain)
catch_discover_tests(result_test)
Expand Down
2 changes: 1 addition & 1 deletion include/result/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Result {

public:
Result() : Result(Err("result is uninitialized")) {}
Result(const Ok& ok) {}
Result(const Ok&) {}
Result(const Err& err) : err_opt(err) {}

bool is_ok() const { return !err_opt.has_value(); }
Expand Down

0 comments on commit a7b06e8

Please sign in to comment.