upb: s/std::endl/'\n' in upb_generator

PiperOrigin-RevId: 572511446
pull/14349/head
Eric Salo 1 year ago committed by Copybara-Service
parent e237925b05
commit f0392ecc42
  1. 2
      upb_generator/BUILD
  2. 9
      upb_generator/protoc-gen-upbdev.cc
  3. 6
      upb_generator/subprocess.cc

@ -362,6 +362,8 @@ cc_binary(
deps = [
":plugin_upb_proto",
":upbdev",
"//upb:base",
"//upb:mem",
"//upb:port",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",

@ -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 @@ int main() {
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 @@ int main() {
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;
}

@ -357,7 +357,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) {
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 @@ bool Subprocess::Communicate(const std::string& input_data,
// 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 @@ bool Subprocess::Communicate(const std::string& input_data,
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);
}
}

Loading…
Cancel
Save