aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-01-12 05:46:22 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-01-12 05:46:22 +0000
commit2835af801c593d7a576e81e7b0114b99e9c08a69 (patch)
treeb947cf4f51c29d52a0f7ec267c8d7f50b8439c4e /cc
parent7d3e0709a5bc21e0febcf91f228091f981710b2a (diff)
parenta07b84598f8f10e356eb4de38a2c61f94bedcf85 (diff)
downloadbuild_soong-2835af801c593d7a576e81e7b0114b99e9c08a69.tar.gz
build_soong-2835af801c593d7a576e81e7b0114b99e9c08a69.tar.bz2
build_soong-2835af801c593d7a576e81e7b0114b99e9c08a69.zip
Merge "Disable availability macros in libc++ on Darwin."
Diffstat (limited to 'cc')
-rw-r--r--cc/stl.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cc/stl.go b/cc/stl.go
index c65f1c2f..c5757cd0 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -144,6 +144,19 @@ func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags {
switch stl.Properties.SelectedStl {
case "libc++", "libc++_static":
flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX")
+
+ if ctx.Darwin() {
+ // libc++'s headers are annotated with availability macros that
+ // indicate which version of Mac OS was the first to ship with a
+ // libc++ feature available in its *system's* libc++.dylib. We do
+ // not use the system's library, but rather ship our own. As such,
+ // these availability attributes are meaningless for us but cause
+ // build breaks when we try to use code that would not be available
+ // in the system's dylib.
+ flags.CppFlags = append(flags.CppFlags,
+ "-D_LIBCPP_DISABLE_AVAILABILITY")
+ }
+
if !ctx.toolchain().Bionic() {
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")