mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Properly dup symbol for declaration
The unification of qc and c function symbol handling made it important that the new symbol was a proper duplicate (minus being in a table) of the old symbol. This fixes redeclared prototypes (especially for qc-style functions, not encountered for c-style). Complete with unit test :)
This commit is contained in:
parent
ee6e38e2f9
commit
291898b46f
3 changed files with 21 additions and 0 deletions
|
@ -260,6 +260,8 @@ declare_symbol (specifier_t spec, const expr_t *init, symtab_t *symtab)
|
|||
// due to the way declarations work, we need a new symbol at all times.
|
||||
// redelcarations will be checked later
|
||||
s = new_symbol (s->name);
|
||||
*s = *spec.sym;
|
||||
s->table = nullptr;
|
||||
}
|
||||
|
||||
if (!spec.type_expr && !spec.is_function) {
|
||||
|
|
|
@ -57,6 +57,7 @@ test_progs_dat=\
|
|||
tools/qfcc/test/motor-point.dat \
|
||||
tools/qfcc/test/motor-xform.dat \
|
||||
tools/qfcc/test/quaternion.dat \
|
||||
tools/qfcc/test/reproto.dat \
|
||||
tools/qfcc/test/return-ivar.dat \
|
||||
tools/qfcc/test/return-postop.dat \
|
||||
tools/qfcc/test/sendv.dat \
|
||||
|
@ -692,6 +693,16 @@ tools/qfcc/test/quaternion.run: $(qfcc_test_run_deps)
|
|||
include $(quaternion_dep) # am--include-marker
|
||||
r_depfiles_remade += $(quaternion_dep)
|
||||
|
||||
tools_qfcc_test_reproto_dat_SOURCES=tools/qfcc/test/reproto.r
|
||||
reproto_obj=$(tools_qfcc_test_reproto_dat_SOURCES:.r=.o)
|
||||
reproto_dep=$(call qcautodep,$(tools_qfcc_test_reproto_dat_SOURCES))
|
||||
tools/qfcc/test/reproto.dat$(EXEEXT): $(reproto_obj) $(QFCC_DEP)
|
||||
$(V_QFCCLD)$(QLINK) -o $@ $(reproto_obj)
|
||||
tools/qfcc/test/reproto.run: $(qfcc_test_run_deps)
|
||||
@$(top_srcdir)/tools/qfcc/test/build-run $@
|
||||
include $(reproto_dep) # am--include-marker
|
||||
r_depfiles_remade += $(reproto_dep)
|
||||
|
||||
tools_qfcc_test_return_ivar_dat_SOURCES=tools/qfcc/test/return-ivar.r
|
||||
return_ivar_obj=$(tools_qfcc_test_return_ivar_dat_SOURCES:.r=.o)
|
||||
return_ivar_dep=$(call qcautodep,$(tools_qfcc_test_return_ivar_dat_SOURCES))
|
||||
|
|
8
tools/qfcc/test/reproto.r
Normal file
8
tools/qfcc/test/reproto.r
Normal file
|
@ -0,0 +1,8 @@
|
|||
float (entity targ) visible;
|
||||
float (entity targ) visible;
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return 0; // to survive and prevail :)
|
||||
}
|
Loading…
Reference in a new issue