Skip to content

Commit

Permalink
pw_span: Remove pw_polyfill dependency
Browse files Browse the repository at this point in the history
This dependency was added back when the type needed to support more
limited constexpr semantics for C++11 and/or C++14. Those language
versions are no longer targeted, and so the header is now just hanging
around as a ghost.

Note that compatibility_test.cc still depends on pw_polyfill. As a
result, I've added the relevant dependency for the module that builds
that test.

Also, pw_varint/varint.h was naughty and depended on pw_polyfill
transitively through pw_span, so I also have had to fix it.

Change-Id: I1f7817a331937b06e06e677e165977f002d62cfa
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/124873
Reviewed-by: Wyatt Hepler <[email protected]>
Commit-Queue: Anqi Dong <[email protected]>
  • Loading branch information
anqid-g authored and CQ Bot Account committed Jan 19, 2023
1 parent a81d369 commit 782bab0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
4 changes: 1 addition & 3 deletions pw_span/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ cc_library_headers {
vendor_available: true,
cpp_std: "c++2a",
export_include_dirs: ["public"],
header_libs: [
"pw_polyfill_headers",
],
header_libs: [],
host_supported: true,
}
7 changes: 5 additions & 2 deletions pw_span/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pw_cc_library(
includes = ["public"],
deps = [
# TODO(b/243851191): Depending on pw_assert causes a dependency cycle.
"//pw_polyfill",
],
)

Expand All @@ -41,12 +40,16 @@ pw_cc_test(
srcs = ["span_test.cc"],
deps = [
":pw_span",
"//pw_polyfill",
"//pw_unit_test",
],
)

pw_cc_test(
name = "compatibility_test",
srcs = ["compatibility_test.cc"],
deps = [":pw_span"],
deps = [
":pw_span",
"//pw_polyfill",
],
)
10 changes: 5 additions & 5 deletions pw_span/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ pw_source_set("span_asserts") {
pw_source_set("pw_span") {
public_configs = [ ":public_config" ]
public = [ "public/pw_span/span.h" ]
public_deps = [
":config",
dir_pw_polyfill,
]
public_deps = [ ":config" ]

# Polyfill <cstddef> (std::byte) and <iterator> (std::size(), std::data) if
# C++17 is not supported.
Expand All @@ -100,7 +97,10 @@ pw_test_group("tests") {
}

pw_test("pw_span_test") {
deps = [ ":pw_span" ]
deps = [
":pw_span",
dir_pw_polyfill,
]
remove_configs = [ "$dir_pw_build:extra_strict_warnings" ]
sources = [ "span_test.cc" ]
}
Expand Down
2 changes: 1 addition & 1 deletion pw_span/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ pw_add_library(pw_span INTERFACE
public
PUBLIC_DEPS
pw_assert
pw_polyfill
pw_polyfill.standard_library
)

pw_add_test(pw_span.pw_span_test
SOURCES
span_test.cc
PRIVATE_DEPS
pw_polyfill
pw_span
GROUPS
modules
Expand Down
1 change: 0 additions & 1 deletion pw_span/public/pw_span/internal/span_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <type_traits>
#include <utility>

#include "pw_polyfill/language_feature_macros.h"
#include "pw_span/internal/config.h"

#if PW_SPAN_ENABLE_ASSERTS
Expand Down
1 change: 1 addition & 0 deletions pw_varint/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ config("default_config") {
pw_source_set("pw_varint") {
public_configs = [ ":default_config" ]
public_deps = [
dir_pw_polyfill,
dir_pw_preprocessor,
dir_pw_span,
]
Expand Down
1 change: 1 addition & 0 deletions pw_varint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pw_add_library(pw_varint STATIC
PUBLIC_INCLUDES
public
PUBLIC_DEPS
pw_polyfill
pw_preprocessor
pw_span
SOURCES
Expand Down

0 comments on commit 782bab0

Please sign in to comment.