Extension: varargs checking

Example

#pragma varargck type "lld" long long
#pragma varargck argpos 1 print

print("%lld %lld", 1LL, 2);

Syntax & Semantics

The extension adds a new #pragma that can be used to define the types associated with printf verbs (like %lld) and then to note that a function has a printf-style format string argument.

When the format string is a literal, the extension warns if the arguments do not match the format string. In the example, the extension would warn that 2 has type int instead of the expected long long.

Implementation

Implemented in earlier rscc.

Not implemented.

Would extend compile to look for and type-check printf-style function calls, but would leave the code alone and let later elements in the chain compile it as usual.