Skip to content

Commit

Permalink
Disable -Wswitch-default when it does not make sense
Browse files Browse the repository at this point in the history
Namely, when all cases are handled in the switch.
  • Loading branch information
flamewing committed Mar 22, 2024
1 parent 22f1205 commit 8200969
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/comper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class comper_internal {
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
ignore_unused_variable_warning(length);
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand Down Expand Up @@ -159,6 +160,7 @@ class comper_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise: {
size_t const value = edge.get_symbol();
Expand Down
2 changes: 2 additions & 0 deletions src/lib/comperx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class comperx_internal {
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
ignore_unused_variable_warning(length);
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand Down Expand Up @@ -164,6 +165,7 @@ class comperx_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise: {
size_t const value = edge.get_symbol();
Expand Down
3 changes: 3 additions & 0 deletions src/lib/kosinski.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class kosinski_internal {
// Given an edge type, computes how many bits are used in the descriptor
// field.
constexpr static size_t desc_bits(edge_type const type) noexcept {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand All @@ -109,6 +110,7 @@ class kosinski_internal {
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
ignore_unused_variable_warning(length);
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand Down Expand Up @@ -216,6 +218,7 @@ class kosinski_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise:
output.descriptor_bit(1);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/kosplus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class kosplus_internal {
// Given an edge type, computes how many bits are used in the descriptor
// field.
constexpr static size_t desc_bits(edge_type const type) noexcept {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand All @@ -109,6 +110,7 @@ class kosplus_internal {
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
ignore_unused_variable_warning(length);
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand Down Expand Up @@ -212,6 +214,7 @@ class kosplus_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise:
output.descriptor_bit(1);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/lzkn1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class lzkn1_internal {
// or "no edge".
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case symbolwise:
Expand Down Expand Up @@ -223,6 +224,7 @@ class lzkn1_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise:
output.descriptor_bit(0);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/rocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct rocket_internal {
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
ignore_unused_variable_warning(length);
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case terminator:
Expand Down Expand Up @@ -181,6 +182,7 @@ struct rocket_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise:
output.descriptor_bit(1);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/saxman.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class saxman_internal {
constexpr static size_t edge_weight(
edge_type const type, size_t length) noexcept {
ignore_unused_variable_warning(length);
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (type) {
using enum edge_type;
case terminator:
Expand Down Expand Up @@ -218,6 +219,7 @@ class saxman_internal {

// Go through each edge in the optimal path.
for (auto const& edge : list.parse_list) {
// NOLINTNEXTLINE(clang-diagnostic-switch-default)
switch (edge.get_type()) {
case edge_type::symbolwise:
output.descriptor_bit(1);
Expand Down

0 comments on commit 8200969

Please sign in to comment.