1*67e74705SXin Li // RUN: %clang_cc1 -emit-llvm < %s -o - 2*67e74705SXin Li 3*67e74705SXin Li // A nice and complicated initialization example with unions from Python 4*67e74705SXin Li typedef int Py_ssize_t; 5*67e74705SXin Li 6*67e74705SXin Li typedef union _gc_head { 7*67e74705SXin Li struct { 8*67e74705SXin Li union _gc_head *gc_next; 9*67e74705SXin Li union _gc_head *gc_prev; 10*67e74705SXin Li Py_ssize_t gc_refs; 11*67e74705SXin Li } gc; 12*67e74705SXin Li long double dummy; /* force worst-case alignment */ 13*67e74705SXin Li } PyGC_Head; 14*67e74705SXin Li 15*67e74705SXin Li struct gc_generation { 16*67e74705SXin Li PyGC_Head head; 17*67e74705SXin Li int threshold; /* collection threshold */ 18*67e74705SXin Li int count; /* count of allocations or collections of younger 19*67e74705SXin Li generations */ 20*67e74705SXin Li }; 21*67e74705SXin Li 22*67e74705SXin Li #define NUM_GENERATIONS 3 23*67e74705SXin Li #define GEN_HEAD(n) (&generations[n].head) 24*67e74705SXin Li 25*67e74705SXin Li /* linked lists of container objects */ 26*67e74705SXin Li struct gc_generation generations[NUM_GENERATIONS] = { 27*67e74705SXin Li /* PyGC_Head, threshold, count */ 28*67e74705SXin Li {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, 29*67e74705SXin Li {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, 30*67e74705SXin Li {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, 31*67e74705SXin Li }; 32