diff --git a/src/google/protobuf/compiler/python/generator.cc b/src/google/protobuf/compiler/python/generator.cc index 91f17626eb..151f81c95c 100644 --- a/src/google/protobuf/compiler/python/generator.cc +++ b/src/google/protobuf/compiler/python/generator.cc @@ -51,9 +51,8 @@ #include #include -#include "absl/container/flat_hash_map.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" +#include "absl/container/flat_hash_map.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" @@ -168,7 +167,7 @@ std::string StringifyDefaultValue(const FieldDescriptor& field) { } // (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) << "Not reached."; + GOOGLE_LOG(FATAL) << "Not reached."; return ""; } @@ -180,9 +179,8 @@ std::string StringifySyntax(FileDescriptor::Syntax syntax) { return "proto3"; case FileDescriptor::SYNTAX_UNKNOWN: default: - GOOGLE_ABSL_LOG(FATAL) - << "Unsupported syntax; this generator only supports proto2 " - "and proto3 syntax."; + GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports proto2 " + "and proto3 syntax."; return ""; } } @@ -292,7 +290,7 @@ bool Generator::Generate(const FileDescriptor* file, } std::unique_ptr output(context->Open(filename)); - GOOGLE_ABSL_CHECK(output.get()); + GOOGLE_CHECK(output.get()); io::Printer printer(output.get(), '$'); printer_ = &printer; @@ -949,7 +947,7 @@ std::string Generator::FieldReferencingExpression( const std::string& python_dict_name) const { // We should only ever be looking up fields in the current file. // The only things we refer to from other files are message descriptors. - GOOGLE_ABSL_CHECK_EQ(field.file(), file_) + GOOGLE_CHECK_EQ(field.file(), file_) << field.file()->name() << " vs. " << file_->name(); if (!containing_type) { return ResolveKeyword(field.name()); @@ -1015,7 +1013,7 @@ void Generator::FixForeignFieldsInExtensions() const { void Generator::FixForeignFieldsInExtension( const FieldDescriptor& extension_field) const { - GOOGLE_ABSL_CHECK(extension_field.is_extension()); + GOOGLE_CHECK(extension_field.is_extension()); absl::flat_hash_map m; // Confusingly, for FieldDescriptors that happen to be extensions, @@ -1230,7 +1228,7 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, std::string sp; proto.SerializeToString(&sp); int offset = file_descriptor_serialized_.find(sp); - GOOGLE_ABSL_CHECK_GE(offset, 0); + GOOGLE_CHECK_GE(offset, 0); printer_->Print( "_globals['$name$']._serialized_start=$serialized_start$\n" diff --git a/src/google/protobuf/compiler/python/helpers.cc b/src/google/protobuf/compiler/python/helpers.cc index 2a129f1a7f..e58ed9ccc8 100644 --- a/src/google/protobuf/compiler/python/helpers.cc +++ b/src/google/protobuf/compiler/python/helpers.cc @@ -32,7 +32,6 @@ #include -#include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" #include "absl/strings/str_replace.h" diff --git a/src/google/protobuf/compiler/python/plugin_unittest.cc b/src/google/protobuf/compiler/python/plugin_unittest.cc index 54cad05f8c..b613f2df7e 100644 --- a/src/google/protobuf/compiler/python/plugin_unittest.cc +++ b/src/google/protobuf/compiler/python/plugin_unittest.cc @@ -39,7 +39,6 @@ #include "google/protobuf/compiler/python/generator.h" #include "google/protobuf/testing/googletest.h" #include -#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_split.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -79,19 +78,19 @@ class TestGenerator : public CodeGenerator { TEST(PythonPluginTest, ImportTest) { // Create files test1.proto and test2.proto with the former importing the // latter. - GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto", - "syntax = \"proto3\";\n" - "package foo;\n" - "import \"test2.proto\";" - "message Message1 {\n" - " Message2 message_2 = 1;\n" - "}\n", - true)); - GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto", - "syntax = \"proto3\";\n" - "package foo;\n" - "message Message2 {}\n", - true)); + GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto", + "syntax = \"proto3\";\n" + "package foo;\n" + "import \"test2.proto\";" + "message Message1 {\n" + " Message2 message_2 = 1;\n" + "}\n", + true)); + GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto", + "syntax = \"proto3\";\n" + "package foo;\n" + "message Message2 {}\n", + true)); compiler::CommandLineInterface cli; cli.SetInputsAreProtoPathRelative(true); @@ -106,8 +105,8 @@ TEST(PythonPluginTest, ImportTest) { // Loop over the lines of the generated code and verify that we find an // ordinary Python import but do not find the string "importlib". std::string output; - GOOGLE_ABSL_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output, - true)); + GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output, + true)); std::vector lines = absl::StrSplit(output, "\n"); std::string expected_import = "import test2_pb2"; bool found_expected_import = false; diff --git a/src/google/protobuf/compiler/python/pyi_generator.cc b/src/google/protobuf/compiler/python/pyi_generator.cc index a239a7840f..607a054534 100644 --- a/src/google/protobuf/compiler/python/pyi_generator.cc +++ b/src/google/protobuf/compiler/python/pyi_generator.cc @@ -34,8 +34,6 @@ #include #include "absl/container/flat_hash_set.h" -#include "google/protobuf/stubs/logging.h" -#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "absl/strings/str_split.h" @@ -386,7 +384,7 @@ std::string PyiGenerator::GetFieldType( return name; } default: - GOOGLE_ABSL_LOG(FATAL) << "Unsupported field type."; + GOOGLE_LOG(FATAL) << "Unsupported field type."; } return ""; } @@ -601,7 +599,7 @@ bool PyiGenerator::Generate(const FileDescriptor* file, } std::unique_ptr output(context->Open(filename)); - GOOGLE_ABSL_CHECK(output.get()); + GOOGLE_CHECK(output.get()); GeneratedCodeInfo annotations; io::AnnotationProtoCollector annotation_collector( &annotations);