upb: s/std::endl/'\n' in upb_generator
PiperOrigin-RevId: 572511446
diff --git a/upb_generator/BUILD b/upb_generator/BUILD
index c960273..bf0a1b9 100644
--- a/upb_generator/BUILD
+++ b/upb_generator/BUILD
@@ -362,6 +362,8 @@
deps = [
":plugin_upb_proto",
":upbdev",
+ "//upb:base",
+ "//upb:mem",
"//upb:port",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
diff --git a/upb_generator/protoc-gen-upbdev.cc b/upb_generator/protoc-gen-upbdev.cc
index d2461dd..ce3bc69 100644
--- a/upb_generator/protoc-gen-upbdev.cc
+++ b/upb_generator/protoc-gen-upbdev.cc
@@ -32,6 +32,9 @@
#include <string>
#include "google/protobuf/compiler/plugin.upb.h"
+#include "upb/base/status.h"
+#include "upb/base/string_view.h"
+#include "upb/mem/arena.h"
#include "upb_generator/subprocess.h"
#include "upb_generator/upbdev.h"
@@ -61,7 +64,7 @@
const upb_StringView sv =
upbdev_ProcessInput(input.data(), input.size(), a, &status);
if (!upb_Status_IsOk(&status)) {
- std::cerr << status.msg << std::endl;
+ std::cerr << status.msg << '\n';
return -1;
}
@@ -75,14 +78,14 @@
const bool ok = subprocess.Communicate(json_request, &json_response, &error);
if (!ok) {
// Dump the JSON request to stderr if we can't launch the next plugin.
- std::cerr << json_request << std::endl;
+ std::cerr << json_request << '\n';
return -1;
}
// Decode, serialize, and write the JSON response.
upbdev_ProcessOutput(json_response.data(), json_response.size(), a, &status);
if (!upb_Status_IsOk(&status)) {
- std::cerr << status.msg << std::endl;
+ std::cerr << status.msg << '\n';
return -1;
}
diff --git a/upb_generator/subprocess.cc b/upb_generator/subprocess.cc
index 0f6f8b4..5280dc0 100644
--- a/upb_generator/subprocess.cc
+++ b/upb_generator/subprocess.cc
@@ -357,7 +357,7 @@
bool Subprocess::Communicate(const std::string& input_data,
std::string* output_data, std::string* error) {
if (child_stdin_ == -1) {
- std::cerr << "Must call Start() first." << std::endl;
+ std::cerr << "Must call Start() first." << '\n';
UPB_ASSERT(child_stdin_ != -1);
}
@@ -387,7 +387,7 @@
// Interrupted by signal. Try again.
continue;
} else {
- std::cerr << "select: " << strerror(errno) << std::endl;
+ std::cerr << "select: " << strerror(errno) << '\n';
UPB_ASSERT(0);
}
}
@@ -434,7 +434,7 @@
int status;
while (waitpid(child_pid_, &status, 0) == -1) {
if (errno != EINTR) {
- std::cerr << "waitpid: " << strerror(errno) << std::endl;
+ std::cerr << "waitpid: " << strerror(errno) << '\n';
UPB_ASSERT(0);
}
}