Skip to content

Commit

Permalink
ToString: LOG(FATAL) for unhandled value (google#136)
Browse files Browse the repository at this point in the history
The cases are exhaustive, and this is not possible, but apparently
some compilers don't realize that and emit a warning.

Fixes google#114
  • Loading branch information
jmr authored Aug 31, 2020
1 parent 8b24624 commit cae6519
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/s2/s2builderutil_lax_polygon_layer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ string ToString(DegenerateBoundaries degenerate_boundaries) {
case DegenerateBoundaries::DISCARD_SHELLS: return "DISCARD_SHELLS";
case DegenerateBoundaries::KEEP: return "KEEP";
}
// Cases are exhaustive, but some compilers don't know that and emit a
// warning.
S2_LOG(FATAL) << "Unknown DegenerateBoundaries value: "
<< static_cast<int>(degenerate_boundaries);
}

void TestLaxPolygon(string_view input_str, string_view expected_str,
Expand Down

0 comments on commit cae6519

Please sign in to comment.