1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 /*
16 Linux ELF:
17 gcc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o
18 
19 OS X Mach-O:
20 gcc -gdwarf-2 -m64 -c typedef.c -o typedef.macho
21 */
22 #include <complex.h>
23 
24 typedef volatile int* t_ptr_volatile_int;
25 typedef const char *t_ptr_const_char;
26 typedef long t_long;
27 typedef unsigned short t_ushort;
28 typedef int t_func_int_of_float_double(float, double);
29 typedef int (*t_ptr_func_int_of_float_double)(float, double);
30 typedef int (*t_ptr_func_int_of_float_complex)(float complex);
31 typedef int (*t_ptr_func_int_of_double_complex)(double complex);
32 typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex);
33 typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char);
34 typedef void t_func_void_of_char(char);
35 typedef void t_func_void_of_void(void);
36 typedef void t_func_void_of_ptr_char_dots(char*, ...);
37 typedef struct my_struct {
38 	volatile int vi;
39 	char x : 1;
40 	int y : 4;
41 	int z[0];
42 	long long array[40];
43 	int zz[0];
44 } t_my_struct;
45 typedef struct my_struct1 {
46 	int zz [1];
47 } t_my_struct1;
48 typedef union my_union {
49 	volatile int vi;
50 	char x : 1;
51 	int y : 4;
52 	long long array[40];
53 } t_my_union;
54 typedef enum my_enum {
55 	e1 = 1,
56 	e2 = 2,
57 	e3 = -5,
58 	e4 = 1000000000000000LL,
59 } t_my_enum;
60 
61 typedef struct list t_my_list;
62 struct list {
63 	short val;
64 	t_my_list *next;
65 };
66 
67 typedef struct tree {
68 	struct tree *left, *right;
69 	unsigned long long val;
70 } t_my_tree;
71 
72 t_ptr_volatile_int *a2;
73 t_ptr_const_char **a3a;
74 t_long *a4;
75 t_ushort *a5;
76 t_func_int_of_float_double *a6;
77 t_ptr_func_int_of_float_double *a7;
78 t_func_ptr_int_of_char_schar_uchar *a8;
79 t_func_void_of_char *a9;
80 t_func_void_of_void *a10;
81 t_func_void_of_ptr_char_dots *a11;
82 t_my_struct *a12;
83 t_my_struct1 *a12a;
84 t_my_union *a12b;
85 t_my_enum *a13;
86 t_my_list *a14;
87 t_my_tree *a15;
88 t_ptr_func_int_of_float_complex *a16;
89 t_ptr_func_int_of_double_complex *a17;
90 t_ptr_func_int_of_long_double_complex *a18;
91 
main()92 int main()
93 {
94 	return 0;
95 }
96