diff options
author | Robert Hensing <robert@roberthensing.nl> | 2023-04-03 18:11:42 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2023-04-03 18:45:20 +0200 |
commit | fba7be80eb0fab54b570623d3991739cf3da0759 (patch) | |
tree | 5d1e6a52ebf94fa353d29dfec6a7cf49b8f27d37 /src/libutil/logging.cc | |
parent | 9470ee877dabcf133469467a23649066e2bcce5c (diff) |
Enable -Werror=switch-enum
switch statements must now match all enum values or disable the
warning.
Explicit is good. This has helped us find two bugs, after solving
another one by debugging.
From now on, adding to an enum will raise errors where they are
not explicitly handled, which is good for productivity, and helps
us decide the correct behavior in all usages.
Notably still excluded from this though are the cases where the
warning is disabled by local pragmas.
fromTOML.cc did not build despite a top-level pragma, so I've had
to resort to a makefile solution for that.
Diffstat (limited to 'src/libutil/logging.cc')
-rw-r--r-- | src/libutil/logging.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index 741e1d1f5..5a2dd99af 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -68,7 +68,7 @@ public: case lvlNotice: case lvlInfo: c = '5'; break; case lvlTalkative: case lvlChatty: c = '6'; break; case lvlDebug: case lvlVomit: c = '7'; - default: c = '7'; break; + default: c = '7'; break; // should not happen, and missing enum case is reported by -Werror=switch-enum } prefix = std::string("<") + c + ">"; } |