[cfe-dev] function prototypes / definition
Douglas Gregor
dgregor at apple.com
Mon Nov 8 18:56:25 PST 2010
On Nov 2, 2010, at 3:38 PM, JP wrote:
> In the following example "old-style" definition of f, "f (p0, p1) Point
> p0, p1; ..." results in the following LLVM assembly:
>
> call void (...)* bitcast (void (i64, i64, i64, i64)* @f to void
> (...)*)(i64 %1, i64 %3, i64 %5, i64 %7)
>
> whereas if f is defined as "f (Point p0, Point p1) ..." the assembly is:
>
> call void @f(i64 %1, i64 %3, i64 %5, i64 %7)
>
> A couple questions:
> 1) How can I warn about or prevent the old-style definition from
> compiling? -Wold-style-definition has no effect.
I don't think we have an implementation of this warning. We just swallow the warning flag. Patches welcome! ;)
> 2) I assume the vararg call to f is expected.
IIRC, yes, that's how K&R function definitions work if there is no prototype visible.
- Doug
More information about the cfe-dev
mailing list