Repository navigation
THRIFT-4134-Fix-remaining-undefined-behavior-invalid.patch #1222
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -273,10 +273,14 @@ void t_json_generator::write_type_spec(t_type* ttype) { | |
| write_key_and_string("valueTypeId", get_type_name(vtype)); | ||
| write_type_spec_object("keyType", ktype); | ||
| write_type_spec_object("valueType", vtype); | ||
| } else if (ttype->is_list() || ttype->is_set()) { | ||
| } else if (ttype->is_list()) { | ||
| t_type* etype = ((t_list*)ttype)->get_elem_type(); | ||
| write_key_and_string("elemTypeId", get_type_name(etype)); | ||
| write_type_spec_object("elemType", etype); | ||
| } else if (ttype->is_set()) { | ||
| t_type* etype = ((t_set*)ttype)->get_elem_type(); | ||
| write_key_and_string("elemTypeId", get_type_name(etype)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: these lines are duplicated from above. They can be refactored by setting etype in a conditional and putting 282 and 283 below that. |
||
| write_type_spec_object("elemType", etype); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -391,11 +391,16 @@ void t_xml_generator::write_type(t_type* ttype) { | |
| if (type == "id") { | ||
| write_attribute("type-module", ttype->get_program()->get_name()); | ||
| write_attribute("type-id", ttype->get_name()); | ||
| } else if (type == "list" || type == "set") { | ||
| } else if (type == "list") { | ||
| t_type* etype = ((t_list*)ttype)->get_elem_type(); | ||
| write_element_start("elemType"); | ||
| write_type(etype); | ||
| write_element_end(); | ||
| } else if (type == "set") { | ||
| t_type* etype = ((t_set*)ttype)->get_elem_type(); | ||
| write_element_start("elemType"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: duplicate lines (see above)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know they are duplicates because I duplicated them. One could argue that it is more readable but sure, we can have a conditional. Or we could refactor it into a method and include the map case. |
||
| write_type(etype); | ||
| write_element_end(); | ||
| } else if (type == "map") { | ||
| t_type* ktype = ((t_map*)ttype)->get_key_type(); | ||
| write_element_start("keyType"); | ||
|
|
||
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.
We'll still want to include
-fno-sanitize-recover=undefined, I think. When that option is set, a binary will crash on undefined behavior. When it is not set, the binary will print an error and continue.Having it set is preferable, I think, so that undefined behavior causes the tests to fail.
Uh oh!
There was an error while loading. Please reload this page.
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.
I just used your proposal. Done.
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.
I should have been more explicit. For finding
vptrerrors, it's good to remove-fno-sanitize-recover=undefined. But for checking that there are none, it's good to have-fno-sanitize-recover=undefined.If this patch fixes some, but not all, of the
vptrerrors, I would suggest leavingCFLAGSas it is inmaster. If it fixes allvptrerrors, I think the way you have it now is optimal.