[C++] named return values and return without value warnings
Richard Henderson
rth@cygnus.com
Fri Oct 6 18:43:00 GMT 2000
On Fri, Oct 06, 2000 at 05:20:44PM -0700, Geoff Keating wrote:
> I think this is why named return values are depreciated.
I thought it was because that extension is not part of the ISO
standard. But anyway, if it's not going to be removed immediately,
it should be fixed.
The first test case highlight the immediate failure. Namely, we
don't mangle the DECL_RETURN to use a psuedo until after we've
already processed the DECL_INIT. Which means that it got lost.
The second test case is intended to test ABI-mandated argument
and return value promotion. The test is only intended to be
run on Alpha systems. The issue being that despite x and y
being unsigned int, the value in the return register should
be sign-extended to a long.
If someone more familiar with c++ testsuite procedures would help
me as to what should be done with these, I'd appreciate it.
The patch fixes (1) by tweeking genrtl_named_return_value to
do things in the right order and (2) by letting function.c
handle the copy from pseudo to hard reg instead of
fixup_result_decl in the front end. As it happens, this also
lets us delete quite a hunk o code.
The third test case is intended to verify that I havn't broken
taking the address of the named return value. As it happened,
the first take at this patch did break it, but there were no
test cases to show it.
> My vote is to see it switched on, plus a patch to annotate all the
> broken testcases for dejagnu, plus XFAILs where necessary for the
> named-return-value stuff where it's broken.
Frankly, that's my vote as well, but before I the effort is
invested in tweeking that many test cases I'd prefer to have
buy-in from the front-end folk.
Therefore, the attached patch only fixes the 5 broken test
cases (by adding -Wreturn-type) to keep the regression checker
quiet.
r~
More information about the Gcc-patches
mailing list