Skip to content

Commit

Permalink
pw_{span,checksum}: Fix span_impl.h visibility; remove improper includes
Browse files Browse the repository at this point in the history
- The pw_span/internal/span_impl.h header was not considered private by
  GN, despite being in the sources list. Simplify the pw_span
  pw_source_set to fix this.
- Remove accidentally direct includes of the
  pw_span/internal/span_impl.h header.
- Remove unused _PW_SPAN_POLYFILL_ENABLED macro.

Change-Id: I7fd11b46e38006cac4d3522c22f119c8f6637b50
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126457
Reviewed-by: Ted Pudlik <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Jan 12, 2023
1 parent aabb87d commit 2f64ed4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion pw_checksum/crc16_ccitt_perf_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "pw_bytes/array.h"
#include "pw_checksum/crc16_ccitt.h"
#include "pw_perf_test/perf_test.h"
#include "pw_span/internal/span_impl.h"
#include "pw_span/span.h"

namespace pw::checksum {
Expand Down
1 change: 0 additions & 1 deletion pw_checksum/crc32_perf_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "pw_bytes/array.h"
#include "pw_checksum/crc32.h"
#include "pw_perf_test/perf_test.h"
#include "pw_span/internal/span_impl.h"
#include "pw_span/span.h"

namespace pw::checksum {
Expand Down
6 changes: 3 additions & 3 deletions pw_span/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ licenses(["notice"])

pw_cc_library(
name = "pw_span",
srcs = ["public/pw_span/internal/span_impl.h"],
hdrs = [
srcs = [
"public/pw_span/internal/config.h",
"public/pw_span/span.h",
"public/pw_span/internal/span_impl.h",
],
hdrs = ["public/pw_span/span.h"],
includes = ["public"],
deps = [
# TODO(b/243851191): Depending on pw_assert causes a dependency cycle.
Expand Down
9 changes: 2 additions & 7 deletions pw_span/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,11 @@ pw_source_set("span_asserts") {

# Provides "pw_span/span.h" and pw::span.
pw_source_set("pw_span") {
public = [ "public/pw_span/span.h" ]
public_deps = [ ":common" ]
}

pw_source_set("common") {
public_configs = [ ":public_config" ]
public = [ "public/pw_span/span.h" ]
public_deps = [
":config",
"$dir_pw_polyfill",
dir_pw_polyfill,
]

# Polyfill <cstddef> (std::byte) and <iterator> (std::size(), std::data) if
Expand All @@ -94,7 +90,6 @@ pw_source_set("common") {
}

sources = [ "public/pw_span/internal/span_impl.h" ]
visibility = [ ":*" ]
}

pw_test_group("tests") {
Expand Down
5 changes: 2 additions & 3 deletions pw_span/public/pw_span/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

// If the C++ library fully supports <span>, pw::span is an alias of std::span,
// but only if PW_SPAN_ENABLE_ASSERTS is not enabled.
#if !PW_SPAN_ENABLE_ASSERTS && \
(defined(__cpp_lib_span) && __cpp_lib_span >= 202002L || \
defined(_PW_SPAN_POLYFILL_ENABLED))
#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L && \
!PW_SPAN_ENABLE_ASSERTS

#include <span>

Expand Down

0 comments on commit 2f64ed4

Please sign in to comment.