Browse Source

Use UNREACHABLE macro for impossible cases in previous commit

Use the UNREACHABLE macro instead of `ASSERT(false, ...);`.
nce_cpp
Benjamin Barenblat 11 years ago
parent
commit
2a886560e8
  1. 3
      src/common/logging/backend.cpp
  2. 4
      src/common/logging/text_formatter.cpp

3
src/common/logging/backend.cpp

@ -80,8 +80,7 @@ const char* GetLevelName(Level log_level) {
LVL(Error);
LVL(Critical);
case Level::Count:
ASSERT_MSG(false, "invalid log level");
return "Unknown";
UNREACHABLE();
}
#undef LVL
}

4
src/common/logging/text_formatter.cpp

@ -84,7 +84,7 @@ void PrintColoredMessage(const Entry& entry) {
case Level::Critical: // Bright magenta
color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
case Level::Count:
ASSERT_MSG(false, "invalid log level"); break;
UNREACHABLE();
}
SetConsoleTextAttribute(console_handle, color);
@ -105,7 +105,7 @@ void PrintColoredMessage(const Entry& entry) {
case Level::Critical: // Bright magenta
color = ESC "[1;35m"; break;
case Level::Count:
ASSERT_MSG(false, "invalid log level"); break;
UNREACHABLE();
}
fputs(color, stderr);

Loading…
Cancel
Save