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
425778aa
Commit
425778aa
authored
Oct 29, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ABI compatibility (#1961)
parent
69a84198
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
6 deletions
+44
-6
include/fmt/format-inl.h
include/fmt/format-inl.h
+10
-2
include/fmt/format.h
include/fmt/format.h
+9
-4
src/format.cc
src/format.cc
+25
-0
No files found.
include/fmt/format-inl.h
View file @
425778aa
...
@@ -261,11 +261,19 @@ const uint64_t basic_data<T>::powers_of_10_64[] = {
...
@@ -261,11 +261,19 @@ const uint64_t basic_data<T>::powers_of_10_64[] = {
10000000000000000000ULL
};
10000000000000000000ULL
};
template
<
typename
T
>
template
<
typename
T
>
const
uint32_t
basic_data
<
T
>::
zero_or_powers_of_10_32
[]
=
{
0
,
0
,
const
uint32_t
basic_data
<
T
>::
zero_or_powers_of_10_32
[]
=
{
0
,
FMT_POWERS_OF_10
(
1
)};
FMT_POWERS_OF_10
(
1
)};
template
<
typename
T
>
template
<
typename
T
>
const
uint64_t
basic_data
<
T
>::
zero_or_powers_of_10_64
[]
=
{
const
uint64_t
basic_data
<
T
>::
zero_or_powers_of_10_64
[]
=
{
0
,
FMT_POWERS_OF_10
(
1
),
FMT_POWERS_OF_10
(
1000000000ULL
),
10000000000000000000ULL
};
template
<
typename
T
>
const
uint32_t
basic_data
<
T
>::
zero_or_powers_of_10_32_new
[]
=
{
0
,
0
,
FMT_POWERS_OF_10
(
1
)};
template
<
typename
T
>
const
uint64_t
basic_data
<
T
>::
zero_or_powers_of_10_64_new
[]
=
{
0
,
0
,
FMT_POWERS_OF_10
(
1
),
FMT_POWERS_OF_10
(
1000000000ULL
),
0
,
0
,
FMT_POWERS_OF_10
(
1
),
FMT_POWERS_OF_10
(
1000000000ULL
),
10000000000000000000ULL
};
10000000000000000000ULL
};
...
...
include/fmt/format.h
View file @
425778aa
...
@@ -866,8 +866,8 @@ template <typename T> struct FMT_EXTERN_TEMPLATE_API divtest_table_entry {
...
@@ -866,8 +866,8 @@ template <typename T> struct FMT_EXTERN_TEMPLATE_API divtest_table_entry {
// Static data is placed in this class template for the header-only config.
// Static data is placed in this class template for the header-only config.
template
<
typename
T
=
void
>
struct
FMT_EXTERN_TEMPLATE_API
basic_data
{
template
<
typename
T
=
void
>
struct
FMT_EXTERN_TEMPLATE_API
basic_data
{
static
const
uint64_t
powers_of_10_64
[];
static
const
uint64_t
powers_of_10_64
[];
static
const
uint32_t
zero_or_powers_of_10_32
[];
static
const
uint32_t
zero_or_powers_of_10_32
_new
[];
static
const
uint64_t
zero_or_powers_of_10_64
[];
static
const
uint64_t
zero_or_powers_of_10_64
_new
[];
static
const
uint64_t
grisu_pow10_significands
[];
static
const
uint64_t
grisu_pow10_significands
[];
static
const
int16_t
grisu_pow10_exponents
[];
static
const
int16_t
grisu_pow10_exponents
[];
static
const
divtest_table_entry
<
uint32_t
>
divtest_table_for_pow5_32
[];
static
const
divtest_table_entry
<
uint32_t
>
divtest_table_for_pow5_32
[];
...
@@ -891,6 +891,10 @@ template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
...
@@ -891,6 +891,10 @@ template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
static
const
char
signs
[];
static
const
char
signs
[];
static
const
char
left_padding_shifts
[
5
];
static
const
char
left_padding_shifts
[
5
];
static
const
char
right_padding_shifts
[
5
];
static
const
char
right_padding_shifts
[
5
];
// DEPRECATED! These are for ABI compatibility.
static
const
uint32_t
zero_or_powers_of_10_32
[];
static
const
uint64_t
zero_or_powers_of_10_64
[];
};
};
// Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)).
// Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)).
...
@@ -917,7 +921,7 @@ struct data : basic_data<> {};
...
@@ -917,7 +921,7 @@ struct data : basic_data<> {};
inline
int
count_digits
(
uint64_t
n
)
{
inline
int
count_digits
(
uint64_t
n
)
{
// https://github.com/fmtlib/format-benchmark/blob/master/digits10
// https://github.com/fmtlib/format-benchmark/blob/master/digits10
auto
t
=
bsr2log10
(
FMT_BUILTIN_CLZLL
(
n
|
1
)
^
63
);
auto
t
=
bsr2log10
(
FMT_BUILTIN_CLZLL
(
n
|
1
)
^
63
);
return
t
-
(
n
<
data
::
zero_or_powers_of_10_64
[
t
]);
return
t
-
(
n
<
data
::
zero_or_powers_of_10_64
_new
[
t
]);
}
}
#else
#else
// Fallback version of count_digits used when __builtin_clz is not available.
// Fallback version of count_digits used when __builtin_clz is not available.
...
@@ -984,7 +988,7 @@ template <> int count_digits<4>(detail::fallback_uintptr n);
...
@@ -984,7 +988,7 @@ template <> int count_digits<4>(detail::fallback_uintptr n);
// Optional version of count_digits for better performance on 32-bit platforms.
// Optional version of count_digits for better performance on 32-bit platforms.
inline
int
count_digits
(
uint32_t
n
)
{
inline
int
count_digits
(
uint32_t
n
)
{
auto
t
=
bsr2log10
(
FMT_BUILTIN_CLZ
(
n
|
1
)
^
31
);
auto
t
=
bsr2log10
(
FMT_BUILTIN_CLZ
(
n
|
1
)
^
31
);
return
t
-
(
n
<
data
::
zero_or_powers_of_10_32
[
t
]);
return
t
-
(
n
<
data
::
zero_or_powers_of_10_32
_new
[
t
]);
}
}
#endif
#endif
...
@@ -3785,6 +3789,7 @@ extern template void detail::vformat_to(detail::buffer<char>&, string_view,
...
@@ -3785,6 +3789,7 @@ extern template void detail::vformat_to(detail::buffer<char>&, string_view,
basic_format_args
<
format_context
>
,
basic_format_args
<
format_context
>
,
detail
::
locale_ref
);
detail
::
locale_ref
);
namespace
detail
{
namespace
detail
{
extern
template
FMT_API
std
::
string
grouping_impl
<
char
>(
locale_ref
loc
);
extern
template
FMT_API
std
::
string
grouping_impl
<
char
>(
locale_ref
loc
);
extern
template
FMT_API
std
::
string
grouping_impl
<
wchar_t
>(
locale_ref
loc
);
extern
template
FMT_API
std
::
string
grouping_impl
<
wchar_t
>(
locale_ref
loc
);
extern
template
FMT_API
char
thousands_sep_impl
<
char
>(
locale_ref
loc
);
extern
template
FMT_API
char
thousands_sep_impl
<
char
>(
locale_ref
loc
);
...
...
src/format.cc
View file @
425778aa
...
@@ -28,6 +28,31 @@ template dragonbox::decimal_fp<float> dragonbox::to_decimal(float x)
...
@@ -28,6 +28,31 @@ template dragonbox::decimal_fp<float> dragonbox::to_decimal(float x)
FMT_NOEXCEPT
;
FMT_NOEXCEPT
;
template
dragonbox
::
decimal_fp
<
double
>
dragonbox
::
to_decimal
(
double
x
)
template
dragonbox
::
decimal_fp
<
double
>
dragonbox
::
to_decimal
(
double
x
)
FMT_NOEXCEPT
;
FMT_NOEXCEPT
;
// DEPRECATED! This function exists for ABI compatibility.
template
<
typename
Char
>
typename
basic_format_context
<
std
::
back_insert_iterator
<
buffer
<
Char
>>
,
Char
>::
iterator
vformat_to
(
buffer
<
Char
>&
buf
,
basic_string_view
<
Char
>
format_str
,
basic_format_args
<
basic_format_context
<
std
::
back_insert_iterator
<
buffer
<
type_identity_t
<
Char
>>>
,
type_identity_t
<
Char
>>>
args
)
{
using
iterator
=
std
::
back_insert_iterator
<
buffer
<
char
>>
;
using
context
=
basic_format_context
<
std
::
back_insert_iterator
<
buffer
<
type_identity_t
<
Char
>>>
,
type_identity_t
<
Char
>>
;
auto
out
=
iterator
(
buf
);
format_handler
<
iterator
,
Char
,
context
>
h
(
out
,
format_str
,
args
,
{});
parse_format_string
<
false
>
(
format_str
,
h
);
return
out
;
}
template
basic_format_context
<
std
::
back_insert_iterator
<
buffer
<
char
>
>
,
char
>::
iterator
vformat_to
(
buffer
<
char
>&
,
string_view
,
basic_format_args
<
basic_format_context
<
std
::
back_insert_iterator
<
buffer
<
type_identity_t
<
char
>>>
,
type_identity_t
<
char
>>>
);
}
// namespace detail
}
// namespace detail
template
struct
FMT_INSTANTIATION_DEF_API
detail
::
basic_data
<
void
>;
template
struct
FMT_INSTANTIATION_DEF_API
detail
::
basic_data
<
void
>;
...
...
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