Skip to content

Commit

Permalink
Add fallback for old cpptrace versions that don't provide <cpptrace/b…
Browse files Browse the repository at this point in the history
…asic.hpp>
  • Loading branch information
jeremy-rifkin committed Dec 22, 2024
1 parent ea0c1a9 commit 1bf749d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion include/libassert/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
#include <libassert/stringification.hpp>
#include <libassert/expression-decomposition.hpp>

#include <cpptrace/basic.hpp>
#if defined(__has_include) && __has_include(<cpptrace/basic.hpp>)
#include <cpptrace/basic.hpp>
#else
#include <cpptrace/cpptrace.hpp>
#endif

#ifdef __cpp_lib_expected
#include <expected>
Expand Down
8 changes: 6 additions & 2 deletions src/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
#include <utility>
#include <vector>

#include <cpptrace/basic.hpp>
#include <cpptrace/exceptions.hpp>
#if defined(__has_include) && __has_include(<cpptrace/basic.hpp>)
#include <cpptrace/basic.hpp>
#include <cpptrace/exceptions.hpp>
#else
#include <cpptrace/cpptrace.hpp>
#endif

#include "common.hpp"
#include "utils.hpp"
Expand Down
9 changes: 7 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
#include <vector>

#include <libassert/assert.hpp>
#include <cpptrace/basic.hpp>
#include <cpptrace/exceptions.hpp>

#if defined(__has_include) && __has_include(<cpptrace/basic.hpp>)
#include <cpptrace/basic.hpp>
#include <cpptrace/exceptions.hpp>
#else
#include <cpptrace/cpptrace.hpp>
#endif

#include "utils.hpp"
#include "microfmt.hpp"
Expand Down

0 comments on commit 1bf749d

Please sign in to comment.