Don't add void
prototypes on functions that would otherwise not need to be rewritten
#688
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for an issue I observed while working on adding itypes to bodyless functions. A function that does not otherwise need to be rewritten will sometimes be rewritten in order to replace a missing prototype with
(void)
. This was causing rewriting errors when an undefined function in an unwritable file was constrained to WILD in order to not add itypes on unwritable function, but it was still rewritten to use avoid
prototype. That particular issue doesn't exist onmain
prior to other change I made, but the test in this PR demonstrates another rewriting error that can be triggered.The function is defined in a macro, so it cannot be rewritten without 3C raising an error. Constraints are generated so that the return type solve to WILD, but 3C still tries to rewrite it to insert a
void
prototype.This is fixed by only rewriting to insert the
void
prototype if the function already had to be rewritten for another reason.