1 /* This testcase is part of GDB, the GNU debugger. 2 3 Copyright 2010-2017 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 18 #include <string.h> 19 20 21 enum flag_enum 22 { 23 /* Define the enumeration values in an unsorted manner to verify that we 24 effectively sort them by value. */ 25 FOO_MASK = 0x07, 26 FOO_1 = 0x01, 27 FOO_2 = 0x02, 28 FOO_3 = 0x04, 29 30 BAR_MASK = 0x70, 31 BAR_1 = 0x10, 32 BAR_2 = 0x20, 33 BAR_3 = 0x40, 34 }; 35 36 enum flag_enum fval; 37 38 struct function_lookup_test 39 { 40 int x,y; 41 }; 42 43 void 44 init_flt (struct function_lookup_test *p, int x, int y) 45 { 46 p->x = x; 47 p->y = y; 48 } 49 50 struct s 51 { 52 int a; 53 int *b; 54 }; 55 56 struct ss 57 { 58 struct s a; 59 struct s b; 60 }; 61 62 void 63 init_s (struct s *s, int a) 64 { 65 s->a = a; 66 s->b = &s->a; 67 } 68 69 void 70 init_ss (struct ss *s, int a, int b) 71 { 72 init_s (&s->a, a); 73 init_s (&s->b, b); 74 } 75 76 int 77 main () 78 { 79 struct function_lookup_test flt; 80 struct ss ss; 81 82 init_flt (&flt, 42, 43); 83 init_ss (&ss, 1, 2); 84 85 return 0; /* break to inspect */ 86 } 87