Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 99a5af6

Browse filesBrowse files
cjihrigtargos
authored andcommitted
src: introduce DCHECK macro
This commit adds a DCHECK macro for consistency with the other DCHECK_* macros. PR-URL: #25207 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e2a01ca commit 99a5af6
Copy full SHA for 99a5af6

File tree

Expand file treeCollapse file tree

5 files changed

+5
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+5
-13
lines changed
Open diff view settings
Collapse file

‎src/aliased_buffer.h‎

Copy file name to clipboardExpand all lines: src/aliased_buffer.h
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ class AliasedBuffer {
231231
void reserve(size_t new_capacity) {
232232
DCHECK_GE(new_capacity, count_);
233233
DCHECK_EQ(byte_offset_, 0);
234-
#if defined(DEBUG) && DEBUG
235-
CHECK(free_buffer_);
236-
#endif
234+
DCHECK(free_buffer_);
237235
const v8::HandleScope handle_scope(isolate_);
238236

239237
const size_t old_size_in_bytes = sizeof(NativeT) * count_;
Collapse file

‎src/base_object-inl.h‎

Copy file name to clipboardExpand all lines: src/base_object-inl.h
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ void BaseObject::ClearWeak() {
113113
v8::Local<v8::FunctionTemplate>
114114
BaseObject::MakeLazilyInitializedJSTemplate(Environment* env) {
115115
auto constructor = [](const v8::FunctionCallbackInfo<v8::Value>& args) {
116-
#ifdef DEBUG
117-
CHECK(args.IsConstructCall());
118-
#endif
116+
DCHECK(args.IsConstructCall());
119117
DCHECK_GT(args.This()->InternalFieldCount(), 0);
120118
args.This()->SetAlignedPointerInInternalField(0, nullptr);
121119
};
Collapse file

‎src/inspector/node_string.h‎

Copy file name to clipboardExpand all lines: src/inspector/node_string.h
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,4 @@ extern size_t kNotFound;
7373
} // namespace inspector
7474
} // namespace node
7575

76-
#ifndef DCHECK
77-
#define DCHECK CHECK
78-
#define DCHECK_LT CHECK_LT
79-
#endif // DCHECK
8076
#endif // SRC_INSPECTOR_NODE_STRING_H_
Collapse file

‎src/string_decoder.cc‎

Copy file name to clipboardExpand all lines: src/string_decoder.cc
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ MaybeLocal<String> MakeString(Isolate* isolate,
4444
isolate->ThrowException(error);
4545
}
4646

47-
#ifdef DEBUG
48-
CHECK(ret.IsEmpty() || ret.ToLocalChecked()->IsString());
49-
#endif
47+
DCHECK(ret.IsEmpty() || ret.ToLocalChecked()->IsString());
5048
return ret.FromMaybe(Local<Value>()).As<String>();
5149
}
5250

Collapse file

‎src/util.h‎

Copy file name to clipboardExpand all lines: src/util.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ void DumpBacktrace(FILE* fp);
130130
#define CHECK_IMPLIES(a, b) CHECK(!(a) || (b))
131131

132132
#ifdef DEBUG
133+
#define DCHECK(expr) CHECK(expr)
133134
#define DCHECK_EQ(a, b) CHECK((a) == (b))
134135
#define DCHECK_GE(a, b) CHECK((a) >= (b))
135136
#define DCHECK_GT(a, b) CHECK((a) > (b))
@@ -140,6 +141,7 @@ void DumpBacktrace(FILE* fp);
140141
#define DCHECK_NOT_NULL(val) CHECK((val) != nullptr)
141142
#define DCHECK_IMPLIES(a, b) CHECK(!(a) || (b))
142143
#else
144+
#define DCHECK(expr)
143145
#define DCHECK_EQ(a, b)
144146
#define DCHECK_GE(a, b)
145147
#define DCHECK_GT(a, b)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.