Skip to content

Commit

Permalink
IOSS: Do not use default case in switch if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Feb 2, 2025
1 parent 357a03d commit 5f41a7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/seacas/libraries/ioss/src/Ioss_Field.C
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright(C) 1999-2024 National Technology & Engineering Solutions
// Copyright(C) 1999-2025 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
Expand Down Expand Up @@ -407,8 +407,8 @@ std::string Ioss::Field::type_string(Ioss::Field::BasicType type)
case Ioss::Field::STRING: return {"string"};
case Ioss::Field::CHARACTER: return {"char"};
case Ioss::Field::INVALID: return {"invalid"};
default: return {"internal error"};
}
return {"internal error"};
}

std::string Ioss::Field::role_string() const { return role_string(get_role()); }
Expand All @@ -417,14 +417,15 @@ std::string Ioss::Field::role_string(Ioss::Field::RoleType role)
{
switch (role) {
case Ioss::Field::INTERNAL: return {"Internal"};
case Ioss::Field::MAP: return {"Map"};
case Ioss::Field::MESH: return {"Mesh"};
case Ioss::Field::ATTRIBUTE: return {"Attribute"};
case Ioss::Field::COMMUNICATION: return {"Communication"};
case Ioss::Field::MESH_REDUCTION: return {"Mesh Reduction"};
case Ioss::Field::REDUCTION: return {"Reduction"};
case Ioss::Field::TRANSIENT: return {"Transient"};
default: return {"internal error"};
}
return {"internal error"};
}

namespace {
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/ioss/src/Ioss_Property.C
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions
// Copyright(C) 1999-2021, 2023, 2025 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
Expand All @@ -22,8 +22,8 @@ namespace {
case Ioss::Property::STRING: return {"string"};
case Ioss::Property::VEC_INTEGER: return {"vector<int>"};
case Ioss::Property::VEC_DOUBLE: return {"vector<double>"};
default: return {"internal error"};
}
return {"internal error"};
}

void error_message(const Ioss::Property &property, const std::string &requested_type)
Expand Down

0 comments on commit 5f41a7e

Please sign in to comment.