From 88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Wed, 16 Dec 2009 23:34:59 +0000 Subject: Removes uses of GTEST_HAS_STD_STRING. --- scons/SConscript.common | 3 --- scons/SConstruct | 6 +++++- scons/SConstruct.common | 23 +++++++++++++++-------- 3 files changed, 20 insertions(+), 12 deletions(-) (limited to 'scons') diff --git a/scons/SConscript.common b/scons/SConscript.common index a49cf0a3..7fda32e1 100644 --- a/scons/SConscript.common +++ b/scons/SConscript.common @@ -88,9 +88,6 @@ class EnvCreator: if env['PLATFORM'] == 'win32': env.Append(CCFLAGS=['/EHsc']) env.Append(CPPDEFINES='_HAS_EXCEPTIONS=1') - # Undoes the _TYPEINFO_ hack, which is unnecessary and only creates - # trouble when exceptions are enabled. - cls._Remove(env, 'CPPDEFINES', '_TYPEINFO_') cls._Remove(env, 'CPPDEFINES', '_HAS_EXCEPTIONS=0') else: env.Append(CCFLAGS='-fexceptions') diff --git a/scons/SConstruct b/scons/SConstruct index 1f2f37f6..c749d6a8 100644 --- a/scons/SConstruct +++ b/scons/SConstruct @@ -50,8 +50,12 @@ sconstruct_helper.Initialize(build_root_path='..', win_base = sconstruct_helper.MakeWinBaseEnvironment() +# We don't support VC 7.1 with exceptions disabled, so we always +# enable exceptions for VC 7.1. For newer versions of VC, we still +# compile with exceptions disabled by default, as that's a more common +# setting for our users. if win_base.get('MSVS_VERSION', None) == '7.1': - sconstruct_helper.AllowVc71StlWithoutExceptions(win_base) + sconstruct_helper.EnableExceptions(win_base) sconstruct_helper.MakeWinDebugEnvironment(win_base, 'win-dbg') sconstruct_helper.MakeWinOptimizedEnvironment(win_base, 'win-opt') diff --git a/scons/SConstruct.common b/scons/SConstruct.common index 7f6db158..cb9a63df 100644 --- a/scons/SConstruct.common +++ b/scons/SConstruct.common @@ -45,6 +45,13 @@ class SConstructHelper: # A dictionary to look up an environment by its name. self.env_dict = {} + def _Remove(self, env, attribute, value): + """Removes the given attribute value from the environment.""" + + attribute_values = env[attribute] + if value in attribute_values: + attribute_values.remove(value) + def Initialize(self, build_root_path, support_multiple_win_builds=False): test_env = Environment() platform = test_env['PLATFORM'] @@ -83,13 +90,14 @@ class SConstructHelper: # Enable scons -h Help(vars.GenerateHelpText(self.env_base)) - def AllowVc71StlWithoutExceptions(self, env): - env.Append( - CPPDEFINES = [# needed for using some parts of STL with exception - # disabled. The scoop is given here, with comments - # from P.J. Plauger at - # http://groups.google.com/group/microsoft.public.vc.stl/browse_thread/thread/5e719833c6bdb177?q=_HAS_EXCEPTIONS+using+namespace+std&pli=1 - '_TYPEINFO_']) + def EnableExceptions(self, env): + if env['PLATFORM'] == 'win32': + env.Append(CCFLAGS=['/EHsc']) + env.Append(CPPDEFINES='_HAS_EXCEPTIONS=1') + self._Remove(env, 'CPPDEFINES', '_HAS_EXCEPTIONS=0') + else: + env.Append(CCFLAGS='-fexceptions') + self._Remove(env, 'CCFLAGS', '-fno-exceptions') def MakeWinBaseEnvironment(self): win_base = self.env_base.Clone( @@ -117,7 +125,6 @@ class SConstructHelper: 'STRICT', 'WIN32_LEAN_AND_MEAN', '_HAS_EXCEPTIONS=0', - 'GTEST_ALLOW_VC71_WITHOUT_EXCEPTIONS_=1', ], LIBPATH=['#/$MAIN_DIR/lib'], LINKFLAGS=['-MACHINE:x86', # Enable safe SEH (not supp. on x64) -- cgit v1.2.3