Commit b26334e5 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

logging: add an assert for the FLAG_INHERIT bit

Summary:
Add a static_assert() to check that the FLAG_INHERIT bit does not conflict with
valid LogLevel values.

Reviewed By: bolinfest

Differential Revision: D6341242

fbshipit-source-id: cec284623c8a612a3c54f1b593d169310790616e
parent 89353dca
......@@ -221,6 +221,12 @@ class LogCategory {
private:
enum : uint32_t { FLAG_INHERIT = 0x80000000 };
// FLAG_INHERIT is the stored in the uppermost bit of the LogLevel field.
// assert that it does not conflict with valid LogLevel values.
static_assert(
static_cast<uint32_t>(LogLevel::MAX_LEVEL) < FLAG_INHERIT,
"The FLAG_INHERIT bit must not be set in any valid LogLevel value");
// Forbidden copy constructor and assignment operator
LogCategory(LogCategory const&) = delete;
LogCategory& operator=(LogCategory const&) = delete;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment