Merge changes from upstream

Commands:
git clone https://fuchsia.googlesource.com/third_party/abseil-cpp
cd abseil-cpp
git checkout upstream/master
git checkout origin/master -b ${USER}-merge
git merge upstream/master

New version of Tink needed by Cobalt uses flat_hash_map.

Change-Id: Icefc708c0b6dedf3ef4981f7b19ca2036a3c9a6b
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..2eb4c42
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+static_library("abseil-cpp") {
+  public_deps = [
+    "//third_party/abseil-cpp/absl",
+  ]
+}
+
+config("abseil_config") {
+  include_dirs = [ "//third_party/abseil-cpp" ]
+
+  cflags = [
+    # Google style does not use unsigned integers, though STL containers
+    # have unsigned types.
+    "-Wno-sign-compare",
+    "-Wno-missing-field-initializers",
+
+    # TODO: disable -Wimplicit-int-float-conversion which has been introduced
+    # in https://reviews.llvm.org/D64666 and is failing in duration.cc:190:12
+    "-Wno-unknown-warning-option",
+    "-Wno-error=implicit-int-float-conversion",
+  ]
+}
diff --git a/absl/BUILD.gn b/absl/BUILD.gn
new file mode 100644
index 0000000..31344d2
--- /dev/null
+++ b/absl/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+static_library("absl") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  public_deps = [
+    "//third_party/abseil-cpp/absl/strings",
+  ]
+}
diff --git a/absl/base/BUILD.gn b/absl/base/BUILD.gn
new file mode 100644
index 0000000..3924445
--- /dev/null
+++ b/absl/base/BUILD.gn
@@ -0,0 +1,162 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+source_set("core_headers") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  public = [
+    "attributes.h",
+    "macros.h",
+    "optimization.h",
+    "port.h",
+    "thread_annotations.h",
+  ]
+  deps = [
+    ":config",
+    ":dynamic_annotations",
+  ]
+}
+
+source_set("base_internal") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  public = [
+    "internal/hide_ptr.h",
+    "internal/identity.h",
+    "internal/inline_variable.h",
+    "internal/invoke.h",
+  ]
+  visibility = []
+  visibility += [ "../*" ]
+}
+
+source_set("base") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/cycleclock.cc",
+    "internal/raw_logging.cc",
+    "internal/spinlock.cc",
+    "internal/sysinfo.cc",
+    "internal/thread_identity.cc",
+    "internal/unscaledcycleclock.cc",
+  ]
+  public = [
+    "call_once.h",
+    "casts.h",
+    "internal/atomic_hook.h",
+    "internal/cycleclock.h",
+    "internal/low_level_scheduling.h",
+    "internal/per_thread_tls.h",
+    "internal/raw_logging.h",
+    "internal/spinlock.h",
+    "internal/sysinfo.h",
+    "internal/thread_identity.h",
+    "internal/tsan_mutex_interface.h",
+    "internal/unscaledcycleclock.h",
+    "log_severity.h",
+  ]
+  deps = [
+    ":base_internal",
+    ":config",
+    ":core_headers",
+    ":dynamic_annotations",
+    ":spinlock_wait",
+  ]
+}
+
+source_set("config") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  public = [
+    "config.h",
+    "policy_checks.h",
+  ]
+}
+
+source_set("malloc_internal") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/low_level_alloc.cc",
+  ]
+  public = [
+    "internal/direct_mmap.h",
+    "internal/low_level_alloc.h",
+  ]
+  deps = [
+    ":base",
+    ":config",
+    ":core_headers",
+    ":dynamic_annotations",
+    ":spinlock_wait",
+  ]
+  visibility = []
+  visibility += [ "../*" ]
+}
+
+source_set("dynamic_annotations") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "dynamic_annotations.cc",
+  ]
+  public = [
+    "dynamic_annotations.h",
+  ]
+}
+
+source_set("spinlock_wait") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/spinlock_akaros.inc",
+    "internal/spinlock_posix.inc",
+    "internal/spinlock_wait.cc",
+    "internal/spinlock_win32.inc",
+  ]
+  public = [
+    "internal/scheduling_mode.h",
+    "internal/spinlock_wait.h",
+  ]
+  deps = [
+    ":core_headers",
+  ]
+  visibility = []
+  visibility += [ "../base:*" ]
+}
+
+source_set("endian") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+  sources = [
+    "internal/endian.h",
+    "internal/unaligned_access.h",
+  ]
+  deps = [
+    ":config",
+    ":core_headers",
+  ]
+}
+
+source_set("throw_delegate") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+  sources = [
+    "internal/throw_delegate.cc",
+    "internal/throw_delegate.h",
+  ]
+  deps = [
+    ":base",
+    ":config",
+    ":core_headers",
+  ]
+}
diff --git a/absl/debugging/BUILD.gn b/absl/debugging/BUILD.gn
new file mode 100644
index 0000000..8c21f61
--- /dev/null
+++ b/absl/debugging/BUILD.gn
@@ -0,0 +1,81 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+source_set("stacktrace") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "stacktrace.cc",
+  ]
+  public = [
+    "stacktrace.h",
+  ]
+  deps = [
+    ":debugging_internal",
+    "../base",
+    "../base:core_headers",
+  ]
+}
+source_set("symbolize") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "symbolize.cc",
+    "symbolize_elf.inc",
+    "symbolize_unimplemented.inc",
+    "symbolize_win32.inc",
+  ]
+  public = [
+    "internal/symbolize.h",
+    "symbolize.h",
+  ]
+  deps = [
+    ":debugging_internal",
+    ":demangle_internal",
+    "../base",
+    "../base:core_headers",
+    "../base:malloc_internal",
+  ]
+}
+
+source_set("demangle_internal") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/demangle.cc",
+  ]
+  public = [
+    "internal/demangle.h",
+  ]
+  deps = [
+    "../base",
+    "../base:core_headers",
+  ]
+}
+
+source_set("debugging_internal") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/address_is_readable.cc",
+    "internal/elf_mem_image.cc",
+    "internal/vdso_support.cc",
+  ]
+  public = [
+    "internal/address_is_readable.h",
+    "internal/elf_mem_image.h",
+    "internal/stacktrace_config.h",
+    "internal/vdso_support.h",
+  ]
+  deps = [
+    "../base",
+    "../base:dynamic_annotations",
+  ]
+}
diff --git a/absl/memory/BUILD.gn b/absl/memory/BUILD.gn
new file mode 100644
index 0000000..e91ae3e
--- /dev/null
+++ b/absl/memory/BUILD.gn
@@ -0,0 +1,22 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+source_set("memory") {
+  public = [
+    "memory.h",
+  ]
+  deps = [
+    "../base:core_headers",
+    "../meta:type_traits",
+  ]
+}
diff --git a/absl/meta/BUILD.gn b/absl/meta/BUILD.gn
new file mode 100644
index 0000000..43771cc
--- /dev/null
+++ b/absl/meta/BUILD.gn
@@ -0,0 +1,21 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+source_set("type_traits") {
+  public = [
+    "type_traits.h",
+  ]
+  deps = [
+    "../base:config",
+  ]
+}
diff --git a/absl/numeric/BUILD.gn b/absl/numeric/BUILD.gn
new file mode 100644
index 0000000..3ba12f0
--- /dev/null
+++ b/absl/numeric/BUILD.gn
@@ -0,0 +1,29 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+source_set("int128") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "int128.cc",
+    "int128_have_intrinsic.inc",
+    "int128_no_intrinsic.inc",
+  ]
+  public = [
+    "int128.h",
+  ]
+  deps = [
+    "../base:config",
+    "../base:core_headers",
+  ]
+}
diff --git a/absl/strings/BUILD.gn b/absl/strings/BUILD.gn
new file mode 100644
index 0000000..5712451
--- /dev/null
+++ b/absl/strings/BUILD.gn
@@ -0,0 +1,76 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+static_library("strings") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "ascii.cc",
+    "ascii.h",
+    "charconv.cc",
+    "charconv.h",
+    "escaping.cc",
+    "escaping.h",
+    "internal/charconv_bigint.cc",
+    "internal/charconv_bigint.h",
+    "internal/charconv_parse.cc",
+    "internal/charconv_parse.h",
+    "internal/memutil.cc",
+    "internal/memutil.h",
+    "internal/stl_type_traits.h",
+    "internal/str_join_internal.h",
+    "internal/str_split_internal.h",
+    "match.cc",
+    "match.h",
+    "numbers.cc",
+    "numbers.h",
+    "str_cat.cc",
+    "str_cat.h",
+    "str_join.h",
+    "str_replace.cc",
+    "str_replace.h",
+    "str_split.cc",
+    "str_split.h",
+    "string_view.cc",
+    "string_view.h",
+    "strip.h",
+    "substitute.cc",
+    "substitute.h",
+  ]
+
+  deps = [
+    ":internal",
+    "../base",
+    "../base:config",
+    "../base:core_headers",
+    "../base:endian",
+    "../base:throw_delegate",
+    "../memory",
+    "../meta:type_traits",
+    "../numeric:int128",
+  ]
+}
+
+static_library("internal") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/bits.h",
+    "internal/char_map.h",
+    "internal/ostringstream.cc",
+    "internal/ostringstream.h",
+    "internal/resize_uninitialized.h",
+    "internal/utf8.cc",
+    "internal/utf8.h",
+  ]
+}
diff --git a/absl/synchronization/BUILD.gn b/absl/synchronization/BUILD.gn
new file mode 100644
index 0000000..c3426e6
--- /dev/null
+++ b/absl/synchronization/BUILD.gn
@@ -0,0 +1,66 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+source_set("graphcycles_internal") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "internal/graphcycles.cc",
+  ]
+  public = [
+    "internal/graphcycles.h",
+  ]
+  deps = [
+    "../base",
+    "../base:base_internal",
+    "../base:core_headers",
+    "../base:malloc_internal",
+  ]
+  visibility = []
+  visibility += [ "../*" ]
+}
+
+source_set("synchronization") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "barrier.cc",
+    "barrier.h",
+    "blocking_counter.cc",
+    "blocking_counter.h",
+    "internal/create_thread_identity.cc",
+    "internal/create_thread_identity.h",
+    "internal/kernel_timeout.h",
+    "internal/mutex_nonprod.inc",
+    "internal/per_thread_sem.cc",
+    "internal/per_thread_sem.h",
+    "internal/waiter.cc",
+    "internal/waiter.h",
+    "mutex.cc",
+    "mutex.h",
+    "notification.cc",
+    "notification.h",
+  ]
+  deps = [
+    ":graphcycles_internal",
+    "../base",
+    "../base:base_internal",
+    "../base:config",
+    "../base:core_headers",
+    "../base:dynamic_annotations",
+    "../base:malloc_internal",
+    "../debugging:stacktrace",
+    "../debugging:symbolize",
+    "../time",
+  ]
+}
diff --git a/absl/time/BUILD.gn b/absl/time/BUILD.gn
new file mode 100644
index 0000000..d0072f8
--- /dev/null
+++ b/absl/time/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [
+  "//third_party/abseil-cpp/*",
+  "$cobalt_root/*",
+  "//third_party/tink/*",
+]
+
+static_library("time") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "clock.cc",
+    "duration.cc",
+    "format.cc",
+    "internal/get_current_time_chrono.inc",
+    "internal/get_current_time_posix.inc",
+    "time.cc",
+  ]
+  public = [
+    "clock.h",
+    "time.h",
+  ]
+  deps = [
+    "../base",
+    "../base:core_headers",
+    "../numeric:int128",
+    "../strings",
+    "../time/internal/cctz:civil_time",
+    "../time/internal/cctz:time_zone",
+  ]
+}
diff --git a/absl/time/internal/cctz/BUILD.gn b/absl/time/internal/cctz/BUILD.gn
new file mode 100644
index 0000000..14e3ebe
--- /dev/null
+++ b/absl/time/internal/cctz/BUILD.gn
@@ -0,0 +1,50 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Please do not add more entries to this list. We plan to remove
+# abseil-cpp from the Fuchsia platform source tree once cobalt
+# moves out-of-tree.
+visibility = [ "//third_party/abseil-cpp/*" ]
+
+source_set("civil_time") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "src/civil_time_detail.cc",
+  ]
+  public = [
+    "include/cctz/civil_time.h",
+    "include/cctz/civil_time_detail.h",
+  ]
+}
+
+source_set("time_zone") {
+  public_configs = [ "//third_party/abseil-cpp:abseil_config" ]
+
+  sources = [
+    "src/time_zone_fixed.cc",
+    "src/time_zone_fixed.h",
+    "src/time_zone_format.cc",
+    "src/time_zone_if.cc",
+    "src/time_zone_if.h",
+    "src/time_zone_impl.cc",
+    "src/time_zone_impl.h",
+    "src/time_zone_info.cc",
+    "src/time_zone_info.h",
+    "src/time_zone_libc.cc",
+    "src/time_zone_libc.h",
+    "src/time_zone_lookup.cc",
+    "src/time_zone_posix.cc",
+    "src/time_zone_posix.h",
+    "src/tzfile.h",
+    "src/zone_info_source.cc",
+  ]
+  public = [
+    "include/cctz/time_zone.h",
+    "include/cctz/zone_info_source.h",
+  ]
+  deps = [
+    ":civil_time",
+  ]
+}