[cfe-dev] function prototypes / definition
JP
jpbonn-keyword-cfedev.957c48 at corniceresearch.com
Tue Nov 2 13:38:12 PDT 2010
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.
2) I assume the vararg call to f is expected. Is there an option or
target specific mechanism for disabling the generation of vararg calls?
This example was distilled from the GCC teststuite:
typedef struct {
long int p_x, p_y;
} Point;
void
f (Point p0, Point p1)
//f (p0, p1)
// Point p0, p1;
{
if (p0.p_x != 0)
abort ();
}
int
main ()
{
Point p0, p1;
p0.p_x = p1.p_x = 0;
p0.p_y = p1.p_y = 1;
f (p0, p1);
exit(0);
}
More information about the cfe-dev
mailing list