-
Notifications
You must be signed in to change notification settings - Fork 4.1k
THRIFT-4846. Topologically sort structs before generation #1786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jeking3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI issues have been resolved so I would suggest rebasing on master to get a clean run.
|
What's blocking this? |
|
Not sure. I took a look at the failed test runs for a few minutes and couldn't find anything that indicated issues with this patch, but it's a wall of text and I'm not familiar enough with the test suite to be able to diagnose what went wrong. |
|
I would suggest to start with the conflict :-) |
This adds a toposort step prior to emitting generating code for structs. For many languages (eg Java) this isn't necessary as there is no "ordering" in the generated code. However, with C and C++, it's important to define structs prior to their inclusion in another struct. This also makes Thrift fail when generating C/C++ code with cyclic references as the toposort is impossible. A new test includes some structs defined in the "wrong" order to ensure that the sort produces working code. I manually tested a file with a true cycle in it, and verified the error output.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
@toddlipcon I took a look at one of the test outputs and saw this: testSubStructValidation failed for Java and this tests StructA and StructB which have been changed in this PR. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically closed due to inactivity. Thank you for your contributions. |
|
This issue is no longer stale. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically closed due to inactivity. Thank you for your contributions. |
This adds a toposort step prior to emitting generating code for structs.
For many languages (eg Java) this isn't necessary as there is no
"ordering" in the generated code. However, with C and C++, it's
important to define structs prior to their inclusion in another struct.
This also makes Thrift fail when generating C/C++ code with cyclic
references as the toposort is impossible.
A new test includes some structs defined in the "wrong" order to ensure
that the sort produces working code.
I manually tested a file with a true cycle in it, and verified the error
output.