aboutsummaryrefslogtreecommitdiff
path: root/tests/struct.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/struct.at')
-rw-r--r--tests/struct.at105
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/struct.at b/tests/struct.at
new file mode 100644
index 0000000..aed1a9c
--- /dev/null
+++ b/tests/struct.at
@@ -0,0 +1,105 @@
+AT_BANNER([struct])
+
+CFLOW_TEST([struct definition followed by attribute],
+[struct struct-attr attribute],
+[struct bar {
+ struct foo *dummy;
+} __attribute__((aligned(8)));
+
+int
+main(int argc, char **argv)
+{
+}
+],
+[main() <int main (int argc, char **argv) at prog:6>
+])
+
+CFLOW_OPT([--symbol __attribute__:wrapper],[
+CFLOW_TEST([struct definition followed by wrapper],
+[struct struct01 struct-wrapper wrapper],
+[struct bar {
+ struct foo *dummy;
+} __attribute__((aligned(8)));
+
+int
+main(int argc, char **argv)
+{
+}
+],
+[main() <int main (int argc, char **argv) at prog:6>
+])
+])
+
+CFLOW_TEST([ANSI C function returning a struct],
+[struct struct02 ret-struct],
+[struct s *
+foo(int arg)
+{
+ bar();
+}
+int
+main(int argc, char **argv)
+{
+ foo();
+}
+],
+[main() <int main (int argc, char **argv) at prog:7>:
+ foo() <struct s *foo (int arg) at prog:2>:
+ bar()
+])
+
+CFLOW_TEST([K&R C function returning a struct],
+[struct struct03 ret-struct],
+[struct s *
+foo(arg)
+ int arg;
+{
+ bar();
+}
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ foo();
+}
+],
+[main() <int main (argc, argv) at prog:8>:
+ foo() <struct s *foo (arg) at prog:2>:
+ bar()
+])
+
+CFLOW_OPT([-m foo],[
+CFLOW_TEST([struct as argument],
+[struct struct04 arg-struct],
+[int
+foo(struct bar *x)
+{
+}
+],
+[foo() <int foo (struct bar *x) at prog:2>
+])
+])
+
+CFLOW_OPT([-x -ix],[
+CFLOW_TEST([struct variable],
+[struct struct05 var-struct],
+[struct { int x; int y; } point;
+],
+[point * prog:1 struct { ... } point
+])
+])
+
+CFLOW_OPT([-x -ix],[
+CFLOW_TEST([array of structs],
+[struct struct06 arr-struct],
+[[struct X {
+ char *name;
+} X[] = {
+ { "foo" },
+};
+]],
+[[X * prog:3 struct X { char *name } X[]
+]])
+])
+

Return to:

Send suggestions and report system problems to the System administrator.