OLD | NEW |
1 /* Test program to test bit field operations */ | 1 /* Test program to test bit field operations */ |
2 | 2 |
3 /* For non-ANSI compilers, use plain ints for the signed bit fields. However, | 3 /* For non-ANSI compilers, use plain ints for the signed bit fields. However, |
4 whether they actually end up signed or not is implementation defined, so | 4 whether they actually end up signed or not is implementation defined, so |
5 this may cause some tests to fail. But at least we can still compile | 5 this may cause some tests to fail. But at least we can still compile |
6 the test program and run the tests... */ | 6 the test program and run the tests... */ |
7 | 7 |
8 #if !defined(__STDC__) && !defined(__cplusplus) | 8 #if !defined(__STDC__) && !defined(__cplusplus) |
9 #define signed /**/ | 9 #define signed /**/ |
10 #endif | 10 #endif |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 /* This is used by bitfields.exp to determine if the target understands | 72 /* This is used by bitfields.exp to determine if the target understands |
73 signed bitfields. */ | 73 signed bitfields. */ |
74 int i; | 74 int i; |
75 | 75 |
76 int main () | 76 int main () |
77 { | 77 { |
78 /* For each member, set that member to 1, allow gdb to verify that the | 78 /* For each member, set that member to 1, allow gdb to verify that the |
79 member (and only that member) is 1, and then reset it back to 0. */ | 79 member (and only that member) is 1, and then reset it back to 0. */ |
80 | 80 |
81 #ifdef usestubs | |
82 set_debug_traps(); | |
83 breakpoint(); | |
84 #endif | |
85 flags.uc = 1; | 81 flags.uc = 1; |
86 break1 (); | 82 break1 (); |
87 flags.uc = 0; | 83 flags.uc = 0; |
88 | 84 |
89 flags.s1 = -1; | 85 flags.s1 = -1; |
90 break1 (); | 86 break1 (); |
91 flags.s1 = 0; | 87 flags.s1 = 0; |
92 | 88 |
93 flags.u1 = 1; | 89 flags.u1 = 1; |
94 break1 (); | 90 break1 (); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 flags.s3 = 0; | 192 flags.s3 = 0; |
197 flags.s9 = 0; | 193 flags.s9 = 0; |
198 | 194 |
199 /* Bitfields at a non-zero offset in a containing structure. */ | 195 /* Bitfields at a non-zero offset in a containing structure. */ |
200 container.one.u3 = 5; | 196 container.one.u3 = 5; |
201 container.two.u3 = 3; | 197 container.two.u3 = 3; |
202 break5 (); | 198 break5 (); |
203 | 199 |
204 return 0; | 200 return 0; |
205 } | 201 } |
OLD | NEW |