From 8200969d56391a4a4f9c9b01fd5eebebd105b373 Mon Sep 17 00:00:00 2001 From: flamewing Date: Fri, 22 Mar 2024 20:52:36 +0100 Subject: [PATCH] Disable -Wswitch-default when it does not make sense Namely, when all cases are handled in the switch. --- src/lib/comper.cc | 2 ++ src/lib/comperx.cc | 2 ++ src/lib/kosinski.cc | 3 +++ src/lib/kosplus.cc | 3 +++ src/lib/lzkn1.cc | 2 ++ src/lib/rocket.cc | 2 ++ src/lib/saxman.cc | 2 ++ 7 files changed, 16 insertions(+) diff --git a/src/lib/comper.cc b/src/lib/comper.cc index ddad31d..b420cc3 100644 --- a/src/lib/comper.cc +++ b/src/lib/comper.cc @@ -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: @@ -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(); diff --git a/src/lib/comperx.cc b/src/lib/comperx.cc index 1838ed7..5e70dff 100644 --- a/src/lib/comperx.cc +++ b/src/lib/comperx.cc @@ -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: @@ -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(); diff --git a/src/lib/kosinski.cc b/src/lib/kosinski.cc index 999fd53..1f084fc 100644 --- a/src/lib/kosinski.cc +++ b/src/lib/kosinski.cc @@ -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: @@ -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: @@ -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); diff --git a/src/lib/kosplus.cc b/src/lib/kosplus.cc index 2b260ad..839d448 100644 --- a/src/lib/kosplus.cc +++ b/src/lib/kosplus.cc @@ -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: @@ -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: @@ -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); diff --git a/src/lib/lzkn1.cc b/src/lib/lzkn1.cc index 6e68965..eb3e30a 100644 --- a/src/lib/lzkn1.cc +++ b/src/lib/lzkn1.cc @@ -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: @@ -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); diff --git a/src/lib/rocket.cc b/src/lib/rocket.cc index cc4818f..3713fa8 100644 --- a/src/lib/rocket.cc +++ b/src/lib/rocket.cc @@ -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: @@ -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); diff --git a/src/lib/saxman.cc b/src/lib/saxman.cc index b837e5f..33cf297 100644 --- a/src/lib/saxman.cc +++ b/src/lib/saxman.cc @@ -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: @@ -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);