android: Update catch2 to v2.7.0

Local change aosp/729005 is not necessary any more. Upstream has similar
change:
https://github.com/catchorg/Catch2/commit/8b0188385498d6ac101854dc3983c6ebd220adc3

Test: run both libcatch2-test and libcatch2-test-upstream on both host and target
Test: run librxcpp-tests --nothrow and librxcpp-tests-upstream
Change-Id: If321d27164aa70a88b7c1aec11cfa71d3b8e574d
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..4852cf0
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,107 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+    name: "libcatch2-defaults",
+    host_supported: true,
+    local_include_dirs: ["include"],  // cc_test ignores export_include_dirs
+    export_include_dirs: ["include"],
+    srcs: ["include/**/*.cpp"],
+    exclude_srcs: ["include/catch_with_main.cpp"],
+}
+
+// !!! IMPORTANT: Use 'whole_static_libs' or the linker will dead-code-eliminate
+// parts of the important code (the console and junit reporters).
+
+// Android users: libcatch2-main is what you want 99% of the time.
+// Using the pre-defined main speeds up compilation significantly.
+// If for some reason you want to provide your own `main`, use "libcatch2"
+// See also docs/configuration.md
+cc_library_static {
+    name: "libcatch2-main",
+    defaults: [
+        "libcatch2-defaults",
+    ],
+    srcs: [
+        "include/catch_with_main.cpp",
+    ],
+}
+
+// libcatch2 without the pre-defined main.
+// This is only useful if your program will define its own main.
+cc_library_static {
+    name: "libcatch2",
+    defaults: [
+        "libcatch2-defaults",
+    ],
+    cflags: ["-DCATCH_CONFIG_DISABLE_EXCEPTIONS"],
+}
+
+// This rule can be used by other external/ projects that depend on catch2
+// without turning off exceptions.
+cc_library_static {
+    name: "libcatch2-upstream",
+    defaults: [
+        "libcatch2-defaults",
+    ],
+    cflags: ["-fexceptions"],
+}
+
+// Configurations meant for validating upstream. Not intended to be used by anything else.
+
+cc_defaults {
+    name: "libcatch2-defaults-tests",
+    host_supported: true,
+    srcs: [
+        "projects/SelfTest/**/*.cpp",
+    ],
+    // This directory just re-includes existing tests 100x over.
+    // This is extremely slow to build, we don't lose coverage by excluding it.
+    exclude_srcs: [
+        "projects/SelfTest/CompileTimePerfTests/**/*.cpp",
+    ],
+}
+
+// Upstream config: Exceptions are enabled.
+// This should be validated first after an upstream merge.
+cc_test {
+    name: "libcatch2-tests-upstream",
+    defaults: [
+        "libcatch2-defaults-tests",
+    ],
+
+    gtest: false,
+    cflags: ["-fexceptions"],
+
+    whole_static_libs: [
+        "libcatch2-upstream",
+    ],
+}
+
+// Android config: Exceptions are disabled.
+// This should be validated second after an upstream merge.
+cc_test {
+    name: "libcatch2-tests",
+    defaults: [
+        "libcatch2-defaults-tests",
+    ],
+    cflags: [
+        "-DCATCH_CONFIG_DISABLE_EXCEPTIONS",
+        "-Wno-unused-function",
+    ],
+    gtest: false,
+    whole_static_libs: [
+        "libcatch2",
+    ],
+}
diff --git a/LICENSE b/LICENSE
new file mode 120000
index 0000000..85de3d4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+LICENSE.txt
\ No newline at end of file
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..cf98e4a
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,19 @@
+name: "catch"
+description:
+    "A modern, C++-native, header-only, test framework for unit-tests, TDD and "
+    "BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x "
+    "branch)"
+
+third_party {
+  url {
+    type: HOMEPAGE
+    value: "http://catch-lib.net"
+  }
+  url {
+    type: GIT
+    value: "https://github.com/catchorg/Catch2.git"
+  }
+  version: "v2.7.0"
+  last_upgrade_date { year: 2019 month: 3 day: 7 }
+  license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_BOOST b/MODULE_LICENSE_BOOST
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BOOST
diff --git a/NOTICE b/NOTICE
new file mode 120000
index 0000000..85de3d4
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+LICENSE.txt
\ No newline at end of file
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..5778e28
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,3 @@
+# Default code reviewers picked from top 3 or more developers.
+# Please update this list if you find better candidates.
+iam@google.com
diff --git a/include/catch_with_main.cpp b/include/catch_with_main.cpp
new file mode 120000
index 0000000..273da6b
--- /dev/null
+++ b/include/catch_with_main.cpp
@@ -0,0 +1 @@
+catch_with_main.hpp
\ No newline at end of file
diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp
index 77c3f1d..fd14c85 100644
--- a/include/internal/catch_assertionhandler.cpp
+++ b/include/internal/catch_assertionhandler.cpp
@@ -15,6 +15,7 @@
 #include "catch_interfaces_registry_hub.h"
 #include "catch_capture_matchers.h"
 #include "catch_run_context.h"
+#include "catch_enforce.h"
 
 namespace Catch {
 
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp
index 303e891..51fa035 100644
--- a/include/internal/catch_capture.hpp
+++ b/include/internal/catch_capture.hpp
@@ -61,6 +61,14 @@
     INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
     if( !Catch::getResultCapture().lastAssertionPassed() )
 
+#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+
+#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... )
+#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... )
+#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr )
+
+#else
+
 ///////////////////////////////////////////////////////////////////////////////
 #define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
     do { \
@@ -112,6 +120,7 @@
         INTERNAL_CATCH_REACT( catchAssertionHandler ) \
     } while( false )
 
+#endif  // CATCH_CONFIG_DISABLE_EXCEPTIONS
 
 ///////////////////////////////////////////////////////////////////////////////
 #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
diff --git a/include/internal/catch_interfaces_exception.h b/include/internal/catch_interfaces_exception.h
index 430701c..73ef990 100644
--- a/include/internal/catch_interfaces_exception.h
+++ b/include/internal/catch_interfaces_exception.h
@@ -46,15 +46,17 @@
             {}
 
             std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
-                try {
+                CATCH_TRY {
                     if( it == itEnd )
                         std::rethrow_exception(std::current_exception());
                     else
                         return (*it)->translate( it+1, itEnd );
                 }
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
                 catch( T& ex ) {
                     return m_translateFunction( ex );
                 }
+#endif
             }
 
         protected:
diff --git a/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp b/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp
index b533c45..5428589 100644
--- a/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp
+++ b/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp
@@ -10,6 +10,7 @@
 #include "internal/catch_tag_alias_registry.h"
 
 TEST_CASE( "Tag alias can be registered against tag patterns" ) {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
 
     Catch::TagAliasRegistry registry;
 
@@ -39,4 +40,6 @@
         CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) );
         CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) );
     }
