Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
2f9acd18
Commit
2f9acd18
authored
Nov 29, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dependency on <cassert>
parent
aaf829bf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
11 deletions
+25
-11
include/fmt/color.h
include/fmt/color.h
+3
-3
include/fmt/core.h
include/fmt/core.h
+12
-5
include/fmt/format-inl.h
include/fmt/format-inl.h
+6
-2
include/fmt/format.h
include/fmt/format.h
+3
-1
test/format
test/format
+1
-0
No files found.
include/fmt/color.h
View file @
2f9acd18
...
@@ -299,15 +299,15 @@ class text_style {
...
@@ -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
;
}
}
...
...
include/fmt/core.h
View file @
2f9acd18
...
@@ -8,7 +8,6 @@
...
@@ -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 @@
...
@@ -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 {
...
@@ -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)
...
...
include/fmt/format-inl.h
View file @
2f9acd18
...
@@ -10,8 +10,7 @@
...
@@ -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 {}; }
...
@@ -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
...
...
include/fmt/format.h
View file @
2f9acd18
...
@@ -220,7 +220,9 @@ inline Dest bit_cast(const Source& source) {
...
@@ -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
;
}
}
...
...
test/format
View file @
2f9acd18
...
@@ -8,6 +8,7 @@
...
@@ -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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment