aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/fmt.cc
blob: bff5af0208bd85b7942fd086c4c2602c78caa344 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "fmt.hh" // IWYU pragma: keep
// Darwin and FreeBSD stdenv do not define _GNU_SOURCE but do have _Unwind_Backtrace.
#if __APPLE__ || __FreeBSD__
#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
#endif
#include <boost/stacktrace/stacktrace.hpp>

template class boost::basic_format<char>;

namespace nix {

// Explicit instantiation saves about 30 cpu-seconds of compile time
template HintFmt::HintFmt(const std::string &, const Uncolored<std::string> &s);
template HintFmt::HintFmt(const std::string &, const std::string &s);
template HintFmt::HintFmt(const std::string &, const uint64_t &, const char * const &);

HintFmt::HintFmt(const std::string & literal) : HintFmt("%s", Uncolored(literal)) {}

void printStackTrace()
{
    std::cerr << boost::stacktrace::stacktrace() << std::endl;
}

}