Text file src/debug/dwarf/testdata/typedef.c

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  /*
     6  Linux ELF:
     7  gcc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o
     8  
     9  OS X Mach-O:
    10  gcc -gdwarf-2 -m64 -c typedef.c -o typedef.macho
    11  gcc -gdwarf-4 -m64 -c typedef.c -o typedef.macho4
    12  */
    13  #include <complex.h>
    14  
    15  typedef volatile int* t_ptr_volatile_int;
    16  typedef const char *t_ptr_const_char;
    17  typedef long t_long;
    18  typedef unsigned short t_ushort;
    19  typedef int t_func_int_of_float_double(float, double);
    20  typedef int (*t_ptr_func_int_of_float_double)(float, double);
    21  typedef int (*t_ptr_func_int_of_float_complex)(float complex);
    22  typedef int (*t_ptr_func_int_of_double_complex)(double complex);
    23  typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex);
    24  typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char);
    25  typedef void t_func_void_of_char(char);
    26  typedef void t_func_void_of_void(void);
    27  typedef void t_func_void_of_ptr_char_dots(char*, ...);
    28  typedef struct my_struct {
    29  	volatile int vi;
    30  	char x : 1;
    31  	int y : 4;
    32  	int z[0];
    33  	long long array[40];
    34  	int zz[0];
    35  } t_my_struct;
    36  typedef struct my_struct1 {
    37  	int zz [1];
    38  } t_my_struct1;
    39  typedef union my_union {
    40  	volatile int vi;
    41  	char x : 1;
    42  	int y : 4;
    43  	long long array[40];
    44  } t_my_union;
    45  typedef enum my_enum {
    46  	e1 = 1,
    47  	e2 = 2,
    48  	e3 = -5,
    49  	e4 = 1000000000000000LL,
    50  } t_my_enum;
    51  
    52  typedef struct list t_my_list;
    53  struct list {
    54  	short val;
    55  	t_my_list *next;
    56  };
    57  
    58  typedef struct tree {
    59  	struct tree *left, *right;
    60  	unsigned long long val;
    61  } t_my_tree;
    62  
    63  t_ptr_volatile_int *a2;
    64  t_ptr_const_char **a3a;
    65  t_long *a4;
    66  t_ushort *a5;
    67  t_func_int_of_float_double *a6;
    68  t_ptr_func_int_of_float_double *a7;
    69  t_func_ptr_int_of_char_schar_uchar *a8;
    70  t_func_void_of_char *a9;
    71  t_func_void_of_void *a10;
    72  t_func_void_of_ptr_char_dots *a11;
    73  t_my_struct *a12;
    74  t_my_struct1 *a12a;
    75  t_my_union *a12b;
    76  t_my_enum *a13;
    77  t_my_list *a14;
    78  t_my_tree *a15;
    79  t_ptr_func_int_of_float_complex *a16;
    80  t_ptr_func_int_of_double_complex *a17;
    81  t_ptr_func_int_of_long_double_complex *a18;
    82  
    83  int main()
    84  {
    85  	return 0;
    86  }
    87  

View as plain text