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

Fix C++ warnings due to missing default cases in switch statements #896

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CPP/Clipper2Lib/include/clipper2/clipper.core.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ namespace Clipper2Lib
throw Clipper2Exception(undefined_error);
case range_error_i:
throw Clipper2Exception(range_error);
// Should never happen, but adding this to stop a compiler warning
default:
throw Clipper2Exception("Unknown error");
}
#else
++error_code; // only to stop compiler warning
Expand Down
6 changes: 6 additions & 0 deletions CPP/Clipper2Lib/src/clipper.engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,9 @@ namespace Clipper2Lib {
case FillRule::Negative:
if (e.wind_cnt != -1) return false;
break;
// Should never happen, but adding this to stop a compiler warning
default:
break;
}

switch (cliptype_)
Expand Down Expand Up @@ -978,6 +981,9 @@ namespace Clipper2Lib {
break;

case ClipType::Xor: return true; break;
// Should never happen, but adding this to stop a compiler warning
default:
break;
}
return false; // we should never get here
}
Expand Down
Loading