Open
Description
Any functions called from inside a _Checked
scope must have a prototype. For example in the following code foo
does not have a prototype, but it is called in a function that could otherwise be made _Checked
.
int foo() {
return 0;
}
int bar() {
return foo();
}
Conversion (-addcr
):
int foo() _Checked {
return 0;
}
int bar() _Checked {
return foo();
}
This conversion is rejected by clang with error: function without a prototype cannot be used or declared in a checked scope
. For this conversion to work, we need to rewrite foo
as int foo(void) _Checked
. We already add void
prototypes while rewriting function definitions, so we should be able to apply this code to add the same prototype on functions called from checked scopes.