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
e46392ea
Commit
e46392ea
authored
Dec 12, 2021
by
Alexey Ochapov
Committed by
Victor Zverovich
Dec 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deprecate _format UDL in code using FMT_DEPRECATED
parent
c882790a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
include/fmt/format.h
include/fmt/format.h
+1
-1
test/format-test.cc
test/format-test.cc
+18
-0
No files found.
include/fmt/format.h
View file @
e46392ea
...
@@ -3056,7 +3056,7 @@ constexpr auto operator"" _a(const char* s, size_t) -> detail::udl_arg<char> {
...
@@ -3056,7 +3056,7 @@ constexpr auto operator"" _a(const char* s, size_t) -> detail::udl_arg<char> {
using namespace fmt::literals;
using namespace fmt::literals;
std::string message = "The answer is {}"_format(42);
std::string message = "The answer is {}"_format(42);
*/
*/
constexpr
auto
operator
""
_format
(
const
char
*
s
,
size_t
n
)
FMT_DEPRECATED
constexpr
auto
operator
""
_format
(
const
char
*
s
,
size_t
n
)
->
detail
::
udl_formatter
<
char
>
{
->
detail
::
udl_formatter
<
char
>
{
return
{{
s
,
n
}};
return
{{
s
,
n
}};
}
}
...
...
test/format-test.cc
View file @
e46392ea
...
@@ -1761,6 +1761,21 @@ TEST(format_test, custom_format_compile_time_string) {
...
@@ -1761,6 +1761,21 @@ TEST(format_test, custom_format_compile_time_string) {
using
namespace
fmt
::
literals
;
using
namespace
fmt
::
literals
;
# if FMT_GCC_VERSION
# define FMT_CHECK_DEPRECATED_UDL_FORMAT 1
# elif FMT_CLANG_VERSION && defined(__has_warning)
# if __has_warning("-Wdeprecated-declarations")
# define FMT_CHECK_DEPRECATED_UDL_FORMAT 1
# endif
# endif
# ifndef FMT_CHECK_DEPRECATED_UDL_FORMAT
# define FMT_CHECK_DEPRECATED_UDL_FORMAT 0
# endif
# if FMT_CHECK_DEPRECATED_UDL_FORMAT
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
TEST
(
format_test
,
format_udl
)
{
TEST
(
format_test
,
format_udl
)
{
EXPECT_EQ
(
"{}c{}"
_format
(
"ab"
,
1
),
fmt
::
format
(
"{}c{}"
,
"ab"
,
1
));
EXPECT_EQ
(
"{}c{}"
_format
(
"ab"
,
1
),
fmt
::
format
(
"{}c{}"
,
"ab"
,
1
));
EXPECT_EQ
(
"foo"
_format
(),
"foo"
);
EXPECT_EQ
(
"foo"
_format
(),
"foo"
);
...
@@ -1768,6 +1783,9 @@ TEST(format_test, format_udl) {
...
@@ -1768,6 +1783,9 @@ TEST(format_test, format_udl) {
EXPECT_EQ
(
"{}"
_format
(
date
(
2015
,
10
,
21
)),
"2015-10-21"
);
EXPECT_EQ
(
"{}"
_format
(
date
(
2015
,
10
,
21
)),
"2015-10-21"
);
}
}
# pragma GCC diagnostic pop
# endif
TEST
(
format_test
,
named_arg_udl
)
{
TEST
(
format_test
,
named_arg_udl
)
{
auto
udl_a
=
fmt
::
format
(
"{first}{second}{first}{third}"
,
"first"
_a
=
"abra"
,
auto
udl_a
=
fmt
::
format
(
"{first}{second}{first}{third}"
,
"first"
_a
=
"abra"
,
"second"
_a
=
"cad"
,
"third"
_a
=
99
);
"second"
_a
=
"cad"
,
"third"
_a
=
99
);
...
...
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