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