Skip to content

Commit

Permalink
upb: s/std::endl/'\n' in upb_generator
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 572511446
  • Loading branch information
ericsalo authored and copybara-github committed Oct 11, 2023
1 parent e237925 commit f0392ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions upb_generator/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 6 additions & 3 deletions upb_generator/protoc-gen-upbdev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions upb_generator/subprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit f0392ec

Please sign in to comment.