aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-03-06 03:25:33 +0100
committerMichael Matz <matz@suse.de>2017-05-02 03:07:36 +0200
commit182367e232e92861be2e4734a6bf496c63389f45 (patch)
tree30e5077a17823a17166d6caf2505b832b16bfde3 /tests
parent5891fbc0c8ff00a07fd323fa34760348b772f87e (diff)
downloadtinycc-182367e232e92861be2e4734a6bf496c63389f45.tar.gz
tinycc-182367e232e92861be2e4734a6bf496c63389f45.tar.bz2
Reorganize type parsing
Various corner cases for declarator parsing were incorrect. This reorganizes and fixes it, and somewhat simplifies it as well.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests2/81_types.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/tests2/81_types.c b/tests/tests2/81_types.c
index 542d066..fd6d71b 100644
--- a/tests/tests2/81_types.c
+++ b/tests/tests2/81_types.c
@@ -6,4 +6,38 @@ enum E const *e2;
struct S *s;
const struct S *s1;
struct S const *s2;
+
+/* Various strangely looking declarators, which are all valid
+ and have to map to the same numbered typedefs. */
+typedef int (*fptr1)();
+int f1 (int (), int);
+typedef int (*fptr2)(int x);
+int f2 (int (int x), int);
+typedef int (*fptr3)(int);
+int f3 (int (int), int);
+typedef int (*fptr4[4])(int);
+int f4 (int (*[4])(int), int);
+typedef int (*fptr5)(fptr1);
+int f5 (int (int()), fptr1);
+int f1 (fptr1 fp, int i)
+{
+ return (*fp)(i);
+}
+int f2 (fptr2 fp, int i)
+{
+ return (*fp)(i);
+}
+int f3 (fptr3 fp, int i)
+{
+ return (*fp)(i);
+}
+int f4 (fptr4 fp, int i)
+{
+ return (*fp[i])(i);
+}
+int f5 (fptr5 fp, fptr1 i)
+{
+ return fp(i);
+}
+int f8 (int ([4]), int);
int main () { return 0; }