[qfcc] Add a failing test case for forward return

ProxyView in qwaq's ui stopped working because of the basic block
changes for function calls.
This commit is contained in:
Bill Currie 2024-03-08 09:01:24 +09:00
parent f390089e66
commit e7930305cc
2 changed files with 61 additions and 0 deletions

View file

@ -30,6 +30,7 @@ test_progs_dat=\
tools/qfcc/test/enum.dat \
tools/qfcc/test/entity-struct.dat \
tools/qfcc/test/fordecl.dat \
tools/qfcc/test/forward-return.dat \
tools/qfcc/test/func-expr.dat \
tools/qfcc/test/func-expr2.dat \
tools/qfcc/test/func-static.dat \
@ -421,6 +422,16 @@ tools/qfcc/test/fordecl.run: $(qfcc_test_run_deps)
include $(fordecl_dep) # am--include-marker
r_depfiles_remade += $(fordecl_dep)
tools_qfcc_test_forward_return_dat_SOURCES=tools/qfcc/test/forward-return.r
forward_return_obj=$(tools_qfcc_test_forward_return_dat_SOURCES:.r=.o)
forward_return_dep=$(call qcautodep,$(tools_qfcc_test_forward_return_dat_SOURCES))
tools/qfcc/test/forward-return.dat$(EXEEXT): $(forward_return_obj) $(QFCC_DEP)
$(V_QFCCLD)$(QLINK) -o $@ $(forward_return_obj)
tools/qfcc/test/forward-return.run: $(qfcc_test_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-run $@
include $(forward_return_dep) # am--include-marker
r_depfiles_remade += $(forward_return_dep)
tools_qfcc_test_func_expr_dat_SOURCES=tools/qfcc/test/func-expr.r
func_expr_obj=$(tools_qfcc_test_func_expr_dat_SOURCES:.r=.o)
func_expr_dep=$(call qcautodep,$(tools_qfcc_test_func_expr_dat_SOURCES))

View file

@ -0,0 +1,50 @@
void __obj_exec_class (struct obj_module *msg) = #0;
id obj_msgSend_super (Super *class, SEL op, ...) = #0;
id (id receiver, SEL op, ...) obj_msgSend = #0;
id (Class class) class_create_instance = #0;
int obj_increment_retaincount (id object) = #0;
void __obj_forward(id object, SEL sel, ...) = #0;
int func (SEL foo, @va_list bar);
@interface Object //just so the runtime doesn't complain
{
Class isa;
}
+alloc;
-init;
-(void) forward: (SEL) sel : (@va_list) args;
@end
@interface Foo : Object
-(int)dosomething;
@end
@implementation Object
-(void) forward: (SEL) sel : (@va_list) args
{
@return func (sel, args);
}
+alloc
{
return class_create_instance (self);
}
-init
{
obj_increment_retaincount (self);
return self;
}
@end
int func (SEL foo, @va_list bar)
{
return 42;
}
int
main ()
{
id obj = [[Object alloc] init];
return !([obj dosomething] == 42);
}