Skip to content
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

Merged
merged 1 commit into from
Feb 9, 2017

Conversation

yoshisatoyanagisawa
Copy link
Contributor

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.

@@ -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.
Copy link
Contributor

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?

@@ -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.
Copy link
Contributor

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.

Copy link
Contributor

@ukai ukai left a 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.
@yoshisatoyanagisawa
Copy link
Contributor Author

Good catch!
I have fixed the comment. Let me avoid double negative.

@ukai ukai merged commit ab65454 into google:master Feb 9, 2017
durswd pushed a commit to durswd/glog that referenced this pull request Sep 2, 2019
DCHECK_ALWAYS_ON to make D* enabled under NDEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants