Skip to content

Commit

Permalink
Remove legacy make_args_checked
Browse files Browse the repository at this point in the history
  • Loading branch information
phprus committed Feb 12, 2022
1 parent e88e8bd commit 2137e17
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
5 changes: 1 addition & 4 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ binary footprint, for example (https://godbolt.org/z/oba4Mc):

template <typename S, typename... Args>
void log(const char* file, int line, const S& format, Args&&... args) {
vlog(file, line, format,
fmt::make_args_checked<Args...>(format, args...));
vlog(file, line, format, fmt::make_format_args(args...));
}

#define MY_LOG(format, ...) \
Expand All @@ -125,8 +124,6 @@ binary footprint, for example (https://godbolt.org/z/oba4Mc):
Note that ``vlog`` is not parameterized on argument types which improves compile
times and reduces binary code size compared to a fully parameterized version.

.. doxygenfunction:: fmt::make_args_checked(const S&, const remove_reference_t<Args>&...)

.. doxygenfunction:: fmt::make_format_args(const Args&...)

.. doxygenclass:: fmt::format_arg_store
Expand Down
21 changes: 0 additions & 21 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -825,27 +825,6 @@ class FMT_API format_error : public std::runtime_error {
~format_error() noexcept override FMT_MSC_DEFAULT;
};

/**
\rst
Constructs a `~fmt::format_arg_store` object that contains references
to arguments and can be implicitly converted to `~fmt::format_args`.
If ``fmt`` is a compile-time string then `make_args_checked` checks
its validity at compile time.
\endrst
*/
template <typename... Args, typename S, typename Char = char_t<S>>
FMT_INLINE auto make_args_checked(const S& fmt,
const remove_reference_t<Args>&... args)
-> format_arg_store<buffer_context<Char>, remove_reference_t<Args>...> {
static_assert(
detail::count<(
std::is_base_of<detail::view, remove_reference_t<Args>>::value &&
std::is_reference<Args>::value)...>() == 0,
"passing views as lvalues is disallowed");
detail::check_format_string<Args...>(fmt);
return {args...};
}

// compile-time support
namespace detail_exported {
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
Expand Down
7 changes: 0 additions & 7 deletions test/module-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,6 @@ TEST(module_test, wformat_args) {
EXPECT_TRUE(args.get(0));
}

TEST(module_test, checked_format_args) {
fmt::basic_format_args args = fmt::make_args_checked<int>("{}", 42);
EXPECT_TRUE(args.get(0));
fmt::basic_format_args wargs = fmt::make_args_checked<int>(L"{}", 42);
EXPECT_TRUE(wargs.get(0));
}

TEST(module_test, dynamic_format_args) {
fmt::dynamic_format_arg_store<fmt::format_context> dyn_store;
dyn_store.push_back(fmt::arg("a42", 42));
Expand Down

0 comments on commit 2137e17

Please sign in to comment.