The warning is currently disabled by default but can be enabled with
-Wstrict-calls-without-prototype. Enabling it by default will be
handled by future patches.
The warning is intended to catch C code like this:
int f(); // No prototype, accepts any number of arguments of any type. int call(void) { return f(1, 2, 3); }
While code like this is legal it can very easily invoke undefined behavior
by passing the wrong number of arguments or wrong types.
The warning only fires when arguments are passed to make it less noisy, i.e.
so that the warning does not fire on code like this:
int g(); int call(void) { return g(); }
While the above code could invoke undefined behavior, if the definition
of g() takes no arguments then the lack of a prototype is benign.
Writing function declarations that are not prototypes is also quite
common when the intention is for it to be a zero argument function
because it's easy to forget to add the void.
This warning while similar to -Wstrict-prototypes is distinct because
it warns at call sites rather at declarations.
This patch currently warns on calls to K&R style function declarations where a
previous declaration has a prototype. It is currently not clear if this is the correct behavior
as noted in the included test case.
rdar://87118271