From ef6535b235613885abc20eb61879c4f97874cb5b Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Thu, 27 Jun 2013 15:51:43 +0200 Subject: [PATCH] Mac: Use libc++ instead of stdlibc++. - Add a missing include file to process_iterator_mac.cc. - Disable Chromium clang plugins. - Add a use_libcpp variable to common.gypi that can be used to build with libc++ instead of libstdc++. In this case several warnings also must be disabled, And the mac deployment target must be bumped to 10.7. - ext/hash_map and ext/hash_set are deprecated. Use unordered containers as a replacement. --- base/process/process_iterator_mac.cc | 1 + build/common.gypi | 30 +++++++++++++++++++++++++++--- third_party/protobuf/config.h | 27 ++++++++++++++------------- 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/base/process/process_iterator_mac.cc b/base/process/process_iterator_mac.cc index 29daa2d..e35c2ae 100644 --- a/base/process/process_iterator_mac.cc +++ b/base/process/process_iterator_mac.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include "base/logging.h" #include "base/strings/string_util.h" diff --git a/build/common.gypi b/build/common.gypi index e13aba4..9961053 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -287,7 +287,7 @@ # Run tools/clang/scripts/update.sh to make sure they are compiled. # This causes 'clang_chrome_plugins_flags' to be set. # Has no effect if 'clang' is not set as well. - 'clang_use_chrome_plugins%': 1, + 'clang_use_chrome_plugins%': 0, # Enable building with ASAN (Clang's -fsanitize=address option). # -fsanitize=address only works with clang, but asan=1 implies clang=1 @@ -1144,6 +1144,9 @@ # rlz codes for searches but do not use the library. 'enable_rlz%': 0, + # Compile with libc++ instead of libstdc++. + 'use_libcpp%' : 0, + # Turns on the i18n support in V8. 'v8_enable_i18n_support': 1, @@ -1414,10 +1417,10 @@ # someplace that Xcode doesn't know about, set mac_sdk_path to the # path to the SDK; when set to a non-empty string, SDK detection # based on mac_sdk_min will be bypassed entirely. - 'mac_sdk_min%': '10.6', + 'mac_sdk_min%': '10.7', 'mac_sdk_path%': '', - 'mac_deployment_target%': '10.6', + 'mac_deployment_target%': '10.7', }, 'mac_sdk_min': '<(mac_sdk_min)', @@ -1427,6 +1430,7 @@ # Compile in Breakpad support by default so that it can be # tested, even if it is not enabled by default at runtime. 'mac_breakpad_compiled_in%': 1, + 'conditions': [ # mac_product_name is set to the name of the .app bundle as it should # appear on disk. This duplicates data from @@ -1997,6 +2001,16 @@ ['use_x11==1', { 'defines': ['USE_X11=1'], }], + ['use_libcpp==1', { + 'defines': ['USE_UNORDERED_CONTAINERS=1'], + 'cflags_cc': [ + '-Wno-deprecated-declarations', + '-Wno-newline-eof', + '-Wno-unused-value', + '-Wno-unused-variable', + '-stdlib=libc++' + ], + }], ['enable_one_click_signin==1', { 'defines': ['ENABLE_ONE_CLICK_SIGNIN'], }], @@ -3914,6 +3928,16 @@ '-Wno-deprecated-register', ], }], + ['use_libcpp==1', { + 'OTHER_CPLUSPLUSFLAGS': ['-stdlib=libc++'], + 'USE_LIBCPP': 'YES', + 'WARNING_CFLAGS': [ + '-Wno-deprecated-declarations', + '-Wno-newline-eof', + '-Wno-unused-value', + '-Wno-unused-variable', + ], + }], ['clang==1 and clang_use_chrome_plugins==1', { 'OTHER_CFLAGS': [ '<@(clang_chrome_plugins_flags)', diff --git a/third_party/protobuf/config.h b/third_party/protobuf/config.h index dcc0041..affcf55 100644 --- a/third_party/protobuf/config.h +++ b/third_party/protobuf/config.h @@ -1,31 +1,32 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ -/* the name of */ -#define HASH_MAP_CLASS hash_map +#if defined(USE_UNORDERED_CONTAINERS) + +#define HASH_MAP_H +#define HASH_SET_H +#define HASH_NAMESPACE std +#define HASH_MAP_CLASS unordered_map +#define HASH_SET_CLASS unordered_set -/* the location of */ -#if defined(USE_STLPORT) -#define HASH_MAP_H #else -#define HASH_MAP_H -#endif -/* the namespace of hash_map/hash_set */ #if defined(USE_STLPORT) +#define HASH_MAP_H +#define HASH_SET_H #define HASH_NAMESPACE std #else +#define HASH_MAP_H +#define HASH_SET_H #define HASH_NAMESPACE __gnu_cxx #endif /* the name of */ +#define HASH_MAP_CLASS hash_map + +/* the name of */ #define HASH_SET_CLASS hash_set -/* the location of */ -#if defined(USE_STLPORT) -#define HASH_SET_H -#else -#define HASH_SET_H #endif /* Define to 1 if you have the header file. */ -- 1.8.4.2