Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
10e98c4f
Commit
10e98c4f
authored
Mar 21, 2019
by
Gennadiy Civil
Browse files
Merge pull request #2180 from twam:master
PiperOrigin-RevId: 239404016
parents
f1883b18
c3ac2655
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
googlemock/docs/DesignDoc.md
googlemock/docs/DesignDoc.md
+0
-1
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+6
-4
No files found.
googlemock/docs/DesignDoc.md
View file @
10e98c4f
...
@@ -198,7 +198,6 @@ Google Test (the name is chosen to match `static_assert` in C++0x).
...
@@ -198,7 +198,6 @@ Google Test (the name is chosen to match `static_assert` in C++0x).
If you are writing a function that returns an
`ACTION`
object, you'll
If you are writing a function that returns an
`ACTION`
object, you'll
need to know its type. The type depends on the macro used to define
need to know its type. The type depends on the macro used to define
the action and the parameter types. The rule is relatively simple:
the action and the parameter types. The rule is relatively simple:
|
**Given Definition**
|
**Expression**
|
**Has Type**
|
|
**Given Definition**
|
**Expression**
|
**Has Type**
|
|:-------------------------|:-----------------------------|:-------------------------|
|:-------------------------|:-----------------------------|:-------------------------|
|
`ACTION(Foo)`
|
`Foo()`
|
`FooAction`
|
|
`ACTION(Foo)`
|
`Foo()`
|
`FooAction`
|
...
...
googletest/src/gtest-port.cc
View file @
10e98c4f
...
@@ -380,6 +380,7 @@ void Mutex::AssertHeld() {
...
@@ -380,6 +380,7 @@ void Mutex::AssertHeld() {
namespace
{
namespace
{
#ifdef _MSC_VER
// Use the RAII idiom to flag mem allocs that are intentionally never
// Use the RAII idiom to flag mem allocs that are intentionally never
// deallocated. The motivation is to silence the false positive mem leaks
// deallocated. The motivation is to silence the false positive mem leaks
// that are reported by the debug version of MS's CRT which can only detect
// that are reported by the debug version of MS's CRT which can only detect
...
@@ -392,19 +393,15 @@ class MemoryIsNotDeallocated
...
@@ -392,19 +393,15 @@ class MemoryIsNotDeallocated
{
{
public:
public:
MemoryIsNotDeallocated
()
:
old_crtdbg_flag_
(
0
)
{
MemoryIsNotDeallocated
()
:
old_crtdbg_flag_
(
0
)
{
#ifdef _MSC_VER
old_crtdbg_flag_
=
_CrtSetDbgFlag
(
_CRTDBG_REPORT_FLAG
);
old_crtdbg_flag_
=
_CrtSetDbgFlag
(
_CRTDBG_REPORT_FLAG
);
// Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT
// Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT
// doesn't report mem leak if there's no matching deallocation.
// doesn't report mem leak if there's no matching deallocation.
_CrtSetDbgFlag
(
old_crtdbg_flag_
&
~
_CRTDBG_ALLOC_MEM_DF
);
_CrtSetDbgFlag
(
old_crtdbg_flag_
&
~
_CRTDBG_ALLOC_MEM_DF
);
#endif // _MSC_VER
}
}
~
MemoryIsNotDeallocated
()
{
~
MemoryIsNotDeallocated
()
{
#ifdef _MSC_VER
// Restore the original _CRTDBG_ALLOC_MEM_DF flag
// Restore the original _CRTDBG_ALLOC_MEM_DF flag
_CrtSetDbgFlag
(
old_crtdbg_flag_
);
_CrtSetDbgFlag
(
old_crtdbg_flag_
);
#endif // _MSC_VER
}
}
private:
private:
...
@@ -412,6 +409,7 @@ class MemoryIsNotDeallocated
...
@@ -412,6 +409,7 @@ class MemoryIsNotDeallocated
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MemoryIsNotDeallocated
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MemoryIsNotDeallocated
);
};
};
#endif // _MSC_VER
}
// namespace
}
// namespace
...
@@ -427,7 +425,9 @@ void Mutex::ThreadSafeLazyInit() {
...
@@ -427,7 +425,9 @@ void Mutex::ThreadSafeLazyInit() {
owner_thread_id_
=
0
;
owner_thread_id_
=
0
;
{
{
// Use RAII to flag that following mem alloc is never deallocated.
// Use RAII to flag that following mem alloc is never deallocated.
#ifdef _MSC_VER
MemoryIsNotDeallocated
memory_is_not_deallocated
;
MemoryIsNotDeallocated
memory_is_not_deallocated
;
#endif // _MSC_VER
critical_section_
=
new
CRITICAL_SECTION
;
critical_section_
=
new
CRITICAL_SECTION
;
}
}
::
InitializeCriticalSection
(
critical_section_
);
::
InitializeCriticalSection
(
critical_section_
);
...
@@ -670,7 +670,9 @@ class ThreadLocalRegistryImpl {
...
@@ -670,7 +670,9 @@ class ThreadLocalRegistryImpl {
// Returns map of thread local instances.
// Returns map of thread local instances.
static
ThreadIdToThreadLocals
*
GetThreadLocalsMapLocked
()
{
static
ThreadIdToThreadLocals
*
GetThreadLocalsMapLocked
()
{
mutex_
.
AssertHeld
();
mutex_
.
AssertHeld
();
#ifdef _MSC_VER
MemoryIsNotDeallocated
memory_is_not_deallocated
;
MemoryIsNotDeallocated
memory_is_not_deallocated
;
#endif // _MSC_VER
static
ThreadIdToThreadLocals
*
map
=
new
ThreadIdToThreadLocals
();
static
ThreadIdToThreadLocals
*
map
=
new
ThreadIdToThreadLocals
();
return
map
;
return
map
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment