| 1 |
/* CTF_K_TYPEDEF record generation. |
| 2 |
|
| 3 |
In this testcase, 7 typedef records are expected. |
| 4 |
|
| 5 |
Further, the declared variables must be of type typedef |
| 6 |
|
| 7 |
Variables: |
| 8 |
a -> 2: my_int (size 0x4) -> 1: int (size 0x4) |
| 9 |
b -> 3: bar_int (size 0x4) -> 1: int (size 0x4) |
| 10 |
c -> 4: foo_int (size 0x4) -> 1: int (size 0x4) |
| 11 |
d -> 7: my_array (size 0x8) -> 5: struct (size 0x8) |
| 12 |
e -> 9: CINT (size 0x4) -> 8: const int (size 0x4) -> 1: int (size 0x4) |
| 13 |
f -> c: CINTP (size 0x8) -> b: const int * (size 0x8) -> a: const int (size 0x4) -> 1: int (size 0x4) |
| 14 |
g -> f: my_node_t (size 0x8) -> d: struct my_node (size 0x8) |
| 15 |
|
| 16 |
There is no direct way to check that the variables are of type typedef. |
| 17 |
So in this testcase, we simply check that: |
| 18 |
1. The typedef records are generated (Check for 7 specific ctt_info, and |
| 19 |
check for the ascii strings for the typedef names). |
| 20 |
2. The ctv_typeidx are distinct (each pointing to a specfic unique type). |
| 21 |
Note that if variables were not of type typedef, ctv_typeidx will not be |
| 22 |
unique (type of a, b, c will all point to int); hence, the check. |
| 23 |
*/ |
| 24 |
|
| 25 |
/* { dg-do compile } */ |
| 26 |
/* { dg-options "-O0 -gctf -dA" } */ |
| 27 |
|
| 28 |
/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 7 } } */ |
| 29 |
/* { dg-final { scan-assembler-times "ascii \"my_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 30 |
/* { dg-final { scan-assembler-times "ascii \"bar_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 31 |
/* { dg-final { scan-assembler-times "ascii \"foo_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 32 |
/* { dg-final { scan-assembler-times "ascii \"my_array.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 33 |
/* { dg-final { scan-assembler-times "ascii \"CINT.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 34 |
/* { dg-final { scan-assembler-times "ascii \"CINTP.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 35 |
/* { dg-final { scan-assembler-times "ascii \"my_node_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ |
| 36 |
|
| 37 |
/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 38 |
/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 39 |
/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 40 |
/* { dg-final { scan-assembler-times "\[\t \]0x9\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 41 |
/* { dg-final { scan-assembler-times "\[\t \]0xa\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 42 |
/* { dg-final { scan-assembler-times "\[\t \]0xc\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 43 |
/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ |
| 44 |
|
| 45 |
typedef int my_int; |
| 46 |
typedef int bar_int; |
| 47 |
typedef int foo_int; |
| 48 |
|
| 49 |
typedef struct { int a[2]; } my_array; |
| 50 |
|
| 51 |
typedef const int CINT; |
| 52 |
typedef const int * CINTP; |
| 53 |
|
| 54 |
typedef struct my_node |
| 55 |
{ |
| 56 |
int flags; |
| 57 |
char value; |
| 58 |
} my_node_t; |
| 59 |
|
| 60 |
my_int a; |
| 61 |
bar_int b; |
| 62 |
foo_int c; |
| 63 |
|
| 64 |
my_array d; |
| 65 |
CINT e = 3; |
| 66 |
CINTP f = &e; |
| 67 |
|
| 68 |
my_node_t g; |