summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/base/CMakeLists.txt1
-rw-r--r--absl/base/optimization_test.cc4
-rw-r--r--absl/debugging/BUILD.bazel1
-rw-r--r--absl/debugging/CMakeLists.txt1
-rw-r--r--absl/debugging/internal/symbolize.h3
-rw-r--r--absl/debugging/symbolize_elf.inc8
-rw-r--r--absl/debugging/symbolize_test.cc5
-rw-r--r--absl/flags/BUILD.bazel3
-rw-r--r--absl/flags/internal/registry.h7
9 files changed, 12 insertions, 21 deletions
diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt
index b43843cc..62486f9d 100644
--- a/absl/base/CMakeLists.txt
+++ b/absl/base/CMakeLists.txt
@@ -711,5 +711,6 @@ absl_cc_test(
${ABSL_TEST_COPTS}
DEPS
absl::core_headers
+ absl::optional
gtest_main
)
diff --git a/absl/base/optimization_test.cc b/absl/base/optimization_test.cc
index 62b35666..894b68f8 100644
--- a/absl/base/optimization_test.cc
+++ b/absl/base/optimization_test.cc
@@ -12,10 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// This test serves primarily as a compilation test for base/raw_logging.h.
-// Raw logging testing is covered by logging_unittest.cc, which is not as
-// portable as this test.
-
#include "absl/base/optimization.h"
#include "gtest/gtest.h"
diff --git a/absl/debugging/BUILD.bazel b/absl/debugging/BUILD.bazel
index ff627924..d3362467 100644
--- a/absl/debugging/BUILD.bazel
+++ b/absl/debugging/BUILD.bazel
@@ -100,6 +100,7 @@ cc_test(
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/memory",
+ "//absl/strings",
"@com_google_googletest//:gtest",
],
)
diff --git a/absl/debugging/CMakeLists.txt b/absl/debugging/CMakeLists.txt
index 995e8887..c597df86 100644
--- a/absl/debugging/CMakeLists.txt
+++ b/absl/debugging/CMakeLists.txt
@@ -85,6 +85,7 @@ absl_cc_test(
absl::core_headers
absl::memory
absl::raw_logging_internal
+ absl::strings
gmock
)
diff --git a/absl/debugging/internal/symbolize.h b/absl/debugging/internal/symbolize.h
index 8789e69a..663d774d 100644
--- a/absl/debugging/internal/symbolize.h
+++ b/absl/debugging/internal/symbolize.h
@@ -22,6 +22,7 @@
#include <cstdint>
#include "absl/base/config.h"
+#include "absl/strings/string_view.h"
#ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
#error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set
@@ -45,7 +46,7 @@ namespace debugging_internal {
//
// This is not async-signal-safe.
bool ForEachSection(int fd,
- const std::function<bool(const std::string& name,
+ const std::function<bool(absl::string_view name,
const ElfW(Shdr) &)>& callback);
// Gets the section header for the given name, if it exists. Returns true on
diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc
index ec86f9a9..c05424e0 100644
--- a/absl/debugging/symbolize_elf.inc
+++ b/absl/debugging/symbolize_elf.inc
@@ -74,6 +74,7 @@
#include "absl/base/port.h"
#include "absl/debugging/internal/demangle.h"
#include "absl/debugging/internal/vdso_support.h"
+#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -498,7 +499,7 @@ static ABSL_ATTRIBUTE_NOINLINE bool GetSectionHeaderByType(
const int kMaxSectionNameLen = 64;
bool ForEachSection(int fd,
- const std::function<bool(const std::string &name,
+ const std::function<bool(absl::string_view name,
const ElfW(Shdr) &)> &callback) {
ElfW(Ehdr) elf_header;
if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
@@ -520,7 +521,7 @@ bool ForEachSection(int fd,
return false;
}
off_t name_offset = shstrtab.sh_offset + out.sh_name;
- char header_name[kMaxSectionNameLen + 1];
+ char header_name[kMaxSectionNameLen];
ssize_t n_read =
ReadFromOffset(fd, &header_name, kMaxSectionNameLen, name_offset);
if (n_read == -1) {
@@ -529,9 +530,8 @@ bool ForEachSection(int fd,
// Long read?
return false;
}
- header_name[n_read] = '\0';
- std::string name(header_name);
+ absl::string_view name(header_name, strnlen(header_name, n_read));
if (!callback(name, out)) {
break;
}
diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc
index e476d82a..43f65549 100644
--- a/absl/debugging/symbolize_test.cc
+++ b/absl/debugging/symbolize_test.cc
@@ -32,6 +32,7 @@
#include "absl/base/optimization.h"
#include "absl/debugging/internal/stack_consumption.h"
#include "absl/memory/memory.h"
+#include "absl/strings/string_view.h"
using testing::Contains;
@@ -401,8 +402,8 @@ TEST(Symbolize, ForEachSection) {
std::vector<std::string> sections;
ASSERT_TRUE(absl::debugging_internal::ForEachSection(
- fd, [&sections](const std::string &name, const ElfW(Shdr) &) {
- sections.push_back(name);
+ fd, [&sections](const absl::string_view name, const ElfW(Shdr) &) {
+ sections.emplace_back(name);
return true;
}));
diff --git a/absl/flags/BUILD.bazel b/absl/flags/BUILD.bazel
index 37c9a105..006911fd 100644
--- a/absl/flags/BUILD.bazel
+++ b/absl/flags/BUILD.bazel
@@ -169,9 +169,6 @@ cc_library(
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
- visibility = [
- "//absl/flags:__pkg__",
- ],
deps = [
":commandlineflag",
":commandlineflag_internal",
diff --git a/absl/flags/internal/registry.h b/absl/flags/internal/registry.h
index c72eebe2..6f5006a0 100644
--- a/absl/flags/internal/registry.h
+++ b/absl/flags/internal/registry.h
@@ -28,15 +28,8 @@
namespace absl {
ABSL_NAMESPACE_BEGIN
-
-// TODO(rogeeff): remove this declaration
-CommandLineFlag* FindCommandLineFlag(absl::string_view name);
-
namespace flags_internal {
-// TODO(rogeeff): remove this alias
-using absl::FindCommandLineFlag;
-
// Executes specified visitor for each non-retired flag in the registry.
// Requires the caller hold the registry lock.
void ForEachFlagUnlocked(std::function<void(CommandLineFlag&)> visitor);