tests/cc: Reuse 0193-incomplete - scc - simple c99 compiler
HTML git clone git://git.simple-cc.org/scc
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 115f7694ce1502f57bb72b9e34d8816c5224e843
DIR parent 0cc26f9abb8c7f8a5ad30563d63bda35a5345322
HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 27 Mar 2025 13:09:21 +0100
tests/cc: Reuse 0193-incomplete
This test was a copy of 0180-imcomplete, and the issue [i]
stated that using an incomplete array type as parameter of
a function is UB. In our case we accept it, but it makes
more sense to give an error in that case. Rework in 0180
is expected. This test is reused to check that an extern
struct can be declared with incomplete type.
[i] https://www.open-std.org/jtc1/sc22/wg14/issues/c90/issue0047.html
Diffstat:
M tests/cc/execute/0193-incomplete.c | 10 +++++++---
M tests/cc/execute/chktest.sh | 2 +-
A tests/cc/execute/test.c | 6 ++++++
3 files changed, 14 insertions(+), 4 deletions(-)
---
DIR diff --git a/tests/cc/execute/0193-incomplete.c b/tests/cc/execute/0193-incomplete.c
@@ -1,13 +1,17 @@
+/* https://www.open-std.org/jtc1/sc22/wg14/issues/c90/issue0047.html */
+
struct dummy;
+extern struct dummy dummy1;
+
void *
-fun(struct dummy p[])
+fun(void)
{
- return p;
+ return &dummy1;
}
int
main()
{
- return 0 != fun(0);
+ return fun() == 0;
}
DIR diff --git a/tests/cc/execute/chktest.sh b/tests/cc/execute/chktest.sh
@@ -18,7 +18,7 @@ do
state=${state:-""}
rm -f a.out
- ((SCCPREFIX=$SCCPREFIX $CC -Isysinclude $CFLAGS "$i" && ./a.out) >>test.log 2>&1 &&
+ (($CC -Isysinclude $CFLAGS "$i" test.c && ./a.out) >>test.log 2>&1 &&
printf '[PASS]' || printf '[FAIL]'
printf '\t%s\t%s\n' $i $state) | tee -a test.log
done < $file
DIR diff --git a/tests/cc/execute/test.c b/tests/cc/execute/test.c
@@ -0,0 +1,6 @@
+struct dummy {
+ int a;
+ int b;
+};
+
+struct dummy dummy1;