]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gcc.dg/pubtypes-2.c
Darwin, testsuite : Update pubtypes tests.
[gcc.git] / gcc / testsuite / gcc.dg / pubtypes-2.c
1 /* { dg-do compile { target *-*-darwin* } } */
2 /* { dg-options "-O0 -gdwarf-2 -dA" } */
3 /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */
4 /* { dg-final { scan-assembler "__debug_pubtypes" } } */
5 /* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} } } */
6 /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
7 /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */
8
9 #include <stdlib.h>
10 #include <stdio.h>
11
12 struct used_struct
13 {
14 int key;
15 char *name;
16 };
17
18 struct unused_struct
19 {
20 int key1;
21 int f2;
22 double f3;
23 char *f4;
24 struct unused_struct *next;
25 };
26
27 int
28 main (int argc, char **argv)
29 {
30 int i;
31 struct used_struct *my_list;
32
33 my_list = (struct used_struct *) malloc (10 * sizeof (struct used_struct));
34
35 for (i = 0; i < 10; i++)
36 {
37 my_list[i].key = i;
38 my_list[i].name = (char *) malloc (11);
39 sprintf (my_list[i].name, "Alice_%d", i);
40 }
41
42 for (i = 0; i < 10; i++)
43 fprintf (stdout, "Key: %d, Name: %s\n", my_list[i].key, my_list[i].name);
44
45 return 0;
46 }
This page took 0.037757 seconds and 5 git commands to generate.