diff options
author | Chris Mihelich <cmihelic@google.com> | 2024-06-14 12:11:34 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-06-14 12:12:29 -0700 |
commit | f04e489056d9be93072bb633d9818b1e2add6316 (patch) | |
tree | a726568621c2a88c206210b0b06b4d256b793ece | |
parent | 9755364a0d9a448c57b705640b4756d566a0051e (diff) |
Drop std:: qualification from integer types like uint64_t.
PiperOrigin-RevId: 643418422
Change-Id: Ib16cfef8ddedc8366df49ca75ab02eb60af08f26
-rw-r--r-- | absl/debugging/internal/demangle_rust.cc | 12 | ||||
-rw-r--r-- | absl/debugging/internal/demangle_rust.h | 2 | ||||
-rw-r--r-- | absl/debugging/internal/demangle_rust_test.cc | 10 | ||||
-rw-r--r-- | absl/debugging/internal/demangle_test.cc | 2 | ||||
-rw-r--r-- | absl/debugging/internal/utf8_for_code_point_test.cc | 42 |
5 files changed, 34 insertions, 34 deletions
diff --git a/absl/debugging/internal/demangle_rust.cc b/absl/debugging/internal/demangle_rust.cc index 06ee7a4b..6b686ab3 100644 --- a/absl/debugging/internal/demangle_rust.cc +++ b/absl/debugging/internal/demangle_rust.cc @@ -503,7 +503,7 @@ class RustSymbolParser { private: // Enumerates resumption points for ABSL_DEMANGLER_RECURSE calls. - enum ReturnAddress : std::uint8_t { + enum ReturnAddress : uint8_t { kInstantiatingCrate, kVendorSpecificSuffix, kIdentifierInUppercaseNamespace, @@ -585,9 +585,9 @@ class RustSymbolParser { // false if not everything fit into the output buffer. ABSL_MUST_USE_RESULT bool Emit(const char* token) { if (silence_depth_ > 0) return true; - const std::size_t token_length = std::strlen(token); - const std::size_t bytes_to_copy = token_length + 1; // token and final NUL - if (static_cast<std::size_t>(out_end_ - out_) < bytes_to_copy) return false; + const size_t token_length = std::strlen(token); + const size_t bytes_to_copy = token_length + 1; // token and final NUL + if (static_cast<size_t>(out_end_ - out_) < bytes_to_copy) return false; std::memcpy(out_, token, bytes_to_copy); out_ += token_length; return true; @@ -604,7 +604,7 @@ class RustSymbolParser { // because 999 > 256. The bound will remain correct even if future // maintenance changes the type of the disambiguator variable. char digits[3 * sizeof(disambiguator)] = {}; - std::size_t leading_digit_index = sizeof(digits) - 1; + size_t leading_digit_index = sizeof(digits) - 1; for (; disambiguator > 0; disambiguator /= 10) { digits[--leading_digit_index] = static_cast<char>('0' + disambiguator % 10); @@ -909,7 +909,7 @@ class RustSymbolParser { } // namespace bool DemangleRustSymbolEncoding(const char* mangled, char* out, - std::size_t out_size) { + size_t out_size) { return RustSymbolParser(mangled, out, out + out_size).Parse(); } diff --git a/absl/debugging/internal/demangle_rust.h b/absl/debugging/internal/demangle_rust.h index 1c19815f..29e08ecd 100644 --- a/absl/debugging/internal/demangle_rust.h +++ b/absl/debugging/internal/demangle_rust.h @@ -36,7 +36,7 @@ namespace debugging_internal { // The demangling logic is under development; search for "not yet implemented" // in the .cc file to see where the gaps are. bool DemangleRustSymbolEncoding(const char* mangled, char* out, - std::size_t out_size); + size_t out_size); } // namespace debugging_internal ABSL_NAMESPACE_END diff --git a/absl/debugging/internal/demangle_rust_test.cc b/absl/debugging/internal/demangle_rust_test.cc index 00bba780..e6b68ae3 100644 --- a/absl/debugging/internal/demangle_rust_test.cc +++ b/absl/debugging/internal/demangle_rust_test.cc @@ -29,7 +29,7 @@ namespace { // chars>, buffer_size) returns true and seems not to have overrun its output // buffer, returns the string written by DemangleRustSymbolEncoding; otherwise // returns an error message. -std::string ResultOfDemangling(const char* mangled, std::size_t buffer_size) { +std::string ResultOfDemangling(const char* mangled, size_t buffer_size) { // Fill the buffer with something other than NUL so we test whether Demangle // appends trailing NUL as expected. std::string buffer(buffer_size + 1, '~'); @@ -58,9 +58,9 @@ std::string ResultOfDemangling(const char* mangled, std::size_t buffer_size) { #define EXPECT_DEMANGLING(mangled, plaintext) \ do { \ [] { \ - constexpr std::size_t plenty_of_space = sizeof(plaintext) + 128; \ - constexpr std::size_t just_enough_space = sizeof(plaintext); \ - constexpr std::size_t one_byte_too_few = sizeof(plaintext) - 1; \ + constexpr size_t plenty_of_space = sizeof(plaintext) + 128; \ + constexpr size_t just_enough_space = sizeof(plaintext); \ + constexpr size_t one_byte_too_few = sizeof(plaintext) - 1; \ const char* expected_plaintext = plaintext; \ const char* expected_error = "Failed parse"; \ ASSERT_EQ(ResultOfDemangling(mangled, plenty_of_space), \ @@ -76,7 +76,7 @@ std::string ResultOfDemangling(const char* mangled, std::size_t buffer_size) { // truncation of a real Rust symbol name). #define EXPECT_DEMANGLING_FAILS(mangled) \ do { \ - constexpr std::size_t plenty_of_space = 1024; \ + constexpr size_t plenty_of_space = 1024; \ const char* expected_error = "Failed parse"; \ EXPECT_EQ(ResultOfDemangling(mangled, plenty_of_space), expected_error); \ } while (0) diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 55686814..5579221a 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -1209,7 +1209,7 @@ TEST(Demangle, BinaryFoldExpressions) { TEST(Demangle, SizeofPacks) { char tmp[80]; - // template <std::size_t i> struct S {}; + // template <size_t i> struct S {}; // // template <class... T> auto f(T... p) -> S<sizeof...(T)> { return {}; } // template auto f<int, long>(int, long) -> S<2>; diff --git a/absl/debugging/internal/utf8_for_code_point_test.cc b/absl/debugging/internal/utf8_for_code_point_test.cc index d6817c77..dd0591ae 100644 --- a/absl/debugging/internal/utf8_for_code_point_test.cc +++ b/absl/debugging/internal/utf8_for_code_point_test.cc @@ -25,32 +25,32 @@ namespace debugging_internal { namespace { TEST(Utf8ForCodePointTest, RecognizesTheSmallestCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0}); + Utf8ForCodePoint utf8(uint64_t{0}); ASSERT_EQ(utf8.length, 1); EXPECT_EQ(utf8.bytes[0], '\0'); } TEST(Utf8ForCodePointTest, RecognizesAsciiSmallA) { - Utf8ForCodePoint utf8(std::uint64_t{'a'}); + Utf8ForCodePoint utf8(uint64_t{'a'}); ASSERT_EQ(utf8.length, 1); EXPECT_EQ(utf8.bytes[0], 'a'); } TEST(Utf8ForCodePointTest, RecognizesTheLargestOneByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x7f}); + Utf8ForCodePoint utf8(uint64_t{0x7f}); ASSERT_EQ(utf8.length, 1); EXPECT_EQ(utf8.bytes[0], '\x7f'); } TEST(Utf8ForCodePointTest, RecognizesTheSmallestTwoByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x80}); + Utf8ForCodePoint utf8(uint64_t{0x80}); ASSERT_EQ(utf8.length, 2); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xc2)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0x80)); } TEST(Utf8ForCodePointTest, RecognizesSmallNWithTilde) { - Utf8ForCodePoint utf8(std::uint64_t{0xf1}); + Utf8ForCodePoint utf8(uint64_t{0xf1}); ASSERT_EQ(utf8.length, 2); const char* want = "ñ"; EXPECT_EQ(utf8.bytes[0], want[0]); @@ -58,7 +58,7 @@ TEST(Utf8ForCodePointTest, RecognizesSmallNWithTilde) { } TEST(Utf8ForCodePointTest, RecognizesCapitalPi) { - Utf8ForCodePoint utf8(std::uint64_t{0x3a0}); + Utf8ForCodePoint utf8(uint64_t{0x3a0}); ASSERT_EQ(utf8.length, 2); const char* want = "Π"; EXPECT_EQ(utf8.bytes[0], want[0]); @@ -66,14 +66,14 @@ TEST(Utf8ForCodePointTest, RecognizesCapitalPi) { } TEST(Utf8ForCodePointTest, RecognizesTheLargestTwoByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x7ff}); + Utf8ForCodePoint utf8(uint64_t{0x7ff}); ASSERT_EQ(utf8.length, 2); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xdf)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0xbf)); } TEST(Utf8ForCodePointTest, RecognizesTheSmallestThreeByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x800}); + Utf8ForCodePoint utf8(uint64_t{0x800}); ASSERT_EQ(utf8.length, 3); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xe0)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0xa0)); @@ -81,7 +81,7 @@ TEST(Utf8ForCodePointTest, RecognizesTheSmallestThreeByteCodePoint) { } TEST(Utf8ForCodePointTest, RecognizesTheChineseCharacterZhong1AsInZhong1Wen2) { - Utf8ForCodePoint utf8(std::uint64_t{0x4e2d}); + Utf8ForCodePoint utf8(uint64_t{0x4e2d}); ASSERT_EQ(utf8.length, 3); const char* want = "中"; EXPECT_EQ(utf8.bytes[0], want[0]); @@ -90,7 +90,7 @@ TEST(Utf8ForCodePointTest, RecognizesTheChineseCharacterZhong1AsInZhong1Wen2) { } TEST(Utf8ForCodePointTest, RecognizesOneBeforeTheSmallestSurrogate) { - Utf8ForCodePoint utf8(std::uint64_t{0xd7ff}); + Utf8ForCodePoint utf8(uint64_t{0xd7ff}); ASSERT_EQ(utf8.length, 3); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xed)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0x9f)); @@ -98,17 +98,17 @@ TEST(Utf8ForCodePointTest, RecognizesOneBeforeTheSmallestSurrogate) { } TEST(Utf8ForCodePointTest, RejectsTheSmallestSurrogate) { - Utf8ForCodePoint utf8(std::uint64_t{0xd800}); + Utf8ForCodePoint utf8(uint64_t{0xd800}); EXPECT_EQ(utf8.length, 0); } TEST(Utf8ForCodePointTest, RejectsTheLargestSurrogate) { - Utf8ForCodePoint utf8(std::uint64_t{0xdfff}); + Utf8ForCodePoint utf8(uint64_t{0xdfff}); EXPECT_EQ(utf8.length, 0); } TEST(Utf8ForCodePointTest, RecognizesOnePastTheLargestSurrogate) { - Utf8ForCodePoint utf8(std::uint64_t{0xe000}); + Utf8ForCodePoint utf8(uint64_t{0xe000}); ASSERT_EQ(utf8.length, 3); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xee)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0x80)); @@ -116,7 +116,7 @@ TEST(Utf8ForCodePointTest, RecognizesOnePastTheLargestSurrogate) { } TEST(Utf8ForCodePointTest, RecognizesTheLargestThreeByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0xffff}); + Utf8ForCodePoint utf8(uint64_t{0xffff}); ASSERT_EQ(utf8.length, 3); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xef)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0xbf)); @@ -124,7 +124,7 @@ TEST(Utf8ForCodePointTest, RecognizesTheLargestThreeByteCodePoint) { } TEST(Utf8ForCodePointTest, RecognizesTheSmallestFourByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x10000}); + Utf8ForCodePoint utf8(uint64_t{0x10000}); ASSERT_EQ(utf8.length, 4); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xf0)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0x90)); @@ -133,7 +133,7 @@ TEST(Utf8ForCodePointTest, RecognizesTheSmallestFourByteCodePoint) { } TEST(Utf8ForCodePointTest, RecognizesTheJackOfHearts) { - Utf8ForCodePoint utf8(std::uint64_t{0x1f0bb}); + Utf8ForCodePoint utf8(uint64_t{0x1f0bb}); ASSERT_EQ(utf8.length, 4); const char* want = "🂻"; EXPECT_EQ(utf8.bytes[0], want[0]); @@ -143,7 +143,7 @@ TEST(Utf8ForCodePointTest, RecognizesTheJackOfHearts) { } TEST(Utf8ForCodePointTest, RecognizesTheLargestFourByteCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x10ffff}); + Utf8ForCodePoint utf8(uint64_t{0x10ffff}); ASSERT_EQ(utf8.length, 4); EXPECT_EQ(utf8.bytes[0], static_cast<char>(0xf4)); EXPECT_EQ(utf8.bytes[1], static_cast<char>(0x8f)); @@ -152,21 +152,21 @@ TEST(Utf8ForCodePointTest, RecognizesTheLargestFourByteCodePoint) { } TEST(Utf8ForCodePointTest, RejectsTheSmallestOverlargeCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0x110000}); + Utf8ForCodePoint utf8(uint64_t{0x110000}); EXPECT_EQ(utf8.length, 0); } TEST(Utf8ForCodePointTest, RejectsAThroughlyOverlargeCodePoint) { - Utf8ForCodePoint utf8(std::uint64_t{0xffffffff00000000}); + Utf8ForCodePoint utf8(uint64_t{0xffffffff00000000}); EXPECT_EQ(utf8.length, 0); } TEST(Utf8ForCodePointTest, OkReturnsTrueForAValidCodePoint) { - EXPECT_TRUE(Utf8ForCodePoint(std::uint64_t{0}).ok()); + EXPECT_TRUE(Utf8ForCodePoint(uint64_t{0}).ok()); } TEST(Utf8ForCodePointTest, OkReturnsFalseForAnInvalidCodePoint) { - EXPECT_FALSE(Utf8ForCodePoint(std::uint64_t{0xffffffff00000000}).ok()); + EXPECT_FALSE(Utf8ForCodePoint(uint64_t{0xffffffff00000000}).ok()); } } // namespace |