| 1 |
/* Test -fdump-go-specs option. */ |
| 2 |
|
| 3 |
/* { dg-options "-c -fdump-go-spec=godump-1.out" } */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-skip-if "not supported for target" { ! "alpha*-*-* s390*-*-* i?86-*-* x86_64-*-*" } } */ |
| 6 |
/* { dg-skip-if "not supported for target" { ! lp64 } } */ |
| 7 |
|
| 8 |
#include <stdint.h> |
| 9 |
|
| 10 |
/* Necessary quoting in the regexp patters: |
| 11 |
|
| 12 |
(?n) at beginning of pattern to make ^ and $ work. |
| 13 |
" -> \" |
| 14 |
*, + -> "*", "+" |
| 15 |
[, ] -> "\[", "\]" |
| 16 |
(, ) -> "\[(\]", "\[)\]" |
| 17 |
{, } -> "\{", "\}" |
| 18 |
*/ |
| 19 |
|
| 20 |
/*** integer based types ***/ |
| 21 |
typedef char c_t; |
| 22 |
/* { dg-final { scan-file godump-1.out "(?n)^type _c_t u?int8$" } } */ |
| 23 |
|
| 24 |
char c_v1; |
| 25 |
/* { dg-final { scan-file godump-1.out "(?n)^var _c_v1 u?int\[0-9\]*$" } } */ |
| 26 |
|
| 27 |
c_t c_v2; |
| 28 |
/* { dg-final { scan-file godump-1.out "(?n)^var _c_v2 _c_t$" } } */ |
| 29 |
|
| 30 |
typedef short s_t; |
| 31 |
/* { dg-final { scan-file godump-1.out "(?n)^type _s_t int\[0-9\]*$" } } */ |
| 32 |
|
| 33 |
short s_v1; |
| 34 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s_v1 int\[0-9\]*$" } } */ |
| 35 |
|
| 36 |
s_t s_v2; |
| 37 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s_v2 _s_t$" } } */ |
| 38 |
|
| 39 |
typedef int i_t; |
| 40 |
/* { dg-final { scan-file godump-1.out "(?n)^type _i_t int\[0-9\]*$" } } */ |
| 41 |
|
| 42 |
int i_v1; |
| 43 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i_v1 int\[0-9\]*$" } } */ |
| 44 |
|
| 45 |
i_t i_v2; |
| 46 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i_v2 _i_t$" } } */ |
| 47 |
|
| 48 |
typedef long l_t; |
| 49 |
/* { dg-final { scan-file godump-1.out "(?n)^type _l_t int\[0-9\]*$" } } */ |
| 50 |
|
| 51 |
long l_v1; |
| 52 |
/* { dg-final { scan-file godump-1.out "(?n)^var _l_v1 int\[0-9\]*$" } } */ |
| 53 |
|
| 54 |
l_t l_v2; |
| 55 |
/* { dg-final { scan-file godump-1.out "(?n)^var _l_v2 _l_t$" } } */ |
| 56 |
|
| 57 |
typedef long long ll_t; |
| 58 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ll_t int\[0-9\]*$" } } */ |
| 59 |
|
| 60 |
long long ll_v1; |
| 61 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ll_v1 int\[0-9\]*$" } } */ |
| 62 |
|
| 63 |
ll_t ll_v2; |
| 64 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ll_v2 _ll_t$" } } */ |
| 65 |
|
| 66 |
typedef unsigned char uc_t; |
| 67 |
/* { dg-final { scan-file godump-1.out "(?n)^type _uc_t uint8$" } } */ |
| 68 |
|
| 69 |
unsigned char uc_v1; |
| 70 |
/* { dg-final { scan-file godump-1.out "(?n)^var _uc_v1 uint\[0-9\]*$" } } */ |
| 71 |
|
| 72 |
uc_t uc_v2; |
| 73 |
/* { dg-final { scan-file godump-1.out "(?n)^var _uc_v2 _uc_t$" } } */ |
| 74 |
|
| 75 |
typedef unsigned short us_t; |
| 76 |
/* { dg-final { scan-file godump-1.out "(?n)^type _us_t uint\[0-9\]*$" } } */ |
| 77 |
|
| 78 |
unsigned short us_v1; |
| 79 |
/* { dg-final { scan-file godump-1.out "(?n)^var _us_v1 uint\[0-9\]*$" } } */ |
| 80 |
|
| 81 |
us_t us_v2; |
| 82 |
/* { dg-final { scan-file godump-1.out "(?n)^var _us_v2 _us_t$" } } */ |
| 83 |
|
| 84 |
typedef unsigned int ui_t; |
| 85 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ui_t uint\[0-9\]*$" } } */ |
| 86 |
|
| 87 |
unsigned int ui_v1; |
| 88 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ui_v1 uint\[0-9\]*$" } } */ |
| 89 |
|
| 90 |
ui_t ui_v2; |
| 91 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ui_v2 _ui_t$" } } */ |
| 92 |
|
| 93 |
typedef unsigned long ul_t; |
| 94 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ul_t uint\[0-9\]*$" } } */ |
| 95 |
|
| 96 |
unsigned long ul_v1; |
| 97 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ul_v1 uint\[0-9\]*$" } } */ |
| 98 |
|
| 99 |
ul_t ul_v2; |
| 100 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ul_v2 _ul_t$" } } */ |
| 101 |
|
| 102 |
typedef unsigned long long ull_t; |
| 103 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ull_t uint\[0-9\]*$" } } */ |
| 104 |
|
| 105 |
unsigned long long ull_v1; |
| 106 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ull_v1 uint\[0-9\]*$" } } */ |
| 107 |
|
| 108 |
ull_t ull_v2; |
| 109 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ull_v2 _ull_t$" } } */ |
| 110 |
|
| 111 |
typedef signed char sc_t; |
| 112 |
/* { dg-final { scan-file godump-1.out "(?n)^type _sc_t int8$" } } */ |
| 113 |
|
| 114 |
signed char sc_v1; |
| 115 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sc_v1 int\[0-9\]*$" } } */ |
| 116 |
|
| 117 |
sc_t sc_v2; |
| 118 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sc_v2 _sc_t$" } } */ |
| 119 |
|
| 120 |
typedef signed short ss_t; |
| 121 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ss_t int\[0-9\]*$" } } */ |
| 122 |
|
| 123 |
signed short ss_v1; |
| 124 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ss_v1 int\[0-9\]*$" } } */ |
| 125 |
|
| 126 |
ss_t ss_v2; |
| 127 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ss_v2 _ss_t$" } } */ |
| 128 |
|
| 129 |
typedef signed int si_t; |
| 130 |
/* { dg-final { scan-file godump-1.out "(?n)^type _si_t int\[0-9\]*$" } } */ |
| 131 |
|
| 132 |
signed int si_v1; |
| 133 |
/* { dg-final { scan-file godump-1.out "(?n)^var _si_v1 int\[0-9\]*$" } } */ |
| 134 |
|
| 135 |
si_t si_v2; |
| 136 |
/* { dg-final { scan-file godump-1.out "(?n)^var _si_v2 _si_t$" } } */ |
| 137 |
|
| 138 |
typedef signed long sl_t; |
| 139 |
/* { dg-final { scan-file godump-1.out "(?n)^type _sl_t int\[0-9\]*$" } } */ |
| 140 |
|
| 141 |
signed long sl_v1; |
| 142 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sl_v1 int\[0-9\]*$" } } */ |
| 143 |
|
| 144 |
sl_t sl_v2; |
| 145 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sl_v2 _sl_t$" } } */ |
| 146 |
|
| 147 |
typedef signed long long sll_t; |
| 148 |
/* { dg-final { scan-file godump-1.out "(?n)^type _sll_t int\[0-9\]*$" } } */ |
| 149 |
|
| 150 |
signed long long sll_v1; |
| 151 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sll_v1 int\[0-9\]*$" } } */ |
| 152 |
|
| 153 |
sll_t sll_v2; |
| 154 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sll_v2 _sll_t$" } } */ |
| 155 |
|
| 156 |
typedef int8_t i8_t; |
| 157 |
/* { dg-final { scan-file godump-1.out "(?n)^type _i8_t int8$" } } */ |
| 158 |
|
| 159 |
int8_t i8_v1; |
| 160 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i8_v1 _int8_t$" } } */ |
| 161 |
|
| 162 |
i8_t i8_v2; |
| 163 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i8_v2 _i8_t$" } } */ |
| 164 |
|
| 165 |
typedef int16_t i16_t; |
| 166 |
/* { dg-final { scan-file godump-1.out "(?n)^type _i16_t int16$" } } */ |
| 167 |
|
| 168 |
int16_t i16_v1; |
| 169 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i16_v1 _int16_t$" } } */ |
| 170 |
|
| 171 |
i16_t i16_v2; |
| 172 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i16_v2 _i16_t$" } } */ |
| 173 |
|
| 174 |
typedef int32_t i32_t; |
| 175 |
/* { dg-final { scan-file godump-1.out "(?n)^type _i32_t int32$" } } */ |
| 176 |
|
| 177 |
int32_t i32_v1; |
| 178 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i32_v1 _int32_t$" } } */ |
| 179 |
|
| 180 |
i32_t i32_v2; |
| 181 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i32_v2 _i32_t$" } } */ |
| 182 |
|
| 183 |
typedef int64_t i64_t; |
| 184 |
/* { dg-final { scan-file godump-1.out "(?n)^type _i64_t int64$" } } */ |
| 185 |
|
| 186 |
int64_t i64_v1; |
| 187 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i64_v1 _int64_t$" } } */ |
| 188 |
|
| 189 |
i64_t i64_v2; |
| 190 |
/* { dg-final { scan-file godump-1.out "(?n)^var _i64_v2 _i64_t$" } } */ |
| 191 |
|
| 192 |
typedef uint8_t ui8_t; |
| 193 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ui8_t uint8$" } } */ |
| 194 |
|
| 195 |
uint8_t ui8_v1; |
| 196 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v1 _uint8_t$" } } */ |
| 197 |
|
| 198 |
ui8_t ui8_v2; |
| 199 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v2 _ui8_t$" } } */ |
| 200 |
|
| 201 |
typedef uint16_t iu16_t; |
| 202 |
/* { dg-final { scan-file godump-1.out "(?n)^type _iu16_t uint16$" } } */ |
| 203 |
|
| 204 |
uint16_t iu16_v1; |
| 205 |
/* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v1 _uint16_t$" } } */ |
| 206 |
|
| 207 |
iu16_t iu16_v2; |
| 208 |
/* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v2 _iu16_t$" } } */ |
| 209 |
|
| 210 |
typedef uint32_t iu32_t; |
| 211 |
/* { dg-final { scan-file godump-1.out "(?n)^type _iu32_t uint32$" } } */ |
| 212 |
|
| 213 |
uint32_t iu32_v1; |
| 214 |
/* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v1 _uint32_t$" } } */ |
| 215 |
|
| 216 |
iu32_t iu32_v2; |
| 217 |
/* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v2 _iu32_t$" } } */ |
| 218 |
|
| 219 |
typedef uint64_t iu64_t; |
| 220 |
/* { dg-final { scan-file godump-1.out "(?n)^type _iu64_t uint64$" } } */ |
| 221 |
|
| 222 |
uint64_t iu64_v1; |
| 223 |
/* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v1 _uint64_t$" } } */ |
| 224 |
|
| 225 |
iu64_t iu64_v2; |
| 226 |
/* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v2 _iu64_t$" } } */ |
| 227 |
|
| 228 |
typedef const char cc_t; |
| 229 |
/* { dg-final { scan-file godump-1.out "(?n)^type _cc_t u?int8$" } } */ |
| 230 |
|
| 231 |
const char cc_v1; |
| 232 |
/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v1 u?int8$" } } */ |
| 233 |
|
| 234 |
cc_t cc_v2; |
| 235 |
/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v2 _cc_t$" } } */ |
| 236 |
|
| 237 |
/*** pointer and array types ***/ |
| 238 |
typedef void *vp_t; |
| 239 |
/* { dg-final { scan-file godump-1.out "(?n)^type _vp_t \\*byte$" } } */ |
| 240 |
|
| 241 |
void *vp_v1; |
| 242 |
/* { dg-final { scan-file godump-1.out "(?n)^var _vp_v1 \\*byte$" } } */ |
| 243 |
|
| 244 |
vp_t vp_v2; |
| 245 |
/* { dg-final { scan-file godump-1.out "(?n)^var _vp_v2 _vp_t$" } } */ |
| 246 |
|
| 247 |
typedef int **ipp_t; |
| 248 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ipp_t \\*\\*int\[0-9\]*$" } } */ |
| 249 |
|
| 250 |
int **ipp_v1; |
| 251 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v1 \\*\\*int\[0-9\]*$" } } */ |
| 252 |
|
| 253 |
ipp_t ipp_v2; |
| 254 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v2 _ipp_t$" } } */ |
| 255 |
|
| 256 |
typedef char ca_t[]; |
| 257 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ca_t \\\[0\\\]u?int8$" } } */ |
| 258 |
|
| 259 |
char ca_v1[]; /* { dg-warning "array 'ca_v1' assumed to have one element" } */ |
| 260 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1 \\\[0\\+1\\\]u?int8$" } } */ |
| 261 |
|
| 262 |
char ca_v1b[2]; |
| 263 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1b \\\[1\\+1\\\]u?int8$" } } */ |
| 264 |
|
| 265 |
ca_t ca_v2; /* { dg-warning "array 'ca_v2' assumed to have one element" } */ |
| 266 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v2 \\\[0\\+1\\\]u?int8$" } } */ |
| 267 |
|
| 268 |
typedef short sa2_t[2]; |
| 269 |
/* { dg-final { scan-file godump-1.out "(?n)^type _sa2_t \\\[1\\+1\\\]int\[0-9\]*$" } } */ |
| 270 |
|
| 271 |
short sa2_v1[2]; |
| 272 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v1 \\\[1\\+1\\\]int\[0-9\]*$" } } */ |
| 273 |
|
| 274 |
sa2_t sa2_v2; |
| 275 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v2 _sa2_t$" } } */ |
| 276 |
|
| 277 |
|
| 278 |
/*** floating point types ***/ |
| 279 |
typedef float f_t; |
| 280 |
/* { dg-final { scan-file godump-1.out "(?n)^type _f_t float\[0-9\]*$" } } */ |
| 281 |
|
| 282 |
float f_v1; |
| 283 |
/* { dg-final { scan-file godump-1.out "(?n)^var _f_v1 float\[0-9\]*$" } } */ |
| 284 |
|
| 285 |
f_t f_v2; |
| 286 |
/* { dg-final { scan-file godump-1.out "(?n)^var _f_v2 _f_t$" } } */ |
| 287 |
|
| 288 |
typedef double d_t; |
| 289 |
/* { dg-final { scan-file godump-1.out "(?n)^type _d_t float\[0-9\]*$" } } */ |
| 290 |
|
| 291 |
double d_v1; |
| 292 |
/* { dg-final { scan-file godump-1.out "(?n)^var _d_v1 float\[0-9\]*$" } } */ |
| 293 |
|
| 294 |
d_t d_v2; |
| 295 |
/* { dg-final { scan-file godump-1.out "(?n)^var _d_v2 _d_t$" } } */ |
| 296 |
|
| 297 |
typedef long double ld_t; |
| 298 |
/* { dg-final { scan-file godump-1.out "(?n)^// type _ld_t INVALID-float-\[0-9\]*$" } } */ |
| 299 |
|
| 300 |
long double ld_v1; |
| 301 |
/* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v1 INVALID-float-\[0-9\]*$" } } */ |
| 302 |
|
| 303 |
ld_t ld_v2; |
| 304 |
/* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v2 INVALID-float-\[0-9\]*$" } } */ |
| 305 |
|
| 306 |
/*** complex types ***/ |
| 307 |
typedef _Complex cx_t; |
| 308 |
/* { dg-final { scan-file godump-1.out "(?n)^type _cx_t complex\[0-9\]*$" } } */ |
| 309 |
|
| 310 |
_Complex cx_v1; |
| 311 |
/* { dg-final { scan-file godump-1.out "(?n)^var _cx_v1 complex\[0-9\]*$" } } */ |
| 312 |
|
| 313 |
cx_t cx_v2; |
| 314 |
/* { dg-final { scan-file godump-1.out "(?n)^var _cx_v2 _cx_t$" } } */ |
| 315 |
|
| 316 |
typedef float _Complex fcx_t; |
| 317 |
/* { dg-final { scan-file godump-1.out "(?n)^type _fcx_t complex\[0-9\]*$" } } */ |
| 318 |
|
| 319 |
float _Complex fcx_v1; |
| 320 |
/* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v1 complex\[0-9\]*$" } } */ |
| 321 |
|
| 322 |
fcx_t fcx_v2; |
| 323 |
/* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v2 _fcx_t$" } } */ |
| 324 |
|
| 325 |
typedef double _Complex dcx_t; |
| 326 |
/* { dg-final { scan-file godump-1.out "(?n)^type _dcx_t complex\[0-9\]*$" } } */ |
| 327 |
|
| 328 |
double _Complex dcx_v1; |
| 329 |
/* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v1 complex\[0-9\]*$" } } */ |
| 330 |
|
| 331 |
dcx_t dcx_v2; |
| 332 |
/* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v2 _dcx_t$" } } */ |
| 333 |
|
| 334 |
typedef long double _Complex ldcx_t; |
| 335 |
/* { dg-final { scan-file godump-1.out "(?n)^// type _ldcx_t INVALID-complex-\[0-9\]*$" } } */ |
| 336 |
|
| 337 |
long double _Complex ldcx_v1; |
| 338 |
/* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v1 INVALID-complex-\[0-9\]*$" } } */ |
| 339 |
|
| 340 |
ldcx_t ldcx_v2; |
| 341 |
/* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v2 INVALID-complex-\[0-9\]*$" } } */ |
| 342 |
|
| 343 |
typedef int _Complex icx_t; |
| 344 |
/* { dg-final { scan-file godump-1.out "(?n)^// type _icx_t INVALID-complex-non-real$" } } */ |
| 345 |
|
| 346 |
int _Complex icx_v1; |
| 347 |
/* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v1 INVALID-complex-non-real$" } } */ |
| 348 |
|
| 349 |
icx_t icx_v2; |
| 350 |
/* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v2 INVALID-complex-non-real$" } } */ |
| 351 |
|
| 352 |
|
| 353 |
/*** nested typedefs ***/ |
| 354 |
typedef int32_t ni_t; |
| 355 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ni_t int32$" } } */ |
| 356 |
|
| 357 |
typedef ni_t ni2_t; |
| 358 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ni2_t int32$" } } */ |
| 359 |
|
| 360 |
ni2_t ni2_v2; |
| 361 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ni2_v2 _ni2_t$" } } */ |
| 362 |
|
| 363 |
typedef ni2_t ni3_t; |
| 364 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ni3_t int32$" } } */ |
| 365 |
|
| 366 |
ni3_t ni3_v2; |
| 367 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ni3_v2 _ni3_t$" } } */ |
| 368 |
|
| 369 |
|
| 370 |
/*** enums ***/ |
| 371 |
enum { E11 }; |
| 372 |
/* { dg-final { scan-file godump-1.out "(?n)^const _E11 = 0$" } } */ |
| 373 |
|
| 374 |
enum { EV11 } e1_v1; |
| 375 |
/* { dg-final { scan-file godump-1.out "(?n)^var _e1_v1 u?int\[0-9\]*$" } } */ |
| 376 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EV11 = 0$" } } */ |
| 377 |
|
| 378 |
enum { E21, E22 }; |
| 379 |
/* { dg-final { scan-file godump-1.out "(?n)^const _E21 = 0$" } } */ |
| 380 |
/* { dg-final { scan-file godump-1.out "(?n)^const _E22 = 1$" } } */ |
| 381 |
|
| 382 |
enum { EV21, EV22 } e2_v1; |
| 383 |
/* { dg-final { scan-file godump-1.out "(?n)^var _e2_v1 u?int\[0-9\]*$" } } */ |
| 384 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EV21 = 0$" } } */ |
| 385 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EV22 = 1$" } } */ |
| 386 |
|
| 387 |
enum { EN1 = 3, EN2 = 77, EN3 = -1, EN4 }; |
| 388 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EN1 = 3$" } } */ |
| 389 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EN2 = 77$" } } */ |
| 390 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EN3 = -1$" } } */ |
| 391 |
/* { dg-final { scan-file godump-1.out "(?n)^const _EN4 = 0$" } } */ |
| 392 |
|
| 393 |
typedef enum { ET1, ET2 } et_t; |
| 394 |
/* { dg-final { scan-file godump-1.out "(?n)^type _et_t u?int\[0-9\]*$" } } */ |
| 395 |
/* { dg-final { scan-file godump-1.out "(?n)^const _ET1 = 0$" } } */ |
| 396 |
/* { dg-final { scan-file godump-1.out "(?n)^const _ET2 = 1$" } } */ |
| 397 |
|
| 398 |
typedef enum e_t_idem_v1 { ETIV1 } e_t_idem_v1; |
| 399 |
/* { dg-final { scan-file godump-1.out "(?n)^type _e_t_idem_v1 u?int\[0-9\]*$" } } */ |
| 400 |
/* { dg-final { scan-file godump-1.out "(?n)^const _ETIV1 = 0$" } } */ |
| 401 |
|
| 402 |
typedef enum e_t_idem_v2 e_t_idem_v2; |
| 403 |
enum e_t_idem_v2 { ETIV2 }; |
| 404 |
/* { dg-final { scan-file godump-1.out "(?n)^type _e_t_idem_v2 u?int\[0-9\]*$" } } */ |
| 405 |
/* { dg-final { scan-file godump-1.out "(?n)^const _ETIV2 = 0$" } } */ |
| 406 |
|
| 407 |
enum { ETV1, ETV2 } et_v1; |
| 408 |
/* { dg-final { scan-file godump-1.out "(?n)^var _et_v1 u?int\[0-9\]*$" } } */ |
| 409 |
/* { dg-final { scan-file godump-1.out "(?n)^const _ETV1 = 0$" } } */ |
| 410 |
/* { dg-final { scan-file godump-1.out "(?n)^const _ETV2 = 1$" } } */ |
| 411 |
|
| 412 |
et_t et_v2; |
| 413 |
/* { dg-final { scan-file godump-1.out "(?n)^var _et_v2 _et_t$" } } */ |
| 414 |
|
| 415 |
|
| 416 |
/*** simple structs ***/ |
| 417 |
typedef struct { } ts0e; |
| 418 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ts0e struct \{ \}$" } } */ |
| 419 |
|
| 420 |
struct { } s0e; |
| 421 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s0e struct \{ \}$" } } */ |
| 422 |
|
| 423 |
typedef struct { int8_t e1; } ts1e; |
| 424 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ts1e struct \{ e1 int8; \}$" } } */ |
| 425 |
|
| 426 |
struct { int8_t e1; } s1e; |
| 427 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s1e struct \{ e1 int8; \}$" } } */ |
| 428 |
|
| 429 |
typedef struct { int8_t e1; void *e2; } ts2el; |
| 430 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ts2el struct \{ e1 int8; e2 \\*byte; \}$" } } */ |
| 431 |
|
| 432 |
struct { int8_t e1; void *e2; } s2el; |
| 433 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s2el struct \{ e1 int8; e2 \\*byte; \}$" } } */ |
| 434 |
|
| 435 |
typedef struct { void *e1; int8_t e2; } ts2eg; |
| 436 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ts2eg struct \{ e1 \\*byte; e2 int8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 437 |
|
| 438 |
struct { void *e1; int8_t e2; } s2eg; |
| 439 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s2eg struct \{ e1 \\*byte; e2 int8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 440 |
|
| 441 |
typedef struct { int64_t l; int8_t c; int32_t i; int16_t s; } tsme; |
| 442 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsme struct \{ l int64; c int8; i int32; s int16; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 443 |
|
| 444 |
struct { int64_t l; int8_t c; int32_t i; int16_t s; } sme; |
| 445 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sme struct \{ l int64; c int\8; i int32; s int16; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 446 |
|
| 447 |
typedef struct { int16_t sa[3]; int8_t ca[3]; } tsae; |
| 448 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsae struct \{ sa \\\[2\\+1\\\]int16; ca \\\[2\\+1\\\]int8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 449 |
|
| 450 |
struct { int16_t sa[3]; int8_t ca[3]; } sae; |
| 451 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sae struct \{ sa \\\[2\\+1\\\]int16; ca \\\[2\\+1\\\]int8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 452 |
|
| 453 |
typedef struct { float f; } tsf_equiv; |
| 454 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_equiv struct \{ f float\[0-9\]*; \}$" } } */ |
| 455 |
|
| 456 |
struct { float f; } sf_equiv; |
| 457 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sf_equiv struct \{ f float\[0-9\]*; \}$" } } */ |
| 458 |
|
| 459 |
typedef struct { float f; uint8_t : 0; } tsf_not_equiv; |
| 460 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ |
| 461 |
|
| 462 |
struct { float f; uint8_t : 0; } sf_not_equiv; |
| 463 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ |
| 464 |
|
| 465 |
typedef struct { double d; } tsd_equiv; |
| 466 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_equiv struct \{ d float\[0-9\]*; \}$" } } */ |
| 467 |
|
| 468 |
struct { double d; } sd_equiv; |
| 469 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sd_equiv struct \{ d float\[0-9\]*; \}$" } } */ |
| 470 |
|
| 471 |
typedef struct { double d; uint8_t : 0; } tsd_not_equiv; |
| 472 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ |
| 473 |
|
| 474 |
struct { double d; uint8_t : 0; } sd_not_equiv; |
| 475 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ |
| 476 |
|
| 477 |
typedef struct s_undef_t s_undef_t2; |
| 478 |
|
| 479 |
typedef struct s_fwd *s_fwd_p; |
| 480 |
/* { dg-final { scan-file godump-1.out "(?n)^type _s_fwd_p \\*_s_fwd$" } } */ |
| 481 |
|
| 482 |
struct s_fwd v_fwd; |
| 483 |
/* { dg-final { scan-file godump-1.out "(?n)^var _v_fwd _s_fwd" } } */ |
| 484 |
|
| 485 |
struct s_fwd { }; |
| 486 |
/* { dg-final { scan-file godump-1.out "(?n)^type _s_fwd struct \{ \}$" } } */ |
| 487 |
|
| 488 |
typedef struct s_t_idem_v1 {} s_t_idem_v1; |
| 489 |
/* { dg-final { scan-file godump-1.out "(?n)^type _s_t_idem_v1 struct \{ \}$" } } */ |
| 490 |
|
| 491 |
typedef struct s_t_idem_v2 s_t_idem_v2; |
| 492 |
struct s_t_idem_v2 { }; |
| 493 |
/* { dg-final { scan-file godump-1.out "(?n)^type _s_t_idem_v2 struct \{ \}$" } } */ |
| 494 |
|
| 495 |
/*** nested structs ***/ |
| 496 |
typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn; |
| 497 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ |
| 498 |
|
| 499 |
struct { struct { uint8_t ca[3]; } s; uint32_t i; } sn; |
| 500 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ |
| 501 |
|
| 502 |
typedef struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } tsn_anon; |
| 503 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]int16; \}$" } } */ |
| 504 |
|
| 505 |
struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } sn_anon; |
| 506 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]int16; \}$" } } */ |
| 507 |
|
| 508 |
|
| 509 |
/*** structs with bitfields ***/ |
| 510 |
typedef struct { uint8_t : 0; uint8_t c; } tsbf_anon_pad1; |
| 511 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad1 struct \{ c uint8; \}$" } } */ |
| 512 |
|
| 513 |
struct { uint8_t : 0; uint8_t c; } sbf_anon_pad1; |
| 514 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad1 struct \{ c uint8; \}$" } } */ |
| 515 |
|
| 516 |
typedef struct { uint8_t : 1; uint8_t c; } tsbf_anon_pad2; |
| 517 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 518 |
|
| 519 |
struct { uint8_t : 1; uint8_t c; } sbf_anon_pad2; |
| 520 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 521 |
|
| 522 |
typedef struct { uint8_t : 7; uint8_t c; } tsbf_anon_pad3; |
| 523 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 524 |
|
| 525 |
struct { uint8_t : 7; uint8_t c; } sbf_anon_pad3; |
| 526 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 527 |
|
| 528 |
typedef struct { uint8_t : 8; uint8_t c; } tsbf_anon_pad4; |
| 529 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad4 struct \{ Godump_0 uint8; c uint8; \}$" } } */ |
| 530 |
|
| 531 |
struct { uint8_t : 8; uint8_t c; } sbf_anon_pad4; |
| 532 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad4 struct \{ Godump_0 uint8; c uint8; \}$" } } */ |
| 533 |
|
| 534 |
typedef struct { uint64_t : 0; uint8_t c; } tsbf_anon_pad5; |
| 535 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad5 struct \{ c uint8; \}$" } } */ |
| 536 |
|
| 537 |
struct { uint64_t : 0; uint8_t c; } sbf_anon_pad5; |
| 538 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad5 struct \{ c uint8; \}$" } } */ |
| 539 |
|
| 540 |
typedef struct { uint64_t : 1; uint8_t c; } tsbf_anon_pad6; |
| 541 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 542 |
|
| 543 |
struct { uint64_t : 1; uint8_t c; } sbf_anon_pad6; |
| 544 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 545 |
|
| 546 |
typedef struct { uint64_t : 63; uint8_t c; } tsbf_anon_pad7; |
| 547 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; \}$" } } */ |
| 548 |
|
| 549 |
struct { uint64_t : 63; uint8_t c; } sbf_anon_pad7; |
| 550 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; \}$" } } */ |
| 551 |
|
| 552 |
typedef struct { uint64_t : 64; uint8_t c; } tsbf_anon_pad8; |
| 553 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad8 struct \{ Godump_0 uint64; c uint8; \}$" } } */ |
| 554 |
|
| 555 |
struct { uint64_t : 64; uint8_t c; } sbf_anon_pad8; |
| 556 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad8 struct \{ Godump_0 uint64; c uint8; \}$" } } */ |
| 557 |
|
| 558 |
typedef struct { uint8_t bf : 1; uint8_t c; } tsbf_pad8_1; |
| 559 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 560 |
|
| 561 |
struct { uint8_t bf : 1; uint8_t c; } sbf_pad8_1; |
| 562 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 563 |
|
| 564 |
typedef struct { uint8_t bf : 7; uint8_t c; } tsbf_pad8_2; |
| 565 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 566 |
|
| 567 |
struct { uint8_t bf : 7; uint8_t c; } sbf_pad8_2; |
| 568 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ |
| 569 |
|
| 570 |
typedef struct { uint8_t bf : 8; uint8_t c; } tsbf_pad8_3; |
| 571 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ |
| 572 |
|
| 573 |
struct { uint8_t bf : 8; uint8_t c; } sbf_pad8_3; |
| 574 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ |
| 575 |
|
| 576 |
typedef struct { uint16_t bf : 1; uint8_t c; } tsbf_pad16_1; |
| 577 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; _ \\\[0\\\]int16; \}$" } } */ |
| 578 |
|
| 579 |
struct { uint16_t bf : 1; uint8_t c; } sbf_pad16_1; |
| 580 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; _ \\\[0\\\]int16; \}$" } } */ |
| 581 |
|
| 582 |
typedef struct { uint16_t bf : 15; uint8_t c; } tsbf_pad16_2; |
| 583 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int16; \}$" } } */ |
| 584 |
|
| 585 |
struct { uint16_t bf : 15; uint8_t c; } sbf_pad16_2; |
| 586 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int16; \}$" } } */ |
| 587 |
|
| 588 |
typedef struct { uint16_t bf : 16; uint8_t c; } tsbf_pad16_3; |
| 589 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_3 struct \{ bf uint16; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 590 |
|
| 591 |
struct { uint16_t bf : 16; uint8_t c; } sbf_pad16_3; |
| 592 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_3 struct \{ bf uint16; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 593 |
|
| 594 |
typedef struct { uint32_t bf : 1; uint8_t c; } tsbf_pad32_1; |
| 595 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int32; \}$" } } */ |
| 596 |
|
| 597 |
struct { uint32_t bf : 1; uint8_t c; } sbf_pad32_1; |
| 598 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int32; \}$" } } */ |
| 599 |
|
| 600 |
typedef struct { uint32_t bf : 31; uint8_t c; } tsbf_pad32_2; |
| 601 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int32; \}$" } } */ |
| 602 |
|
| 603 |
struct { uint32_t bf : 31; uint8_t c; } sbf_pad32_2; |
| 604 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int32; \}$" } } */ |
| 605 |
|
| 606 |
typedef struct { uint32_t bf : 32; uint8_t c; } tsbf_pad32_3; |
| 607 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_3 struct \{ bf uint32; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 608 |
|
| 609 |
struct { uint32_t bf : 32; uint8_t c; } sbf_pad32_3; |
| 610 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_3 struct \{ bf uint32; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 611 |
|
| 612 |
typedef struct { uint64_t bf : 1; uint8_t c; } tsbf_pad64_1; |
| 613 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int64; \}$" } } */ |
| 614 |
|
| 615 |
struct { uint64_t bf : 1; uint8_t c; } sbf_pad64_1; |
| 616 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int64; \}$" } } */ |
| 617 |
|
| 618 |
typedef struct { uint64_t bf : 63; uint8_t c; } tsbf_pad64_2; |
| 619 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int64; \}$" } } */ |
| 620 |
|
| 621 |
struct { uint64_t bf : 63; uint8_t c; } sbf_pad64_2; |
| 622 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; _ \\\[0\\\]int64; \}$" } } */ |
| 623 |
|
| 624 |
typedef struct { uint64_t bf : 64; uint8_t c; } tsbf_pad64_3; |
| 625 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 626 |
|
| 627 |
struct { uint64_t bf : 64; uint8_t c; } sbf_pad64_3; |
| 628 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ |
| 629 |
|
| 630 |
typedef struct { uint8_t b1 : 1; } tsbf_1b; |
| 631 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ |
| 632 |
|
| 633 |
struct { uint8_t b1 : 1; } sbf_1b; |
| 634 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ |
| 635 |
|
| 636 |
typedef struct |
| 637 |
{ |
| 638 |
uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; |
| 639 |
uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; |
| 640 |
} tsbf_8b; |
| 641 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ |
| 642 |
|
| 643 |
struct |
| 644 |
{ |
| 645 |
uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; |
| 646 |
uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; |
| 647 |
} sbf_8b; |
| 648 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ |
| 649 |
|
| 650 |
typedef struct { |
| 651 |
uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; |
| 652 |
uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; |
| 653 |
uint8_t b9 : 1; |
| 654 |
} tsbf_9b; |
| 655 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ |
| 656 |
|
| 657 |
struct { |
| 658 |
uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; |
| 659 |
uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; |
| 660 |
uint8_t b9 : 1; |
| 661 |
} sbf_9b; |
| 662 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ |
| 663 |
|
| 664 |
typedef struct { |
| 665 |
uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; |
| 666 |
} tsbf_18b; |
| 667 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ |
| 668 |
|
| 669 |
struct { |
| 670 |
uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; |
| 671 |
} sbf_18b; |
| 672 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ |
| 673 |
|
| 674 |
struct |
| 675 |
{ |
| 676 |
uint16_t bf1 : 8; |
| 677 |
uint8_t c; |
| 678 |
uint16_t bf2 : 8; |
| 679 |
uint32_t bf3 : 12; |
| 680 |
uint16_t s; |
| 681 |
} sbf_gaps; |
| 682 |
/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; _ \\\[0\\\]int32; \}$" } } */ |
| 683 |
|
| 684 |
typedef struct |
| 685 |
{ |
| 686 |
uint16_t bf1 : 8; |
| 687 |
uint8_t c; |
| 688 |
uint16_t bf2 : 8; |
| 689 |
uint32_t bf3 : 12; |
| 690 |
uint16_t s; |
| 691 |
} tsbf_gaps; |
| 692 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; _ \\\[0\\\]int32; \}$" } } */ |
| 693 |
|
| 694 |
typedef struct |
| 695 |
{ |
| 696 |
union |
| 697 |
{ |
| 698 |
int64_t : 1; |
| 699 |
union |
| 700 |
{ |
| 701 |
int32_t bf : 1; |
| 702 |
union |
| 703 |
{ |
| 704 |
int16_t s; |
| 705 |
int8_t c; |
| 706 |
}; |
| 707 |
}; |
| 708 |
} u; |
| 709 |
} ts_nested; |
| 710 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 711 |
|
| 712 |
struct |
| 713 |
{ |
| 714 |
union |
| 715 |
{ |
| 716 |
int64_t : 1; |
| 717 |
union |
| 718 |
{ |
| 719 |
int32_t bf : 1; |
| 720 |
union |
| 721 |
{ |
| 722 |
int16_t s; |
| 723 |
int8_t c; |
| 724 |
}; |
| 725 |
}; |
| 726 |
} u; |
| 727 |
} s_nested; |
| 728 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 729 |
|
| 730 |
typedef struct |
| 731 |
{ |
| 732 |
struct |
| 733 |
{ |
| 734 |
int64_t : 1; |
| 735 |
struct |
| 736 |
{ |
| 737 |
int32_t bf : 1; |
| 738 |
struct |
| 739 |
{ |
| 740 |
int16_t s; |
| 741 |
int8_t c; |
| 742 |
}; |
| 743 |
}; |
| 744 |
} u; |
| 745 |
} ts_nested2; |
| 746 |
/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 747 |
|
| 748 |
struct |
| 749 |
{ |
| 750 |
struct |
| 751 |
{ |
| 752 |
int64_t : 1; |
| 753 |
struct |
| 754 |
{ |
| 755 |
int32_t bf : 1; |
| 756 |
struct |
| 757 |
{ |
| 758 |
int16_t s; |
| 759 |
int8_t c; |
| 760 |
}; |
| 761 |
}; |
| 762 |
} u; |
| 763 |
} s_nested2; |
| 764 |
/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 765 |
|
| 766 |
|
| 767 |
/*** unions ***/ |
| 768 |
typedef union { } tue; |
| 769 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tue struct \{ \}$" } } */ |
| 770 |
|
| 771 |
union { } ue; |
| 772 |
/* { dg-final { scan-file godump-1.out "(?n)^var _ue struct \{ \}$" } } */ |
| 773 |
|
| 774 |
typedef union u_t_idem_v1 { } u_t_idem_v1; |
| 775 |
/* { dg-final { scan-file godump-1.out "(?n)^type _u_t_idem_v1 struct \{ \}$" } } */ |
| 776 |
|
| 777 |
typedef union u_t_idem_v2 u_t_idem_v2; |
| 778 |
union u_t_idem_v2 { }; |
| 779 |
/* { dg-final { scan-file godump-1.out "(?n)^type _u_t_idem_v2 struct \{ \}$" } } */ |
| 780 |
|
| 781 |
typedef union { uint8_t c; uint64_t l; } tu1; |
| 782 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 783 |
|
| 784 |
union { uint8_t c; uint64_t l; } u1; |
| 785 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 786 |
|
| 787 |
typedef union { uint64_t l; uint8_t c; } tu2; |
| 788 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu2 struct \{ l uint64; \}$" } } */ |
| 789 |
|
| 790 |
union { uint64_t l; uint8_t c; } u2; |
| 791 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u2 struct \{ l uint64; \}$" } } */ |
| 792 |
|
| 793 |
typedef union { uint64_t l[3]; uint8_t c; } tu3; |
| 794 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ |
| 795 |
|
| 796 |
union { uint64_t l[3]; uint8_t c; } u3; |
| 797 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ |
| 798 |
|
| 799 |
typedef struct { union { uint8_t c; uint64_t l; }; } tsu_anon; |
| 800 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 801 |
|
| 802 |
struct { union { uint8_t c; uint64_t l; }; } su_anon; |
| 803 |
/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 804 |
|
| 805 |
typedef union { uint64_t bf : 1; uint8_t ca[5]; } tu_size; |
| 806 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 807 |
|
| 808 |
union { uint64_t bf : 1; uint8_t ca[5]; } u_size; |
| 809 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 810 |
|
| 811 |
typedef union { uint64_t : 1; uint8_t ca[5]; } tu2_size; |
| 812 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ |
| 813 |
|
| 814 |
union { uint64_t : 1; uint8_t ca[5]; } u2_size; |
| 815 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ |
| 816 |
|
| 817 |
typedef union u_undef_t u_undef_t2; |
| 818 |
|
| 819 |
typedef union { uint64_t b : 1; uint8_t ca[5]; } tu3_size; |
| 820 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 821 |
|
| 822 |
union { uint64_t b : 1; uint8_t ca[5]; } u3_size; |
| 823 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; _ \\\[0\\\]u?int64; \}$" } } */ |
| 824 |
|
| 825 |
typedef union |
| 826 |
{ |
| 827 |
union |
| 828 |
{ |
| 829 |
int64_t : 1; |
| 830 |
union |
| 831 |
{ |
| 832 |
int32_t bf : 1; |
| 833 |
union |
| 834 |
{ |
| 835 |
int16_t s; |
| 836 |
int8_t c; |
| 837 |
}; |
| 838 |
}; |
| 839 |
} u; |
| 840 |
} tu_nested; |
| 841 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 842 |
|
| 843 |
union |
| 844 |
{ |
| 845 |
union |
| 846 |
{ |
| 847 |
int64_t : 1; |
| 848 |
union |
| 849 |
{ |
| 850 |
int32_t bf : 1; |
| 851 |
union |
| 852 |
{ |
| 853 |
int16_t s; |
| 854 |
int8_t c; |
| 855 |
}; |
| 856 |
}; |
| 857 |
} u; |
| 858 |
} u_nested; |
| 859 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 860 |
|
| 861 |
typedef union |
| 862 |
{ |
| 863 |
struct |
| 864 |
{ |
| 865 |
int64_t : 1; |
| 866 |
struct |
| 867 |
{ |
| 868 |
int32_t bf : 1; |
| 869 |
struct |
| 870 |
{ |
| 871 |
int16_t s; |
| 872 |
int8_t c; |
| 873 |
}; |
| 874 |
}; |
| 875 |
} u; |
| 876 |
} tu_nested2; |
| 877 |
/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 878 |
|
| 879 |
union |
| 880 |
{ |
| 881 |
struct |
| 882 |
{ |
| 883 |
int64_t : 1; |
| 884 |
struct |
| 885 |
{ |
| 886 |
int32_t bf : 1; |
| 887 |
struct |
| 888 |
{ |
| 889 |
int16_t s; |
| 890 |
int8_t c; |
| 891 |
}; |
| 892 |
}; |
| 893 |
} u; |
| 894 |
} u_nested2; |
| 895 |
/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; _ \\\[0\\\]u?int32; \}; \}$" } } */ |
| 896 |
|
| 897 |
|
| 898 |
/*** functions ***/ |
| 899 |
extern uint32_t func1(uint8_t c); |
| 900 |
/* { dg-final { scan-file godump-1.out "(?n)^func _func1 \[(\]uint\[0-9\]*\[)\] uint\[0-9\]* __asm__\[(\]\"func1\"\[)\]$" } } */ |
| 901 |
|
| 902 |
typedef int8_t (*func_t)(void *p); |
| 903 |
/* { dg-final { scan-file godump-1.out "(?n)^type _func_t func\[(\]\\*byte\[)\] int\[0-9\]*$" } } */ |
| 904 |
|
| 905 |
/* { dg-final { remove-build-file "godump-1.out" } } */ |