[qfcc] Add some failing typedef redef tests

typeredef1 parses properly but fails due to it erroneously complaining
that foo is redeclared as a different kind of object (it's the same
kind).

typeredef2 is the real problem in that it's a syntax error when it
should not be. This has proven to be a show-stopper for development on
my laptop as it has very recent vulkan headers which have such a
duplicate typedef.
This commit is contained in:
Bill Currie 2023-02-04 16:08:53 +09:00
parent 99d32d5e54
commit e974e9d758
4 changed files with 33 additions and 0 deletions

View File

@ -72,6 +72,10 @@ test_progs_dat=\
fail_progs_dat=
test_build_passes=\
tools/qfcc/test/typeredef1.r \
tools/qfcc/test/typeredef2.r
test_build_errors=\
tools/qfcc/test/classarray.r \
tools/qfcc/test/dealloc-warn.r \
@ -96,6 +100,7 @@ test_defspace_src=\
TESTS += \
$(test_bins) \
$(test_progs_dat:.dat=.run) \
$(test_build_passes:.r=.run) \
$(test_build_errors:.r=.run)
XFAIL_TESTS += \
$(fail_bins) \
@ -118,6 +123,7 @@ tools_qfcc_test_test_harness_LDADD= $(QFCC_TEST_LIBS)
tools_qfcc_test_test_harness_DEPENDENCIES= $(QFCC_TEST_DEPS)
qfcc_test_run_deps = Makefile tools/qfcc/test/build-run
qfcc_comp_run_deps = Makefile tools/qfcc/test/build-compile-pass-run
qfcc_fail_run_deps = Makefile tools/qfcc/test/build-compile-fail-run
tools_qfcc_test_address_cast_dat_SOURCES=tools/qfcc/test/address-cast.r
address_cast_obj=$(tools_qfcc_test_address_cast_dat_SOURCES:.r=.o)
@ -301,6 +307,12 @@ tools/qfcc/test/double-int-compare.run$(EXEEXT): tools/qfcc/test/double-int-comp
tools/qfcc/test/double-float-compare.run$(EXEEXT): tools/qfcc/test/double-float-compare.r $(qfcc_fail_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-compile-fail-run $@ $(QFCC) $(QCFLAGS) $<
tools/qfcc/test/typeredef1.run$(EXEEXT): tools/qfcc/test/typeredef1.r $(qfcc_comp_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-compile-pass-run $@ $(QFCC) $(QCFLAGS) $<
tools/qfcc/test/typeredef2.run$(EXEEXT): tools/qfcc/test/typeredef2.r $(qfcc_comp_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-compile-pass-run $@ $(QFCC) $(QCFLAGS) $<
tools_qfcc_test_enum_dat_SOURCES=tools/qfcc/test/enum.r
enum_obj=$(tools_qfcc_test_enum_dat_SOURCES:.r=.o)
enum_dep=$(call qcautodep,$(tools_qfcc_test_enum_dat_SOURCES))
@ -773,6 +785,8 @@ r_depfiles_remade += $(zerolinker_dep)
EXTRA_DIST += \
$(test_build_errors) \
$(test_build_passes) \
tools/qfcc/test/build-compile-pass-run \
tools/qfcc/test/build-compile-fail-run \
tools/qfcc/test/test-bi.h \
tools/qfcc/test/build-run \

View File

@ -0,0 +1,15 @@
#! /bin/sh
script=$1
shift
cat > $script <<EOF
#! /bin/sh
# compile must pass
$@
if test \$? != 0; then
exit 1
fi
exit 0
EOF
chmod +x $script

View File

@ -0,0 +1,2 @@
typedef int foo;
typedef int foo;

View File

@ -0,0 +1,2 @@
typedef int foo(void);
typedef int foo(void);