Skip to content

Commit

Permalink
Fix issue causing -Wcovered-switch-default
Browse files Browse the repository at this point in the history
Summary: Use same pattern used in `toAppendDoubleConversion`.

Reviewed By: yfeldblum

Differential Revision: D60627686

fbshipit-source-id: d015a361d3798b72b9b25c4c600a871f99b5daaa
  • Loading branch information
skrueger authored and facebook-github-bot committed Aug 3, 2024
1 parent 7145c45 commit 8cde06b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions folly/Conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@ toAppendStdToChars(
std::to_chars_result conv_result;
char buffer[256];
char* const bufferEnd = buffer + sizeof(buffer);
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wcovered-switch-default")
switch (mode) {
case DtoaMode::SHORTEST: {
if (useShortestFixed) {
Expand Down Expand Up @@ -1029,12 +1031,13 @@ toAppendStdToChars(
buffer, bufferEnd, value, std::chars_format::fixed, numDigits);
break;
case DtoaMode::PRECISION:
default:
assert(mode == DtoaMode::PRECISION);
conv_result = std::to_chars(
buffer, bufferEnd, value, std::chars_format::general, numDigits);
break;
default:
folly::throw_exception<std::invalid_argument>("Unsupported DtoaMode");
}
FOLLY_POP_WARNING

auto [resultEnd, ec] = conv_result;
if (ec != std::errc()) {
Expand Down

0 comments on commit 8cde06b

Please sign in to comment.