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
c006f8c1
Commit
c006f8c1
authored
Apr 14, 2011
by
zhanyong.wan
Browse files
fixes a problem caused by gcc 4.6 optimization (by Paul Pluzhnikov)
parent
6a5a25b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
include/gtest/internal/gtest-port.h
include/gtest/internal/gtest-port.h
+7
-0
src/gtest-death-test.cc
src/gtest-death-test.cc
+5
-0
No files found.
include/gtest/internal/gtest-port.h
View file @
c006f8c1
...
...
@@ -662,6 +662,13 @@
# define GTEST_API_
#endif
#if defined(__GNUC__)
// Ask the compiler to never inline a given function.
#define GTEST_NO_INLINE_ __attribute__((noinline))
#else
#define GTEST_NO_INLINE_
#endif // __GNUC__
namespace
testing
{
class
Message
;
...
...
src/gtest-death-test.cc
View file @
c006f8c1
...
...
@@ -932,6 +932,11 @@ static int ExecDeathTestChildMain(void* child_arg) {
// This could be accomplished more elegantly by a single recursive
// function, but we want to guard against the unlikely possibility of
// a smart compiler optimizing the recursion away.
//
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
// correct answer.
bool
StackLowerThanAddress
(
const
void
*
ptr
)
GTEST_NO_INLINE_
;
bool
StackLowerThanAddress
(
const
void
*
ptr
)
{
int
dummy
;
return
&
dummy
<
ptr
;
...
...
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