+
+#endif
 }
diff --git a/projects/SelfTest/UsageTests/Compilation.tests.cpp b/projects/SelfTest/UsageTests/Compilation.tests.cpp
index 7f2ad8b..70b814a 100644
--- a/projects/SelfTest/UsageTests/Compilation.tests.cpp
+++ b/projects/SelfTest/UsageTests/Compilation.tests.cpp
@@ -68,7 +68,11 @@
 
     void throws_int(bool b) {
         if (b) {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
             throw 1;
+#else
+            std::terminate();
+#endif
         }
     }
 
diff --git a/projects/SelfTest/UsageTests/Exception.tests.cpp b/projects/SelfTest/UsageTests/Exception.tests.cpp
index 9c198df..b13b93b 100644
--- a/projects/SelfTest/UsageTests/Exception.tests.cpp
+++ b/projects/SelfTest/UsageTests/Exception.tests.cpp
@@ -21,6 +21,10 @@
 #pragma clang diagnostic ignored "-Wunreachable-code"
 #endif
 
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+// Cannot use try/catch keywords with -fno-exceptions.
+// Even if an exception was to be "thrown" it would just call std::terminate instead.
+
 namespace { namespace ExceptionTests {
 
 #ifndef EXCEPTION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
@@ -205,6 +209,8 @@
 
 }} // namespace ExceptionTests
 
+#endif // CATCH_CONFIG_USE_EXCEPTIONS
+
 #ifdef __clang__
 #pragma clang diagnostic pop
 #endif
diff --git a/projects/SelfTest/UsageTests/Matchers.tests.cpp b/projects/SelfTest/UsageTests/Matchers.tests.cpp
index f07481d..dc4b701 100644
--- a/projects/SelfTest/UsageTests/Matchers.tests.cpp
+++ b/projects/SelfTest/UsageTests/Matchers.tests.cpp
@@ -52,6 +52,7 @@
         int i;
     };
 
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
     void doesNotThrow() {}
 
     [[noreturn]]
@@ -63,6 +64,7 @@
     void throwsAsInt(int i) {
         throw i;
     }
+#endif
 
     class ExceptionMatcher : public Catch::MatcherBase<SpecialException> {
         int m_expected;
@@ -298,6 +300,7 @@
             }
         }
 
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
         TEST_CASE("Exception matchers that succeed", "[matchers][exceptions][!throws]") {
             CHECK_THROWS_MATCHES(throws(1), SpecialException, ExceptionMatcher{1});
             REQUIRE_THROWS_MATCHES(throws(2), SpecialException, ExceptionMatcher{2});
@@ -317,6 +320,7 @@
                 REQUIRE_THROWS_MATCHES(throws(4), SpecialException, ExceptionMatcher{1});
             }
         }
+#endif
 
         TEST_CASE("Floating point matchers: float", "[matchers][floating-point]") {
             SECTION("Margin") {
diff --git a/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp b/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp
index 60b3f90..a048e15 100644
--- a/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp
+++ b/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp
@@ -1,7 +1,7 @@
 #define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
 #include "catch.hpp"
 
-#if defined(CATCH_CONFIG_CPP17_VARIANT)
+#if defined(CATCH_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
 
 #include <string>
 #include <variant>
diff --git a/projects/SelfTest/UsageTests/Tricky.tests.cpp b/projects/SelfTest/UsageTests/Tricky.tests.cpp
index ea507a8..77bad2f 100644
--- a/projects/SelfTest/UsageTests/Tricky.tests.cpp
+++ b/projects/SelfTest/UsageTests/Tricky.tests.cpp
@@ -364,16 +364,20 @@
 }
 
 namespace {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
     struct constructor_throws {
         [[noreturn]] constructor_throws() {
             throw 1;
         }
     };
+#endif
 }
 
 TEST_CASE("Commas in various macros are allowed") {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
     REQUIRE_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} );
     CHECK_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} );
+#endif
     REQUIRE_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} );
     CHECK_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} );
 
@@ -397,9 +401,11 @@
 }
 
 TEST_CASE( "non-copyable objects", "[.][failing]" ) {
+#if CHECK_CONFIG_USE_RTTI
     // Thanks to Agustin Bergé (@k-ballo on the cpplang Slack) for raising this
     std::type_info const& ti = typeid(int);
     CHECK( ti == typeid(int) );
+#endif
 }
 
 // #925