Breaking change: Migrate to Abseil's logging library.

This deletes our old branches of internal Abseil code in favor of their newly open-sourced library.  Notably, this removes the ability to turn CHECK crashes into exceptions.

PiperOrigin-RevId: 504460562
pull/11584/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent 79ee26a557
commit a9f1ea6371
  1. 2
      .github/workflows/codespell.yml
  2. 2
      .gitmodules
  3. 8
      CMakeLists.txt
  4. 1
      build_defs/cpp_opts.bzl
  5. 22
      cmake/abseil-cpp.cmake
  6. 48
      cmake/gtest.cmake
  7. 38
      cmake/tests.cmake
  8. 18
      conformance/binary_json_conformance_suite.cc
  9. 18
      conformance/conformance_cpp.cc
  10. 20
      conformance/conformance_test.cc
  11. 22
      conformance/conformance_test_runner.cc
  12. 6
      conformance/text_format_conformance_suite.cc
  13. 5
      kokoro/common/setup_kokoro_environment.sh
  14. 4
      kokoro/macos-next/cpp/build.sh
  15. 7
      kokoro/windows/prepare_build_win64.bat
  16. 4
      protobuf_deps.bzl
  17. 4
      python/google/protobuf/pyext/descriptor.cc
  18. 12
      python/google/protobuf/pyext/descriptor_database.cc
  19. 24
      python/google/protobuf/pyext/message.cc
  20. 4
      python/google/protobuf/pyext/safe_numerics.h
  21. 2
      regenerate_stale_files.sh
  22. 17
      src/google/protobuf/BUILD.bazel
  23. 4
      src/google/protobuf/any_test.cc
  24. 40
      src/google/protobuf/arena.cc
  25. 2
      src/google/protobuf/arena.h
  26. 6
      src/google/protobuf/arena_align.h
  27. 24
      src/google/protobuf/arena_align_test.cc
  28. 10
      src/google/protobuf/arena_cleanup.h
  29. 4
      src/google/protobuf/arena_test_util.cc
  30. 8
      src/google/protobuf/arena_test_util.h
  31. 66
      src/google/protobuf/arena_unittest.cc
  32. 8
      src/google/protobuf/arenastring.cc
  33. 10
      src/google/protobuf/arenastring.h
  34. 2
      src/google/protobuf/arenastring_unittest.cc
  35. 4
      src/google/protobuf/arenaz_sampler_test.cc
  36. 7
      src/google/protobuf/compiler/BUILD.bazel
  37. 6
      src/google/protobuf/compiler/annotation_test_util.cc
  38. 6
      src/google/protobuf/compiler/code_generator.cc
  39. 22
      src/google/protobuf/compiler/command_line_interface.cc
  40. 36
      src/google/protobuf/compiler/command_line_interface_unittest.cc
  41. 8
      src/google/protobuf/compiler/cpp/bootstrap_unittest.cc
  42. 10
      src/google/protobuf/compiler/cpp/field.cc
  43. 6
      src/google/protobuf/compiler/cpp/field.h
  44. 4
      src/google/protobuf/compiler/cpp/field_generators/enum_field.cc
  45. 2
      src/google/protobuf/compiler/cpp/field_generators/map_field.cc
  46. 2
      src/google/protobuf/compiler/cpp/field_generators/message_field.cc
  47. 6
      src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc
  48. 12
      src/google/protobuf/compiler/cpp/field_generators/string_field.cc
  49. 6
      src/google/protobuf/compiler/cpp/file.cc
  50. 4
      src/google/protobuf/compiler/cpp/file.h
  51. 16
      src/google/protobuf/compiler/cpp/generator.cc
  52. 30
      src/google/protobuf/compiler/cpp/helpers.cc
  53. 6
      src/google/protobuf/compiler/cpp/helpers.h
  54. 68
      src/google/protobuf/compiler/cpp/message.cc
  55. 52
      src/google/protobuf/compiler/cpp/message_size_unittest.cc
  56. 8
      src/google/protobuf/compiler/cpp/metadata_test.cc
  57. 4
      src/google/protobuf/compiler/cpp/padding_optimizer.cc
  58. 32
      src/google/protobuf/compiler/cpp/parse_function_generator.cc
  59. 4
      src/google/protobuf/compiler/cpp/plugin_unittest.cc
  60. 8
      src/google/protobuf/compiler/cpp/service.cc
  61. 2
      src/google/protobuf/compiler/cpp/tracker.cc
  62. 4
      src/google/protobuf/compiler/cpp/unittest.inc
  63. 2
      src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
  64. 4
      src/google/protobuf/compiler/csharp/csharp_enum.cc
  65. 10
      src/google/protobuf/compiler/csharp/csharp_field_base.cc
  66. 8
      src/google/protobuf/compiler/csharp/csharp_helpers.cc
  67. 4
      src/google/protobuf/compiler/csharp/csharp_message.cc
  68. 2
      src/google/protobuf/compiler/importer.h
  69. 10
      src/google/protobuf/compiler/importer_unittest.cc
  70. 8
      src/google/protobuf/compiler/java/context.cc
  71. 10
      src/google/protobuf/compiler/java/enum_field.cc
  72. 6
      src/google/protobuf/compiler/java/enum_field_lite.cc
  73. 4
      src/google/protobuf/compiler/java/field.cc
  74. 4
      src/google/protobuf/compiler/java/field.h
  75. 14
      src/google/protobuf/compiler/java/file.cc
  76. 28
      src/google/protobuf/compiler/java/helpers.cc
  77. 8
      src/google/protobuf/compiler/java/map_field.cc
  78. 8
      src/google/protobuf/compiler/java/map_field_lite.cc
  79. 6
      src/google/protobuf/compiler/java/message.cc
  80. 6
      src/google/protobuf/compiler/java/message_builder.cc
  81. 4
      src/google/protobuf/compiler/java/message_builder_lite.cc
  82. 2
      src/google/protobuf/compiler/java/message_field.cc
  83. 4
      src/google/protobuf/compiler/java/message_lite.cc
  84. 6
      src/google/protobuf/compiler/java/message_serialization_unittest.cc
  85. 4
      src/google/protobuf/compiler/java/name_resolver.cc
  86. 6
      src/google/protobuf/compiler/java/plugin_unittest.cc
  87. 12
      src/google/protobuf/compiler/java/primitive_field.cc
  88. 6
      src/google/protobuf/compiler/java/primitive_field_lite.cc
  89. 2
      src/google/protobuf/compiler/java/service.cc
  90. 6
      src/google/protobuf/compiler/java/string_field.cc
  91. 6
      src/google/protobuf/compiler/java/string_field_lite.cc
  92. 2
      src/google/protobuf/compiler/main.cc
  93. 48
      src/google/protobuf/compiler/mock_code_generator.cc
  94. 11
      src/google/protobuf/compiler/objectivec/extension.cc
  95. 16
      src/google/protobuf/compiler/objectivec/field.cc
  96. 14
      src/google/protobuf/compiler/objectivec/helpers.cc
  97. 4
      src/google/protobuf/compiler/objectivec/import_writer.cc
  98. 4
      src/google/protobuf/compiler/objectivec/map_field.cc
  99. 4
      src/google/protobuf/compiler/objectivec/message.cc
  100. 6
      src/google/protobuf/compiler/objectivec/primitive_field.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -15,4 +15,4 @@ jobs:
with:
check_filenames: true
skip: ./.git,./third_party,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./.github/workflows/codespell.yml
ignore_words_list: "alow,alse,ba,chec,cleare,copyable,cloneable,dedup,dur,errorprone,falsy,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',ro,te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,streem,sur,falsy"
ignore_words_list: "alow,alse,atleast,ba,chec,cleare,copyable,cloneable,dedup,dur,errorprone,falsy,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',ro,te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,streem,sur,falsy"

2
.gitmodules vendored

@ -5,7 +5,7 @@
[submodule "third_party/abseil-cpp"]
path = third_party/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
branch = lts_2023_01_17
branch = lts_2023_01_24
[submodule "third_party/jsoncpp"]
path = third_party/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp.git

@ -258,6 +258,9 @@ else (protobuf_BUILD_SHARED_LIBS)
endif()
endif (protobuf_BUILD_SHARED_LIBS)
# Export all symbols on Windows when building shared libraries
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Build with multiple processes
@ -268,6 +271,7 @@ if (MSVC)
# MSVC warning suppressions
add_compile_options(
/wd4065 # switch statement contains 'default' but no 'case' labels
/wd4146 # unary minus operator applied to unsigned type
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
/wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
@ -319,6 +323,10 @@ endif (protobuf_UNICODE)
set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library")
set_property(CACHE protobuf_ABSL_PROVIDER PROPERTY STRINGS "module" "package")
if (protobuf_BUILD_TESTS)
include(${protobuf_SOURCE_DIR}/cmake/gtest.cmake)
endif (protobuf_BUILD_TESTS)
include(${protobuf_SOURCE_DIR}/cmake/abseil-cpp.cmake)
if (protobuf_BUILD_PROTOBUF_BINARIES)

@ -3,6 +3,7 @@
COPTS = select({
"//build_defs:config_msvc": [
"/wd4065", # switch statement contains 'default' but no 'case' labels
"/wd4146", # unary minus operator applied to unsigned type
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data

@ -1,5 +1,15 @@
# Setup our dependency on Abseil.
if(protobuf_BUILD_TESTS)
# Tell Abseil to build test-only helpers.
set(ABSL_BUILD_TEST_HELPERS ON)
# We depend on googletest too, so just tell Abseil to use the same one we've
# already setup.
set(ABSL_USE_EXTERNAL_GOOGLETEST ON)
set(ABSL_FIND_GOOGLETEST OFF)
endif()
if(TARGET absl::strings)
# If Abseil is included already, skip including it.
# (https://github.com/protocolbuffers/protobuf/issues/10435)
@ -31,11 +41,11 @@ if (BUILD_SHARED_LIBS AND MSVC)
# On MSVC Abseil is bundled into a single DLL.
set(protobuf_ABSL_USED_TARGETS abseil_dll)
# As a workaround for https://github.com/abseil/abseil-cpp/issues/1118,
# make sure ABSL_CONSUME_DLL gets set for all subsequent builds.
add_definitions(-DABSL_CONSUME_DLL)
set(protobuf_ABSL_USED_TEST_TARGETS abseil_test_dll)
else()
set(protobuf_ABSL_USED_TARGETS
absl::absl_check
absl::absl_log
absl::algorithm
absl::base
absl::bind_front
@ -45,6 +55,7 @@ else()
absl::cord
absl::core_headers
absl::debugging
absl::die_if_null
absl::dynamic_annotations
absl::flags
absl::flat_hash_map
@ -52,6 +63,8 @@ else()
absl::function_ref
absl::hash
absl::layout
absl::log_initialize
absl::log_severity
absl::memory
absl::node_hash_map
absl::node_hash_set
@ -66,4 +79,7 @@ else()
absl::utility
absl::variant
)
set(protobuf_ABSL_USED_TEST_TARGETS
absl::scoped_mock_log
)
endif ()

@ -0,0 +1,48 @@
option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF)
if (protobuf_USE_EXTERNAL_GTEST)
find_package(GTest REQUIRED)
else()
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/googletest directory that's needed to "
"build tests. If you use git, make sure you have cloned submodules:\n"
" git submodule update --init --recursive\n"
"If instead you want to skip tests, run cmake with:\n"
" cmake -Dprotobuf_BUILD_TESTS=OFF\n")
endif()
set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock")
set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest")
include_directories(
${googlemock_source_dir}
${googletest_source_dir}
${googletest_source_dir}/include
${googlemock_source_dir}/include
)
add_library(gmock ${protobuf_SHARED_OR_STATIC}
"${googlemock_source_dir}/src/gmock-all.cc"
"${googletest_source_dir}/src/gtest-all.cc"
)
if (protobuf_BUILD_SHARED_LIBS)
set_target_properties(gmock
PROPERTIES
COMPILE_DEFINITIONS
"GTEST_CREATE_SHARED_LIBRARY=1"
)
install(TARGETS gmock EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT})
add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc")
target_link_libraries(gmock_main gmock)
add_library(GTest::gmock ALIAS gmock)
add_library(GTest::gmock_main ALIAS gmock_main)
add_library(GTest::gtest ALIAS gmock)
add_library(GTest::gtest_main ALIAS gmock_main)
endif()

@ -1,5 +1,3 @@
option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF)
option(protobuf_REMOVE_INSTALLED_HEADERS
"Remove local headers so that installed ones are used instead" OFF)
@ -7,39 +5,6 @@ option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH
"Using absolute test_plugin path in tests" ON)
mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
if (protobuf_USE_EXTERNAL_GTEST)
find_package(GTest REQUIRED)
else()
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/googletest directory that's needed to "
"build tests. If you use git, make sure you have cloned submodules:\n"
" git submodule update --init --recursive\n"
"If instead you want to skip tests, run cmake with:\n"
" cmake -Dprotobuf_BUILD_TESTS=OFF\n")
endif()
set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock")
set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest")
include_directories(
${googlemock_source_dir}
${googletest_source_dir}
${googletest_source_dir}/include
${googlemock_source_dir}/include
)
add_library(gmock STATIC
"${googlemock_source_dir}/src/gmock-all.cc"
"${googletest_source_dir}/src/gtest-all.cc"
)
target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT})
add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc")
target_link_libraries(gmock_main gmock)
add_library(GTest::gmock ALIAS gmock)
add_library(GTest::gmock_main ALIAS gmock_main)
endif()
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
set(lite_test_protos
@ -133,6 +98,7 @@ target_link_libraries(tests
${protobuf_LIB_PROTOC}
${protobuf_LIB_PROTOBUF}
${protobuf_ABSL_USED_TARGETS}
${protobuf_ABSL_USED_TEST_TARGETS}
GTest::gmock_main
)
@ -148,6 +114,7 @@ target_link_libraries(test_plugin
${protobuf_LIB_PROTOC}
${protobuf_LIB_PROTOBUF}
${protobuf_ABSL_USED_TARGETS}
${protobuf_ABSL_USED_TEST_TARGETS}
GTest::gmock
)
@ -159,6 +126,7 @@ add_executable(lite-test
target_link_libraries(lite-test
${protobuf_LIB_PROTOBUF_LITE}
${protobuf_ABSL_USED_TARGETS}
${protobuf_ABSL_USED_TEST_TARGETS}
GTest::gmock_main
)

@ -38,8 +38,8 @@
#include "google/protobuf/text_format.h"
#include "google/protobuf/util/json_util.h"
#include "google/protobuf/util/type_resolver_util.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "json/json.h"
@ -241,7 +241,7 @@ const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type,
if (packed == Packed::kFalse) {
packed_string = "Unpacked ";
}
GOOGLE_ABSL_LOG(FATAL) << "Couldn't find field with type: " << repeated_string
ABSL_LOG(FATAL) << "Couldn't find field with type: " << repeated_string
<< packed_string << FieldDescriptor::TypeName(type) << " for "
<< proto_string;
return nullptr;
@ -265,7 +265,7 @@ const FieldDescriptor* GetFieldForMapType(FieldDescriptor::Type key_type,
}
const absl::string_view proto_string = is_proto3 ? "Proto3" : "Proto2";
GOOGLE_ABSL_LOG(FATAL) << "Couldn't find map field with type: "
ABSL_LOG(FATAL) << "Couldn't find map field with type: "
<< FieldDescriptor::TypeName(key_type) << " and "
<< FieldDescriptor::TypeName(key_type) << " for "
<< proto_string;
@ -285,7 +285,7 @@ const FieldDescriptor* GetFieldForOneofType(FieldDescriptor::Type type,
}
const absl::string_view proto_string = is_proto3 ? "Proto3" : "Proto2";
GOOGLE_ABSL_LOG(FATAL) << "Couldn't find oneof field with type: "
ABSL_LOG(FATAL) << "Couldn't find oneof field with type: "
<< FieldDescriptor::TypeName(type) << " for " << proto_string;
return nullptr;
}
@ -353,7 +353,7 @@ bool BinaryAndJsonConformanceSuite::ParseJsonResponse(
}
if (!test_message->ParseFromString(binary_protobuf)) {
GOOGLE_ABSL_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode "
ABSL_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode "
<< "yielded unparseable proto.";
return false;
}
@ -407,7 +407,7 @@ bool BinaryAndJsonConformanceSuite::ParseResponse(
}
default:
GOOGLE_ABSL_LOG(FATAL) << test_name
ABSL_LOG(FATAL) << test_name
<< ": unknown payload type: " << response.result_case();
}
@ -652,7 +652,7 @@ void BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson(
const string& test_name, ConformanceLevel level,
const string& text_format) {
TestAllTypesProto3 payload_message;
GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(text_format, &payload_message))
ABSL_CHECK(TextFormat::ParseFromString(text_format, &payload_message))
<< "Failed to parse: " << text_format;
TestAllTypesProto3 prototype;
@ -1414,7 +1414,7 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
req.set_protobuf_payload("");
req.set_requested_output_format(conformance::WireFormat::PROTOBUF);
RunTest("FindFailures", req, &res);
GOOGLE_ABSL_CHECK(failure_set.MergeFromString(res.protobuf_payload()));
ABSL_CHECK(failure_set.MergeFromString(res.protobuf_payload()));
for (const string& failure : failure_set.failure()) {
AddExpectedFailedTest(failure);
}

