Skip to content

Functions called in checked scope must have prototype #382

Open
@john-h-kastner

Description

@john-h-kastner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions