From 9ff23da2550dd159d81933c0236529ececc526b5 Mon Sep 17 00:00:00 2001
From: Benjamin Barenblat <bbaren@mit.edu>
Date: Sun, 2 Aug 2015 12:55:31 -0400
Subject: Handle invalid `Log::Level::Count`

Add a case of `Log::Level::Count` to all switch statements that
dispatch on `Log::Level`.  The case simply asserts `false` and notes
the invalid log level.
---
 src/common/logging/backend.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/common/logging/backend.cpp')

diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index d85e583737..68580e1c06 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -6,6 +6,7 @@
 #include <array>
 #include <cstdio>
 
+#include "common/assert.h"
 #include "common/common_funcs.h" // snprintf compatibility define
 #include "common/logging/backend.h"
 #include "common/logging/filter.h"
@@ -78,8 +79,10 @@ const char* GetLevelName(Level log_level) {
         LVL(Warning);
         LVL(Error);
         LVL(Critical);
+        case Level::Count:
+            ASSERT_MSG(false, "invalid log level");
+            return "Unknown";
     }
-    return "Unknown";
 #undef LVL
 }
 
-- 
cgit v1.2.3-70-g09d2