@ -40,8 +40,8 @@
#include "google/protobuf/text_format.h"
#include "google/protobuf/util/json_util.h"
#include "google/protobuf/util/type_resolver_util.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "conformance/conformance.pb.h"
@ -187,14 +187,14 @@ absl::StatusOr<ConformanceResponse> Harness::RunTest(
return absl::InvalidArgumentError("unspecified output format");
case conformance::PROTOBUF: {
GOOGLE_ABSL_CHECK(
ABSL_CHECK(
test_message->SerializeToString(response.mutable_protobuf_payload()));
break;
}
case conformance::JSON: {
std::string proto_binary;
GOOGLE_ABSL_CHECK(test_message->SerializeToString(&proto_binary));
ABSL_CHECK(test_message->SerializeToString(&proto_binary));
absl::Status status =
BinaryToJsonString(resolver_.get(), type_url_, proto_binary,
response.mutable_json_payload());
@ -208,7 +208,7 @@ absl::StatusOr<ConformanceResponse> Harness::RunTest(
case conformance::TEXT_FORMAT: {
TextFormat::Printer printer;
printer.SetHideUnknownFields(!request.print_unknown_fields());
GOOGLE_ABSL_CHECK(printer.PrintToString(*test_message,
ABSL_CHECK(printer.PrintToString(*test_message,
response.mutable_text_payload()));
break;
}
@ -234,7 +234,7 @@ absl::StatusOr<bool> Harness::ServeConformanceRequest() {
RETURN_IF_ERROR(ReadFd(STDIN_FILENO, &serialized_input[0], in_len));
ConformanceRequest request;
GOOGLE_ABSL_CHECK(request.ParseFromString(serialized_input));
ABSL_CHECK(request.ParseFromString(serialized_input));
absl::StatusOr<ConformanceResponse> response = RunTest(request);
RETURN_IF_ERROR(response.status());
@ -247,7 +247,7 @@ absl::StatusOr<bool> Harness::ServeConformanceRequest() {
RETURN_IF_ERROR(WriteFd(STDOUT_FILENO, serialized_output.data(), out_len));
if (verbose_) {
GOOGLE_ABSL_LOG(INFO) << "conformance-cpp: request=" << request.ShortDebugString()
ABSL_LOG(INFO) << "conformance-cpp: request=" << request.ShortDebugString()
<< ", response=" << response->ShortDebugString();
}
return false;
@ -262,13 +262,13 @@ int main() {
while (true) {
auto is_done = harness.ServeConformanceRequest();
if (!is_done.ok()) {
GOOGLE_ABSL_LOG(FATAL) << is_done.status();
ABSL_LOG(FATAL) << is_done.status();
}
if (*is_done) {
break;
}
total_runs++;
}
GOOGLE_ABSL_LOG(INFO) << "conformance-cpp: received EOF from test runner after "
ABSL_LOG(INFO) << "conformance-cpp: received EOF from test runner after "
<< total_runs << " tests";
}

@ -40,7 +40,7 @@
#include "google/protobuf/util/field_comparator.h"
#include "google/protobuf/util/json_util.h"
#include "google/protobuf/util/message_differencer.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
@ -147,7 +147,7 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting(
}
default:
GOOGLE_ABSL_LOG(FATAL) << "Unspecified input format";
ABSL_LOG(FATAL) << "Unspecified input format";
}
request_.set_test_category(test_category);
@ -181,7 +181,7 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceLevelToString(
case RECOMMENDED:
return "Recommended";
}
GOOGLE_ABSL_LOG(FATAL) << "Unknown value: " << level;
ABSL_LOG(FATAL) << "Unknown value: " << level;
return "";
}
@ -195,7 +195,7 @@ string ConformanceTestSuite::ConformanceRequestSetting::InputFormatString(
case conformance::TEXT_FORMAT:
return "TextFormatInput";
default:
GOOGLE_ABSL_LOG(FATAL) << "Unspecified output format";
ABSL_LOG(FATAL) << "Unspecified output format";
}
return "";
}
@ -210,7 +210,7 @@ string ConformanceTestSuite::ConformanceRequestSetting::OutputFormatString(
case conformance::TEXT_FORMAT:
return "TextFormatOutput";
default:
GOOGLE_ABSL_LOG(FATAL) << "Unspecified output format";
ABSL_LOG(FATAL) << "Unspecified output format";
}
return "";
}
@ -315,7 +315,7 @@ void ConformanceTestSuite::RunValidInputTest(
const ConformanceRequestSetting& setting,
const string& equivalent_text_format) {
std::unique_ptr<Message> reference_message(setting.NewTestMessage());
GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(equivalent_text_format,
ABSL_CHECK(TextFormat::ParseFromString(equivalent_text_format,
reference_message.get()))
<< "Failed to parse data for test case: " << setting.GetTestName()
<< ", data: " << equivalent_text_format;
@ -343,7 +343,7 @@ void ConformanceTestSuite::VerifyResponse(
ConformanceLevel level = setting.GetLevel();
std::unique_ptr<Message> reference_message = setting.NewTestMessage();
GOOGLE_ABSL_CHECK(reference_message->ParseFromString(equivalent_wire_format))
ABSL_CHECK(reference_message->ParseFromString(equivalent_wire_format))
<< "Failed to parse wire data for test case: " << test_name;
switch (response.result_case()) {
@ -378,7 +378,7 @@ void ConformanceTestSuite::VerifyResponse(
bool check = false;
if (require_same_wire_format) {
GOOGLE_ABSL_DCHECK_EQ(response.result_case(),
ABSL_DCHECK_EQ(response.result_case(),
ConformanceResponse::kProtobufPayload);
const string& protobuf_payload = response.protobuf_payload();
check = equivalent_wire_format == protobuf_payload;
@ -404,7 +404,7 @@ void ConformanceTestSuite::RunTest(const string& test_name,
const ConformanceRequest& request,
ConformanceResponse* response) {
if (test_names_.insert(test_name).second == false) {
GOOGLE_ABSL_LOG(FATAL) << "Duplicated test name: " << test_name;
ABSL_LOG(FATAL) << "Duplicated test name: " << test_name;
}
string serialized_request;
@ -439,7 +439,7 @@ string ConformanceTestSuite::WireFormatToString(WireFormat wire_format) {
case conformance::UNSPECIFIED:
return "UNSPECIFIED";
default:
GOOGLE_ABSL_LOG(FATAL) << "unknown wire type: " << wire_format;
ABSL_LOG(FATAL) << "unknown wire type: " << wire_format;
}
return "";
}

@ -65,7 +65,7 @@
#include <future>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
#include "conformance/conformance.pb.h"
#include "conformance_test.h"
@ -161,7 +161,7 @@ void ForkPipeRunner::RunTest(const std::string &test_name,
if (!TryRead(read_fd_, &len, sizeof(uint32_t))) {
// We failed to read from the child, assume a crash and try to reap.
GOOGLE_ABSL_LOG(INFO) << "Trying to reap child, pid=" << child_pid_;
ABSL_LOG(INFO) << "Trying to reap child, pid=" << child_pid_;
int status = 0;
waitpid(child_pid_, &status, WEXITED);
@ -183,7 +183,7 @@ void ForkPipeRunner::RunTest(const std::string &test_name,
absl::StrAppendFormat(&error_msg, "child killed by signal %d",
WTERMSIG(status));
}
GOOGLE_ABSL_LOG(INFO) << error_msg;
ABSL_LOG(INFO) << error_msg;
child_pid_ = -1;
response_obj.SerializeToString(response);
@ -312,10 +312,10 @@ void ForkPipeRunner::SpawnTestProgram() {
std::vector<const char *> argv;
argv.push_back(executable.get());
GOOGLE_ABSL_LOG(INFO) << argv[0];
ABSL_LOG(INFO) << argv[0];
for (size_t i = 0; i < executable_args_.size(); ++i) {
argv.push_back(executable_args_[i].c_str());
GOOGLE_ABSL_LOG(INFO) << executable_args_[i];
ABSL_LOG(INFO) << executable_args_[i];
}
argv.push_back(nullptr);
// Never returns.
@ -325,7 +325,7 @@ void ForkPipeRunner::SpawnTestProgram() {
void ForkPipeRunner::CheckedWrite(int fd, const void *buf, size_t len) {
if (static_cast<size_t>(write(fd, buf, len)) != len) {
GOOGLE_ABSL_LOG(FATAL) << current_test_name_
ABSL_LOG(FATAL) << current_test_name_
<< ": error writing to test program: " << strerror(errno);
}
}
@ -343,7 +343,7 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
if (performance_) {
status = future.wait_for(std::chrono::seconds(5));
if (status == std::future_status::timeout) {
GOOGLE_ABSL_LOG(ERROR) << current_test_name_ << ": timeout from test program";
ABSL_LOG(ERROR) << current_test_name_ << ": timeout from test program";
kill(child_pid_, SIGQUIT);
// TODO(sandyzhang): Only log in flag-guarded mode, since reading output
// from SIGQUIT is slow and verbose.
@ -356,7 +356,7 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
read(fd, (void *)&err[err_ofs], err.size() - err_ofs);
err_ofs += err_bytes_read;
} while (err_bytes_read > 0 && err_ofs < err.size());
GOOGLE_ABSL_LOG(ERROR) << "child_pid_=" << child_pid_ << " SIGQUIT: \n"
ABSL_LOG(ERROR) << "child_pid_=" << child_pid_ << " SIGQUIT: \n"
<< &err[0];
return false;
}
@ -365,11 +365,11 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
}
ssize_t bytes_read = future.get();
if (bytes_read == 0) {
GOOGLE_ABSL_LOG(ERROR) << current_test_name_
ABSL_LOG(ERROR) << current_test_name_
<< ": unexpected EOF from test program";
return false;
} else if (bytes_read < 0) {
GOOGLE_ABSL_LOG(ERROR) << current_test_name_
ABSL_LOG(ERROR) << current_test_name_
<< ": error reading from test program: "
<< strerror(errno);
return false;
@ -384,7 +384,7 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
void ForkPipeRunner::CheckedRead(int fd, void *buf, size_t len) {
if (!TryRead(fd, buf, len)) {
GOOGLE_ABSL_LOG(FATAL) << current_test_name_
ABSL_LOG(FATAL) << current_test_name_
<< ": error reading from test program: " << strerror(errno);
}
}

@ -32,7 +32,7 @@
#include "google/protobuf/any.pb.h"
#include "google/protobuf/text_format.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "conformance_test.h"
#include "google/protobuf/test_messages_proto2.pb.h"
@ -70,7 +70,7 @@ bool TextFormatConformanceTestSuite::ParseTextFormatResponse(
parser.AllowFieldNumber(true);
}
if (!parser.ParseFromString(response.text_payload(), test_message)) {
GOOGLE_ABSL_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode "
ABSL_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode "
<< "yielded unparseable proto. Text payload: "
<< response.text_payload();
return false;
@ -127,7 +127,7 @@ bool TextFormatConformanceTestSuite::ParseResponse(
}
default:
GOOGLE_ABSL_LOG(FATAL) << test_name
ABSL_LOG(FATAL) << test_name
<< ": unknown payload type: " << response.result_case();
}

@ -9,3 +9,8 @@ sudo apt-get -y update && \
gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --set gcc /usr/bin/gcc-7
# TODO(b/265232445) Remove this once the patch is upstreamed
git submodule update --init --recursive
sed -i 's:random/mock_helpers.h:random/internal/mock_helpers.h:' third_party/abseil-cpp/CMake/AbseilDll.cmake
sed -i 's:ABSL_INTERNA_TEST_DLL_TARGETS:ABSL_INTERNAL_TEST_DLL_TARGETS:' third_party/abseil-cpp/CMake/AbseilDll.cmake

@ -24,6 +24,10 @@ cd $(dirname $0)/../../..
git submodule update --init --recursive
./regenerate_stale_files.sh
# TODO(b/265232445) Remove this once the patch is upstreamed
sed -i '' 's:random/mock_helpers.h:random/internal/mock_helpers.h:' third_party/abseil-cpp/CMake/AbseilDll.cmake
sed -i '' 's:ABSL_INTERNA_TEST_DLL_TARGETS:ABSL_INTERNAL_TEST_DLL_TARGETS:' third_party/abseil-cpp/CMake/AbseilDll.cmake
#
# Run build
#

@ -9,6 +9,10 @@ Powershell.exe -Command "New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\C
@rem Update git submodules.
git submodule update --init --recursive
@rem TODO(b/265232445) Remove this once the patch is upstreamed
sed -i 's:random/mock_helpers.h:random/internal/mock_helpers.h:' third_party\abseil-cpp\CMake\AbseilDll.cmake
sed -i 's:ABSL_INTERNA_TEST_DLL_TARGETS:ABSL_INTERNAL_TEST_DLL_TARGETS:' third_party\abseil-cpp\CMake\AbseilDll.cmake
@rem Select Visual Studio 2017.
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@ -44,4 +48,7 @@ set BAZEL_FLAGS=--enable_runfiles --keep_going --test_output=errors ^
--remote_cache=https://storage.googleapis.com/protobuf-bazel-cache/%KOKORO_JOB_NAME%
@rem Regenerate stale CMake configs.
@rem LINT.IfChange(staleness_tests)
bazel test //src:cmake_lists_staleness_test || call bazel-bin\src\cmake_lists_staleness_test.exe --fix
bazel test //src/google/protobuf:well_known_types_staleness_test || call bazel-bin\src\google\protobuf\well_known_types_staleness_test.exe --fix
@rem LINT.ThenChange(//depot/google3/third_party/protobuf/github/regenerate_stale_files.sh)

@ -41,8 +41,8 @@ def protobuf_deps():
_github_archive(
name = "com_google_absl",
repo = "https://github.com/abseil/abseil-cpp",
commit = "10b627fbe944110d1672bdf3f8e23b5909721399",
sha256 = "138ec814b4b72a79a41b2ae6526150467ff7749d8a792a63742207a5d8578ed1",
commit = "f016820c2496845293659e181643aa1509487e03",
sha256 = "f4ad187e815deb34f70218173799659867087fa8925b9741934c0462b88d2f93",
)
if not native.existing_rule("zlib"):

@ -32,7 +32,7 @@
#include "google/protobuf/pyext/descriptor.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#define PY_SSIZE_T_CLEAN
#include <Python.h>
@ -406,7 +406,7 @@ PyObject* NewInternedDescriptor(PyTypeObject* type,
std::unordered_map<const void*, PyObject*>::iterator it =
interned_descriptors->find(descriptor);
if (it != interned_descriptors->end()) {
GOOGLE_ABSL_DCHECK(Py_TYPE(it->second) == type);
ABSL_DCHECK(Py_TYPE(it->second) == type);
Py_INCREF(it->second);
return it->second;
}

@ -38,7 +38,7 @@
#include <vector>
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "google/protobuf/pyext/message.h"
#include "google/protobuf/pyext/scoped_pyobject_ptr.h"
@ -62,7 +62,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor,
// Expected error: item was simply not found.
PyErr_Clear();
} else {
GOOGLE_ABSL_LOG(ERROR) << "DescriptorDatabase method raised an error";
ABSL_LOG(ERROR) << "DescriptorDatabase method raised an error";
PyErr_Print();
}
return false;
@ -86,7 +86,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor,
ScopedPyObjectPtr serialized_pb(
PyObject_CallMethod(py_descriptor, "SerializeToString", nullptr));
if (serialized_pb == nullptr) {
GOOGLE_ABSL_LOG(ERROR)
ABSL_LOG(ERROR)
<< "DescriptorDatabase method did not return a FileDescriptorProto";
PyErr_Print();
return false;
@ -94,14 +94,14 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor,
char* str;
Py_ssize_t len;
if (PyBytes_AsStringAndSize(serialized_pb.get(), &str, &len) < 0) {
GOOGLE_ABSL_LOG(ERROR)
ABSL_LOG(ERROR)
<< "DescriptorDatabase method did not return a FileDescriptorProto";
PyErr_Print();
return false;
}
FileDescriptorProto file_proto;
if (!file_proto.ParseFromArray(str, len)) {
GOOGLE_ABSL_LOG(ERROR)
ABSL_LOG(ERROR)
<< "DescriptorDatabase method did not return a FileDescriptorProto";
return false;
}
@ -172,7 +172,7 @@ bool PyDescriptorDatabase::FindAllExtensionNumbers(
ScopedPyObjectPtr item(PySequence_GetItem(py_list.get(), i));
item_value = PyLong_AsLong(item.get());
if (item_value < 0) {
GOOGLE_ABSL_LOG(ERROR) << "FindAllExtensionNumbers method did not return "
ABSL_LOG(ERROR) << "FindAllExtensionNumbers method did not return "
<< "valid extension numbers.";
PyErr_Print();
return false;

@ -42,7 +42,7 @@
#include <string>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/match.h"
#ifndef PyVarObject_HEAD_INIT
@ -252,10 +252,10 @@ static PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) {
if (WKT_classes == nullptr) {
ScopedPyObjectPtr well_known_types(
PyImport_ImportModule(PROTOBUF_PYTHON_INTERNAL ".well_known_types"));
GOOGLE_ABSL_DCHECK(well_known_types != nullptr);
ABSL_DCHECK(well_known_types != nullptr);
WKT_classes = PyObject_GetAttrString(well_known_types.get(), "WKTBASES");
GOOGLE_ABSL_DCHECK(WKT_classes != nullptr);
ABSL_DCHECK(WKT_classes != nullptr);
}
PyObject* well_known_class = PyDict_GetItemString(
@ -680,7 +680,7 @@ bool IsValidUTF8(PyObject* obj) {
bool AllowInvalidUTF8(const FieldDescriptor* field) { return false; }
PyObject* CheckString(PyObject* arg, const FieldDescriptor* descriptor) {
GOOGLE_ABSL_DCHECK(descriptor->type() == FieldDescriptor::TYPE_STRING ||
ABSL_DCHECK(descriptor->type() == FieldDescriptor::TYPE_STRING ||
descriptor->type() == FieldDescriptor::TYPE_BYTES);
if (descriptor->type() == FieldDescriptor::TYPE_STRING) {
if (!PyBytes_Check(arg) && !PyUnicode_Check(arg)) {
@ -784,7 +784,7 @@ bool CheckFieldBelongsToMessage(const FieldDescriptor* field_descriptor,
namespace cmessage {
PyMessageFactory* GetFactoryForMessage(CMessage* message) {
GOOGLE_ABSL_DCHECK(PyObject_TypeCheck(message, CMessage_Type));
ABSL_DCHECK(PyObject_TypeCheck(message, CMessage_Type));
return reinterpret_cast<CMessageClass*>(Py_TYPE(message))->py_message_factory;
}
@ -856,7 +856,7 @@ int AssureWritable(CMessage* self) {
}
// Toplevel messages are always mutable.
GOOGLE_ABSL_DCHECK(self->parent);
ABSL_DCHECK(self->parent);
if (AssureWritable(self->parent) == -1) {
return -1;
@ -988,7 +988,7 @@ int DeleteRepeatedField(
}
Arena* arena = Arena::InternalGetArenaForAllocation(message);
GOOGLE_ABSL_DCHECK_EQ(arena, nullptr)
ABSL_DCHECK_EQ(arena, nullptr)
<< "python protobuf is expected to be allocated from heap";
// Remove items, starting from the end.
for (; length > to; length--) {
@ -1001,10 +1001,10 @@ int DeleteRepeatedField(
//
// To work around a debug hardening (PROTOBUF_FORCE_COPY_IN_RELEASE),
// explicitly use UnsafeArenaReleaseLast. To not break rare use cases where
// arena is used, we fallback to ReleaseLast (but GOOGLE_ABSL_DCHECK to find/fix
// arena is used, we fallback to ReleaseLast (but ABSL_DCHECK to find/fix
// it).
//
// Note that arena is likely null and GOOGLE_ABSL_DCHECK and ReleaesLast might be
// Note that arena is likely null and ABSL_DCHECK and ReleaesLast might be
// redundant. The current approach takes extra cautious path not to disrupt
// production.
Message* sub_message =
@ -1269,8 +1269,8 @@ static void Dealloc(CMessage* self) {
PyObject_ClearWeakRefs(reinterpret_cast<PyObject*>(self));
}
// At this point all dependent objects have been removed.
GOOGLE_ABSL_DCHECK(!self->child_submessages || self->child_submessages->empty());
GOOGLE_ABSL_DCHECK(!self->composite_fields || self->composite_fields->empty());
ABSL_DCHECK(!self->child_submessages || self->child_submessages->empty());
ABSL_DCHECK(!self->composite_fields || self->composite_fields->empty());
delete self->child_submessages;
delete self->composite_fields;
if (self->unknown_field_set) {
@ -1715,7 +1715,7 @@ static PyObject* InternalSerializeToString(
coded_out.SetSerializationDeterministic(deterministic);
}
self->message->SerializeWithCachedSizes(&coded_out);
GOOGLE_ABSL_CHECK(!coded_out.HadError());
ABSL_CHECK(!coded_out.HadError());
return result;
}

@ -34,7 +34,7 @@
#include <limits>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
namespace google {
namespace protobuf {
@ -152,7 +152,7 @@ inline bool IsValidNumericCast(Source source) {
// (this is static_asserted), though this could be supported if necessary.
template <class Dest, class Source>
inline Dest checked_numeric_cast(Source source) {
GOOGLE_ABSL_CHECK(IsValidNumericCast<Dest>(source));
ABSL_CHECK(IsValidNumericCast<Dest>(source));
return static_cast<Dest>(source);
}

@ -9,8 +9,10 @@ set -ex
cd $(dirname -- "$0")
# Run and fix all staleness tests.
# LINT.IfChange(staleness_tests)
bazel test //src:cmake_lists_staleness_test || ./bazel-bin/src/cmake_lists_staleness_test --fix
bazel test //src/google/protobuf:well_known_types_staleness_test || ./bazel-bin/src/google/protobuf/well_known_types_staleness_test --fix
# LINT.ThenChange(//depot/google3/third_party/protobuf/github/kokoro/windows/prepare_build_win64.bat:staleness_tests)
# Generate C# code.
# This doesn't currently have Bazel staleness tests, but there's an existing

@ -194,6 +194,8 @@ cc_library(
],
deps = [
"//src/google/protobuf/stubs:lite",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/numeric:bits",
],
)
@ -208,6 +210,7 @@ cc_library(
],
deps = [
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
],
)
@ -262,6 +265,8 @@ cc_library(
":arena_cleanup",
":arena_config",
"//src/google/protobuf/stubs:lite",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/synchronization",
],
)
@ -337,6 +342,8 @@ cc_library(
"//src/google/protobuf/stubs:lite",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/meta:type_traits",
"@com_google_absl//absl/numeric:bits",
"@com_google_absl//absl/strings:internal",
@ -410,6 +417,8 @@ cc_library(
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/hash",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings:internal",
"@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time",
@ -698,6 +707,7 @@ cc_library(
deps = [
":cc_lite_test_protos",
":test_util2",
"@com_google_absl//absl/log:absl_check",
"@com_google_googletest//:gtest",
],
)
@ -734,6 +744,7 @@ cc_library(
":lite_test_util",
"//src/google/protobuf/testing",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log:absl_check",
"@com_google_googletest//:gtest",
],
)
@ -757,6 +768,7 @@ cc_test(
deps = [
":protobuf",
":test_util",
"@com_google_absl//absl/log:absl_check",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
@ -845,6 +857,8 @@ cc_test(
":protobuf",
"//src/google/protobuf/compiler:importer",
"//src/google/protobuf/testing",
"@com_google_absl//absl/log:die_if_null",
"@com_google_absl//absl/log:scoped_mock_log",
"@com_google_absl//absl/strings:str_format",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
@ -1037,6 +1051,7 @@ cc_test(
"//src/google/protobuf/io",
"//src/google/protobuf/stubs",
"//src/google/protobuf/testing",
"@com_google_absl//absl/log:scoped_mock_log",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
@ -1193,6 +1208,7 @@ cc_test(
"//src/google/protobuf/io",
"//src/google/protobuf/stubs",
"//src/google/protobuf/testing",
"@com_google_absl//absl/log:scoped_mock_log",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],
@ -1253,6 +1269,7 @@ cc_test(
"//src/google/protobuf/io",
"//src/google/protobuf/stubs",
"//src/google/protobuf/testing",
"@com_google_absl//absl/log:scoped_mock_log",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
],

@ -178,7 +178,7 @@ TEST(AnyTest, MoveAssignment) {
EXPECT_EQ(12345, payload.int32_value());
}
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST(AnyTest, PackSelfDeath) {
google::protobuf::Any any;
@ -186,7 +186,7 @@ TEST(AnyTest, PackSelfDeath) {
EXPECT_DEATH(any.PackFrom(any, ""), "&message");
}
#endif // !NDEBUG
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
} // namespace

@ -94,7 +94,7 @@ static SerialArena::Memory AllocateMemory(const AllocationPolicy* policy_ptr,
size = policy.start_block_size;
}
// Verify that min_bytes + kBlockHeaderSize won't overflow.
GOOGLE_ABSL_CHECK_LE(min_bytes, std::numeric_limits<size_t>::max() -
ABSL_CHECK_LE(min_bytes, std::numeric_limits<size_t>::max() -
SerialArena::kBlockHeaderSize);
size = std::max(size, SerialArena::kBlockHeaderSize + min_bytes);
@ -140,7 +140,7 @@ SerialArena::SerialArena(ArenaBlock* b, ThreadSafeArena& parent)
head_{b},
space_allocated_{b->size},
parent_{parent} {
GOOGLE_ABSL_DCHECK(!b->IsSentry());
ABSL_DCHECK(!b->IsSentry());
}
// It is guaranteed that this is the first SerialArena. Use sentry block.
@ -169,7 +169,7 @@ void SerialArena::Init(ArenaBlock* b, size_t offset) {
}
SerialArena* SerialArena::New(Memory mem, ThreadSafeArena& parent) {
GOOGLE_ABSL_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize,
ABSL_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize,
mem.size);
ThreadSafeArenaStats::RecordAllocateStats(parent.arena_stats_.MutableStats(),
/*used=*/0, /*allocated=*/mem.size,
@ -279,7 +279,7 @@ void SerialArena::CleanupList() {
do {
char* limit = b->Limit();
char* it = reinterpret_cast<char*>(b->cleanup_nodes);
GOOGLE_ABSL_DCHECK(!b->IsSentry() || it == limit);
ABSL_DCHECK(!b->IsSentry() || it == limit);
while (it < limit) {
it += cleanup::DestroyNode(it);
}
@ -352,7 +352,7 @@ class ThreadSafeArena::SerialArenaChunk {
return Layout(capacity()).Slice<kIds>(ptr()).first(safe_size());
}
std::atomic<void*>& id(uint32_t i) {
GOOGLE_ABSL_DCHECK_LT(i, capacity());
ABSL_DCHECK_LT(i, capacity());
return Layout(capacity()).Pointer<kIds>(ptr())[i];
}
@ -364,11 +364,11 @@ class ThreadSafeArena::SerialArenaChunk {
return Layout(capacity()).Slice<kArenas>(ptr()).first(safe_size());
}
const std::atomic<SerialArena*>& arena(uint32_t i) const {
GOOGLE_ABSL_DCHECK_LT(i, capacity());
ABSL_DCHECK_LT(i, capacity());
return Layout(capacity()).Pointer<kArenas>(ptr())[i];
}
std::atomic<SerialArena*>& arena(uint32_t i) {
GOOGLE_ABSL_DCHECK_LT(i, capacity());
ABSL_DCHECK_LT(i, capacity());
return Layout(capacity()).Pointer<kArenas>(ptr())[i];
}
@ -475,7 +475,7 @@ ThreadSafeArena::ThreadSafeArena(void* mem, size_t size,
}
ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size) {
GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
if (buf == nullptr || size <= kBlockHeaderSize) {
return SentryArenaBlock();
}
@ -488,7 +488,7 @@ ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size,
const AllocationPolicy& policy) {
if (policy.IsDefault()) return FirstBlock(buf, size);
GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
SerialArena::Memory mem;
if (buf == nullptr || size < kBlockHeaderSize + kAllocPolicySize) {
@ -510,26 +510,26 @@ void ThreadSafeArena::InitializeWithPolicy(const AllocationPolicy& policy) {
#ifndef NDEBUG
const uint64_t old_alloc_policy = alloc_policy_.get_raw();
// If there was a policy (e.g., in Reset()), make sure flags were preserved.
#define GOOGLE_ABSL_DCHECK_POLICY_FLAGS_() \
#define ABSL_DCHECK_POLICY_FLAGS_() \
if (old_alloc_policy > 3) \
GOOGLE_ABSL_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3)
ABSL_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3)
#else
#define GOOGLE_ABSL_DCHECK_POLICY_FLAGS_()
#define ABSL_DCHECK_POLICY_FLAGS_()
#endif // NDEBUG
// We ensured enough space so this cannot fail.
void* p;
if (!first_arena_.MaybeAllocateAligned(kAllocPolicySize, &p)) {
GOOGLE_ABSL_LOG(FATAL) << "MaybeAllocateAligned cannot fail here.";
ABSL_LOG(FATAL) << "MaybeAllocateAligned cannot fail here.";
return;
}
new (p) AllocationPolicy{policy};
// Low bits store flags, so they mustn't be overwritten.
GOOGLE_ABSL_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3);
ABSL_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3);
alloc_policy_.set_policy(reinterpret_cast<AllocationPolicy*>(p));
GOOGLE_ABSL_DCHECK_POLICY_FLAGS_();
ABSL_DCHECK_POLICY_FLAGS_();
#undef GOOGLE_ABSL_DCHECK_POLICY_FLAGS_
#undef ABSL_DCHECK_POLICY_FLAGS_
}
uint64_t ThreadSafeArena::GetNextLifeCycleId() {
@ -645,10 +645,10 @@ SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) {
// necessary to Free and we should revisit this. (b/247560530)
for (auto it = span.rbegin(); it != span.rend(); ++it) {
SerialArena* serial = it->load(std::memory_order_relaxed);
GOOGLE_ABSL_DCHECK_NE(serial, nullptr);
ABSL_DCHECK_NE(serial, nullptr);
// Always frees the first block of "serial" as it cannot be user-provided.
SerialArena::Memory mem = serial->Free(deallocator);
GOOGLE_ABSL_DCHECK_NE(mem.ptr, nullptr);
ABSL_DCHECK_NE(mem.ptr, nullptr);
deallocator(mem);
}
@ -792,7 +792,7 @@ void ThreadSafeArena::CleanupList() {
// and required not to break inter-object dependencies. (b/247560530)
for (auto it = span.rbegin(); it != span.rend(); ++it) {
SerialArena* serial = it->load(std::memory_order_relaxed);
GOOGLE_ABSL_DCHECK_NE(serial, nullptr);
ABSL_DCHECK_NE(serial, nullptr);
serial->CleanupList();
}
});
@ -815,7 +815,7 @@ SerialArena* ThreadSafeArena::GetSerialArenaFallback(size_t n) {
for (uint32_t i = 0; i < ids.size(); ++i) {
if (ids[i].load(std::memory_order_relaxed) == id) {
serial = chunk->arena(i).load(std::memory_order_relaxed);
GOOGLE_ABSL_DCHECK_NE(serial, nullptr);
ABSL_DCHECK_NE(serial, nullptr);
break;
}
}

@ -314,7 +314,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
"CreateArray requires a trivially constructible type");
static_assert(std::is_trivially_destructible<T>::value,
"CreateArray requires a trivially destructible type");
GOOGLE_ABSL_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
ABSL_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
<< "Requested size is too large to fit into size_t.";
if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) {
return static_cast<T*>(::operator new[](num_elements * sizeof(T)));

@ -78,7 +78,7 @@
#include <cstddef>
#include <cstdint>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/numeric/bits.h"
// Must be included last.
@ -175,8 +175,8 @@ struct ArenaAlign {
inline ArenaAlign ArenaAlignAs(size_t align) {
// align must be a non zero power of 2 >= 8
GOOGLE_ABSL_DCHECK_NE(align, 0U);
GOOGLE_ABSL_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align;
ABSL_DCHECK_NE(align, 0U);
ABSL_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align;
return ArenaAlign{align};
}

@ -72,9 +72,9 @@ TEST(ArenaAlignDefault, Padded) {
EXPECT_THAT(align_default.Padded(0), Eq(0));
EXPECT_THAT(align_default.Padded(8), Eq(8));
EXPECT_THAT(align_default.Padded(64), Eq(64));
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(align_default.Padded(1), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST(ArenaAlignDefault, CeilPtr) {
@ -95,13 +95,13 @@ TEST(ArenaAlignDefault, CheckAligned) {
EXPECT_THAT(align_default.CheckAligned(p + 0), Eq(p + 0));
EXPECT_THAT(align_default.CheckAligned(p + 8), Eq(p + 8));
EXPECT_THAT(align_default.CheckAligned(p + 16), Eq(p + 16));
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(align_default.CheckAligned(p + 1), ".*");
EXPECT_DEBUG_DEATH(align_default.CheckAligned(p + 7), ".*");
EXPECT_DEBUG_DEATH(align_default.CheckAligned(p + 9), ".*");
EXPECT_DEBUG_DEATH(align_default.CheckAligned(p + 15), ".*");
EXPECT_DEBUG_DEATH(align_default.CheckAligned(p + 17), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST(ArenaAlignDefault, CeilDefaultAligned) {
@ -110,13 +110,13 @@ TEST(ArenaAlignDefault, CeilDefaultAligned) {
EXPECT_THAT(align_default.CeilDefaultAligned(p + 0), Eq(p + 0));
EXPECT_THAT(align_default.CeilDefaultAligned(p + 8), Eq(p + 8));
EXPECT_THAT(align_default.CeilDefaultAligned(p + 16), Eq(p + 16));
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(align_default.CeilDefaultAligned(p + 1), ".*");
EXPECT_DEBUG_DEATH(align_default.CeilDefaultAligned(p + 7), ".*");
EXPECT_DEBUG_DEATH(align_default.CeilDefaultAligned(p + 9), ".*");
EXPECT_DEBUG_DEATH(align_default.CeilDefaultAligned(p + 15), ".*");
EXPECT_DEBUG_DEATH(align_default.CeilDefaultAligned(p + 17), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST(ArenaAlignDefault, IsAligned) {
@ -161,12 +161,12 @@ TEST(ArenaAlign, Padded) {
auto align_64 = ArenaAlignAs(64);
EXPECT_THAT(align_64.Padded(64), Eq(64 + 64 - ArenaAlignDefault::align));
EXPECT_THAT(align_64.Padded(128), Eq(128 + 64 - ArenaAlignDefault::align));
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
// TODO(mvels): there are direct callers of AllocateAligned() that violate
// `size` being a multiple of `align`: that should be an error / assert.
// EXPECT_DEBUG_DEATH(align_64.Padded(16), ".*");
EXPECT_DEBUG_DEATH(ArenaAlignAs(2).Padded(8), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST(ArenaAlign, CeilPtr) {
@ -187,7 +187,7 @@ TEST(ArenaAlign, CheckAligned) {
EXPECT_THAT(align_64.CheckAligned(p + 0), Eq(p));
EXPECT_THAT(align_64.CheckAligned(p + 64), Eq(p + 64));
EXPECT_THAT(align_64.CheckAligned(p + 128), Eq(p + 128));
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(align_64.CheckAligned(p + 1), ".*");
EXPECT_DEBUG_DEATH(align_64.CheckAligned(p + 7), ".*");
EXPECT_DEBUG_DEATH(align_64.CheckAligned(p + 8), ".*");
@ -197,7 +197,7 @@ TEST(ArenaAlign, CheckAligned) {
EXPECT_DEBUG_DEATH(align_64.CheckAligned(p + 72), ".*");
EXPECT_DEBUG_DEATH(align_64.CheckAligned(p + 120), ".*");
EXPECT_DEBUG_DEATH(align_64.CheckAligned(p + 129), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST(ArenaAlign, CeilDefaultAligned) {
@ -210,14 +210,14 @@ TEST(ArenaAlign, CeilDefaultAligned) {
EXPECT_THAT(align_64.CeilDefaultAligned(p + 72), Eq(p + 128));
EXPECT_THAT(align_64.CeilDefaultAligned(p + 120), Eq(p + 128));
EXPECT_THAT(align_64.CeilDefaultAligned(p + 128), Eq(p + 128));
#if PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(align_64.CeilDefaultAligned(p + 1), ".*");
EXPECT_DEBUG_DEATH(align_64.CeilDefaultAligned(p + 7), ".*");
EXPECT_DEBUG_DEATH(align_64.CeilDefaultAligned(p + 63), ".*");
EXPECT_DEBUG_DEATH(align_64.CeilDefaultAligned(p + 65), ".*");
EXPECT_DEBUG_DEATH(align_64.CeilDefaultAligned(p + 127), ".*");
EXPECT_DEBUG_DEATH(align_64.CeilDefaultAligned(p + 129), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST(ArenaAlign, IsAligned) {

@ -36,8 +36,8 @@
#include <string>
#include "absl/base/attributes.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/cord.h"
@ -92,7 +92,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE void CreateNode(Tag tag, void* pos,
void (*destructor)(void*)) {
auto elem = reinterpret_cast<uintptr_t>(elem_raw);
if (EnableSpecializedTags()) {
GOOGLE_ABSL_DCHECK_EQ(elem & 3, 0ULL); // Must be aligned
ABSL_DCHECK_EQ(elem & 3, 0ULL); // Must be aligned
switch (tag) {
case Tag::kString: {
TaggedNode n = {elem | static_cast<uintptr_t>(Tag::kString)};
@ -187,7 +187,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE Tag Type(void* raw) {
case Tag::kCord:
return Tag::kCord;
default:
GOOGLE_ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << (elem & 0x7ULL);
ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << (elem & 0x7ULL);
return Tag::kDynamic;
}
}
@ -204,7 +204,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE size_t Size(Tag tag) {
case Tag::kCord:
return sizeof(TaggedNode);
default:
GOOGLE_ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << static_cast<int>(tag);
ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << static_cast<int>(tag);
return sizeof(DynamicNode);
}
}

@ -30,10 +30,10 @@
#include "google/protobuf/arena_test_util.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#define EXPECT_EQ GOOGLE_ABSL_CHECK_EQ
#define EXPECT_EQ ABSL_CHECK_EQ
namespace google {
namespace protobuf {

@ -31,7 +31,7 @@
#ifndef GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
#define GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/arena.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
@ -70,7 +70,7 @@ void TestParseCorruptedString(const T& message) {
}
// This next line is a low bar. But getting through the test without crashing
// due to use-after-free or other bugs is a big part of what we're checking.
GOOGLE_ABSL_CHECK_GT(success_count, 0);
ABSL_CHECK_GT(success_count, 0);
}
namespace internal {
@ -105,8 +105,8 @@ class ArenaHolder {
explicit ArenaHolder(Arena* arena)
: field_(Arena::CreateMessage<T>(arena)),
owned_by_arena_(arena != nullptr) {
GOOGLE_ABSL_DCHECK(google::protobuf::Arena::is_arena_constructable<T>::value);
GOOGLE_ABSL_DCHECK(google::protobuf::Arena::is_destructor_skippable<T>::value);
ABSL_DCHECK(google::protobuf::Arena::is_arena_constructable<T>::value);
ABSL_DCHECK(google::protobuf::Arena::is_destructor_skippable<T>::value);
}
~ArenaHolder() {

@ -41,7 +41,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/barrier.h"
#include "google/protobuf/arena_test_util.h"
@ -670,7 +670,7 @@ TEST(ArenaTest, SetAllocatedAcrossArenas) {
TestAllTypes::NestedMessage* arena2_submessage =
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena2);
arena2_submessage->set_bb(42);
#ifdef PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(arena1_message->set_allocated_optional_nested_message(
arena2_submessage),
"submessage_arena");
@ -683,7 +683,7 @@ TEST(ArenaTest, SetAllocatedAcrossArenas) {
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena1);
arena1_submessage->set_bb(42);
TestAllTypes* heap_message = new TestAllTypes;
#ifdef PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
heap_message->set_allocated_optional_nested_message(arena1_submessage),
"submessage_arena");
@ -739,7 +739,7 @@ TEST(ArenaTest, SetAllocatedAcrossArenasWithReflection) {
TestAllTypes::NestedMessage* arena2_submessage =
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena2);
arena2_submessage->set_bb(42);
#ifdef PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
r->SetAllocatedMessage(arena1_message, arena2_submessage, msg_field),
"GetOwningArena");
@ -752,7 +752,7 @@ TEST(ArenaTest, SetAllocatedAcrossArenasWithReflection) {
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena1);
arena1_submessage->set_bb(42);
TestAllTypes* heap_message = new TestAllTypes;
#ifdef PROTOBUF_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
r->SetAllocatedMessage(heap_message, arena1_submessage, msg_field),
"GetOwningArena");
@ -855,14 +855,13 @@ TEST(ArenaTest, AddAllocatedToRepeatedField) {
TestAllTypes::NestedMessage* arena2_submessage =
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena2);
arena2_submessage->set_bb(42);
#ifdef PROTOBUF_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
arena1_message->mutable_repeated_nested_message()->AddAllocated(
arena2_submessage),
"value_arena");
#endif
// Should not receive object.
EXPECT_TRUE(arena1_message->repeated_nested_message().empty());
arena1_message->mutable_repeated_nested_message()->AddAllocated(
arena2_submessage);
ASSERT_THAT(arena1_message->repeated_nested_message(), testing::SizeIs(1));
EXPECT_EQ(
arena1_message->mutable_repeated_nested_message()->at(0).GetArena(),
&arena1);
arena1_message->clear_repeated_nested_message();
}
// Arena->heap case.
@ -872,14 +871,12 @@ TEST(ArenaTest, AddAllocatedToRepeatedField) {
TestAllTypes::NestedMessage* arena2_submessage =
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena2);
arena2_submessage->set_bb(42);
#ifdef PROTOBUF_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
heap_message->mutable_repeated_nested_message()->AddAllocated(
arena2_submessage),
"value_arena");
#endif
// Should not receive object.
EXPECT_TRUE(heap_message->repeated_nested_message().empty());
heap_message->mutable_repeated_nested_message()->AddAllocated(
arena2_submessage);
ASSERT_THAT(heap_message->repeated_nested_message(), testing::SizeIs(1));
EXPECT_EQ(heap_message->mutable_repeated_nested_message()->at(0).GetArena(),
nullptr);
heap_message->clear_repeated_nested_message();
}
delete heap_message;
@ -977,13 +974,12 @@ TEST(ArenaTest, AddAllocatedToRepeatedFieldViaReflection) {
TestAllTypes::NestedMessage* arena2_submessage =
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena2);
arena2_submessage->set_bb(42);
#ifdef PROTOBUF_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
r->AddAllocatedMessage(arena1_message, fd, arena2_submessage),
"value_arena");
#endif
// Should not receive object.
EXPECT_TRUE(arena1_message->repeated_nested_message().empty());
r->AddAllocatedMessage(arena1_message, fd, arena2_submessage);
ASSERT_THAT(arena1_message->repeated_nested_message(), testing::SizeIs(1));
EXPECT_EQ(
arena1_message->mutable_repeated_nested_message()->at(0).GetArena(),
&arena1);
arena1_message->clear_repeated_nested_message();
}
// Arena->heap case.
@ -993,13 +989,11 @@ TEST(ArenaTest, AddAllocatedToRepeatedFieldViaReflection) {
TestAllTypes::NestedMessage* arena2_submessage =
Arena::CreateMessage<TestAllTypes::NestedMessage>(&arena2);
arena2_submessage->set_bb(42);
#ifdef PROTOBUF_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(
r->AddAllocatedMessage(heap_message, fd, arena2_submessage),
"value_arena");
#endif
// Should not receive object.
EXPECT_TRUE(heap_message->repeated_nested_message().empty());
r->AddAllocatedMessage(heap_message, fd, arena2_submessage);
ASSERT_THAT(heap_message->repeated_nested_message(), testing::SizeIs(1));
EXPECT_EQ(heap_message->mutable_repeated_nested_message()->at(0).GetArena(),
nullptr);
heap_message->clear_repeated_nested_message();
}
delete heap_message;
}
@ -1450,7 +1444,7 @@ TEST(ArenaTest, Alignment) {
Arena arena;
for (int i = 0; i < 200; i++) {
void* p = Arena::CreateArray<char>(&arena, i);
GOOGLE_ABSL_CHECK_EQ(reinterpret_cast<uintptr_t>(p) % 8, 0) << i << ": " << p;
ABSL_CHECK_EQ(reinterpret_cast<uintptr_t>(p) % 8, 0) << i << ": " << p;
}
}

@ -32,7 +32,7 @@
#include <cstddef>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
#include "google/protobuf/io/coded_stream.h"
@ -202,7 +202,7 @@ std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) {
if (tagged_ptr_.IsMutable()) {
return tagged_ptr_.Get();
} else {
GOOGLE_ABSL_DCHECK(IsDefault());
ABSL_DCHECK(IsDefault());
// Allocate empty. The contents are not relevant.
return NewString(arena);
}
@ -211,7 +211,7 @@ std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) {
template <typename... Lazy>
std::string* ArenaStringPtr::MutableSlow(::google::protobuf::Arena* arena,
const Lazy&... lazy_default) {
GOOGLE_ABSL_DCHECK(IsDefault());
ABSL_DCHECK(IsDefault());
// For empty defaults, this ends up calling the default constructor which is
// more efficient than a copy construction from
@ -285,7 +285,7 @@ const char* EpsCopyInputStream::ReadArenaString(const char* ptr,
ArenaStringPtr* s,
Arena* arena) {
ScopedCheckPtrInvariants check(&s->tagged_ptr_);
GOOGLE_ABSL_DCHECK(arena != nullptr);
ABSL_DCHECK(arena != nullptr);
int size = ReadSize(&ptr);
if (!ptr) return nullptr;

@ -36,7 +36,7 @@
#include <type_traits>
#include <utility>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/arena.h"
#include "google/protobuf/port.h"
#include "absl/strings/string_view.h"
@ -197,11 +197,11 @@ class TaggedStringPtr {
private:
static inline void assert_aligned(const void* p) {
GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(p) & kMask, 0UL);
ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(p) & kMask, 0UL);
}
inline std::string* TagAs(Type type, std::string* p) {
GOOGLE_ABSL_DCHECK(p != nullptr);
ABSL_DCHECK(p != nullptr);
assert_aligned(p);
ptr_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(p) | type);
return p;
@ -478,8 +478,8 @@ inline void ArenaStringPtr::ClearNonDefaultToEmpty() {
}
inline std::string* ArenaStringPtr::UnsafeMutablePointer() {
GOOGLE_ABSL_DCHECK(tagged_ptr_.IsMutable());
GOOGLE_ABSL_DCHECK(tagged_ptr_.Get() != nullptr);
ABSL_DCHECK(tagged_ptr_.IsMutable());
ABSL_DCHECK(tagged_ptr_.Get() != nullptr);
return tagged_ptr_.Get();
}

@ -40,7 +40,7 @@
#include "google/protobuf/generated_message_util.h"
#include "google/protobuf/message_lite.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"

@ -445,7 +445,7 @@ class ThreadSafeArenazSamplerTestThread : public Thread {
protobuf_test_messages::proto2::TestAllTypesProto2>
message = google::protobuf::MakeArenaSafeUnique<
protobuf_test_messages::proto2::TestAllTypesProto2>(arena_);
GOOGLE_ABSL_CHECK(message != nullptr);
ABSL_CHECK(message != nullptr);
// Signal that a message on the arena has been created. This should create
// a SerialArena for this thread.
if (barrier_->Block()) {
@ -508,7 +508,7 @@ class SampleFirstArenaThread : public Thread {
protobuf_test_messages::proto2::TestAllTypesProto2>
message = google::protobuf::MakeArenaSafeUnique<
protobuf_test_messages::proto2::TestAllTypesProto2>(&arena);
GOOGLE_ABSL_CHECK(message != nullptr);
ABSL_CHECK(message != nullptr);
arena_created_.Notify();
samples_counted_.WaitForNotification();
}

@ -38,6 +38,8 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
"//src/google/protobuf:protobuf_nowkt",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
],
)
@ -61,6 +63,8 @@ cc_library(
deps = [
"//src/google/protobuf:protobuf_nowkt",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
],
@ -86,6 +90,8 @@ cc_library(
":importer",
"//src/google/protobuf:protobuf_nowkt",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
],
@ -109,6 +115,7 @@ cc_library(
"//src/google/protobuf/compiler/php",
"//src/google/protobuf/compiler/python",
"//src/google/protobuf/compiler/ruby",
"@com_google_absl//absl/log:initialize",
],
)

@ -40,7 +40,7 @@
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/io/printer.h"
#include "google/protobuf/io/zero_copy_stream.h"
@ -72,7 +72,7 @@ class DescriptorCapturingGenerator : public CodeGenerator {
} // namespace
void AddFile(absl::string_view filename, absl::string_view data) {
GOOGLE_ABSL_CHECK_OK(File::SetContents(
ABSL_CHECK_OK(File::SetContents(
absl::StrCat(TestTempDir(), "/", filename), data, true));
}
@ -96,7 +96,7 @@ bool RunProtoCompiler(const std::string& filename,
bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info) {
std::string data;
GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &data, true));
ABSL_CHECK_OK(File::GetContents(path, &data, true));
io::ArrayInputStream input(data.data(), data.size());
return info->ParseFromZeroCopyStream(&input);
}

@ -38,7 +38,7 @@
#include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
@ -85,7 +85,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForAppend(
io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert(
const std::string& filename, const std::string& insertion_point) {
GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support insertion.";
ABSL_LOG(FATAL) << "This GeneratorContext does not support insertion.";
return nullptr; // make compiler happy
}
@ -97,7 +97,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForInsertWithGeneratedCodeInfo(
void GeneratorContext::ListParsedFiles(
std::vector<const FileDescriptor*>* output) {
GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles";
ABSL_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles";
}
void GeneratorContext::GetCompilerVersion(Version* version) const {

@ -73,8 +73,8 @@
#endif
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "google/protobuf/compiler/subprocess.h"
#include "google/protobuf/compiler/plugin.pb.h"
#include "absl/container/flat_hash_set.h"
@ -142,7 +142,7 @@ void SetFdToTextMode(int fd) {
#ifdef _WIN32
if (setmode(fd, _O_TEXT) == -1) {
// This should never happen, I think.
GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno);
ABSL_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno);
}
#endif
// (Text and binary are the same on non-Windows platforms.)
@ -152,7 +152,7 @@ void SetFdToBinaryMode(int fd) {
#ifdef _WIN32
if (setmode(fd, _O_BINARY) == -1) {
// This should never happen, I think.
GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd
ABSL_LOG(WARNING) << "setmode(" << fd
<< ", _O_BINARY): " << strerror(errno);
}
#endif
@ -898,7 +898,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() {
data_pos += line_length;
}
GOOGLE_ABSL_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size);
ABSL_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size);
UpdateMetadata(data_, pos, data_.size() + indent_size, indent_.size());
}
@ -1112,7 +1112,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
if (!dependency_out_name_.empty()) {
GOOGLE_ABSL_DCHECK(disk_source_tree.get());
ABSL_DCHECK(disk_source_tree.get());
if (!GenerateDependencyManifestFile(parsed_files, output_directories,
disk_source_tree.get())) {
return 1;
@ -1132,7 +1132,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
FileDescriptorProto file;
file.set_name("empty_message.proto");
file.add_message_type()->set_name("EmptyMessage");
GOOGLE_ABSL_CHECK(pool.BuildFile(file) != nullptr);
ABSL_CHECK(pool.BuildFile(file) != nullptr);
codec_type_ = "EmptyMessage";
if (!EncodeOrDecode(&pool)) {
return 1;
@ -1160,7 +1160,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
break;
case PRINT_NONE:
GOOGLE_ABSL_LOG(ERROR)
ABSL_LOG(ERROR)
<< "If the code reaches here, it usually means a bug of "
"flag parsing in the CommandLineInterface.";
return 1;
@ -1565,7 +1565,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
input_files_.empty() && descriptor_set_in_names_.empty();
break;
default:
GOOGLE_ABSL_LOG(FATAL) << "Unexpected mode: " << mode_;
ABSL_LOG(FATAL) << "Unexpected mode: " << mode_;
}
if (missing_proto_definitions) {
std::cerr << "Missing input file." << std::endl;
@ -1770,7 +1770,7 @@ CommandLineInterface::InterpretArgument(const std::string& name,
direct_dependencies_explicitly_set_ = true;
std::vector<std::string> direct =
absl::StrSplit(value, ":", absl::SkipEmpty());
GOOGLE_ABSL_DCHECK(direct_dependencies_.empty());
ABSL_DCHECK(direct_dependencies_.empty());
direct_dependencies_.insert(direct.begin(), direct.end());
} else if (name == "--direct_dependencies_violation_msg") {
@ -2170,7 +2170,7 @@ bool CommandLineInterface::GenerateOutput(
std::string error;
if (output_directive.generator == nullptr) {
// This is a plugin.
GOOGLE_ABSL_CHECK(absl::StartsWith(output_directive.name, "--") &&
ABSL_CHECK(absl::StartsWith(output_directive.name, "--") &&
absl::EndsWith(output_directive.name, "_out"))
<< "Bad name for plugin generator: " << output_directive.name;

@ -38,7 +38,7 @@
#include <cstdint>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
@ -289,7 +289,7 @@ void CommandLineInterfaceTest::SetUp() {
}
// Create the temp directory.
GOOGLE_ABSL_CHECK_OK(File::CreateDir(temp_directory_, 0777));
ABSL_CHECK_OK(File::CreateDir(temp_directory_, 0777));
// Register generators.
CodeGenerator* generator = new MockCodeGenerator("test_generator");
@ -362,7 +362,7 @@ void CommandLineInterfaceTest::RunWithArgs(std::vector<std::string> args) {
#endif
if (plugin_path.empty() || !FileExists(plugin_path)) {
GOOGLE_ABSL_LOG(ERROR)
ABSL_LOG(ERROR)
<< "Plugin executable not found. Plugin tests are likely to fail."
<< plugin_path;
} else {
@ -402,20 +402,20 @@ void CommandLineInterfaceTest::CreateTempFile(absl::string_view name,
if (slash_pos != std::string::npos) {
absl::string_view dir = name.substr(0, slash_pos);
if (!FileExists(absl::StrCat(temp_directory_, "/", dir))) {
GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(
ABSL_CHECK_OK(File::RecursivelyCreateDir(
absl::StrCat(temp_directory_, "/", dir), 0777));
}
}
// Write file.
std::string full_name = absl::StrCat(temp_directory_, "/", name);
GOOGLE_ABSL_CHECK_OK(File::SetContents(
ABSL_CHECK_OK(File::SetContents(
full_name, absl::StrReplaceAll(contents, {{"$tmpdir", temp_directory_}}),
true));
}
void CommandLineInterfaceTest::CreateTempDir(absl::string_view name) {
GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(
ABSL_CHECK_OK(File::RecursivelyCreateDir(
absl::StrCat(temp_directory_, "/", name), 0777));
}
@ -504,7 +504,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet(
absl::string_view filename, FileDescriptorSet* descriptor_set) {
std::string path = absl::StrCat(temp_directory_, "/", filename);
std::string file_contents;
GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true));
ABSL_CHECK_OK(File::GetContents(path, &file_contents, true));
if (!descriptor_set->ParseFromString(file_contents)) {
FAIL() << "Could not parse file contents: " << path;
@ -514,7 +514,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet(
void CommandLineInterfaceTest::WriteDescriptorSet(
absl::string_view filename, const FileDescriptorSet* descriptor_set) {
std::string binary_proto;
GOOGLE_ABSL_CHECK(descriptor_set->SerializeToString(&binary_proto));
ABSL_CHECK(descriptor_set->SerializeToString(&binary_proto));
CreateTempFile(filename, binary_proto);
}
@ -540,7 +540,7 @@ void CommandLineInterfaceTest::ExpectFileContent(absl::string_view filename,
absl::string_view content) {
std::string path = absl::StrCat(temp_directory_, "/", filename);
std::string file_contents;
GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true));
ABSL_CHECK_OK(File::GetContents(path, &file_contents, true));
EXPECT_EQ(absl::StrReplaceAll(content, {{"$tmpdir", temp_directory_}}),
file_contents);
@ -2240,7 +2240,7 @@ TEST_F(CommandLineInterfaceTest, PluginReceivesSourceCodeInfo) {
Run("protocol_compiler --plug_out=$tmpdir --proto_path=$tmpdir foo.proto");
ExpectErrorSubstring(
"Saw message type MockCodeGenerator_HasSourceCodeInfo: 1.");
"Saw message type MockCodeGenerator_HasSourceCodeInfo: true.");
}
TEST_F(CommandLineInterfaceTest, PluginReceivesJsonName) {
@ -2252,7 +2252,7 @@ TEST_F(CommandLineInterfaceTest, PluginReceivesJsonName) {
Run("protocol_compiler --plug_out=$tmpdir --proto_path=$tmpdir foo.proto");
ExpectErrorSubstring("Saw json_name: 1");
ExpectErrorSubstring("Saw json_name: true");
}
TEST_F(CommandLineInterfaceTest, PluginReceivesCompilerVersion) {
@ -2567,8 +2567,8 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
void RedirectStdinFromText(const std::string& input) {
std::string filename = absl::StrCat(TestTempDir(), "/test_stdin");
GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, input, true));
GOOGLE_ABSL_CHECK(RedirectStdinFromFile(filename));
ABSL_CHECK_OK(File::SetContents(filename, input, true));
ABSL_CHECK(RedirectStdinFromFile(filename));
}
bool RedirectStdinFromFile(const std::string& filename) {
@ -2637,7 +2637,7 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
void ExpectStdoutMatchesBinaryFile(const std::string& filename) {
std::string expected_output;
GOOGLE_ABSL_CHECK_OK(
ABSL_CHECK_OK(
File::GetContents(filename, &expected_output, true));
// Don't use EXPECT_EQ because we don't want to print raw binary data to
@ -2647,7 +2647,7 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
void ExpectStdoutMatchesTextFile(const std::string& filename) {
std::string expected_output;
GOOGLE_ABSL_CHECK_OK(
ABSL_CHECK_OK(
File::GetContents(filename, &expected_output, true));
ExpectStdoutMatchesText(expected_output);
@ -2680,11 +2680,11 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
protobuf_unittest_import::PublicImportMessage public_import_message;
public_import_message.descriptor()->file()->CopyTo(
file_descriptor_set.add_file());
GOOGLE_ABSL_DCHECK(file_descriptor_set.IsInitialized());
ABSL_DCHECK(file_descriptor_set.IsInitialized());
std::string binary_proto;
GOOGLE_ABSL_CHECK(file_descriptor_set.SerializeToString(&binary_proto));
GOOGLE_ABSL_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_,
ABSL_CHECK(file_descriptor_set.SerializeToString(&binary_proto));
ABSL_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_,
binary_proto, true));
}

@ -53,7 +53,7 @@
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/cpp/helpers.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"
@ -97,15 +97,15 @@ class MockGeneratorContext : public GeneratorContext {
std::string expected_contents = *it->second;
std::string actual_contents;
GOOGLE_ABSL_CHECK_OK(File::GetContents(
ABSL_CHECK_OK(File::GetContents(
absl::StrCat(TestUtil::TestSourceDir(), "/", physical_filename),
&actual_contents, true))
<< physical_filename;
#ifdef WRITE_FILES // Define to debug mismatched files.
GOOGLE_ABSL_CHECK_OK(File::SetContents("/tmp/expected.cc", expected_contents,
ABSL_CHECK_OK(File::SetContents("/tmp/expected.cc", expected_contents,
true));
GOOGLE_ABSL_CHECK_OK(
ABSL_CHECK_OK(
File::SetContents("/tmp/actual.cc", actual_contents, true));
#endif

@ -41,7 +41,7 @@
#include "google/protobuf/descriptor.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
@ -169,7 +169,7 @@ void FieldGeneratorBase::GenerateCopyConstructorCode(io::Printer* p) const {
}
void FieldGeneratorBase::GenerateIfHasField(io::Printer* p) const {
GOOGLE_ABSL_CHECK(internal::cpp::HasHasbit(descriptor_));
ABSL_CHECK(internal::cpp::HasHasbit(descriptor_));
Formatter format(p);
format("if (($has_hasbit$) != 0) {\n");
@ -229,7 +229,7 @@ void HasBitVars(const FieldDescriptor* field, const Options& opts,
return;
}
GOOGLE_ABSL_CHECK(internal::cpp::HasHasbit(field));
ABSL_CHECK(internal::cpp::HasHasbit(field));
int32_t index = *idx / 32;
std::string mask = absl::StrFormat("0x%08xu", 1u << (*idx % 32));
@ -250,12 +250,12 @@ void HasBitVars(const FieldDescriptor* field, const Options& opts,
void InlinedStringVars(const FieldDescriptor* field, const Options& opts,
absl::optional<uint32_t> idx, std::vector<Sub>& vars) {
if (!IsStringInlined(field, opts)) {
GOOGLE_ABSL_CHECK(!idx.has_value());
ABSL_CHECK(!idx.has_value());
return;
}
// The first bit is the tracking bit for on demand registering ArenaDtor.
GOOGLE_ABSL_CHECK_GT(*idx, 0)
ABSL_CHECK_GT(*idx, 0)
<< "_inlined_string_donated_'s bit 0 is reserved for arena dtor tracking";
int32_t index = *idx / 32;

@ -43,7 +43,7 @@
#include "google/protobuf/descriptor.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/compiler/cpp/helpers.h"
#include "google/protobuf/compiler/cpp/options.h"
#include "google/protobuf/io/printer.h"
@ -103,7 +103,7 @@ class FieldGeneratorBase {
virtual void GenerateDestructorCode(io::Printer* p) const {}
virtual void GenerateArenaDestructorCode(io::Printer* p) const {
GOOGLE_ABSL_CHECK(NeedsArenaDestructor() == ArenaDtorNeeds::kNone)
ABSL_CHECK(NeedsArenaDestructor() == ArenaDtorNeeds::kNone)
<< descriptor_->cpp_type_name();
}
@ -400,7 +400,7 @@ class FieldGeneratorTable {
absl::Span<const int32_t> inlined_string_indices);
const FieldGenerator& get(const FieldDescriptor* field) const {
GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_);
ABSL_CHECK_EQ(field->containing_type(), descriptor_);
return fields_[field->index()];
}

@ -37,7 +37,7 @@
#include <tuple>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/memory/memory.h"
#include "google/protobuf/compiler/cpp/field.h"
#include "google/protobuf/compiler/cpp/field_generators/generators.h"
@ -113,7 +113,7 @@ class RepeatedEnumFieldGenerator : public FieldGeneratorBase {
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* /*printer*/) const override {
GOOGLE_ABSL_CHECK(!ShouldSplit(descriptor_, options_));
ABSL_CHECK(!ShouldSplit(descriptor_, options_));
}
void GenerateDestructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(

@ -32,7 +32,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/cpp/field_generators/generators.h"

@ -36,7 +36,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/cpp/field.h"

@ -39,7 +39,7 @@
#include "google/protobuf/descriptor.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h"
#include "absl/strings/substitute.h"
#include "absl/types/optional.h"
@ -95,7 +95,7 @@ absl::optional<size_t> FixedSize(FieldDescriptor::Type type) {
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return absl::nullopt;
}
@ -335,7 +335,7 @@ class RepeatedPrimitive final : public FieldGeneratorBase {
void GenerateConstructorCode(io::Printer* p) const override {}
void GenerateCopyConstructorCode(io::Printer* p) const override {
GOOGLE_ABSL_CHECK(!ShouldSplit(field_, *opts_));
ABSL_CHECK(!ShouldSplit(field_, *opts_));
}
void GenerateConstexprAggregateInitializer(io::Printer* p) const override {

@ -36,7 +36,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/memory/memory.h"
#include "google/protobuf/compiler/cpp/field.h"
#include "google/protobuf/compiler/cpp/field_generators/generators.h"
@ -160,7 +160,7 @@ class RepeatedStringFieldGenerator : public FieldGeneratorBase {
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override {}
void GenerateCopyConstructorCode(io::Printer* printer) const override {
GOOGLE_ABSL_CHECK(!ShouldSplit(descriptor_, options_));
ABSL_CHECK(!ShouldSplit(descriptor_, options_));
}
void GenerateDestructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
@ -430,7 +430,7 @@ void StringFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
if (descriptor_->default_value_string().empty()) {
format("$field$.ClearToEmpty();\n");
} else {
GOOGLE_ABSL_DCHECK(!inlined_);
ABSL_DCHECK(!inlined_);
format(
"$field$.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n");
}
@ -504,7 +504,7 @@ void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const {
if (inlined_ && descriptor_->default_value_string().empty()) {
return;
}
GOOGLE_ABSL_DCHECK(!inlined_);
ABSL_DCHECK(!inlined_);
format("$field$.InitDefault();\n");
if (IsString(descriptor_, options_) &&
descriptor_->default_value_string().empty()) {
@ -558,7 +558,7 @@ void StringFieldGenerator::GenerateDestructorCode(io::Printer* printer) const {
}
// Explicitly calls ~InlinedStringField as its automatic call is disabled.
// Destructor has been implicitly skipped as a union.
GOOGLE_ABSL_DCHECK(!ShouldSplit(descriptor_, options_));
ABSL_DCHECK(!ShouldSplit(descriptor_, options_));
format("$field$.~InlinedStringField();\n");
}
@ -616,7 +616,7 @@ void StringFieldGenerator::GenerateAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
if (ShouldSplit(descriptor_, options_)) {
GOOGLE_ABSL_CHECK(!inlined_);
ABSL_CHECK(!inlined_);
format("decltype(Impl_::Split::$name$_){}");
return;
}

@ -375,7 +375,7 @@ void FileGenerator::GeneratePBHeader(io::Printer* p,
void FileGenerator::DoIncludeFile(absl::string_view google3_name,
bool do_export, io::Printer* p) {
constexpr absl::string_view prefix = "third_party/protobuf/";
GOOGLE_ABSL_CHECK(absl::StartsWith(google3_name, prefix)) << google3_name;
ABSL_CHECK(absl::StartsWith(google3_name, prefix)) << google3_name;
auto v = p->WithVars(
{{"export_suffix", do_export ? "// IWYU pragma: export" : ""}});
@ -1242,11 +1242,11 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* p) {
IncludeFile("third_party/protobuf/implicit_weak_message.h", p);
}
if (HasWeakFields(file_, options_)) {
GOOGLE_ABSL_CHECK(!options_.opensource_runtime);
ABSL_CHECK(!options_.opensource_runtime);
IncludeFile("third_party/protobuf/weak_field_map.h", p);
}
if (HasLazyFields(file_, options_, &scc_analyzer_)) {
GOOGLE_ABSL_CHECK(!options_.opensource_runtime);
ABSL_CHECK(!options_.opensource_runtime);
IncludeFile("third_party/protobuf/lazy_field.h", p);
}
if (ShouldVerify(file_, options_, &scc_analyzer_)) {

@ -45,7 +45,7 @@
#include "google/protobuf/compiler/scc.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/compiler/cpp/enum.h"
#include "google/protobuf/compiler/cpp/extension.h"
#include "google/protobuf/compiler/cpp/field.h"
@ -179,7 +179,7 @@ class FileGenerator {
bool IsDepWeak(const FileDescriptor* dep) const {
if (weak_deps_.count(dep) != 0) {
GOOGLE_ABSL_CHECK(!options_.opensource_runtime);
ABSL_CHECK(!options_.opensource_runtime);
return true;
}
return false;

@ -78,7 +78,7 @@ absl::flat_hash_map<absl::string_view, std::string> CommonVars(
// Warning: there is some clever naming/splitting here to avoid extract
// script rewrites. The names of these variables must not be things that
// the extract script will rewrite. That's why we use "CHK" (for example)
// instead of "GOOGLE_ABSL_CHECK".
// instead of "ABSL_CHECK".
//
// These values are things the extract script would rewrite if we did not
// split them. It might not strictly matter since we don't generate
@ -87,12 +87,12 @@ absl::flat_hash_map<absl::string_view, std::string> CommonVars(
{"GOOGLE_PROTOBUF", is_oss ? "GOOGLE_PROTOBUF"
: "GOOGLE3_PROTOBU"
"F"},
{"CHK", is_oss ? "GOOGLE_ABSL_CHECK"
: "ABSL_CHEC"
"K"},
{"DCHK", is_oss ? "GOOGLE_ABSL_DCHECK"
: "ABSL_DCHEC"
"K"},
{"CHK",
"ABSL_CHEC"
"K"},
{"DCHK",
"ABSL_DCHEC"
"K"},
};
}
} // namespace
@ -300,7 +300,7 @@ bool CppGenerator::Generate(const FileDescriptor* file,
// pb.cc file. If we have more files than messages, then some files will
// be generated as empty placeholders.
if (file_options.num_cc_files > 0) {
GOOGLE_ABSL_CHECK_LE(num_cc_files, file_options.num_cc_files)
ABSL_CHECK_LE(num_cc_files, file_options.num_cc_files)
<< "There must be at least as many numbered .cc files as messages "
"and extensions.";
num_cc_files = file_options.num_cc_files;

@ -50,8 +50,8 @@
#include "google/protobuf/dynamic_message.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -439,7 +439,7 @@ std::string ExtensionName(const FieldDescriptor* d) {
std::string QualifiedExtensionName(const FieldDescriptor* d,
const Options& options) {
GOOGLE_ABSL_DCHECK(d->is_extension());
ABSL_DCHECK(d->is_extension());
return QualifiedFileLevelSymbol(d->file(), ExtensionName(d), options);
}
@ -559,19 +559,19 @@ std::string FieldMemberName(const FieldDescriptor* field, bool split) {
return absl::StrCat(prefix, split_prefix, FieldName(field), "_");
}
// Oneof fields are never split.
GOOGLE_ABSL_CHECK(!split);
ABSL_CHECK(!split);
return absl::StrCat(prefix, field->containing_oneof()->name(), "_.",
FieldName(field), "_");
}
std::string OneofCaseConstantName(const FieldDescriptor* field) {
GOOGLE_ABSL_DCHECK(field->containing_oneof());
ABSL_DCHECK(field->containing_oneof());
std::string field_name = UnderscoresToCamelCase(field->name(), true);
return absl::StrCat("k", field_name);
}
std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field) {
GOOGLE_ABSL_DCHECK(field->containing_oneof());
ABSL_DCHECK(field->containing_oneof());
const std::string qualification =
QualifiedClassName(field->containing_type());
return absl::StrCat(qualification, "::", OneofCaseConstantName(field));
@ -605,7 +605,7 @@ int EstimateAlignmentSize(const FieldDescriptor* field) {
case FieldDescriptor::CPPTYPE_MESSAGE:
return 8;
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return -1; // Make compiler happy.
}
@ -667,7 +667,7 @@ const char* PrimitiveTypeName(FieldDescriptor::CppType type) {
// CppTypes are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}
@ -699,7 +699,7 @@ std::string PrimitiveTypeName(const Options& options,
// CppTypes are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return "";
}
@ -747,7 +747,7 @@ const char* DeclaredTypeMethodName(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return "";
}
@ -838,7 +838,7 @@ std::string DefaultValue(const Options& options, const FieldDescriptor* field) {
// Can't actually get here; make compiler happy. (We could add a default
// case above but then we wouldn't get the nice compiler warning when a
// new type is added.)
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return "";
}
@ -1117,13 +1117,13 @@ bool IsStringOrMessage(const FieldDescriptor* field) {
return true;
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
FieldOptions::CType EffectiveStringCType(const FieldDescriptor* field,
const Options& options) {
GOOGLE_ABSL_DCHECK(field->cpp_type() == FieldDescriptor::CPPTYPE_STRING);
ABSL_DCHECK(field->cpp_type() == FieldDescriptor::CPPTYPE_STRING);
if (options.opensource_runtime) {
// Open-source protobuf release only supports STRING ctype.
return FieldOptions::STRING;
@ -1634,7 +1634,7 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file,
case EnforceOptimizeMode::kNoEnforcement:
if (file->options().optimize_for() == FileOptions::CODE_SIZE) {
if (HasBootstrapProblem(file, options, has_opt_codesize_extension)) {
GOOGLE_ABSL_LOG(WARNING)
ABSL_LOG(WARNING)
<< "Proto states optimize_for = CODE_SIZE, but we "
"cannot honor that because it contains custom option "
"extensions defined in the same proto.";
@ -1644,7 +1644,7 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file,
return file->options().optimize_for();
}
GOOGLE_ABSL_LOG(FATAL) << "Unknown optimization enforcement requested.";
ABSL_LOG(FATAL) << "Unknown optimization enforcement requested.";
// The phony return below serves to silence a warning from GCC 8.
return FileOptions::SPEED;
}

@ -44,7 +44,7 @@
#include "google/protobuf/compiler/scc.h"
#include "google/protobuf/compiler/code_generator.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/match.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
@ -340,7 +340,7 @@ inline bool UseUnknownFieldSet(const FileDescriptor* file,
inline bool IsWeak(const FieldDescriptor* field, const Options& options) {
if (field->options().weak()) {
GOOGLE_ABSL_CHECK(!options.opensource_runtime);
ABSL_CHECK(!options.opensource_runtime);
return true;
}
return false;
@ -985,7 +985,7 @@ struct OneOfRangeImpl {
value_type operator*() { return descriptor->oneof_decl(idx); }
friend bool operator==(const Iterator& a, const Iterator& b) {
GOOGLE_ABSL_DCHECK(a.descriptor == b.descriptor);
ABSL_DCHECK(a.descriptor == b.descriptor);
return a.idx == b.idx;
}
friend bool operator!=(const Iterator& a, const Iterator& b) {

@ -51,8 +51,8 @@
#include "google/protobuf/map_entry_lite.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -104,7 +104,7 @@ std::string ConditionalToCheckBitmasks(
parts.push_back(
absl::StrCat("((", has_bits_var, "[", i, "] & ", m, ") ^ ", m, ")"));
}
GOOGLE_ABSL_CHECK(!parts.empty());
ABSL_CHECK(!parts.empty());
// If we have multiple parts, each expected to be 0, then bitwise-or them.
std::string result =
parts.size() == 1
@ -208,7 +208,7 @@ RunMap FindRuns(const std::vector<const FieldDescriptor*>& fields,
// !HasHasbit(field).
bool EmitFieldNonDefaultCondition(io::Printer* p, const std::string& prefix,
const FieldDescriptor* field) {
GOOGLE_ABSL_CHECK(!HasHasbit(field));
ABSL_CHECK(!HasHasbit(field));
Formatter format(p);
auto v = p->WithVars({{
{"prefix", prefix},
@ -273,7 +273,7 @@ bool HasInternalHasMethod(const FieldDescriptor* field) {
void CollectMapInfo(
const Options& options, const Descriptor* descriptor,
absl::flat_hash_map<absl::string_view, std::string>* variables) {
GOOGLE_ABSL_CHECK(IsMapEntryMessage(descriptor));
ABSL_CHECK(IsMapEntryMessage(descriptor));
absl::flat_hash_map<absl::string_view, std::string>& vars = *variables;
const FieldDescriptor* key = descriptor->map_key();
const FieldDescriptor* val = descriptor->map_value();
@ -359,16 +359,16 @@ std::vector<std::vector<const FieldDescriptor*>> CollectFields(
// masked to tell if any thing in "fields" is present.
uint32_t GenChunkMask(const std::vector<const FieldDescriptor*>& fields,
const std::vector<int>& has_bit_indices) {
GOOGLE_ABSL_CHECK(!fields.empty());
ABSL_CHECK(!fields.empty());
int first_index_offset = has_bit_indices[fields.front()->index()] / 32;
uint32_t chunk_mask = 0;
for (auto field : fields) {
// "index" defines where in the _has_bits_ the field appears.
int index = has_bit_indices[field->index()];
GOOGLE_ABSL_CHECK_EQ(first_index_offset, index / 32);
ABSL_CHECK_EQ(first_index_offset, index / 32);
chunk_mask |= static_cast<uint32_t>(1) << (index % 32);
}
GOOGLE_ABSL_CHECK_NE(0, chunk_mask);
ABSL_CHECK_NE(0, chunk_mask);
return chunk_mask;
}
@ -465,7 +465,7 @@ void ColdChunkSkipper::OnStartChunk(int chunk, int cached_has_word_index,
for (auto field : chunks_[chunk]) {
int hasbit_index = has_bit_indices_[field->index()];
// Fields on a chunk must be in the same word.
GOOGLE_ABSL_CHECK_EQ(this_word, hasbit_index / 32);
ABSL_CHECK_EQ(this_word, hasbit_index / 32);
mask |= 1 << (hasbit_index % 32);
}
}
@ -970,7 +970,7 @@ void MessageGenerator::GenerateSingularFieldHasBits(
}
if (HasHasbit(field)) {
int has_bit_index = HasBitIndex(field);
GOOGLE_ABSL_CHECK_NE(has_bit_index, kNoHasbit);
ABSL_CHECK_NE(has_bit_index, kNoHasbit);
auto v = p->WithVars(HasbitVars(has_bit_index));
format(
@ -1187,7 +1187,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
" }\n",
descriptor_->field(0)->full_name());
} else {
GOOGLE_ABSL_CHECK(utf8_check == Utf8CheckMode::kVerify);
ABSL_CHECK(utf8_check == Utf8CheckMode::kVerify);
format(
" static bool ValidateKey(std::string* s) {\n"
"#ifndef NDEBUG\n"
@ -1216,7 +1216,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
" }\n",
descriptor_->field(1)->full_name());
} else {
GOOGLE_ABSL_CHECK(utf8_check == Utf8CheckMode::kVerify);
ABSL_CHECK(utf8_check == Utf8CheckMode::kVerify);
format(
" static bool ValidateValue(std::string* s) {\n"
"#ifndef NDEBUG\n"
@ -1836,7 +1836,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
format.Outdent();
format("};");
GOOGLE_ABSL_DCHECK(!need_to_emit_cached_size);
ABSL_DCHECK(!need_to_emit_cached_size);
} // NOLINT(readability/fn_size)
void MessageGenerator::GenerateInlineMethods(io::Printer* p) {
@ -1875,8 +1875,8 @@ void MessageGenerator::GenerateSchema(io::Printer* p, int offset,
if (inlined_string_indices_.empty()) {
inlined_string_indices_offset = -1;
} else {
GOOGLE_ABSL_DCHECK_NE(has_offset, -1);
GOOGLE_ABSL_DCHECK(!IsMapEntryMessage(descriptor_));
ABSL_DCHECK_NE(has_offset, -1);
ABSL_DCHECK(!IsMapEntryMessage(descriptor_));
inlined_string_indices_offset = has_offset + has_bit_indices_.size();
}
format("{ $1$, $2$, $3$, sizeof($classtype$)},\n", offset, has_offset,
@ -1959,7 +1959,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) {
field_generators_.get(field).GenerateInternalAccessorDeclarations(p);
if (HasHasbit(field)) {
int has_bit_index = HasBitIndex(field);
GOOGLE_ABSL_CHECK_NE(has_bit_index, kNoHasbit) << field->full_name();
ABSL_CHECK_NE(has_bit_index, kNoHasbit) << field->full_name();
format(
"static void set_has_$1$(HasBits* has_bits) {\n"
" (*has_bits)[$2$] |= $3$u;\n"
@ -2172,7 +2172,7 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets(io::Printer* p) {
format("PROTOBUF_FIELD_OFFSET($classtype$, _impl_.$1$_),\n", oneof->name());
count++;
}
GOOGLE_ABSL_CHECK_EQ(count, descriptor_->real_oneof_decl_count());
ABSL_CHECK_EQ(count, descriptor_->real_oneof_decl_count());
if (IsMapEntryMessage(descriptor_)) {
entries += 2;
@ -2415,7 +2415,7 @@ ArenaDtorNeeds MessageGenerator::NeedsArenaDestructor() const {
}
void MessageGenerator::GenerateArenaDestructorCode(io::Printer* p) {
GOOGLE_ABSL_CHECK(NeedsArenaDestructor() > ArenaDtorNeeds::kNone);
ABSL_CHECK(NeedsArenaDestructor() > ArenaDtorNeeds::kNone);
Formatter format(p);
@ -2922,7 +2922,7 @@ void MessageGenerator::GenerateClear(io::Printer* p) {
bool chunk_is_split =
!chunk.empty() && ShouldSplit(chunk.front(), options_);
// All chunks after the first split chunk should also be split.
GOOGLE_ABSL_CHECK(!first_split_chunk_processed || chunk_is_split);
ABSL_CHECK(!first_split_chunk_processed || chunk_is_split);
if (chunk_is_split && !first_split_chunk_processed) {
// Some fields are cleared without checking has_bit. So we add the
// condition here to avoid writing to the default split instance.
@ -2933,7 +2933,7 @@ void MessageGenerator::GenerateClear(io::Printer* p) {
for (const auto& field : chunk) {
if (CanClearByZeroing(field)) {
GOOGLE_ABSL_CHECK(!saw_non_zero_init);
ABSL_CHECK(!saw_non_zero_init);
if (!memset_start) memset_start = field;
memset_end = field;
} else {
@ -2959,8 +2959,8 @@ void MessageGenerator::GenerateClear(io::Printer* p) {
// Check (up to) 8 has_bits at a time if we have more than one field in
// this chunk. Due to field layout ordering, we may check
// _has_bits_[last_chunk * 8 / 32] multiple times.
GOOGLE_ABSL_DCHECK_LE(2, popcnt(chunk_mask));
GOOGLE_ABSL_DCHECK_GE(8, popcnt(chunk_mask));
ABSL_DCHECK_LE(2, popcnt(chunk_mask));
ABSL_DCHECK_GE(8, popcnt(chunk_mask));
if (cached_has_word_index != HasWordIndex(chunk.front())) {
cached_has_word_index = HasWordIndex(chunk.front());
@ -2975,8 +2975,8 @@ void MessageGenerator::GenerateClear(io::Printer* p) {
// For clarity, do not memset a single field.
field_generators_.get(memset_start).GenerateMessageClearingCode(p);
} else {
GOOGLE_ABSL_CHECK_EQ(chunk_is_split, ShouldSplit(memset_start, options_));
GOOGLE_ABSL_CHECK_EQ(chunk_is_split, ShouldSplit(memset_end, options_));
ABSL_CHECK_EQ(chunk_is_split, ShouldSplit(memset_start, options_));
ABSL_CHECK_EQ(chunk_is_split, ShouldSplit(memset_end, options_));
format(
"::memset(&$1$, 0, static_cast<::size_t>(\n"
" reinterpret_cast<char*>(&$2$) -\n"
@ -3249,7 +3249,7 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* p) {
void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
if (HasSimpleBaseClass(descriptor_, options_)) return;
// Generate the class-specific MergeFrom, which avoids the GOOGLE_ABSL_CHECK and
// Generate the class-specific MergeFrom, which avoids the ABSL_CHECK and
// cast.
Formatter format(p);
if (!HasDescriptorMethods(descriptor_->file(), options_)) {
@ -3313,8 +3313,8 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
// Check (up to) 8 has_bits at a time if we have more than one field in
// this chunk. Due to field layout ordering, we may check
// _has_bits_[last_chunk * 8 / 32] multiple times.
GOOGLE_ABSL_DCHECK_LE(2, popcnt(chunk_mask));
GOOGLE_ABSL_DCHECK_GE(8, popcnt(chunk_mask));
ABSL_DCHECK_LE(2, popcnt(chunk_mask));
ABSL_DCHECK_GE(8, popcnt(chunk_mask));
if (cached_has_word_index != HasWordIndex(chunk.front())) {
cached_has_word_index = HasWordIndex(chunk.front());
@ -3346,7 +3346,7 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
} else if (field->options().weak() ||
cached_has_word_index != HasWordIndex(field)) {
// Check hasbit, not using cached bits.
GOOGLE_ABSL_CHECK(HasHasbit(field));
ABSL_CHECK(HasHasbit(field));
auto v = p->WithVars(HasbitVars(HasBitIndex(field)));
format(
"if ((from.$has_bits$[$has_array_index$] & $has_mask$) != 0) {\n");
@ -3356,7 +3356,7 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
format("}\n");
} else {
// Check hasbit, using cached bits.
GOOGLE_ABSL_CHECK(HasHasbit(field));
ABSL_CHECK(HasHasbit(field));
int has_bit_index = has_bit_indices_[field->index()];
const std::string mask = absl::StrCat(
absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8));
@ -3380,7 +3380,7 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
if (have_outer_if) {
if (deferred_has_bit_changes) {
// Flush the has bits for the primitives we deferred.
GOOGLE_ABSL_CHECK_LE(0, cached_has_word_index);
ABSL_CHECK_LE(0, cached_has_word_index);
format("_this->$has_bits$[$1$] |= cached_has_bits;\n",
cached_has_word_index);
}
@ -3506,7 +3506,7 @@ void MessageGenerator::GenerateVerify(io::Printer* p) {
void MessageGenerator::GenerateSerializeOneofFields(
io::Printer* p, const std::vector<const FieldDescriptor*>& fields) {
Formatter format(p);
GOOGLE_ABSL_CHECK(!fields.empty());
ABSL_CHECK(!fields.empty());
if (fields.size() == 1) {
GenerateSerializeOneField(p, fields[0], -1);
return;
@ -3865,7 +3865,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBodyShuffled(
int num_fields = ordered_fields.size() + sorted_extensions.size();
constexpr int kLargePrime = 1000003;
GOOGLE_ABSL_CHECK_LT(num_fields, kLargePrime)
ABSL_CHECK_LT(num_fields, kLargePrime)
<< "Prime offset must be greater than the number of fields to ensure "
"those are coprime.";
@ -4082,8 +4082,8 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) {
// Check (up to) 8 has_bits at a time if we have more than one field in
// this chunk. Due to field layout ordering, we may check
// _has_bits_[last_chunk * 8 / 32] multiple times.
GOOGLE_ABSL_DCHECK_LE(2, popcnt(chunk_mask));
GOOGLE_ABSL_DCHECK_GE(8, popcnt(chunk_mask));
ABSL_DCHECK_LE(2, popcnt(chunk_mask));
ABSL_DCHECK_GE(8, popcnt(chunk_mask));
if (cached_has_word_index != HasWordIndex(chunk.front())) {
cached_has_word_index = HasWordIndex(chunk.front());

@ -30,7 +30,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/unittest.pb.h"
@ -43,8 +43,8 @@ namespace cpp {
namespace cpp_unittest {
#if !defined(GOOGLE_ABSL_CHECK_MESSAGE_SIZE)
#define GOOGLE_ABSL_CHECK_MESSAGE_SIZE(t, expected)
#if !defined(ABSL_CHECK_MESSAGE_SIZE)
#define ABSL_CHECK_MESSAGE_SIZE(t, expected)
#endif
// Mock structures to lock down the size of messages in a platform-independent
@ -53,13 +53,13 @@ struct MockMessageBase {
virtual ~MockMessageBase() = default; // 8 bytes vtable
void* internal_metadata; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockMessageBase, 16);
ABSL_CHECK_MESSAGE_SIZE(MockMessageBase, 16);
struct MockZeroFieldsBase : public MockMessageBase {
int cached_size; // 4 bytes
// + 4 bytes padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockZeroFieldsBase, 24);
ABSL_CHECK_MESSAGE_SIZE(MockZeroFieldsBase, 24);
struct MockExtensionSet {
void* arena; // 8 bytes
@ -67,7 +67,7 @@ struct MockExtensionSet {
int16_t size; // 4 bytes
void* data; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockExtensionSet, 24);
ABSL_CHECK_MESSAGE_SIZE(MockExtensionSet, 24);
struct MockRepeatedPtrField {
void* arena; // 8 bytes
@ -75,24 +75,24 @@ struct MockRepeatedPtrField {
int total_size; // 4 bytes
void* data; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockRepeatedPtrField, 24);
ABSL_CHECK_MESSAGE_SIZE(MockRepeatedPtrField, 24);
struct MockRepeatedField {
int current_size; // 4 bytes
int total_size; // 4 bytes
void* data; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockRepeatedField, 16);
ABSL_CHECK_MESSAGE_SIZE(MockRepeatedField, 16);
TEST(GeneratedMessageTest, MockSizes) {
// Consistency checks -- if these fail, the tests below will definitely fail.
GOOGLE_ABSL_CHECK_EQ(sizeof(MessageLite), sizeof(MockMessageBase));
GOOGLE_ABSL_CHECK_EQ(sizeof(Message), sizeof(MockMessageBase));
GOOGLE_ABSL_CHECK_EQ(sizeof(internal::ZeroFieldsBase), sizeof(MockZeroFieldsBase));
GOOGLE_ABSL_CHECK_EQ(sizeof(internal::ExtensionSet), sizeof(MockExtensionSet));
GOOGLE_ABSL_CHECK_EQ(sizeof(RepeatedPtrField<std::string>),
ABSL_CHECK_EQ(sizeof(MessageLite), sizeof(MockMessageBase));
ABSL_CHECK_EQ(sizeof(Message), sizeof(MockMessageBase));
ABSL_CHECK_EQ(sizeof(internal::ZeroFieldsBase), sizeof(MockZeroFieldsBase));
ABSL_CHECK_EQ(sizeof(internal::ExtensionSet), sizeof(MockExtensionSet));
ABSL_CHECK_EQ(sizeof(RepeatedPtrField<std::string>),
sizeof(MockRepeatedPtrField));
GOOGLE_ABSL_CHECK_EQ(sizeof(RepeatedField<int>), sizeof(MockRepeatedField));
ABSL_CHECK_EQ(sizeof(RepeatedField<int>), sizeof(MockRepeatedField));
}
TEST(GeneratedMessageTest, EmptyMessageSize) {
@ -111,7 +111,7 @@ TEST(GeneratedMessageTest, EmptyMessageWithExtensionsSize) {
int cached_size; // 4 bytes
// + 4 bytes of padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 48);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 48);
EXPECT_EQ(sizeof(protobuf_unittest::TestEmptyMessageWithExtensions),
sizeof(MockGenerated));
}
@ -124,7 +124,7 @@ TEST(GeneratedMessageTest, RecursiveMessageSize) {
int32_t i; // 4 bytes
// + 4 bytes padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 40);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 40);
EXPECT_EQ(sizeof(protobuf_unittest::TestRecursiveMessage),
sizeof(MockGenerated));
}
@ -135,7 +135,7 @@ TEST(GeneratedMessageTest, OneStringSize) {
int cached_size; // 4 bytes
void* data; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
EXPECT_EQ(sizeof(protobuf_unittest::OneString), sizeof(MockGenerated));
}
@ -145,7 +145,7 @@ TEST(GeneratedMessageTest, MoreStringSize) {
MockRepeatedPtrField data; // 24 bytes
// + 4 bytes padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 48);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 48);
EXPECT_EQ(sizeof(protobuf_unittest::MoreString), sizeof(MockGenerated));
}
@ -156,7 +156,7 @@ TEST(GeneratedMessageTest, Int32MessageSize) {
int32_t data; // 4 bytes
// + 4 bytes padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
EXPECT_EQ(sizeof(protobuf_unittest::Int32Message), sizeof(MockGenerated));
}
@ -166,7 +166,7 @@ TEST(GeneratedMessageTest, Int64MessageSize) {
int cached_size; // 4 bytes
int64_t data; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
EXPECT_EQ(sizeof(protobuf_unittest::Int64Message), sizeof(MockGenerated));
}
@ -177,7 +177,7 @@ TEST(GeneratedMessageTest, BoolMessageSize) {
bool data; // 1 byte
// + 3 bytes padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
EXPECT_EQ(sizeof(protobuf_unittest::BoolMessage), sizeof(MockGenerated));
}
@ -187,7 +187,7 @@ TEST(GeneratedMessageTest, OneofSize) {
int cached_size; // 4 bytes
uint32_t oneof_case[1]; // 4 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32);
EXPECT_EQ(sizeof(protobuf_unittest::TestOneof), sizeof(MockGenerated));
}
@ -202,7 +202,7 @@ TEST(GeneratedMessageTest, Oneof2Size) {
void* bar; // 8 bytes
uint32_t oneof_case[2]; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 64);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 64);
EXPECT_EQ(sizeof(protobuf_unittest::TestOneof2), sizeof(MockGenerated));
}
@ -217,7 +217,7 @@ TEST(GeneratedMessageTest, FieldOrderingsSize) {
float my_float; // 4 bytes
// + 4 bytes of padding
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 80);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 80);
EXPECT_EQ(sizeof(protobuf_unittest::TestFieldOrderings), sizeof(MockGenerated));
}
@ -234,7 +234,7 @@ TEST(GeneratedMessageTest, TestMessageSize) {
int m5; // 4 bytes
int64_t m6; // 8 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 56);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 56);
EXPECT_EQ(sizeof(protobuf_unittest::TestMessageSize), sizeof(MockGenerated));
}
@ -263,7 +263,7 @@ TEST(GeneratedMessageTest, PackedTypesSize) {
int packed_enum_cached_byte_size; // 4 bytes
int cached_size; // 4 bytes
};
GOOGLE_ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 16 * 15 + 8 * 6 + 8);
ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 16 * 15 + 8 * 6 + 8);
EXPECT_EQ(sizeof(protobuf_unittest::TestPackedTypes), sizeof(MockGenerated));
}

@ -37,7 +37,7 @@
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/compiler/annotation_test_util.h"
#include "google/protobuf/compiler/cpp/helpers.h"
@ -79,12 +79,12 @@ class CppMetadataTest : public ::testing::Test {
absl::StrCat(TestTempDir(), "/", StripProto(filename));
if (pb_cc != nullptr) {
GOOGLE_ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".pb.cc"),
ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".pb.cc"),
pb_cc, true));
}
if (pb_h != nullptr && pb_h_info != nullptr) {
GOOGLE_ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".pb.h"), pb_h,
ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".pb.h"), pb_h,
true));
if (!atu::DecodeMetadata(absl::StrCat(output_base, ".pb.h.meta"),
pb_h_info)) {
@ -93,7 +93,7 @@ class CppMetadataTest : public ::testing::Test {
}
if (proto_h != nullptr && proto_h_info != nullptr) {
GOOGLE_ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".proto.h"),
ABSL_CHECK_OK(File::GetContents(absl::StrCat(output_base, ".proto.h"),
proto_h, true));
if (!atu::DecodeMetadata(absl::StrCat(output_base, ".proto.h.meta"),
proto_h_info)) {

@ -30,7 +30,7 @@
#include "google/protobuf/compiler/cpp/padding_optimizer.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "google/protobuf/compiler/cpp/helpers.h"
namespace google {
@ -138,7 +138,7 @@ static void OptimizeLayoutHelper(std::vector<const FieldDescriptor*>* fields,
aligned_to_8[f].push_back(FieldGroup(j, field));
break;
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown alignment size "
ABSL_LOG(FATAL) << "Unknown alignment size "
<< EstimateAlignmentSize(field) << "for a field "
<< field->full_name() << ".";
}

@ -37,7 +37,7 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/cpp/helpers.h"
#include "google/protobuf/generated_message_tctable_gen.h"
@ -202,7 +202,7 @@ bool ParseFunctionGenerator::should_generate_tctable() const {
}
void ParseFunctionGenerator::GenerateTailcallParseFunction(Formatter& format) {
GOOGLE_ABSL_CHECK(should_generate_tctable());
ABSL_CHECK(should_generate_tctable());
// Generate an `_InternalParse` that starts the tail-calling loop.
format(
@ -229,7 +229,7 @@ static bool NeedsUnknownEnumSupport(const Descriptor* descriptor) {
void ParseFunctionGenerator::GenerateTailcallFallbackFunction(
Formatter& format) {
GOOGLE_ABSL_CHECK(should_generate_tctable());
ABSL_CHECK(should_generate_tctable());
format(
"const char* $classname$::Tct_ParseFallback(PROTOBUF_TC_PARAM_DECL) {\n"
"#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) return nullptr\n");
@ -421,7 +421,7 @@ static NumToEntryTable MakeNumToEntryTable(
for (; field_entry_index != N; ++field_entry_index) {
auto* field_descriptor = field_descriptors[field_entry_index];
uint32_t fnum = field_descriptor->number();
GOOGLE_ABSL_CHECK_GT(fnum, last_skip_entry_start);
ABSL_CHECK_GT(fnum, last_skip_entry_start);
if (start_new_block == false) {
// If the next field number is within 15 of the last_skip_entry_start, we
// continue writing just to that entry. If it's between 16 and 31 more,
@ -454,7 +454,7 @@ static NumToEntryTable MakeNumToEntryTable(
}
void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) {
GOOGLE_ABSL_CHECK(should_generate_tctable());
ABSL_CHECK(should_generate_tctable());
// All entries without a fast-path parsing function need a fallback.
std::string fallback;
if (tc_table_info_->use_generated_fallback) {
@ -565,7 +565,7 @@ void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) {
format("65535, 65535\n");
}
if (ordered_fields_.empty()) {
GOOGLE_ABSL_LOG_IF(DFATAL, !tc_table_info_->aux_entries.empty())
ABSL_DLOG_IF(FATAL, !tc_table_info_->aux_entries.empty())
<< "Invalid message: " << descriptor_->full_name() << " has "
<< tc_table_info_->aux_entries.size()
<< " auxiliary field entries, but no fields";
@ -662,7 +662,7 @@ void ParseFunctionGenerator::GenerateFastFieldEntries(Formatter& format) {
format("{$1$, {$2$, $3$}},\n", info.func_name, info.coded_tag,
info.nonfield_info);
} else {
GOOGLE_ABSL_CHECK(!ShouldSplit(info.field, options_));
ABSL_CHECK(!ShouldSplit(info.field, options_));
std::string func_name = info.func_name;
if (GetOptimizeFor(info.field->file(), options_) == FileOptions::SPEED) {
@ -731,7 +731,7 @@ static void FormatFieldKind(Formatter& format,
PROTOBUF_INTERNAL_TYPE_CARD_CASE(RawString);
PROTOBUF_INTERNAL_TYPE_CARD_CASE(Utf8String);
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown type_card: 0x" << type_card;
ABSL_LOG(FATAL) << "Unknown type_card: 0x" << type_card;
}
static constexpr const char* kRepNames[] = {"AString", "IString", "Cord",
@ -814,7 +814,7 @@ static void FormatFieldKind(Formatter& format,
PROTOBUF_INTERNAL_TYPE_CARD_CASE(PackedSInt64);
PROTOBUF_INTERNAL_TYPE_CARD_CASE(PackedDouble);
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown type_card: 0x" << type_card;
ABSL_LOG(FATAL) << "Unknown type_card: 0x" << type_card;
}
}
}
@ -907,13 +907,13 @@ void ParseFunctionGenerator::GenerateArenaString(Formatter& format,
"if (arena != nullptr) {\n"
" ptr = ctx->ReadArenaString(ptr, &$msg$$field$, arena");
if (IsStringInlined(field, options_)) {
GOOGLE_ABSL_DCHECK(!inlined_string_indices_.empty());
ABSL_DCHECK(!inlined_string_indices_.empty());
int inlined_string_index = inlined_string_indices_[field->index()];
GOOGLE_ABSL_DCHECK_GT(inlined_string_index, 0);
ABSL_DCHECK_GT(inlined_string_index, 0);
format(", &$msg$$inlined_string_donated_array$[0], $1$, $this$",
inlined_string_index);
} else {
GOOGLE_ABSL_DCHECK(field->default_value_string().empty());
ABSL_DCHECK(field->default_value_string().empty());
}
format(
");\n"
@ -1026,7 +1026,7 @@ void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format,
case FieldDescriptor::TYPE_MESSAGE: {
if (field->is_map()) {
const FieldDescriptor* val = field->message_type()->map_value();
GOOGLE_ABSL_CHECK(val);
ABSL_CHECK(val);
if (val->type() == FieldDescriptor::TYPE_ENUM &&
!internal::cpp::HasPreservingUnknownEnumSemantics(field)) {
format(
@ -1114,7 +1114,7 @@ void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format,
break;
}
default:
GOOGLE_ABSL_LOG(FATAL) << "Illegal combination for length delimited wiretype "
ABSL_LOG(FATAL) << "Illegal combination for length delimited wiretype "
<< " filed type is " << field->type();
}
}
@ -1229,7 +1229,7 @@ void ParseFunctionGenerator::GenerateFieldBody(
break;
}
case WireFormatLite::WIRETYPE_END_GROUP: {
GOOGLE_ABSL_LOG(FATAL) << "Can't have end group field\n";
ABSL_LOG(FATAL) << "Can't have end group field\n";
break;
}
} // switch (wire_type)
@ -1243,7 +1243,7 @@ static uint32_t ExpectedTag(const FieldDescriptor* field,
if (field->is_packable()) {
auto expected_wiretype = WireFormat::WireTypeForFieldType(field->type());
expected_tag = WireFormatLite::MakeTag(field->number(), expected_wiretype);
GOOGLE_ABSL_CHECK(expected_wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
ABSL_CHECK(expected_wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
auto fallback_wiretype = WireFormatLite::WIRETYPE_LENGTH_DELIMITED;
uint32_t fallback_tag =
WireFormatLite::MakeTag(field->number(), fallback_wiretype);

@ -42,7 +42,7 @@
#include "google/protobuf/compiler/command_line_interface.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/io/printer.h"
#include "google/protobuf/io/zero_copy_stream.h"
@ -172,7 +172,7 @@ class TestGenerator : public CodeGenerator {
// not verify that they are correctly-placed; that would require actually
// compiling the output which is a bit more than I care to do for this test.
TEST(CppPluginTest, PluginTest) {
GOOGLE_ABSL_CHECK_OK(
ABSL_CHECK_OK(
File::SetContents(absl::StrCat(TestTempDir(), "/test.proto"),
"syntax = \"proto2\";\n"
"package foo;\n"

@ -212,12 +212,12 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) {
::$proto_ns$::RpcController* controller,
const ::$proto_ns$::Message* request,
::$proto_ns$::Message* response, ::google::protobuf::Closure* done) {
GOOGLE_ABSL_DCHECK_EQ(method->service(), $file_level_service_descriptors$[$index$]);
ABSL_DCHECK_EQ(method->service(), $file_level_service_descriptors$[$index$]);
switch (method->index()) {
$cases$;
default:
GOOGLE_ABSL_LOG(FATAL) << "Bad method index; this should never happen.";
ABSL_LOG(FATAL) << "Bad method index; this should never happen.";
break;
}
}
@ -253,12 +253,12 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which,
R"cc(
const ::$proto_ns$::Message& $classname$::Get$which$Prototype(
const ::$proto_ns$::MethodDescriptor* method) const {
GOOGLE_ABSL_DCHECK_EQ(method->service(), descriptor());
ABSL_DCHECK_EQ(method->service(), descriptor());
switch (method->index()) {
$cases$;
default:
GOOGLE_ABSL_LOG(FATAL) << "Bad method index; this should never happen.";
ABSL_LOG(FATAL) << "Bad method index; this should never happen.";
return *::$proto_ns$::MessageFactory::generated_factory()
->GetPrototype(method->$which_type$_type());
}

@ -253,7 +253,7 @@ Getters StringFieldGetters(const FieldDescriptor* field, const Options& opts) {
Getters StringOneofGetters(const FieldDescriptor* field,
const OneofDescriptor* oneof, const Options& opts) {
GOOGLE_ABSL_CHECK(oneof != nullptr);
ABSL_CHECK(oneof != nullptr);
std::string member = FieldMemberName(field, ShouldSplit(field, opts));
bool is_std_string = field->options().ctype() == FieldOptions::STRING;

@ -1331,7 +1331,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethod) {
TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethodTypeFailure) {
// Verify death if we call Foo() with Bar's message types.
#if PROTOBUF_HAS_DEATH_TEST // death tests do not work on Windows yet
#if GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet
EXPECT_DEBUG_DEATH(
mock_service_.CallMethod(foo_, &mock_controller_,
&foo_request_, &bar_response_, done_.get()),
@ -1342,7 +1342,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, CallMethodTypeFailure) {
mock_service_.CallMethod(foo_, &mock_controller_,
&bar_request_, &foo_response_, done_.get()),
"dynamic_cast");
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}
TEST_F(GENERATED_SERVICE_TEST_NAME, GetPrototypes) {

@ -83,7 +83,7 @@ class MockGeneratorContext : public GeneratorContext {
std::string expected_contents = *it->second;
std::string actual_contents;
GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(
ABSL_CHECK_OK(File::GetContentsAsText(
absl::StrCat(TestSourceDir(), "/", physical_filename), &actual_contents,
true))
<< "Unable to get " << physical_filename;

@ -35,7 +35,7 @@
#include "google/protobuf/compiler/code_generator.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/csharp/csharp_doc_comment.h"
#include "google/protobuf/compiler/csharp/csharp_helpers.h"
@ -79,7 +79,7 @@ void EnumGenerator::Generate(io::Printer* printer) {
// Make sure we don't get any duplicate names due to prefix removal.
while (!used_names.insert(name).second) {
// It's possible we'll end up giving this warning multiple times, but that's better than not at all.
GOOGLE_ABSL_LOG(WARNING) << "Duplicate enum value " << name << " (originally "
ABSL_LOG(WARNING) << "Duplicate enum value " << name << " (originally "
<< original_name << ") in " << descriptor_->name()
<< "; adding underscore to distinguish";
absl::StrAppend(&name, "_");

@ -36,7 +36,7 @@
#include <string>
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "google/protobuf/compiler/csharp/csharp_helpers.h"
#include "google/protobuf/compiler/csharp/names.h"
#include "google/protobuf/descriptor.h"
@ -279,7 +279,7 @@ std::string FieldGeneratorBase::type_name(const FieldDescriptor* descriptor) {
case FieldDescriptor::TYPE_SINT64:
return "long";
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
ABSL_LOG(FATAL) << "Unknown field type.";
return "";
}
}
@ -321,7 +321,7 @@ bool FieldGeneratorBase::has_default_value() {
case FieldDescriptor::TYPE_SINT64:
return descriptor_->default_value_int64() != 0L;
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
ABSL_LOG(FATAL) << "Unknown field type.";
return true;
}
}
@ -425,7 +425,7 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor)
case FieldDescriptor::TYPE_SINT64:
return absl::StrCat(descriptor->default_value_int64(), "L");
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
ABSL_LOG(FATAL) << "Unknown field type.";
return "";
}
}
@ -473,7 +473,7 @@ std::string FieldGeneratorBase::capitalized_type_name() {
case FieldDescriptor::TYPE_SINT64:
return "SInt64";
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
ABSL_LOG(FATAL) << "Unknown field type.";
return "";
}
}

@ -41,7 +41,7 @@
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/string_view.h"
@ -108,7 +108,7 @@ CSharpType GetCSharpType(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return (CSharpType) -1;
}
@ -340,7 +340,7 @@ int GetFixedSize(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return -1;
}
@ -465,7 +465,7 @@ bool IsNullable(const FieldDescriptor* descriptor) {
return true;
default:
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
ABSL_LOG(FATAL) << "Unknown field type.";
return true;
}
}

@ -35,7 +35,7 @@
#include "google/protobuf/compiler/code_generator.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/csharp/csharp_doc_comment.h"
#include "google/protobuf/compiler/csharp/csharp_enum.h"
@ -767,7 +767,7 @@ int MessageGenerator::GetPresenceIndex(const FieldDescriptor* descriptor) {
index++;
}
}
GOOGLE_ABSL_LOG(DFATAL) << "Could not find presence index for field "
ABSL_DLOG(FATAL) << "Could not find presence index for field "
<< descriptor->name();
return -1;
}

@ -222,7 +222,7 @@ class PROTOBUF_EXPORT MultiFileErrorCollector {
ABSL_DEPRECATED("Use RecordError")
virtual void AddError(const std::string& filename, int line, int column,
const std::string& message) {
GOOGLE_ABSL_LOG(FATAL) << "AddError or RecordError must be implemented.";
ABSL_LOG(FATAL) << "AddError or RecordError must be implemented.";
}
ABSL_DEPRECATED("Use RecordWarning")

@ -43,7 +43,7 @@
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/substitute.h"
@ -269,7 +269,7 @@ class DiskSourceTreeTest : public testing::Test {
if (FileExists(dirnames_[i])) {
File::DeleteRecursively(dirnames_[i], NULL, NULL);
}
GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirnames_[i], 0777));
ABSL_CHECK_OK(File::CreateDir(dirnames_[i], 0777));
}
}
@ -282,11 +282,11 @@ class DiskSourceTreeTest : public testing::Test {
}
void AddFile(const std::string& filename, const char* contents) {
GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, contents, true));
ABSL_CHECK_OK(File::SetContents(filename, contents, true));
}
void AddSubdir(const std::string& dirname) {
GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirname, 0777));
ABSL_CHECK_OK(File::CreateDir(dirname, 0777));
}
void ExpectFileContents(const std::string& filename,
@ -400,7 +400,7 @@ TEST_F(DiskSourceTreeTest, OrderingTrumpsSpecificity) {
// directory is more-specific than a former one.
// Create the "bar" directory so we can put a file in it.
GOOGLE_ABSL_CHECK_OK(File::CreateDir(absl::StrCat(dirnames_[0], "/bar"),
ABSL_CHECK_OK(File::CreateDir(absl::StrCat(dirnames_[0], "/bar"),
0777));
// Add files and map paths.

@ -32,7 +32,7 @@
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
@ -159,7 +159,7 @@ void Context::InitializeFieldGeneratorInfoForFields(
}
}
if (is_conflict[i]) {
GOOGLE_ABSL_LOG(WARNING) << "field \"" << field->full_name()
ABSL_LOG(WARNING) << "field \"" << field->full_name()
<< "\" is conflicting "
<< "with another field: " << conflict_reason[i];
}
@ -184,7 +184,7 @@ const FieldGeneratorInfo* Context::GetFieldGeneratorInfo(
const FieldDescriptor* field) const {
auto it = field_generator_info_map_.find(field);
if (it == field_generator_info_map_.end()) {
GOOGLE_ABSL_LOG(FATAL) << "Can not find FieldGeneratorInfo for field: "
ABSL_LOG(FATAL) << "Can not find FieldGeneratorInfo for field: "
<< field->full_name();
}
return &it->second;
@ -194,7 +194,7 @@ const OneofGeneratorInfo* Context::GetOneofGeneratorInfo(
const OneofDescriptor* oneof) const {
auto it = oneof_generator_info_map_.find(oneof);
if (it == oneof_generator_info_map_.end()) {
GOOGLE_ABSL_LOG(FATAL) << "Can not find OneofGeneratorInfo for oneof: "
ABSL_LOG(FATAL) << "Can not find OneofGeneratorInfo for oneof: "
<< oneof->name();
}
return &it->second;

@ -38,8 +38,8 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -345,7 +345,7 @@ void ImmutableEnumFieldGenerator::GenerateMergingCode(
" set$capitalized_name$Value(other.get$capitalized_name$Value());\n"
"}\n");
} else {
GOOGLE_ABSL_LOG(FATAL) << "Can't reach here.";
ABSL_LOG(FATAL) << "Can't reach here.";
}
}
@ -429,7 +429,7 @@ ImmutableEnumOneofFieldGenerator::~ImmutableEnumOneofFieldGenerator() {}
void ImmutableEnumOneofFieldGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
@ -464,7 +464,7 @@ void ImmutableEnumOneofFieldGenerator::GenerateMembers(
void ImmutableEnumOneofFieldGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -38,7 +38,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "google/protobuf/compiler/java/context.h"
@ -400,7 +400,7 @@ ImmutableEnumOneofFieldLiteGenerator::~ImmutableEnumOneofFieldLiteGenerator() {}
void ImmutableEnumOneofFieldLiteGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -476,7 +476,7 @@ void ImmutableEnumOneofFieldLiteGenerator::GenerateFieldInfo(
void ImmutableEnumOneofFieldLiteGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -38,7 +38,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/java/context.h"
@ -186,7 +186,7 @@ static inline void ReportUnexpectedPackedFieldsCall(io::Printer* printer) {
// but this method should be overridden.
// - This FieldGenerator doesn't support packing, and this method
// should never have been called.
GOOGLE_ABSL_LOG(FATAL) << "GenerateBuilderParsingCodeFromPacked() "
ABSL_LOG(FATAL) << "GenerateBuilderParsingCodeFromPacked() "
<< "called on field generator that does not support packing.";
}

@ -40,7 +40,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/port.h"
@ -135,7 +135,7 @@ class FieldGeneratorMap {
template <typename FieldGeneratorType>
inline const FieldGeneratorType& FieldGeneratorMap<FieldGeneratorType>::get(
const FieldDescriptor* field) const {
GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_);
ABSL_CHECK_EQ(field->containing_type(), descriptor_);
return *field_generators_[field->index()];
}

@ -38,7 +38,7 @@
#include <vector>
#include "absl/container/btree_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/compiler/java/context.h"
@ -133,7 +133,7 @@ void CollectExtensions(const FileDescriptorProto& file_proto,
// builder-pool to find out all extensions.
const Descriptor* file_proto_desc = alternate_pool.FindMessageTypeByName(
file_proto.GetDescriptor()->full_name());
GOOGLE_ABSL_CHECK(file_proto_desc)
ABSL_CHECK(file_proto_desc)
<< "Find unknown fields in FileDescriptorProto when building "
<< file_proto.name()
<< ". It's likely that those fields are custom options, however, "
@ -142,14 +142,14 @@ void CollectExtensions(const FileDescriptorProto& file_proto,
DynamicMessageFactory factory;
std::unique_ptr<Message> dynamic_file_proto(
factory.GetPrototype(file_proto_desc)->New());
GOOGLE_ABSL_CHECK(dynamic_file_proto.get() != NULL);
GOOGLE_ABSL_CHECK(dynamic_file_proto->ParseFromString(file_data));
ABSL_CHECK(dynamic_file_proto.get() != NULL);
ABSL_CHECK(dynamic_file_proto->ParseFromString(file_data));
// Collect the extensions again from the dynamic message. There should be no
// more unknown fields this time, i.e. all the custom options should be
// parsed as extensions now.
extensions->clear();
GOOGLE_ABSL_CHECK(CollectExtensions(*dynamic_file_proto, extensions))
ABSL_CHECK(CollectExtensions(*dynamic_file_proto, extensions))
<< "Find unknown fields in FileDescriptorProto when building "
<< file_proto.name()
<< ". It's likely that those fields are custom options, however, "
@ -234,7 +234,7 @@ bool FileGenerator::Validate(std::string* error) {
// because filenames are case-insensitive on those platforms.
if (name_resolver_->HasConflictingClassName(
file_, classname_, NameEquality::EQUAL_IGNORE_CASE)) {
GOOGLE_ABSL_LOG(WARNING)
ABSL_LOG(WARNING)
<< file_->name() << ": The file's outer class name, \"" << classname_
<< "\", matches the name of one of the types declared inside it when "
<< "case is ignored. This can cause compilation issues on Windows / "
@ -246,7 +246,7 @@ bool FileGenerator::Validate(std::string* error) {
// Print a warning if optimize_for = LITE_RUNTIME is used.
if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME &&
!options_.enforce_lite) {
GOOGLE_ABSL_LOG(WARNING)
ABSL_LOG(WARNING)
<< "The optimize_for = LITE_RUNTIME option is no longer supported by "
<< "protobuf Java code generator and is ignored--protoc will always "
<< "generate full runtime code for Java. To use Java Lite runtime, "

@ -40,8 +40,8 @@
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -108,7 +108,7 @@ void PrintEnumVerifierLogic(
std::string UnderscoresToCamelCase(absl::string_view input,
bool cap_next_letter) {
GOOGLE_ABSL_CHECK(!input.empty());
ABSL_CHECK(!input.empty());
std::string result;
// Note: I distrust ctype.h due to locales.
for (int i = 0; i < input.size(); i++) {
@ -287,7 +287,7 @@ JavaType GetJavaType(const FieldDescriptor* field) {
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return JAVATYPE_INT;
}
@ -316,7 +316,7 @@ absl::string_view PrimitiveTypeName(JavaType type) {
// JavaTypes are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return {};
}
@ -349,7 +349,7 @@ absl::string_view BoxedPrimitiveTypeName(JavaType type) {
// JavaTypes are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return {};
}
@ -382,7 +382,7 @@ absl::string_view KotlinTypeName(JavaType type) {
// JavaTypes are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return {};
}
@ -441,7 +441,7 @@ absl::string_view FieldTypeName(FieldDescriptor::Type field_type) {
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return {};
}
@ -532,7 +532,7 @@ std::string DefaultValue(const FieldDescriptor* field, bool immutable,
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return "";
}
@ -564,7 +564,7 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field) {
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
@ -671,7 +671,7 @@ bool IsReferenceType(JavaType type) {
// JavaTypes are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
@ -720,7 +720,7 @@ absl::string_view GetCapitalizedType(const FieldDescriptor* field,
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return {};
}
@ -770,7 +770,7 @@ int FixedSize(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return -1;
}
@ -906,7 +906,7 @@ int GetExperimentalJavaFieldTypeForPacked(const FieldDescriptor* field) {
} else if (result > FieldDescriptor::TYPE_BYTES) {
return result + 30;
} else {
GOOGLE_ABSL_LOG(FATAL) << field->full_name() << " can't be packed.";
ABSL_LOG(FATAL) << field->full_name() << " can't be packed.";
return 0;
}
}

@ -48,16 +48,16 @@ namespace java {
namespace {
const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) {
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_ABSL_CHECK(message->options().map_entry());
ABSL_CHECK(message->options().map_entry());
return message->map_key();
}
const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) {
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_ABSL_CHECK(message->options().map_entry());
ABSL_CHECK(message->options().map_entry());
return message->map_value();
}

@ -50,16 +50,16 @@ namespace java {
namespace {
const FieldDescriptor* KeyField(const FieldDescriptor* descriptor) {
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_ABSL_CHECK(message->options().map_entry());
ABSL_CHECK(message->options().map_entry());
return message->map_key();
}
const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) {
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, descriptor->type());
const Descriptor* message = descriptor->message_type();
GOOGLE_ABSL_CHECK(message->options().map_entry());
ABSL_CHECK(message->options().map_entry());
return message->map_value();
}

@ -73,7 +73,7 @@ namespace {
std::string MapValueImmutableClassdName(const Descriptor* descriptor,
ClassNameResolver* name_resolver) {
const FieldDescriptor* value_field = descriptor->map_value();
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
return name_resolver->GetImmutableClassName(value_field->message_type());
}
} // namespace
@ -85,7 +85,7 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor)
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}
@ -99,7 +99,7 @@ ImmutableMessageGenerator::ImmutableMessageGenerator(
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_ABSL_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
ABSL_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A non-lite message generator is used to "
"generate lite messages.";
}

@ -70,7 +70,7 @@ namespace {
std::string MapValueImmutableClassdName(const Descriptor* descriptor,
ClassNameResolver* name_resolver) {
const FieldDescriptor* value_field = descriptor->map_value();
GOOGLE_ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
ABSL_CHECK_EQ(FieldDescriptor::TYPE_MESSAGE, value_field->type());
return name_resolver->GetImmutableClassName(value_field->message_type());
}
} // namespace
@ -81,13 +81,13 @@ MessageBuilderGenerator::MessageBuilderGenerator(const Descriptor* descriptor,
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_ABSL_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
ABSL_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A non-lite message generator is used to "
"generate lite messages.";
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}

@ -68,13 +68,13 @@ MessageBuilderLiteGenerator::MessageBuilderLiteGenerator(
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_ABSL_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
ABSL_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A lite message generator is used to "
"generate non-lite messages.";
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}

@ -36,7 +36,7 @@
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"

@ -76,13 +76,13 @@ ImmutableMessageLiteGenerator::ImmutableMessageLiteGenerator(
context_(context),
name_resolver_(context->GetNameResolver()),
field_generators_(descriptor, context_) {
GOOGLE_ABSL_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
ABSL_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite()))
<< "Generator factory error: A lite message generator is used to "
"generate non-lite messages.";
for (int i = 0; i < descriptor_->field_count(); i++) {
if (IsRealOneof(descriptor_->field(i))) {
const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof();
GOOGLE_ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof);
}
}
}

@ -38,7 +38,7 @@
#include <gmock/gmock.h>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
#include "google/protobuf/compiler/command_line_interface.h"
@ -77,10 +77,10 @@ int CompileJavaProto(std::string proto_file_name) {
}
TEST(MessageSerializationTest, CollapseAdjacentExtensionRanges) {
GOOGLE_ABSL_CHECK_EQ(CompileJavaProto("message_serialization_unittest.proto"), 0);
ABSL_CHECK_EQ(CompileJavaProto("message_serialization_unittest.proto"), 0);
std::string java_source;
GOOGLE_ABSL_CHECK_OK(File::GetContents(
ABSL_CHECK_OK(File::GetContents(
// Open-source codebase does not support file::JoinPath, so we manually
// concatenate instead.
absl::StrCat(TestTempDir(),

@ -32,7 +32,7 @@
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/substitute.h"
@ -106,7 +106,7 @@ std::string ClassNameWithoutPackage(const ServiceDescriptor* descriptor,
absl::string_view full_name =
StripPackageName(descriptor->full_name(), descriptor->file());
// We don't allow nested service definitions.
GOOGLE_ABSL_CHECK(!absl::StrContains(full_name, '.'));
ABSL_CHECK(!absl::StrContains(full_name, '.'));
return std::string(full_name);
}

@ -37,7 +37,7 @@
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_split.h"
#include "google/protobuf/compiler/command_line_interface.h"
#include "google/protobuf/compiler/java/generator.h"
@ -81,7 +81,7 @@ class TestGenerator : public CodeGenerator {
// not verify that they are correctly-placed; that would require actually
// compiling the output which is a bit more than I care to do for this test.
TEST(JavaPluginTest, PluginTest) {
GOOGLE_ABSL_CHECK_OK(
ABSL_CHECK_OK(
File::SetContents(absl::StrCat(TestTempDir(), "/test.proto"),
"syntax = \"proto2\";\n"
"package foo;\n"
@ -114,7 +114,7 @@ TEST(JavaPluginTest, PluginTest) {
// expect
std::string output;
GOOGLE_ABSL_CHECK_OK(File::GetContents(absl::StrCat(TestTempDir(), "/Test.java"),
ABSL_CHECK_OK(File::GetContents(absl::StrCat(TestTempDir(), "/Test.java"),
&output, true));
std::vector<std::string> lines = absl::StrSplit(output, "\n");
bool found_generated_annotation = false;

@ -37,8 +37,8 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -449,7 +449,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateEqualsCode(
case JAVATYPE_ENUM:
case JAVATYPE_MESSAGE:
default:
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
break;
}
}
@ -500,7 +500,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateHashCode(
case JAVATYPE_ENUM:
case JAVATYPE_MESSAGE:
default:
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
break;
}
}
@ -527,7 +527,7 @@ ImmutablePrimitiveOneofFieldGenerator::
void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -550,7 +550,7 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers(
void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"

@ -37,7 +37,7 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
@ -416,7 +416,7 @@ ImmutablePrimitiveOneofFieldLiteGenerator::
void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -464,7 +464,7 @@ void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateFieldInfo(
void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -34,7 +34,7 @@
#include "google/protobuf/compiler/java/service.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"

@ -39,7 +39,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -522,7 +522,7 @@ ImmutableStringOneofFieldGenerator::~ImmutableStringOneofFieldGenerator() {}
void ImmutableStringOneofFieldGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
@ -586,7 +586,7 @@ void ImmutableStringOneofFieldGenerator::GenerateMembers(
void ImmutableStringOneofFieldGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -39,7 +39,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/java/context.h"
#include "google/protobuf/compiler/java/doc_comment.h"
@ -408,7 +408,7 @@ ImmutableStringOneofFieldLiteGenerator::
void ImmutableStringOneofFieldLiteGenerator::GenerateMembers(
io::Printer* printer) const {
PrintExtraFieldInfo(variables_, printer);
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"
@ -486,7 +486,7 @@ void ImmutableStringOneofFieldLiteGenerator::GenerateFieldInfo(
void ImmutableStringOneofFieldLiteGenerator::GenerateBuilderMembers(
io::Printer* printer) const {
GOOGLE_ABSL_DCHECK(HasHazzer(descriptor_));
ABSL_DCHECK(HasHazzer(descriptor_));
WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
printer->Print(variables_,
"@java.lang.Override\n"

@ -28,6 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "absl/log/initialize.h"
#include "google/protobuf/compiler/command_line_interface.h"
#include "google/protobuf/compiler/cpp/generator.h"
#include "google/protobuf/compiler/csharp/csharp_generator.h"
@ -47,6 +48,7 @@ namespace protobuf {
namespace compiler {
int ProtobufMain(int argc, char* argv[]) {
absl::InitializeLog();
CommandLineInterface cli;
cli.AllowPlugins("protoc-");

@ -37,6 +37,7 @@
#include <cstdint>
#include <iostream>
#include <memory>
#include <ostream>
#include <string>
#include <vector>
@ -45,8 +46,8 @@
#include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/descriptor.pb.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_replace.h"
@ -110,7 +111,7 @@ void MockCodeGenerator::ExpectGenerated(
absl::string_view first_parsed_file_name,
absl::string_view output_directory) {
std::string content;
GOOGLE_ABSL_CHECK_OK(File::GetContents(
ABSL_CHECK_OK(File::GetContents(
absl::StrCat(output_directory, "/", GetOutputFileName(name, file)),
&content, true));
@ -169,16 +170,16 @@ void MockCodeGenerator::CheckGeneratedAnnotations(
absl::string_view name, absl::string_view file,
absl::string_view output_directory) {
std::string file_content;
GOOGLE_ABSL_CHECK_OK(File::GetContents(
ABSL_CHECK_OK(File::GetContents(
absl::StrCat(output_directory, "/", GetOutputFileName(name, file)),
&file_content, true));
std::string meta_content;
GOOGLE_ABSL_CHECK_OK(
ABSL_CHECK_OK(
File::GetContents(absl::StrCat(output_directory, "/",
GetOutputFileName(name, file), ".pb.meta"),
&meta_content, true));
GeneratedCodeInfo annotations;
GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(meta_content, &annotations));
ABSL_CHECK(TextFormat::ParseFromString(meta_content, &annotations));
ASSERT_EQ(7, annotations.annotation_size());
CheckSingleAnnotation("first_annotation", "first", file_content,
@ -219,40 +220,39 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file,
if (command == "Error") {
*error = "Saw message type MockCodeGenerator_Error.";
return false;
} else if (command == "Exit") {
}
if (command == "Exit") {
std::cerr << "Saw message type MockCodeGenerator_Exit." << std::endl;
exit(123);
} else if (command == "Abort") {
std::cerr << "Saw message type MockCodeGenerator_Abort." << std::endl;
abort();
} else if (command == "HasSourceCodeInfo") {
}
ABSL_CHECK(command != "Abort")
<< "Saw message type MockCodeGenerator_Abort.";
if (command == "HasSourceCodeInfo") {
FileDescriptorProto file_descriptor_proto;
file->CopySourceCodeInfoTo(&file_descriptor_proto);
bool has_source_code_info =
file_descriptor_proto.has_source_code_info() &&
file_descriptor_proto.source_code_info().location_size() > 0;
std::cerr << "Saw message type MockCodeGenerator_HasSourceCodeInfo: "
<< has_source_code_info << "." << std::endl;
abort();
ABSL_LOG(FATAL)
<< "Saw message type MockCodeGenerator_HasSourceCodeInfo: "
<< has_source_code_info << ".";
} else if (command == "HasJsonName") {
FieldDescriptorProto field_descriptor_proto;
file->message_type(i)->field(0)->CopyTo(&field_descriptor_proto);
std::cerr << "Saw json_name: " << field_descriptor_proto.has_json_name()
<< std::endl;
abort();
ABSL_LOG(FATAL) << "Saw json_name: "
<< field_descriptor_proto.has_json_name();
} else if (command == "Annotate") {
annotate = true;
} else if (command == "ShowVersionNumber") {
Version compiler_version;
context->GetCompilerVersion(&compiler_version);
std::cerr << "Saw compiler_version: "
<< compiler_version.major() * 1000000 +
compiler_version.minor() * 1000 +
compiler_version.patch()
<< " " << compiler_version.suffix() << std::endl;
abort();
ABSL_LOG(FATAL) << "Saw compiler_version: "
<< compiler_version.major() * 1000000 +
compiler_version.minor() * 1000 +
compiler_version.patch()
<< " " << compiler_version.suffix();
} else {
GOOGLE_ABSL_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command;
ABSL_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command;
}
}
}

@ -54,14 +54,9 @@ ExtensionGenerator::ExtensionGenerator(absl::string_view root_class_name,
root_class_and_method_name_(
absl::StrCat(root_class_name, "_", method_name_)),
descriptor_(descriptor) {
if (descriptor->is_map()) {
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
// error cases, so it seems to be ok to use as a back door for errors.
std::cerr << "error: Extension is a map<>!"
<< " That used to be blocked by the compiler." << std::endl;
std::cerr.flush();
abort();
}
ABSL_CHECK(!descriptor->is_map())
<< "error: Extension is a map<>!"
<< " That used to be blocked by the compiler.";
}
void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) const {

@ -36,8 +36,8 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/enum_field.h"
#include "google/protobuf/compiler/objectivec/helpers.h"
@ -169,7 +169,7 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
@ -289,12 +289,8 @@ void FieldGenerator::SetNoHasBit() { variables_["has_index"] = "GPBNoHasBit"; }
int FieldGenerator::ExtraRuntimeHasBitsNeeded() const { return 0; }
void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) {
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
// error cases, so it seems to be ok to use as a back door for errors.
std::cerr << "Error: should have overridden SetExtraRuntimeHasBitsBase()."
<< std::endl;
std::cerr.flush();
abort();
ABSL_LOG(FATAL)
<< "Error: should have overridden SetExtraRuntimeHasBitsBase().";
}
void FieldGenerator::SetOneofIndexBase(int index_base) {
@ -478,7 +474,7 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor)
const FieldGenerator& FieldGeneratorMap::get(
const FieldDescriptor* field) const {
GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_);
ABSL_CHECK_EQ(field->containing_type(), descriptor_);
return *field_generators_[field->index()];
}

@ -33,7 +33,7 @@
#include <string>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
@ -67,7 +67,7 @@ std::string GetZeroEnumNameForFlagType(const FlagType flag_type) {
case FLAGTYPE_FIELD:
return "GPBFieldNone";
default:
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return "0";
}
}
@ -81,7 +81,7 @@ std::string GetEnumNameForFlagType(const FlagType flag_type) {
case FLAGTYPE_FIELD:
return "GPBFieldFlags";
default:
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}
}
@ -148,7 +148,7 @@ std::string GetCapitalizedType(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}
@ -197,7 +197,7 @@ ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return OBJECTIVECTYPE_INT32;
}
@ -236,7 +236,7 @@ std::string GPBGenericValueFieldName(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}
@ -309,7 +309,7 @@ std::string DefaultValue(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}

@ -36,7 +36,7 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_check.h"
#include "absl/strings/ascii.h"
#include "absl/strings/match.h"
#include "google/protobuf/compiler/objectivec/line_consumer.h"
@ -197,7 +197,7 @@ void ImportWriter::PrintRuntimeImports(io::Printer* p,
// If bundled, no need to do the framework support below.
if (for_bundled_proto_) {
GOOGLE_ABSL_DCHECK(!default_cpp_symbol);
ABSL_DCHECK(!default_cpp_symbol);
for (const auto& header : protobuf_imports_) {
p->Print("#import \"$header$\"\n", "header", header);
}

@ -34,7 +34,7 @@
#include <vector>
#include "absl/container/btree_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/match.h"
#include "google/protobuf/compiler/objectivec/helpers.h"
#include "google/protobuf/compiler/objectivec/names.h"
@ -79,7 +79,7 @@ const char* MapEntryTypeName(const FieldDescriptor* descriptor, bool isKey) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}

@ -38,7 +38,7 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/extension.h"
@ -129,7 +129,7 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return 0;
}

@ -33,7 +33,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/helpers.h"
#include "google/protobuf/io/printer.h"
@ -74,7 +74,7 @@ const char* PrimitiveTypeName(const FieldDescriptor* descriptor) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}
@ -108,7 +108,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save