Skip to content

Commit

Permalink
small optimizations, deactivate SAN because of gcc bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Graeter committed Mar 28, 2024
1 parent c205cd2 commit fd5b77a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,6 @@ jobs:


steps:
- name: Set up Ubuntu version codename
id: set-codename
run: |
if [ "${{ matrix.os }}" == "ubuntu-20.04" ]; then
echo "::set-output name=ubuntu-codename::focal"
elif [ "${{ matrix.os }}" == "ubuntu-22.04" ]; then
echo "::set-output name=ubuntu-codename::jammy"
else
echo "::error ::Unsupported Ubuntu version"
exit 1
fi
- name: Check for llvm version mismatches
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
uses: actions/github-script@v3
Expand Down Expand Up @@ -204,7 +192,7 @@ jobs:
- name: Install cmake
run: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ ${{ steps.set-codename.outputs.ubuntu-codename }} main" && \
sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && \
sudo apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
sudo apt-get install -y --no-install-recommends cmake cmake-curses-gui
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# Set the project name and language
project(
anywho
VERSION 0.0.3
VERSION 0.0.7
DESCRIPTION ""
HOMEPAGE_URL "https://github.com/johannes-graeter/anywho"
LANGUAGES CXX C)
Expand Down
8 changes: 4 additions & 4 deletions ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ macro(anywho_supports_sanitizers)
set(SUPPORTS_UBSAN OFF)
endif()

if((CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*" OR CMAKE_CXX_COMPILER_ID MATCHES ".*GNU.*") AND WIN32)
# if((CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*" OR CMAKE_CXX_COMPILER_ID MATCHES ".*GNU.*") AND WIN32)
set(SUPPORTS_ASAN OFF)
else()
set(SUPPORTS_ASAN ON)
endif()
# else()
# set(SUPPORTS_ASAN ON)
# endif()
endmacro()

macro(anywho_setup_options)
Expand Down
8 changes: 4 additions & 4 deletions include/error_factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ template<typename T, concepts::Error E>
inline std::expected<T, E> make_error(bool has_no_error, T truth_value, E &&error)
{
if (has_no_error) {
return truth_value;
return std::expected<T, E>{ truth_value };
} else {
return std::unexpected(error);
}
Expand All @@ -40,7 +40,7 @@ inline std::expected<T, E> make_error(bool has_no_error, T truth_value, E &&erro
template<typename T, concepts::Error E>
inline std::expected<T, E> make_error(std::function<std::tuple<bool, T>(void)> callable, E &&error)
{
const auto &[has_no_error, truth_value] = callable();
const auto [has_no_error, truth_value] = callable();

return make_error(has_no_error, truth_value, std::move(error));
}
Expand All @@ -56,7 +56,7 @@ inline std::expected<T, E> make_error(std::function<std::tuple<bool, T>(void)> c
template<typename T> inline std::expected<T, ErrorFromCode> make_error(std::error_code error_code, T truth_value)
{
if (!error_code) {
return truth_value;
return std::expected<T, ErrorFromCode>{ truth_value };
} else {
return std::unexpected(ErrorFromCode(error_code));
}
Expand All @@ -73,7 +73,7 @@ template<typename T> inline std::expected<T, ErrorFromCode> make_error(std::erro
template<typename T>
inline std::expected<T, ErrorFromCode> make_error(std::function<std::tuple<std::error_code, T>(void)> callable)
{
const auto &[error_code, truth_value] = callable();
const auto [error_code, truth_value] = callable();

return make_error(error_code, truth_value);
}
Expand Down

0 comments on commit fd5b77a

Please sign in to comment.