commit 1dbce6a1af3146a9534cf84c1676923c00f5b090
parent f9c47e070844f7752b18e63197f2819ce106386c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 10:53:25 +0200
tests/cc: Add error/0038-void.c
Diffstat:
2 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/tests/cc/error/0038-void.c b/tests/cc/error/0038-void.c
@@ -0,0 +1,55 @@
+/*
+PATTERN:
+0038-void.c:18: error: 'void' must be the only parameter
+0038-void.c:24: error: 'void' must be the only parameter
+0038-void.c:30: error: 'void' must be the only parameter
+0038-void.c:45: error: too many arguments in function call
+0038-void.c:46: error: too few arguments in function call
+0038-void.c:48: error: too many arguments in function call
+0038-void.c:49: error: too few arguments in function call
+0038-void.c:50: error: too few arguments in function call
+0038-void.c:52: error: too few arguments in function call
+0038-void.c:54: error: too many arguments in function call
+too many errors
+.
+*/
+
+int
+f1(void, int a)
+{
+ return 0;
+}
+
+int
+f2(int a, void)
+{
+ return 0;
+}
+
+int
+f3(int a, void, int b)
+{
+ return 0;
+}
+
+int
+f4(void)
+{
+ return 0;
+}
+
+int
+main()
+{
+ f1(1);
+ f1(1, 2);
+ f1();
+ f2(1);
+ f2(1, 2);
+ f2();
+ f3(1);
+ f3(1, 2);
+ f3();
+ f4();
+ return f4(1);
+}
diff --git a/tests/cc/error/scc-tests.lst b/tests/cc/error/scc-tests.lst
@@ -35,3 +35,4 @@
0035-cpp.c
0036-func.c
0037-pointer.c
+0038-void.c