Skip to content

Commit

Permalink
[MINOR] Silence compiler warnings (unnecessary switch default)
Browse files Browse the repository at this point in the history
Replacing switch default cases where all cases are covered with an exception as this should never happen.
  • Loading branch information
corepointer committed Sep 24, 2024
1 parent 000c22f commit ed2e2a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/runtime/local/kernels/EwUnarySca.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ EwUnaryScaFuncPtr<VTRes, VTArg> getEwUnaryScaFuncPtr(UnaryOpCode opCode) {
// Comparison.
MAKE_CASE(UnaryOpCode::ISNAN)
#undef MAKE_CASE
default:
throw std::runtime_error("unknown UnaryOpCode: " +
std::to_string(static_cast<int>(opCode)));
throw std::runtime_error("unknown UnaryOpCode: " + std::to_string(static_cast<int>(opCode)));
}
if (!res)
throw std::runtime_error(
Expand Down
13 changes: 4 additions & 9 deletions src/runtime/local/kernels/Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,19 @@ VTRes aggregate(const mlir::daphne::GroupEnum &aggFunc, const VTArg *begin,
using mlir::daphne::GroupEnum;
switch (aggFunc) {
case GroupEnum::COUNT:
return end - begin;
break; // TODO: Do we need to check for Null elements here?
return end - begin;// TODO: Do we need to check for Null elements here?
case GroupEnum::SUM:
return std::accumulate(begin, end, (VTRes)0);
break;
case GroupEnum::MIN:
return *std::min_element(begin, end);
break;
case GroupEnum::MAX:
return *std::max_element(begin, end);
break;
case GroupEnum::AVG:
return std::accumulate(begin, end, (double)0) / (double)(end - begin);
break;
default:
return *begin;
break;
// default:
// return *begin;
}
throw std::runtime_error("unknown value of mlir::daphne::GroupEnum");
}

// struct which calls the aggregate() function (specified via aggFunc) on each
Expand Down

0 comments on commit ed2e2a1

Please sign in to comment.