diff --git a/src/google/protobuf/compiler/annotation_test_util.cc b/src/google/protobuf/compiler/annotation_test_util.cc index f8ffeec584..35ec75c53b 100644 --- a/src/google/protobuf/compiler/annotation_test_util.cc +++ b/src/google/protobuf/compiler/annotation_test_util.cc @@ -40,6 +40,7 @@ #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/io/zero_copy_stream.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" @@ -70,8 +71,8 @@ class DescriptorCapturingGenerator : public CodeGenerator { } // namespace void AddFile(const std::string& filename, const std::string& data) { - GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data, - true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data, + true)); } bool RunProtoCompiler(const std::string& filename, @@ -94,7 +95,7 @@ bool RunProtoCompiler(const std::string& filename, bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info) { std::string data; - GOOGLE_CHECK_OK(File::GetContents(path, &data, true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &data, true)); io::ArrayInputStream input(data.data(), data.size()); return info->ParseFromZeroCopyStream(&input); } diff --git a/src/google/protobuf/compiler/code_generator.cc b/src/google/protobuf/compiler/code_generator.cc index 8bc11cb0d6..737306415c 100644 --- a/src/google/protobuf/compiler/code_generator.cc +++ b/src/google/protobuf/compiler/code_generator.cc @@ -34,9 +34,9 @@ #include "google/protobuf/compiler/code_generator.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/descriptor.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_split.h" #include "absl/strings/strip.h" @@ -81,7 +81,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForAppend( io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert( const std::string& filename, const std::string& insertion_point) { - GOOGLE_LOG(FATAL) << "This GeneratorContext does not support insertion."; + GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support insertion."; return nullptr; // make compiler happy } @@ -93,7 +93,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForInsertWithGeneratedCodeInfo( void GeneratorContext::ListParsedFiles( std::vector* output) { - GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; + GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; } void GeneratorContext::GetCompilerVersion(Version* version) const { diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 6a44b04a47..9c7a168670 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -74,6 +74,7 @@ #include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/subprocess.h" #include "google/protobuf/compiler/plugin.pb.h" #include "absl/container/flat_hash_set.h" @@ -141,7 +142,7 @@ void SetFdToTextMode(int fd) { #ifdef _WIN32 if (setmode(fd, _O_TEXT) == -1) { // This should never happen, I think. - GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno); + GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno); } #endif // (Text and binary are the same on non-Windows platforms.) @@ -151,7 +152,8 @@ void SetFdToBinaryMode(int fd) { #ifdef _WIN32 if (setmode(fd, _O_BINARY) == -1) { // This should never happen, I think. - GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_BINARY): " << strerror(errno); + GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd + << ", _O_BINARY): " << strerror(errno); } #endif // (Text and binary are the same on non-Windows platforms.) @@ -892,7 +894,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { data_pos += line_length; } - GOOGLE_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size); + GOOGLE_ABSL_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size); UpdateMetadata(data_, pos, data_.size() + indent_size, indent_.size()); } @@ -1106,7 +1108,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { } if (!dependency_out_name_.empty()) { - GOOGLE_DCHECK(disk_source_tree.get()); + GOOGLE_ABSL_DCHECK(disk_source_tree.get()); if (!GenerateDependencyManifestFile(parsed_files, output_directories, disk_source_tree.get())) { return 1; @@ -1126,7 +1128,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_CHECK(pool.BuildFile(file) != nullptr); + GOOGLE_ABSL_CHECK(pool.BuildFile(file) != nullptr); codec_type_ = "EmptyMessage"; if (!EncodeOrDecode(&pool)) { return 1; @@ -1154,8 +1156,9 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { } break; case PRINT_NONE: - GOOGLE_LOG(ERROR) << "If the code reaches here, it usually means a bug of " - "flag parsing in the CommandLineInterface."; + GOOGLE_ABSL_LOG(ERROR) + << "If the code reaches here, it usually means a bug of " + "flag parsing in the CommandLineInterface."; return 1; // Do not add a default case. @@ -1558,7 +1561,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments( input_files_.empty() && descriptor_set_in_names_.empty(); break; default: - GOOGLE_LOG(FATAL) << "Unexpected mode: " << mode_; + GOOGLE_ABSL_LOG(FATAL) << "Unexpected mode: " << mode_; } if (missing_proto_definitions) { std::cerr << "Missing input file." << std::endl; @@ -1763,7 +1766,7 @@ CommandLineInterface::InterpretArgument(const std::string& name, direct_dependencies_explicitly_set_ = true; std::vector direct = absl::StrSplit(value, ":", absl::SkipEmpty()); - GOOGLE_DCHECK(direct_dependencies_.empty()); + GOOGLE_ABSL_DCHECK(direct_dependencies_.empty()); direct_dependencies_.insert(direct.begin(), direct.end()); } else if (name == "--direct_dependencies_violation_msg") { @@ -2163,8 +2166,8 @@ bool CommandLineInterface::GenerateOutput( std::string error; if (output_directive.generator == nullptr) { // This is a plugin. - GOOGLE_CHECK(absl::StartsWith(output_directive.name, "--") && - absl::EndsWith(output_directive.name, "_out")) + GOOGLE_ABSL_CHECK(absl::StartsWith(output_directive.name, "--") && + absl::EndsWith(output_directive.name, "_out")) << "Bad name for plugin generator: " << output_directive.name; std::string plugin_name = PluginName(plugin_prefix_, output_directive.name); diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index b595cf19eb..bc268f01bf 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -38,6 +38,7 @@ #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_format.h" #ifndef _MSC_VER @@ -288,7 +289,7 @@ void CommandLineInterfaceTest::SetUp() { } // Create the temp directory. - GOOGLE_CHECK_OK(File::CreateDir(temp_directory_, 0777)); + GOOGLE_ABSL_CHECK_OK(File::CreateDir(temp_directory_, 0777)); // Register generators. CodeGenerator* generator = new MockCodeGenerator("test_generator"); @@ -361,7 +362,7 @@ void CommandLineInterfaceTest::RunWithArgs(std::vector args) { #endif if (plugin_path.empty() || !FileExists(plugin_path)) { - GOOGLE_LOG(ERROR) + GOOGLE_ABSL_LOG(ERROR) << "Plugin executable not found. Plugin tests are likely to fail." << plugin_path; } else { @@ -401,21 +402,21 @@ void CommandLineInterfaceTest::CreateTempFile(const std::string& name, if (slash_pos != std::string::npos) { std::string dir = name.substr(0, slash_pos); if (!FileExists(temp_directory_ + "/" + dir)) { - GOOGLE_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + dir, - 0777)); + GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + dir, + 0777)); } } // Write file. std::string full_name = temp_directory_ + "/" + name; - GOOGLE_CHECK_OK(File::SetContents( + GOOGLE_ABSL_CHECK_OK(File::SetContents( full_name, absl::StrReplaceAll(contents, {{"$tmpdir", temp_directory_}}), true)); } void CommandLineInterfaceTest::CreateTempDir(const std::string& name) { - GOOGLE_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + name, - 0777)); + GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + name, + 0777)); } // ------------------------------------------------------------------- @@ -503,7 +504,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet( const std::string& filename, FileDescriptorSet* descriptor_set) { std::string path = temp_directory_ + "/" + filename; std::string file_contents; - GOOGLE_CHECK_OK(File::GetContents(path, &file_contents, true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true)); if (!descriptor_set->ParseFromString(file_contents)) { FAIL() << "Could not parse file contents: " << path; @@ -513,7 +514,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet( void CommandLineInterfaceTest::WriteDescriptorSet( const std::string& filename, const FileDescriptorSet* descriptor_set) { std::string binary_proto; - GOOGLE_CHECK(descriptor_set->SerializeToString(&binary_proto)); + GOOGLE_ABSL_CHECK(descriptor_set->SerializeToString(&binary_proto)); CreateTempFile(filename, binary_proto); } @@ -539,7 +540,7 @@ void CommandLineInterfaceTest::ExpectFileContent(const std::string& filename, const std::string& content) { std::string path = temp_directory_ + "/" + filename; std::string file_contents; - GOOGLE_CHECK_OK(File::GetContents(path, &file_contents, true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true)); EXPECT_EQ(absl::StrReplaceAll(content, {{"$tmpdir", temp_directory_}}), file_contents); @@ -2560,8 +2561,8 @@ class EncodeDecodeTest : public testing::TestWithParam { void RedirectStdinFromText(const std::string& input) { std::string filename = TestTempDir() + "/test_stdin"; - GOOGLE_CHECK_OK(File::SetContents(filename, input, true)); - GOOGLE_CHECK(RedirectStdinFromFile(filename)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, input, true)); + GOOGLE_ABSL_CHECK(RedirectStdinFromFile(filename)); } bool RedirectStdinFromFile(const std::string& filename) { @@ -2629,7 +2630,8 @@ class EncodeDecodeTest : public testing::TestWithParam { void ExpectStdoutMatchesBinaryFile(const std::string& filename) { std::string expected_output; - GOOGLE_CHECK_OK(File::GetContents(filename, &expected_output, true)); + GOOGLE_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 // stdout on failure. @@ -2638,7 +2640,8 @@ class EncodeDecodeTest : public testing::TestWithParam { void ExpectStdoutMatchesTextFile(const std::string& filename) { std::string expected_output; - GOOGLE_CHECK_OK(File::GetContents(filename, &expected_output, true)); + GOOGLE_ABSL_CHECK_OK( + File::GetContents(filename, &expected_output, true)); ExpectStdoutMatchesText(expected_output); } @@ -2670,12 +2673,12 @@ class EncodeDecodeTest : public testing::TestWithParam { protobuf_unittest_import::PublicImportMessage public_import_message; public_import_message.descriptor()->file()->CopyTo( file_descriptor_set.add_file()); - GOOGLE_DCHECK(file_descriptor_set.IsInitialized()); + GOOGLE_ABSL_DCHECK(file_descriptor_set.IsInitialized()); std::string binary_proto; - GOOGLE_CHECK(file_descriptor_set.SerializeToString(&binary_proto)); - GOOGLE_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_, - binary_proto, true)); + GOOGLE_ABSL_CHECK(file_descriptor_set.SerializeToString(&binary_proto)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_, + binary_proto, true)); } int duped_stdin_; diff --git a/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc b/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc index b40e0bd6f3..189b07ddbd 100644 --- a/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc @@ -83,9 +83,8 @@ class MockGeneratorContext : public GeneratorContext { std::string expected_contents = *it->second; std::string actual_contents; - GOOGLE_CHECK_OK( - File::GetContentsAsText(TestSourceDir() + "/" + physical_filename, - &actual_contents, true)) + GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText( + TestSourceDir() + "/" + physical_filename, &actual_contents, true)) << "Unable to get " << physical_filename; EXPECT_TRUE(actual_contents == expected_contents) << physical_filename << " needs to be regenerated. Please run " diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc index eaeef31053..5f30778a63 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -35,6 +35,7 @@ #include "google/protobuf/compiler/code_generator.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/csharp/csharp_doc_comment.h" #include "google/protobuf/compiler/csharp/csharp_helpers.h" @@ -78,8 +79,9 @@ 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_LOG(WARNING) << "Duplicate enum value " << name << " (originally " << original_name - << ") in " << descriptor_->name() << "; adding underscore to distinguish"; + GOOGLE_ABSL_LOG(WARNING) << "Duplicate enum value " << name << " (originally " + << original_name << ") in " << descriptor_->name() + << "; adding underscore to distinguish"; name += "_"; } int number = descriptor_->value(i)->number(); diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc index 158bf71074..d7137aac7a 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -36,6 +36,7 @@ #include #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/csharp/csharp_helpers.h" #include "google/protobuf/compiler/csharp/names.h" #include "google/protobuf/descriptor.h" @@ -278,7 +279,7 @@ std::string FieldGeneratorBase::type_name(const FieldDescriptor* descriptor) { case FieldDescriptor::TYPE_SINT64: return "long"; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return ""; } } @@ -320,7 +321,7 @@ bool FieldGeneratorBase::has_default_value() { case FieldDescriptor::TYPE_SINT64: return descriptor_->default_value_int64() != 0L; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return true; } } @@ -420,7 +421,7 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor) case FieldDescriptor::TYPE_SINT64: return absl::StrCat(descriptor->default_value_int64()) + "L"; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return ""; } } @@ -468,7 +469,7 @@ std::string FieldGeneratorBase::capitalized_type_name() { case FieldDescriptor::TYPE_SINT64: return "SInt64"; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return ""; } } diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc index 1ff5444cbc..b14f31d024 100644 --- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -40,6 +40,7 @@ #include #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/str_replace.h" #include "absl/strings/string_view.h" @@ -106,7 +107,7 @@ CSharpType GetCSharpType(FieldDescriptor::Type type) { // No default because we want the compiler to complain if any new // types are added. } - GOOGLE_LOG(FATAL)<< "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return (CSharpType) -1; } @@ -336,7 +337,7 @@ int GetFixedSize(FieldDescriptor::Type type) { // No default because we want the compiler to complain if any new // types are added. } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return -1; } @@ -461,7 +462,7 @@ bool IsNullable(const FieldDescriptor* descriptor) { return true; default: - GOOGLE_LOG(FATAL) << "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return true; } } diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index d5c803fce6..861908475a 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -35,6 +35,7 @@ #include "google/protobuf/compiler/code_generator.h" #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/csharp/csharp_doc_comment.h" #include "google/protobuf/compiler/csharp/csharp_enum.h" @@ -764,7 +765,8 @@ int MessageGenerator::GetPresenceIndex(const FieldDescriptor* descriptor) { index++; } } - GOOGLE_LOG(DFATAL)<< "Could not find presence index for field " << descriptor->name(); + GOOGLE_ABSL_LOG(DFATAL) << "Could not find presence index for field " + << descriptor->name(); return -1; } diff --git a/src/google/protobuf/compiler/importer_unittest.cc b/src/google/protobuf/compiler/importer_unittest.cc index 8b7c0ea495..ddfbd9c0d5 100644 --- a/src/google/protobuf/compiler/importer_unittest.cc +++ b/src/google/protobuf/compiler/importer_unittest.cc @@ -36,7 +36,6 @@ #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" @@ -44,6 +43,7 @@ #include "google/protobuf/testing/googletest.h" #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/status/status.h" #include "absl/strings/substitute.h" #include "google/protobuf/io/zero_copy_stream_impl.h" @@ -266,7 +266,7 @@ class DiskSourceTreeTest : public testing::Test { if (FileExists(dirnames_[i])) { File::DeleteRecursively(dirnames_[i], NULL, NULL); } - GOOGLE_CHECK_OK(File::CreateDir(dirnames_[i], 0777)); + GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirnames_[i], 0777)); } } @@ -279,11 +279,11 @@ class DiskSourceTreeTest : public testing::Test { } void AddFile(const std::string& filename, const char* contents) { - GOOGLE_CHECK_OK(File::SetContents(filename, contents, true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, contents, true)); } void AddSubdir(const std::string& dirname) { - GOOGLE_CHECK_OK(File::CreateDir(dirname, 0777)); + GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirname, 0777)); } void ExpectFileContents(const std::string& filename, @@ -397,7 +397,8 @@ 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_CHECK_OK(File::CreateDir(dirnames_[0] + "/bar", 0777)); + GOOGLE_ABSL_CHECK_OK( + File::CreateDir(dirnames_[0] + "/bar", 0777)); // Add files and map paths. AddFile(dirnames_[0] + "/bar/foo", "Hello World!"); diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc index 3e05346296..a4d6ecf395 100644 --- a/src/google/protobuf/compiler/mock_code_generator.cc +++ b/src/google/protobuf/compiler/mock_code_generator.cc @@ -39,12 +39,13 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/descriptor.pb.h" #include +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_join.h" #include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" @@ -105,7 +106,7 @@ void MockCodeGenerator::ExpectGenerated( const std::string& first_parsed_file_name, const std::string& output_directory) { std::string content; - GOOGLE_CHECK_OK( + GOOGLE_ABSL_CHECK_OK( File::GetContents(output_directory + "/" + GetOutputFileName(name, file), &content, true)); @@ -163,15 +164,15 @@ void MockCodeGenerator::CheckGeneratedAnnotations( const std::string& name, const std::string& file, const std::string& output_directory) { std::string file_content; - GOOGLE_CHECK_OK( + GOOGLE_ABSL_CHECK_OK( File::GetContents(output_directory + "/" + GetOutputFileName(name, file), &file_content, true)); std::string meta_content; - GOOGLE_CHECK_OK(File::GetContents( + GOOGLE_ABSL_CHECK_OK(File::GetContents( output_directory + "/" + GetOutputFileName(name, file) + ".pb.meta", &meta_content, true)); GeneratedCodeInfo annotations; - GOOGLE_CHECK(TextFormat::ParseFromString(meta_content, &annotations)); + GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(meta_content, &annotations)); ASSERT_EQ(7, annotations.annotation_size()); CheckSingleAnnotation("first_annotation", "first", file_content, @@ -245,7 +246,7 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, << " " << compiler_version.suffix() << std::endl; abort(); } else { - GOOGLE_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command; + GOOGLE_ABSL_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command; } } } diff --git a/src/google/protobuf/compiler/objectivec/field.cc b/src/google/protobuf/compiler/objectivec/field.cc index bf4c1f3998..8119be6fdf 100644 --- a/src/google/protobuf/compiler/objectivec/field.cc +++ b/src/google/protobuf/compiler/objectivec/field.cc @@ -36,6 +36,8 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/objectivec/enum_field.h" #include "google/protobuf/compiler/objectivec/helpers.h" @@ -167,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return false; } @@ -476,7 +478,7 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor) const FieldGenerator& FieldGeneratorMap::get( const FieldDescriptor* field) const { - GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); + GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_); return *field_generators_[field->index()]; } diff --git a/src/google/protobuf/compiler/objectivec/helpers.cc b/src/google/protobuf/compiler/objectivec/helpers.cc index 2c376d7355..e7081ee1d1 100644 --- a/src/google/protobuf/compiler/objectivec/helpers.cc +++ b/src/google/protobuf/compiler/objectivec/helpers.cc @@ -34,6 +34,7 @@ #include #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" @@ -66,7 +67,7 @@ std::string GetZeroEnumNameForFlagType(const FlagType flag_type) { case FLAGTYPE_FIELD: return "GPBFieldNone"; default: - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return "0"; } } @@ -80,7 +81,7 @@ std::string GetEnumNameForFlagType(const FlagType flag_type) { case FLAGTYPE_FIELD: return "GPBFieldFlags"; default: - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } } @@ -147,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } @@ -196,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return OBJECTIVECTYPE_INT32; } @@ -235,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } @@ -306,7 +307,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } diff --git a/src/google/protobuf/compiler/objectivec/import_writer.cc b/src/google/protobuf/compiler/objectivec/import_writer.cc index 63a8a043b2..3bbf62d119 100644 --- a/src/google/protobuf/compiler/objectivec/import_writer.cc +++ b/src/google/protobuf/compiler/objectivec/import_writer.cc @@ -36,6 +36,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "google/protobuf/compiler/objectivec/line_consumer.h" @@ -197,7 +198,7 @@ void ImportWriter::PrintRuntimeImports(io::Printer* p, // If bundled, no need to do the framework support below. if (for_bundled_proto_) { - GOOGLE_DCHECK(!default_cpp_symbol); + GOOGLE_ABSL_DCHECK(!default_cpp_symbol); for (const auto& header : protobuf_imports_) { p->Print("#import \"$header$\"\n", "header", header); } diff --git a/src/google/protobuf/compiler/objectivec/map_field.cc b/src/google/protobuf/compiler/objectivec/map_field.cc index a9c73fd654..be76323bdb 100644 --- a/src/google/protobuf/compiler/objectivec/map_field.cc +++ b/src/google/protobuf/compiler/objectivec/map_field.cc @@ -34,6 +34,7 @@ #include #include "absl/container/btree_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/match.h" #include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/compiler/objectivec/names.h" @@ -78,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } diff --git a/src/google/protobuf/compiler/objectivec/message.cc b/src/google/protobuf/compiler/objectivec/message.cc index 7a52b40b55..51a404737b 100644 --- a/src/google/protobuf/compiler/objectivec/message.cc +++ b/src/google/protobuf/compiler/objectivec/message.cc @@ -38,6 +38,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/objectivec/extension.h" @@ -127,7 +128,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return 0; } diff --git a/src/google/protobuf/compiler/objectivec/primitive_field.cc b/src/google/protobuf/compiler/objectivec/primitive_field.cc index fa89d2cfa2..24c85b34a5 100644 --- a/src/google/protobuf/compiler/objectivec/primitive_field.cc +++ b/src/google/protobuf/compiler/objectivec/primitive_field.cc @@ -33,6 +33,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/io/printer.h" @@ -73,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } @@ -107,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_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index 98e4bca539..f0e103fe25 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -44,10 +44,11 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "absl/base/casts.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/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" @@ -516,8 +517,8 @@ int Parser::LocationRecorder::CurrentPathSize() const { void Parser::LocationRecorder::AttachComments( std::string* leading, std::string* trailing, std::vector* detached_comments) const { - GOOGLE_CHECK(!location_->has_leading_comments()); - GOOGLE_CHECK(!location_->has_trailing_comments()); + GOOGLE_ABSL_CHECK(!location_->has_leading_comments()); + GOOGLE_ABSL_CHECK(!location_->has_trailing_comments()); if (!leading->empty()) { location_->mutable_leading_comments()->swap(*leading); @@ -671,10 +672,11 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { file->set_syntax(syntax_identifier_); } } else if (!stop_after_syntax_identifier_) { - GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " << file->name() - << ". Please use 'syntax = \"proto2\";' " - << "or 'syntax = \"proto3\";' to specify a syntax " - << "version. (Defaulted to proto2 syntax.)"; + GOOGLE_ABSL_LOG(WARNING) << "No syntax specified for the proto file: " + << file->name() + << ". Please use 'syntax = \"proto2\";' " + << "or 'syntax = \"proto3\";' to specify a syntax " + << "version. (Defaulted to proto2 syntax.)"; syntax_identifier_ = "proto2"; } @@ -1488,7 +1490,7 @@ bool Parser::ParseOption(Message* options, // Create an entry in the uninterpreted_option field. const FieldDescriptor* uninterpreted_option_field = options->GetDescriptor()->FindFieldByName("uninterpreted_option"); - GOOGLE_CHECK(uninterpreted_option_field != nullptr) + GOOGLE_ABSL_CHECK(uninterpreted_option_field != nullptr) << "No field named \"uninterpreted_option\" in the Options proto."; const Reflection* reflection = options->GetReflection(); @@ -1541,7 +1543,8 @@ bool Parser::ParseOption(Message* options, switch (input_->current().type) { case io::Tokenizer::TYPE_START: - GOOGLE_LOG(FATAL) << "Trying to read value before any tokens have been read."; + GOOGLE_ABSL_LOG(FATAL) + << "Trying to read value before any tokens have been read."; return false; case io::Tokenizer::TYPE_END: @@ -1550,9 +1553,9 @@ bool Parser::ParseOption(Message* options, case io::Tokenizer::TYPE_WHITESPACE: case io::Tokenizer::TYPE_NEWLINE: - GOOGLE_CHECK(!input_->report_whitespace() && !input_->report_newlines()) + GOOGLE_ABSL_CHECK(!input_->report_whitespace() && !input_->report_newlines()) << "Whitespace tokens were not requested."; - GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace."; + GOOGLE_ABSL_LOG(FATAL) << "Tokenizer reported whitespace."; return false; case io::Tokenizer::TYPE_IDENTIFIER: { diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc index 91789f70f8..2628f89ae4 100644 --- a/src/google/protobuf/compiler/parser_unittest.cc +++ b/src/google/protobuf/compiler/parser_unittest.cc @@ -45,6 +45,7 @@ #include "google/protobuf/testing/googletest.h" #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_join.h" #include "absl/strings/substitute.h" #include "google/protobuf/test_util2.h" @@ -2855,14 +2856,14 @@ class SourceInfoTest : public ParserTest { while (*text != '\0') { if (*text == '$') { ++text; - GOOGLE_CHECK_NE('\0', *text); + GOOGLE_ABSL_CHECK_NE('\0', *text); if (*text == '$') { text_without_markers_ += '$'; ++column; } else { markers_[*text] = std::make_pair(line, column); ++text; - GOOGLE_CHECK_EQ('$', *text); + GOOGLE_ABSL_CHECK_EQ('$', *text); } } else if (*text == '\n') { ++line; diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 5501c98f2b..956fe0b800 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -36,6 +36,7 @@ #include "google/protobuf/compiler/code_generator.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_replace.h" @@ -2309,14 +2310,14 @@ bool Generator::GenerateAll(const std::vector& files, options.aggregate_metadata = true; for (const auto& prefix : absl::StrSplit(option_pair[1], "#", absl::AllowEmpty())) { options.aggregate_metadata_prefixes.emplace(prefix); - GOOGLE_LOG(INFO) << prefix; + GOOGLE_ABSL_LOG(INFO) << prefix; } } else if (option_pair[0] == "internal") { options.is_descriptor = true; } else if (option_pair[0] == "internal_generate_c_wkt") { GenerateCWellKnownTypes(files, generator_context); } else { - GOOGLE_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; + GOOGLE_ABSL_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; } } diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc index 082e0a852a..df0916f7fb 100644 --- a/src/google/protobuf/compiler/plugin.cc +++ b/src/google/protobuf/compiler/plugin.cc @@ -39,7 +39,6 @@ #include #endif -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/descriptor.h" diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.cc b/src/google/protobuf/compiler/ruby/ruby_generator.cc index be643d88b6..47a621eefd 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -34,6 +34,7 @@ #include #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/plugin.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" @@ -121,8 +122,8 @@ std::string StringifySyntax(FileDescriptor::Syntax syntax) { return "proto3"; case FileDescriptor::SYNTAX_UNKNOWN: default: - GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports " - "proto2 and proto3 syntax."; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported syntax; this generator only supports " + "proto2 and proto3 syntax."; return ""; } } @@ -247,7 +248,8 @@ void GenerateOneof(const OneofDescriptor* oneof, io::Printer* printer) { bool GenerateMessage(const Descriptor* message, io::Printer* printer, std::string* error) { if (message->extension_range_count() > 0 || message->extension_count() > 0) { - GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; + GOOGLE_ABSL_LOG(WARNING) + << "Extensions are not yet supported for proto2 .proto files."; } // Don't generate MapEntry messages -- we use the Ruby extension's native @@ -422,8 +424,8 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) { if (package_name.find("::") != std::string::npos) { need_change_to_module = false; } else if (package_name.find('.') != std::string::npos) { - GOOGLE_LOG(WARNING) << "ruby_package option should be in the form of:" - << " 'A::B::C' and not 'A.B.C'"; + GOOGLE_ABSL_LOG(WARNING) << "ruby_package option should be in the form of:" + << " 'A::B::C' and not 'A.B.C'"; } } else { package_name = file->package(); @@ -519,7 +521,8 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, // TODO: Remove this when ruby supports extensions for proto2 syntax. if (file->syntax() == FileDescriptor::SYNTAX_PROTO2 && file->extension_count() > 0) { - GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; + GOOGLE_ABSL_LOG(WARNING) + << "Extensions are not yet supported for proto2 .proto files."; } bool use_raw_descriptor = file->name() == "google/protobuf/descriptor.proto"; diff --git a/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc b/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc index 31d3770cee..729f370cb1 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc @@ -68,26 +68,18 @@ void RubyTest(std::string proto_file, std::string import_proto_file = "") { // Copy generated_code.proto to the temporary test directory. std::string test_input; - GOOGLE_CHECK_OK(File::GetContents( - ruby_tests + proto_file + ".proto", - &test_input, - true)); - GOOGLE_CHECK_OK(File::SetContents( - TestTempDir() + proto_file + ".proto", - test_input, - true)); + GOOGLE_ABSL_CHECK_OK( + File::GetContents(ruby_tests + proto_file + ".proto", &test_input, true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + proto_file + ".proto", + test_input, true)); // Copy generated_code_import.proto to the temporary test directory. std::string test_import; if (!import_proto_file.empty()) { - GOOGLE_CHECK_OK(File::GetContents( - ruby_tests + import_proto_file + ".proto", - &test_import, - true)); - GOOGLE_CHECK_OK(File::SetContents( - TestTempDir() + import_proto_file + ".proto", - test_import, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(ruby_tests + import_proto_file + ".proto", + &test_import, true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents( + TestTempDir() + import_proto_file + ".proto", test_import, true)); } // Invoke the proto compiler (we will be inside TestTempDir() at this point). @@ -106,15 +98,11 @@ void RubyTest(std::string proto_file, std::string import_proto_file = "") { // Load the generated output and compare to the expected result. std::string output; - GOOGLE_CHECK_OK(File::GetContentsAsText( - TestTempDir() + proto_file + "_pb.rb", - &output, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(TestTempDir() + proto_file + "_pb.rb", + &output, true)); std::string expected_output; - GOOGLE_CHECK_OK(File::GetContentsAsText( - ruby_tests + proto_file + "_pb.rb", - &expected_output, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(ruby_tests + proto_file + "_pb.rb", + &expected_output, true)); EXPECT_EQ(expected_output, output); } diff --git a/src/google/protobuf/compiler/scc.h b/src/google/protobuf/compiler/scc.h index b9768bca36..df5bb4a5e2 100644 --- a/src/google/protobuf/compiler/scc.h +++ b/src/google/protobuf/compiler/scc.h @@ -33,9 +33,9 @@ #include -#include "google/protobuf/stubs/logging.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/memory/memory.h" #include "google/protobuf/descriptor.h" @@ -99,7 +99,7 @@ class PROTOC_EXPORT SCCAnalyzer { // Mark visited by inserting in map. auto ins = cache_.try_emplace(descriptor, absl::make_unique()); // Must not have visited already. - GOOGLE_DCHECK(ins.second); + GOOGLE_ABSL_DCHECK(ins.second); NodeData& result = *ins.first->second; // Initialize data structures. result.index = result.lowlink = index_++; @@ -107,7 +107,7 @@ class PROTOC_EXPORT SCCAnalyzer { // Recurse the fields / nodes in graph for (const auto* dep : DepsGenerator()(descriptor)) { - GOOGLE_CHECK(dep); + GOOGLE_ABSL_CHECK(dep); auto it = cache_.find(dep); if (it == cache_.end()) { // unexplored node @@ -150,7 +150,7 @@ class PROTOC_EXPORT SCCAnalyzer { absl::flat_hash_set seen; for (auto descriptor : scc->descriptors) { for (auto child_msg : DepsGenerator()(descriptor)) { - GOOGLE_CHECK(child_msg); + GOOGLE_ABSL_CHECK(child_msg); const SCC* child = GetSCC(child_msg); if (child == scc) continue; if (seen.insert(child).second) { diff --git a/src/google/protobuf/compiler/subprocess.cc b/src/google/protobuf/compiler/subprocess.cc index 7b48c49fcb..12f7849fdb 100644 --- a/src/google/protobuf/compiler/subprocess.cc +++ b/src/google/protobuf/compiler/subprocess.cc @@ -43,6 +43,7 @@ #include #endif +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/substitute.h" @@ -57,8 +58,8 @@ namespace compiler { static void CloseHandleOrDie(HANDLE handle) { if (!CloseHandle(handle)) { - GOOGLE_LOG(FATAL) << "CloseHandle: " - << Subprocess::Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "CloseHandle: " + << Subprocess::Win32ErrorMessage(GetLastError()); } } @@ -85,22 +86,22 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { HANDLE stdout_pipe_write; if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, nullptr, 0)) { - GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); } if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, nullptr, 0)) { - GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); } // Make child side of the pipes inheritable. if (!SetHandleInformation(stdin_pipe_read, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { - GOOGLE_LOG(FATAL) << "SetHandleInformation: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "SetHandleInformation: " + << Win32ErrorMessage(GetLastError()); } if (!SetHandleInformation(stdout_pipe_write, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { - GOOGLE_LOG(FATAL) << "SetHandleInformation: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "SetHandleInformation: " + << Win32ErrorMessage(GetLastError()); } // Setup STARTUPINFO to redirect handles. @@ -113,13 +114,13 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { startup_info.hStdError = GetStdHandle(STD_ERROR_HANDLE); if (startup_info.hStdError == INVALID_HANDLE_VALUE) { - GOOGLE_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError()); } // get wide string version of program as the path may contain non-ascii characters std::wstring wprogram; if (!io::win32::strings::utf8_to_wcs(program.c_str(), &wprogram)) { - GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); } // Invoking cmd.exe allows for '.bat' files from the path as well as '.exe'. @@ -128,7 +129,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { // get wide string version of command line as the path may contain non-ascii characters std::wstring wcommand_line; if (!io::win32::strings::utf8_to_wcs(command_line.c_str(), &wcommand_line)) { - GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); } // Using a malloc'ed string because CreateProcess() can mutate its second @@ -169,7 +170,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, return false; } - GOOGLE_CHECK(child_handle_ != nullptr) << "Must call Start() first."; + GOOGLE_ABSL_CHECK(child_handle_ != nullptr) << "Must call Start() first."; std::string input_data; if (!input.SerializeToString(&input_data)) { @@ -199,11 +200,11 @@ bool Subprocess::Communicate(const Message& input, Message* output, wait_result < WAIT_OBJECT_0 + handle_count) { signaled_handle = handles[wait_result - WAIT_OBJECT_0]; } else if (wait_result == WAIT_FAILED) { - GOOGLE_LOG(FATAL) << "WaitForMultipleObjects: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "WaitForMultipleObjects: " + << Win32ErrorMessage(GetLastError()); } else { - GOOGLE_LOG(FATAL) << "WaitForMultipleObjects: Unexpected return code: " - << wait_result; + GOOGLE_ABSL_LOG(FATAL) << "WaitForMultipleObjects: Unexpected return code: " + << wait_result; } if (signaled_handle == child_stdin_) { @@ -246,17 +247,17 @@ bool Subprocess::Communicate(const Message& input, Message* output, DWORD wait_result = WaitForSingleObject(child_handle_, INFINITE); if (wait_result == WAIT_FAILED) { - GOOGLE_LOG(FATAL) << "WaitForSingleObject: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "WaitForSingleObject: " + << Win32ErrorMessage(GetLastError()); } else if (wait_result != WAIT_OBJECT_0) { - GOOGLE_LOG(FATAL) << "WaitForSingleObject: Unexpected return code: " - << wait_result; + GOOGLE_ABSL_LOG(FATAL) << "WaitForSingleObject: Unexpected return code: " + << wait_result; } DWORD exit_code; if (!GetExitCodeProcess(child_handle_, &exit_code)) { - GOOGLE_LOG(FATAL) << "GetExitCodeProcess: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "GetExitCodeProcess: " + << Win32ErrorMessage(GetLastError()); } CloseHandleOrDie(child_handle_); @@ -325,14 +326,14 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { int stdin_pipe[2]; int stdout_pipe[2]; - GOOGLE_CHECK(pipe(stdin_pipe) != -1); - GOOGLE_CHECK(pipe(stdout_pipe) != -1); + GOOGLE_ABSL_CHECK(pipe(stdin_pipe) != -1); + GOOGLE_ABSL_CHECK(pipe(stdout_pipe) != -1); char* argv[2] = {portable_strdup(program.c_str()), nullptr}; child_pid_ = fork(); if (child_pid_ == -1) { - GOOGLE_LOG(FATAL) << "fork: " << strerror(errno); + GOOGLE_ABSL_LOG(FATAL) << "fork: " << strerror(errno); } else if (child_pid_ == 0) { // We are the child. dup2(stdin_pipe[0], STDIN_FILENO); @@ -379,7 +380,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { bool Subprocess::Communicate(const Message& input, Message* output, std::string* error) { - GOOGLE_CHECK_NE(child_stdin_, -1) << "Must call Start() first."; + GOOGLE_ABSL_CHECK_NE(child_stdin_, -1) << "Must call Start() first."; // The "sighandler_t" typedef is GNU-specific, so define our own. typedef void SignalHandler(int); @@ -414,7 +415,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, // Interrupted by signal. Try again. continue; } else { - GOOGLE_LOG(FATAL) << "select: " << strerror(errno); + GOOGLE_ABSL_LOG(FATAL) << "select: " << strerror(errno); } } @@ -460,7 +461,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, int status; while (waitpid(child_pid_, &status, 0) == -1) { if (errno != EINTR) { - GOOGLE_LOG(FATAL) << "waitpid: " << strerror(errno); + GOOGLE_ABSL_LOG(FATAL) << "waitpid: " << strerror(errno); } }