RESTinio
include_fmtlib.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
12#pragma once
13
14// Because fmt can include `windows.h` we should include
15// Asio's header before fmt.
16//
17// Since v.0.6.1
19
20#if defined(__GNUG__) || defined(__clang__)
21
22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Wpedantic"
24#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
25
26#if defined(__clang__)
27 #pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template"
28#endif
29
30#endif
31
32#include <fmt/format.h>
33#include <fmt/ostream.h>
34#if FMT_VERSION < 60000
35 #include <fmt/time.h>
36#else
37 #include <fmt/chrono.h>
38#endif
39
40// Workaround for absence of fmt::runtime in fmtlib prior to v8.0.0.
41namespace restinio
42{
43
44namespace fmtlib_tools
45{
46
47#if FMT_VERSION < 80000
48inline auto
49runtime_format_string( const char * fmt_string ) noexcept
50{
51 return fmt_string;
52}
53#else
54inline auto
55runtime_format_string( const char * fmt_string )
56{
57 return fmt::runtime( fmt_string );
58}
59#endif
60
61} /* namespace fmtlib_tools */
62
63} /* namespace restinio */
64
65#if defined(__GNUG__) || defined(__clang__)
66
67#pragma GCC diagnostic pop
68
69#endif
auto runtime_format_string(const char *fmt_string) noexcept