From 0bc58246b1c88378cb8bc1d6882f04710e67afb0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 7 Oct 2024 09:29:14 +0900 Subject: [PATCH] [qfcc] Add a passing test for shadowed params It's currently passing for Ruamoko, but glsl doesn't catch shadowed params. There's a bit of a conflict and I want to make sure I don't lose the checking. --- tools/qfcc/test/Makemodule.am | 6 +++++- tools/qfcc/test/shadow-param.r | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tools/qfcc/test/shadow-param.r diff --git a/tools/qfcc/test/Makemodule.am b/tools/qfcc/test/Makemodule.am index 51d173ba2..4c57e56a4 100644 --- a/tools/qfcc/test/Makemodule.am +++ b/tools/qfcc/test/Makemodule.am @@ -110,7 +110,8 @@ test_build_errors=\ tools/qfcc/test/double-demote-int-ginit.r \ tools/qfcc/test/double-demote-int-linit.r \ tools/qfcc/test/double-int-compare.r \ - tools/qfcc/test/double-float-compare.r + tools/qfcc/test/double-float-compare.r \ + tools/qfcc/test/shadow-param.r fail_build_errors= @@ -385,6 +386,9 @@ 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/shadow-param.run$(EXEEXT): tools/qfcc/test/shadow-param.r $(qfcc_fail_run_deps) + @$(top_srcdir)/tools/qfcc/test/build-compile-fail-run $@ $(QFCC) $(QCFLAGS) $< + tools/qfcc/test/motor.run$(EXEEXT): tools/qfcc/test/motor.r $(qfcc_comp_run_deps) @$(top_srcdir)/tools/qfcc/test/build-compile-pass-run $@ $(QFCC) $(QCFLAGS) -c $< diff --git a/tools/qfcc/test/shadow-param.r b/tools/qfcc/test/shadow-param.r new file mode 100644 index 000000000..c0c418e90 --- /dev/null +++ b/tools/qfcc/test/shadow-param.r @@ -0,0 +1,10 @@ +float func (int x) +{ + float x = 0; + return x; +} + +int main () +{ + return 1; // test fails if compile succeeds +}