Remove dependency on <cassert>
This commit is contained in:
parent
aaf829bfb1
commit
2f9acd1838
@ -299,15 +299,15 @@ class text_style {
|
|||||||
return static_cast<uint8_t>(ems) != 0;
|
return static_cast<uint8_t>(ems) != 0;
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR internal::color_type get_foreground() const FMT_NOEXCEPT {
|
FMT_CONSTEXPR internal::color_type get_foreground() const FMT_NOEXCEPT {
|
||||||
assert(has_foreground() && "no foreground specified for this style");
|
FMT_ASSERT(has_foreground(), "no foreground specified for this style");
|
||||||
return foreground_color;
|
return foreground_color;
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR internal::color_type get_background() const FMT_NOEXCEPT {
|
FMT_CONSTEXPR internal::color_type get_background() const FMT_NOEXCEPT {
|
||||||
assert(has_background() && "no background specified for this style");
|
FMT_ASSERT(has_background(), "no background specified for this style");
|
||||||
return background_color;
|
return background_color;
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR emphasis get_emphasis() const FMT_NOEXCEPT {
|
FMT_CONSTEXPR emphasis get_emphasis() const FMT_NOEXCEPT {
|
||||||
assert(has_emphasis() && "no emphasis specified for this style");
|
FMT_ASSERT(has_emphasis(), "no emphasis specified for this style");
|
||||||
return ems;
|
return ems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#ifndef FMT_CORE_H_
|
#ifndef FMT_CORE_H_
|
||||||
#define FMT_CORE_H_
|
#define FMT_CORE_H_
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstdio> // std::FILE
|
#include <cstdio> // std::FILE
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@ -187,10 +186,6 @@
|
|||||||
# define FMT_EXTERN
|
# define FMT_EXTERN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FMT_ASSERT
|
|
||||||
# define FMT_ASSERT(condition, message) assert((condition) && (message))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// libc++ supports string_view in pre-c++17.
|
// libc++ supports string_view in pre-c++17.
|
||||||
#if (FMT_HAS_INCLUDE(<string_view>) && \
|
#if (FMT_HAS_INCLUDE(<string_view>) && \
|
||||||
(__cplusplus > 201402L || defined(_LIBCPP_VERSION))) || \
|
(__cplusplus > 201402L || defined(_LIBCPP_VERSION))) || \
|
||||||
@ -229,6 +224,18 @@ namespace internal {
|
|||||||
// A workaround for gcc 4.8 to make void_t work in a SFINAE context.
|
// A workaround for gcc 4.8 to make void_t work in a SFINAE context.
|
||||||
template <typename... Ts> struct void_t_impl { using type = void; };
|
template <typename... Ts> struct void_t_impl { using type = void; };
|
||||||
|
|
||||||
|
void assert_fail(const char* file, int line, const char* message);
|
||||||
|
|
||||||
|
#ifndef FMT_ASSERT
|
||||||
|
# ifdef NDEBUG
|
||||||
|
# define FMT_ASSERT(condition, message)
|
||||||
|
# else
|
||||||
|
# define FMT_ASSERT(condition, message) \
|
||||||
|
if (!(condition)) \
|
||||||
|
fmt::internal::assert_fail(__FILE__, __LINE__, (message))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(FMT_USE_STRING_VIEW)
|
#if defined(FMT_USE_STRING_VIEW)
|
||||||
template <typename Char> using std_string_view = std::basic_string_view<Char>;
|
template <typename Char> using std_string_view = std::basic_string_view<Char>;
|
||||||
#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
|
#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cassert>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
@ -57,6 +56,11 @@ inline fmt::internal::null<> strerror_s(char*, std::size_t, ...) { return {}; }
|
|||||||
FMT_BEGIN_NAMESPACE
|
FMT_BEGIN_NAMESPACE
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
|
||||||
|
print(stderr, "{}:{}: assertion failed: {}", file, line, message);
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
# define FMT_SNPRINTF snprintf
|
# define FMT_SNPRINTF snprintf
|
||||||
#else // _MSC_VER
|
#else // _MSC_VER
|
||||||
|
@ -220,7 +220,9 @@ inline Dest bit_cast(const Source& source) {
|
|||||||
|
|
||||||
inline bool is_big_endian() {
|
inline bool is_big_endian() {
|
||||||
auto u = 1u;
|
auto u = 1u;
|
||||||
struct bytes { char data[sizeof(u)]; };
|
struct bytes {
|
||||||
|
char data[sizeof(u)];
|
||||||
|
};
|
||||||
return bit_cast<bytes>(u).data[0] == 0;
|
return bit_cast<bytes>(u).data[0] == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#ifndef FMT_FORMAT_
|
#ifndef FMT_FORMAT_
|
||||||
#define FMT_FORMAT_
|
#define FMT_FORMAT_
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user