Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
683f431d
Commit
683f431d
authored
Jun 11, 2009
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Works around a gcc bug when compiling tr1/tuple with RTTI disabled.
parent
b24b49d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
7 deletions
+52
-7
Makefile.am
Makefile.am
+8
-0
gtest-port.h
include/gtest/internal/gtest-port.h
+14
-0
SConscript
scons/SConscript
+30
-7
No files found.
Makefile.am
View file @
683f431d
...
...
@@ -292,6 +292,14 @@ check_PROGRAMS += test/gtest_unittest
test_gtest_unittest_SOURCES
=
test
/gtest_unittest.cc
test_gtest_unittest_LDADD
=
lib/libgtest_main.la
# Verifies that Google Test works when RTTI is disabled.
TESTS
+=
test
/gtest_no_rtti_test
check_PROGRAMS
+=
test
/gtest_no_rtti_test
test_gtest_no_rtti_test_SOURCES
=
test
/gtest_unittest.cc
\
src/gtest-all.cc
\
src/gtest_main.cc
test_gtest_no_rtti_test_CXXFLAGS
=
$(AM_CXXFLAGS)
-fno-rtti
-DGTEST_HAS_RTTI
=
0
# The following tests depend on the presence of a Python installation and are
# keyed off of it. TODO(chandlerc@google.com): While we currently only attempt
# to build and execute these tests if Autoconf has found Python v2.4 on the
...
...
include/gtest/internal/gtest-port.h
View file @
683f431d
...
...
@@ -379,7 +379,21 @@
#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
// not conform to the TR1 spec, which requires the header to be <tuple>.
#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
// which is #included by <tr1/tuple>, to not compile when RTTI is
// disabled. _TR1_FUNCTIONAL is the header guard for
// <tr1/functional>. Hence the following #define is a hack to prevent
// <tr1/functional> from being included.
#define _TR1_FUNCTIONAL 1
#include <tr1/tuple>
#undef _TR1_FUNCTIONAL // Allows the user to #include
// <tr1/functional> if he chooses to.
#else
#include <tr1/tuple>
#endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
#else
// If the compiler is not GCC 4.0+, we assume the user is using a
// spec-conforming TR1 implementation.
...
...
scons/SConscript
View file @
683f431d
...
...
@@ -126,6 +126,13 @@ if env_with_exceptions['PLATFORM'] == 'win32':
if
'_TYPEINFO_'
in
cppdefines
:
cppdefines
.
remove
(
'_TYPEINFO_'
)
env_without_rtti
=
env
.
Clone
()
if
env_without_rtti
[
'PLATFORM'
]
==
'win32'
:
env_without_rtti
.
Append
(
CCFLAGS
=
[
'/GR-'
])
else
:
env_without_rtti
.
Append
(
CCFLAGS
=
[
'-fno-rtti'
])
env_without_rtti
.
Append
(
CPPDEFINES
=
'GTEST_HAS_RTTI=0'
)
gtest_ex_obj
=
env_with_exceptions
.
Object
(
target
=
'gtest_ex'
,
source
=
gtest_source
)
gtest_main_ex_obj
=
env_with_exceptions
.
Object
(
target
=
'gtest_main_ex'
,
...
...
@@ -158,19 +165,19 @@ def ConstructSourceList(target, dir_prefix, additional_sources=None):
source
+=
additional_sources
return
source
def
GtestBinary
(
env
,
target
,
gtest_lib
,
sources
):
def
GtestBinary
(
env
,
target
,
gtest_lib
s
,
sources
):
"""Helper to create gtest binaries: tests, samples, etc.
Args:
env: The SCons construction environment to use to build.
target: The basename of the target's main source file, also used as target
name.
gtest_lib
: The gtest lib
to use.
gtest_lib
s: A list of gtest libraries
to use.
sources: A list of source files in the target.
"""
unit_test
=
env
.
Program
(
target
=
target
,
source
=
sources
,
LIBS
=
[
gtest_lib
]
)
binary
=
env
.
Program
(
target
=
target
,
source
=
sources
,
LIBS
=
gtest_libs
)
if
'EXE_OUTPUT'
in
env
.
Dictionary
():
env
.
Install
(
'$EXE_OUTPUT'
,
source
=
[
unit_test
])
env
.
Install
(
'$EXE_OUTPUT'
,
source
=
[
binary
])
def
GtestUnitTest
(
env
,
target
,
gtest_lib
,
additional_sources
=
None
):
"""Helper to create gtest unit tests.
...
...
@@ -183,7 +190,7 @@ def GtestUnitTest(env, target, gtest_lib, additional_sources=None):
"""
GtestBinary
(
env
,
target
,
gtest_lib
,
[
gtest_lib
]
,
ConstructSourceList
(
target
,
"../test"
,
additional_sources
=
additional_sources
))
...
...
@@ -232,9 +239,25 @@ gtest_unittest_ex_obj = env_with_exceptions.Object(
source
=
'../test/gtest_unittest.cc'
)
GtestBinary
(
env_with_exceptions
,
'gtest_ex_unittest'
,
gtest_ex_main
,
[
gtest_ex_main
]
,
gtest_unittest_ex_obj
)
gtest_unittest_no_rtti_obj
=
env_without_rtti
.
Object
(
target
=
'gtest_unittest_no_rtti'
,
source
=
'../test/gtest_unittest.cc'
)
gtest_all_no_rtti_obj
=
env_without_rtti
.
Object
(
target
=
'gtest_all_no_rtti'
,
source
=
'../src/gtest-all.cc'
)
gtest_main_no_rtti_obj
=
env_without_rtti
.
Object
(
target
=
'gtest_main_no_rtti'
,
source
=
'../src/gtest_main.cc'
)
GtestBinary
(
env_without_rtti
,
'gtest_no_rtti_test'
,
[],
gtest_unittest_no_rtti_obj
+
gtest_all_no_rtti_obj
+
gtest_main_no_rtti_obj
)
# We need to disable some optimization flags for some tests on
# Windows; otherwise the redirection of stdout does not work
# (apparently because of a compiler bug).
...
...
@@ -258,7 +281,7 @@ def GtestSample(env, target, gtest_lib, additional_sources=None):
"""
GtestBinary
(
env
,
target
,
gtest_lib
,
[
gtest_lib
]
,
ConstructSourceList
(
target
,
"../samples"
,
additional_sources
=
additional_sources
))
...
...
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