quakeforge/tools/qfcc/test/twice-called.r
Bill Currie 33a3f92503 [qfcc] Move .return handling into statements.c
The means that the actual call expression is not in the statement lint
of the enclosing block expression, but just its result, whether the call
is void or not. This actually simplifies several things, but most
importantly will make Ruamoko calls easier to implement.

The test is because I had some trouble with double-calls, and is how I
found the return-postop issue :P
2022-01-21 13:09:23 +09:00

28 lines
400 B
R

#include "test-harness.h"
int counter;
int
function (void)
{
return ++counter;
}
int
main (void)
{
int ret = 0;
counter = 0;
//function ();
//if (counter != 1) {
//printf ("discarded return not called only once\n");
// ret = 1;
//}
counter = 0;
printf ("function: %d\n", function ());
if (counter != 1) {
//printf ("used return not called only once\n");
ret = 1;
}
return ret;
}