Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc: fix -Wnvro warning #4254

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1718,8 +1718,9 @@ auto find_escape(const Char* begin, const Char* end)

inline auto find_escape(const char* begin, const char* end)
-> find_escape_result<char> {
if (const_check(!use_utf8)) return find_escape<char>(begin, end);
auto result = find_escape_result<char>{end, nullptr, 0};
auto result = find_escape<char>(begin, end);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not eliding the 24 byte copy slower than unconditionally calling find_escape<char>?

if (const_check(!use_utf8)) return result;
result = find_escape_result<char>{end, nullptr, 0};
for_each_codepoint(string_view(begin, to_unsigned(end - begin)),
[&](uint32_t cp, string_view sv) {
if (needs_escape(cp)) {
Expand Down
Loading