Skip to content

Commit

Permalink
remove redundant declaration from generated code
Browse files Browse the repository at this point in the history
It turns out that forward-declaring:
    struct foo;
is redundant when combined with:
    typedef struct foo foo;

Which is exactly what we were doing in the generated upb code. So, simplify it!

PiperOrigin-RevId: 456590031
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jun 22, 2022
1 parent b174d9d commit a6cbda7
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions upbc/protoc-gen-upb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,6 @@ void WriteHeader(const FileLayout& layout, Output& output) {
SortedExtensions(file);

// Forward-declare types defined in this file.
for (auto message : this_file_messages) {
output("struct $0;\n", ToCIdent(message->full_name()));
}
for (auto message : this_file_messages) {
output("typedef struct $0 $0;\n", ToCIdent(message->full_name()));
}
Expand Down

0 comments on commit a6cbda7

Please sign in to comment.