...
Run Format

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

Documentation: debug/dwarf/testdata

     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	*/
    12	#include <complex.h>
    13	
    14	typedef volatile int* t_ptr_volatile_int;
    15	typedef const char *t_ptr_const_char;
    16	typedef long t_long;
    17	typedef unsigned short t_ushort;
    18	typedef int t_func_int_of_float_double(float, double);
    19	typedef int (*t_ptr_func_int_of_float_double)(float, double);
    20	typedef int (*t_ptr_func_int_of_float_complex)(float complex);
    21	typedef int (*t_ptr_func_int_of_double_complex)(double complex);
    22	typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex);
    23	typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char);
    24	typedef void t_func_void_of_char(char);
    25	typedef void t_func_void_of_void(void);
    26	typedef void t_func_void_of_ptr_char_dots(char*, ...);
    27	typedef struct my_struct {
    28		volatile int vi;
    29		char x : 1;
    30		int y : 4;
    31		int z[0];
    32		long long array[40];
    33		int zz[0];
    34	} t_my_struct;
    35	typedef struct my_struct1 {
    36		int zz [1];
    37	} t_my_struct1;
    38	typedef union my_union {
    39		volatile int vi;
    40		char x : 1;
    41		int y : 4;
    42		long long array[40];
    43	} t_my_union;
    44	typedef enum my_enum {
    45		e1 = 1,
    46		e2 = 2,
    47		e3 = -5,
    48		e4 = 1000000000000000LL,
    49	} t_my_enum;
    50	
    51	typedef struct list t_my_list;
    52	struct list {
    53		short val;
    54		t_my_list *next;
    55	};
    56	
    57	typedef struct tree {
    58		struct tree *left, *right;
    59		unsigned long long val;
    60	} t_my_tree;
    61	
    62	t_ptr_volatile_int *a2;
    63	t_ptr_const_char **a3a;
    64	t_long *a4;
    65	t_ushort *a5;
    66	t_func_int_of_float_double *a6;
    67	t_ptr_func_int_of_float_double *a7;
    68	t_func_ptr_int_of_char_schar_uchar *a8;
    69	t_func_void_of_char *a9;
    70	t_func_void_of_void *a10;
    71	t_func_void_of_ptr_char_dots *a11;
    72	t_my_struct *a12;
    73	t_my_struct1 *a12a;
    74	t_my_union *a12b;
    75	t_my_enum *a13;
    76	t_my_list *a14;
    77	t_my_tree *a15;
    78	t_ptr_func_int_of_float_complex *a16;
    79	t_ptr_func_int_of_double_complex *a17;
    80	t_ptr_func_int_of_long_double_complex *a18;
    81	
    82	int main()
    83	{
    84		return 0;
    85	}

View as plain text