-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DCHECK_ALWAYS_ON to make D* enabled under NDEBUG #164
Conversation
src/glog/logging.h.in
Outdated
@@ -986,7 +992,7 @@ const LogSeverity GLOG_0 = GLOG_ERROR; | |||
LOG_IF_EVERY_N(severity, condition, n) | |||
#define DLOG_ASSERT(condition) LOG_ASSERT(condition) | |||
|
|||
// debug-only checking. not executed in NDEBUG mode. | |||
// debug-only checking. not executed in DCHECK_IS_ON() mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not executed in !DCHECK_IS_ON() mode?
src/windows/glog/logging.h
Outdated
@@ -990,7 +996,7 @@ const LogSeverity GLOG_0 = GLOG_ERROR; | |||
LOG_IF_EVERY_N(severity, condition, n) | |||
#define DLOG_ASSERT(condition) LOG_ASSERT(condition) | |||
|
|||
// debug-only checking. not executed in NDEBUG mode. | |||
// debug-only checking. not executed in DCHECK_IS_ON() mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not executed in !DCHECK_IS_ON() mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to fix comment?
The macro NDEBUG could be automatically defined for release build on some build environments (e.g. MSVC). If we use NDEBUG as a key to distinguish using DCHECK as CHECK (I call this DCHECK is enabled) or not, we cannot make DCHECK enabled for release build on such environments. Considering people use a program with glog for presubmit testing or dogfooding, they should need to do release build with DCHECK enabled.
5534cf9
to
027332f
Compare
Good catch! |
DCHECK_ALWAYS_ON to make D* enabled under NDEBUG
The macro NDEBUG could be automatically defined for release build on
some build environments (e.g. MSVC). If we use NDEBUG as a key to
distinguish using DCHECK as CHECK (I call this DCHECK is enabled) or
not, we cannot make DCHECK enabled for release build on such
environments.
Considering people use a program with glog for presubmit testing or
dogfooding, they should need to do release build with DCHECK enabled.