pw_polyfill, pw_minimal_cpp_stdlib: Fix namespace
- Clang / libc++ require standard library names to be defined in a
special namespace. If they are simply declared in namespace std,
strange errors can occur. This caused problems with std::span. Update
pw_polyfill to add a macro that provides the std namespace
declaration.
- Update pw_polyfill and pw_minimal_cpp_stdlib to use the new std
namespace macro.
- Fully isolate the pw_minimal_cpp_stdlib library tests from the rest of
Pigweed, since Pigweed builds with the standard library. This prevents
isolates potentially conflicting standard library defintions.
Change-Id: I1a095e8ac879757ffba6796239e70785cc328cd7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13240
Reviewed-by: Rob Mohr <mohrr@google.com>
Reviewed-by: David Rogers <davidrogers@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
diff --git a/pw_minimal_cpp_stdlib/BUILD.gn b/pw_minimal_cpp_stdlib/BUILD.gn
index 541541d..5f3a6ad 100644
--- a/pw_minimal_cpp_stdlib/BUILD.gn
+++ b/pw_minimal_cpp_stdlib/BUILD.gn
@@ -76,14 +76,26 @@
]
}
-pw_test("minimal_cpp_stdlib_test") {
+pw_source_set("minimal_cpp_stdlib_isolated_test") {
configs = [ ":no_cpp_includes" ]
- deps = [ ":pw_minimal_cpp_stdlib" ]
+ deps = [
+ ":pw_minimal_cpp_stdlib",
+ dir_pw_preprocessor,
+ ]
+ sources = [ "isolated_test.cc" ]
+ visibility = [ ":*" ]
+}
+
+pw_test("minimal_cpp_stdlib_test") {
+ deps = [ ":minimal_cpp_stdlib_isolated_test" ]
sources = [ "test.cc" ]
}
pw_test("standard_library_test") {
- sources = [ "test.cc" ]
+ sources = [
+ "isolated_test.cc",
+ "test.cc",
+ ]
}
pw_doc_group("docs") {