From 57ab0915777a2764bec37969dc709b20bf4a048e Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Tue, 4 Nov 2014 00:00:14 +0000 Subject: [PATCH] godump.c (go_format_type): Rewrite RECORD_TYPE nad UNION_TYPE support with -fdump-go-spec. gcc/: * godump.c (go_format_type): Rewrite RECORD_TYPE nad UNION_TYPE support with -fdump-go-spec. Anonymous substructures are now flattened and replaced by their fields (record) or the first named, non-bitfield field (union). gcc/testsuite/: * build-go/gcc/testsuite/gcc/godump-1.out: Update godump tests. From-SVN: r217058 --- gcc/ChangeLog | 7 + gcc/godump.c | 181 ++-- gcc/testsuite/ChangeLog | 4 + gcc/testsuite/gcc.misc-tests/godump-1.c | 1185 +++++++++++++++-------- 4 files changed, 875 insertions(+), 502 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a9e9f6fa4dc..21ad41fb0256 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-11-03 Dominik Vogt + + * godump.c (go_format_type): Rewrite RECORD_TYPE nad UNION_TYPE support + with -fdump-go-spec. Anonymous substructures are now flattened and + replaced by their fields (record) or the first named, non-bitfield + field (union). + 2014-11-04 Manuel López-Ibáñez * input.c (expand_location_to_spelling_point): Fix typo. diff --git a/gcc/godump.c b/gcc/godump.c index fccd3eb51211..7c386c49cc73 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -678,11 +678,13 @@ go_force_record_alignment (struct obstack *ob, const char *type_string, static bool go_format_type (struct godump_container *container, tree type, - bool use_type_name, bool is_func_ok, unsigned int *p_art_i) + bool use_type_name, bool is_func_ok, unsigned int *p_art_i, + bool is_anon_record_or_union) { bool ret; struct obstack *ob; unsigned int art_i_dummy; + bool is_union = false; if (p_art_i == NULL) { @@ -856,7 +858,7 @@ go_format_type (struct godump_container *container, tree type, else { if (!go_format_type (container, TREE_TYPE (type), use_type_name, - true, NULL)) + true, NULL, false)) ret = false; } break; @@ -882,15 +884,19 @@ go_format_type (struct godump_container *container, tree type, obstack_1grow (ob, '0'); obstack_1grow (ob, ']'); if (!go_format_type (container, TREE_TYPE (type), use_type_name, false, - NULL)) + NULL, false)) ret = false; break; + case UNION_TYPE: + is_union = true; + /* Fall through to RECORD_TYPE case. */ case RECORD_TYPE: { unsigned int prev_field_end; - unsigned int most_strict_known_alignment; + unsigned int known_alignment; tree field; + bool emitted_a_field; /* FIXME: Why is this necessary? Without it we can get a core dump on the s390x headers, or from a file containing simply @@ -898,51 +904,77 @@ go_format_type (struct godump_container *container, tree type, layout_type (type); prev_field_end = 0; - most_strict_known_alignment = 1; - obstack_grow (ob, "struct { ", 9); - for (field = TYPE_FIELDS (type); + known_alignment = 1; + /* Anonymous records and unions are flattened, i.e. they are not put + into "struct { ... }". */ + if (!is_anon_record_or_union) + obstack_grow (ob, "struct { ", 9); + for (field = TYPE_FIELDS (type), emitted_a_field = false; field != NULL_TREE; field = TREE_CHAIN (field)) { - bool field_ok; - if (TREE_CODE (field) != FIELD_DECL) continue; - field_ok = true; if (DECL_BIT_FIELD (field)) + /* Bit fields are replaced by padding. */ continue; - else - { + /* Only the first non-bitfield field is emitted for unions. */ + if (!is_union || !emitted_a_field) + { + /* Emit the field. */ + bool field_ok; + bool is_anon_substructure; + unsigned int decl_align_unit; + unsigned int decl_offset; + + field_ok = true; + emitted_a_field = true; + is_anon_substructure = + (DECL_NAME (field) == NULL + && (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)); + /* Keep track of the alignment of named substructures, either + of the whole record, or the alignment of the emitted field + (for unions). */ + decl_align_unit = DECL_ALIGN_UNIT (field); + if (!is_anon_substructure && decl_align_unit > known_alignment) + known_alignment = decl_align_unit; + /* Pad to start of field. */ + decl_offset = + TREE_INT_CST_LOW (DECL_FIELD_OFFSET (field)) + + precision_to_units + (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))); { - unsigned int decl_align_unit; - unsigned int decl_offset; + unsigned int align_unit; - decl_align_unit = DECL_ALIGN_UNIT (field); - decl_offset = - TREE_INT_CST_LOW (DECL_FIELD_OFFSET (field)) - + precision_to_units - (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))); - if (decl_align_unit > most_strict_known_alignment) - most_strict_known_alignment = decl_align_unit; + /* For anonymous records and unions there is no automatic + structure alignment, so use 1 as the alignment. */ + align_unit = (is_anon_substructure) ? 1 : decl_align_unit; *p_art_i = go_append_padding - (ob, prev_field_end, decl_offset, decl_align_unit, *p_art_i, + (ob, prev_field_end, decl_offset, align_unit, *p_art_i, &prev_field_end); - if (DECL_SIZE_UNIT (field)) - prev_field_end += TREE_INT_CST_LOW (DECL_SIZE_UNIT (field)); } - if (DECL_NAME (field) == NULL) - *p_art_i = go_append_artificial_name (ob, *p_art_i); - else - go_append_decl_name (ob, field, container->keyword_hash); - obstack_1grow (ob, ' '); - - /* Do not expand type if a record or union type or a - function pointer. */ + if (DECL_SIZE_UNIT (field)) + prev_field_end += + TREE_INT_CST_LOW (DECL_SIZE_UNIT (field)); + /* Emit the field name, but not for anonymous records and + unions. */ + if (!is_anon_substructure) + { + if ((DECL_NAME (field) == NULL)) + *p_art_i = go_append_artificial_name (ob, *p_art_i); + else + go_append_decl_name + (ob, field, container->keyword_hash); + obstack_1grow (ob, ' '); + } + /* Do not expand type if a record or union type or a function + pointer. */ if (TYPE_NAME (TREE_TYPE (field)) != NULL_TREE && (RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)) || (POINTER_TYPE_P (TREE_TYPE (field)) && (TREE_CODE (TREE_TYPE (TREE_TYPE (field))) - == FUNCTION_TYPE)))) + == FUNCTION_TYPE)))) { tree name; void **slot; @@ -961,24 +993,27 @@ go_format_type (struct godump_container *container, tree type, else { if (!go_format_type (container, TREE_TYPE (field), true, - false, p_art_i)) + false, p_art_i, is_anon_substructure)) field_ok = false; } - obstack_grow (ob, "; ", 2); - } - if (!field_ok) - ret = false; + if (!is_anon_substructure) + obstack_grow (ob, "; ", 2); + if (!field_ok) + ret = false; + } } - /* Alignment and padding as necessary. */ + /* Padding. */ { - unsigned int type_align_unit; + unsigned int align_unit; - type_align_unit = TYPE_ALIGN_UNIT (type); - /* Padding. */ + align_unit = (is_anon_record_or_union) ? 1 : TYPE_ALIGN_UNIT (type); *p_art_i = go_append_padding (ob, prev_field_end, TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)), - type_align_unit, *p_art_i, &prev_field_end); - if (most_strict_known_alignment < type_align_unit) + align_unit, *p_art_i, &prev_field_end); + } + /* Alignment. */ + if (!is_anon_record_or_union + && known_alignment < TYPE_ALIGN_UNIT (type)) { const char *s; char buf[100]; @@ -995,46 +1030,10 @@ go_format_type (struct godump_container *container, tree type, } *p_art_i = go_force_record_alignment (ob, s, *p_art_i, buf); } - } - obstack_1grow (ob, '}'); + if (!is_anon_record_or_union) + obstack_1grow (ob, '}'); } - break; - - case UNION_TYPE: - { - const char *s; - unsigned int sz_units; - - layout_type (type); - sz_units = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); - s = go_get_uinttype_for_precision (TYPE_ALIGN (type), true); - obstack_grow (ob, "struct { ", 9); - if (s == NULL) - { - ret = false; - s = "INVALID-union-alignment"; - obstack_grow (ob, s, strlen (s)); - } - else - { - char buf[100]; - tree field; - - field = TYPE_FIELDS (type); - /* Use the same index as the byte field's artificial name for - padding. */ - if (field != NULL_TREE && DECL_NAME (field) != NULL) - go_append_decl_name (ob, field, container->keyword_hash); - else - *p_art_i = go_append_artificial_name (ob, *p_art_i); - snprintf (buf, sizeof buf, " [%u]byte; ", sz_units); - obstack_grow (ob, buf, strlen (buf)); - if (TYPE_ALIGN_UNIT (type) > 1) - *p_art_i = go_force_record_alignment (ob, s, *p_art_i, NULL); - } - obstack_1grow (ob, '}'); - } - break; + break; case FUNCTION_TYPE: { @@ -1061,7 +1060,7 @@ go_format_type (struct godump_container *container, tree type, break; if (seen_arg) obstack_grow (ob, ", ", 2); - if (!go_format_type (container, arg_type, true, false, NULL)) + if (!go_format_type (container, arg_type, true, false, NULL, false)) ret = false; seen_arg = true; } @@ -1077,7 +1076,8 @@ go_format_type (struct godump_container *container, tree type, if (!VOID_TYPE_P (result)) { obstack_1grow (ob, ' '); - if (!go_format_type (container, result, use_type_name, false, NULL)) + if (!go_format_type (container, result, use_type_name, false, NULL, + false)) ret = false; } } @@ -1111,7 +1111,7 @@ go_output_type (struct godump_container *container) static void go_output_fndecl (struct godump_container *container, tree decl) { - if (!go_format_type (container, TREE_TYPE (decl), false, true, NULL)) + if (!go_format_type (container, TREE_TYPE (decl), false, true, NULL, false)) fprintf (go_dump_file, "// "); fprintf (go_dump_file, "func _%s ", IDENTIFIER_POINTER (DECL_NAME (decl))); @@ -1186,7 +1186,8 @@ go_output_typedef (struct godump_container *container, tree decl) return; *slot = CONST_CAST (void *, (const void *) type); - if (!go_format_type (container, TREE_TYPE (decl), false, false, NULL)) + if (!go_format_type (container, TREE_TYPE (decl), false, false, NULL, + false)) { fprintf (go_dump_file, "// "); slot = htab_find_slot (container->invalid_hash, type, INSERT); @@ -1222,7 +1223,8 @@ go_output_typedef (struct godump_container *container, tree decl) return; *slot = CONST_CAST (void *, (const void *) type); - if (!go_format_type (container, TREE_TYPE (decl), false, false, NULL)) + if (!go_format_type (container, TREE_TYPE (decl), false, false, NULL, + false)) { fprintf (go_dump_file, "// "); slot = htab_find_slot (container->invalid_hash, type, INSERT); @@ -1285,7 +1287,8 @@ go_output_var (struct godump_container *container, tree decl) NO_INSERT) != NULL; } else - is_valid = go_format_type (container, TREE_TYPE (decl), true, false, NULL); + is_valid = go_format_type (container, TREE_TYPE (decl), true, false, NULL, + false); if (is_valid && htab_find_slot (container->type_hash, IDENTIFIER_POINTER (DECL_NAME (decl)), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f442b094c4e7..5c16ebee6a8e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-11-03 Dominik Vogt + + * build-go/gcc/testsuite/gcc/godump-1.out: Update godump tests. + 2014-11-03 Tobias Burnus * gfortran.dg/coarray_collectives_14.f90: Fix testcase. diff --git a/gcc/testsuite/gcc.misc-tests/godump-1.c b/gcc/testsuite/gcc.misc-tests/godump-1.c index 4ab39064843f..e1f18b966739 100644 --- a/gcc/testsuite/gcc.misc-tests/godump-1.c +++ b/gcc/testsuite/gcc.misc-tests/godump-1.c @@ -7,276 +7,6 @@ #include -/* integer based types */ -typedef char c_t; -char c_v1; -c_t c_v2; -typedef short s_t; -short s_v1; -s_t s_v2; -typedef int i_t; -int i_v1; -i_t i_v2; -typedef long l_t; -long l_v1; -l_t l_v2; -typedef long long ll_t; -long long ll_v1; -ll_t ll_v2; -typedef unsigned char uc_t; -unsigned char uc_v1; -uc_t uc_v2; -typedef unsigned short us_t; -unsigned short us_v1; -us_t us_v2; -typedef unsigned int ui_t; -unsigned int ui_v1; -ui_t ui_v2; -typedef unsigned long ul_t; -unsigned long ul_v1; -ul_t ul_v2; -typedef unsigned long long ull_t; -unsigned long long ull_v1; -ull_t ull_v2; -typedef signed char sc_t; -signed char sc_v1; -sc_t sc_v2; -typedef signed short ss_t; -signed short ss_v1; -ss_t ss_v2; -typedef signed int si_t; -signed int si_v1; -si_t si_v2; -typedef signed long sl_t; -signed long sl_v1; -sl_t sl_v2; -typedef signed long long sll_t; -signed long long sll_v1; -sll_t sll_v2; -typedef int8_t i8_t; -int8_t i8_v1; -i8_t i8_v2; -typedef int16_t i16_t; -int16_t i16_v1; -i16_t i16_v2; -typedef int32_t i32_t; -int32_t i32_v1; -i32_t i32_v2; -typedef int64_t i64_t; -int64_t i64_v1; -i64_t i64_v2; -typedef uint8_t ui8_t; -uint8_t ui8_v1; -ui8_t ui8_v2; -typedef uint16_t iu16_t; -uint16_t iu16_v1; -iu16_t iu16_v2; -typedef uint32_t iu32_t; -uint32_t iu32_v1; -iu32_t iu32_v2; -typedef uint64_t iu64_t; -uint64_t iu64_v1; -iu64_t iu64_v2; -typedef const char cc_t; -const char cc_v1; -cc_t cc_v2; - -/* pointer and array types */ -typedef void *vp_t; -void *vp_v1; -vp_t vp_v2; -typedef int **ipp_t; -int **ipp_v1; -ipp_t ipp_v2; -typedef char ca_t[]; -char ca_v1[]; /* { dg-warning "array 'ca_v1' assumed to have one element" } */ -char ca_v1b[2]; -ca_t ca_v2; /* { dg-warning "array 'ca_v2' assumed to have one element" } */ -typedef short sa2_t[2]; -short sa2_v1[2]; -sa2_t sa2_v2; - -/* floating point types */ -typedef float f_t; -float f_v1; -f_t f_v2; -typedef double d_t; -double d_v1; -d_t d_v2; -typedef long double ld_t; -long double ld_v1; -ld_t ld_v2; -typedef _Complex cx_t; -_Complex cx_v1; -cx_t cx_v2; -typedef float _Complex fcx_t; -float _Complex fcx_v1; -fcx_t fcx_v2; -typedef double _Complex dcx_t; -double _Complex dcx_v1; -dcx_t dcx_v2; -typedef long double _Complex ldcx_t; -long double _Complex ldcx_v1; -ldcx_t ldcx_v2; -typedef int _Complex icx_t; -int _Complex icx_v1; -icx_t icx_v2; - -/* nested typedefs */ -typedef int ni_t; -typedef ni_t ni2_t; -ni2_t ni2_v2; -typedef ni2_t ni3_t; -ni3_t ni3_v2; - -/* enums */ -enum { E11 }; -enum { EV11 } e1_v1; -enum { E21, E22 }; -enum { EV21, EV22 } e2_v1; -enum { EN1 = 3, EN2 = 77, EN3 = -1, EN4 }; -typedef enum { ET1, ET2 } et_t; -enum { ETV1, ETV2 } et_v1; -et_t et_v2; - -/* simple structs */ -typedef struct { } ts0e; -struct { } s0e; -typedef struct { int8_t e1; } ts1e; -struct { int8_t e1; } s1e; -typedef struct { int8_t e1; void *e2; } ts2el; -struct { int8_t e1; void *e2; } s2el; -typedef struct { void *e1; int8_t e2; } ts2eg; -struct { void *e1; int8_t e2; } s2eg; -typedef struct { int64_t l; int8_t c; int32_t i; int16_t s; } tsme; -struct { int64_t l; int8_t c; int32_t i; int16_t s; } sme; -typedef struct { int16_t sa[3]; int8_t ca[3]; } tsae; -struct { int16_t sa[3]; int8_t ca[3]; } sae; -typedef struct { float f; } tsf_equiv; -struct { float f; } sf_equiv; -typedef struct { float f; uint8_t : 0; } tsf_not_equiv; -struct { float f; uint8_t : 0; } sf_not_equiv; -typedef struct { double d; } tsd_equiv; -struct { double d; } sd_equiv; -typedef struct { double d; uint8_t : 0; } tsd_not_equiv; -struct { double d; uint8_t : 0; } sd_not_equiv; -typedef struct s_undef_t s_undef_t2; - -/* nested structs */ -typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn; -struct { struct { uint8_t ca[3]; } s; uint32_t i; } sn; -typedef struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } tsn_anon; -struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } sn_anon; - -/* structs with bitfields */ -typedef struct { uint8_t : 0; uint8_t c; } tsbf_anon_pad1; -struct { uint8_t : 0; uint8_t c; } sbf_anon_pad1; -typedef struct { uint8_t : 1; uint8_t c; } tsbf_anon_pad2; -struct { uint8_t : 1; uint8_t c; } sbf_anon_pad2; -typedef struct { uint8_t : 7; uint8_t c; } tsbf_anon_pad3; -struct { uint8_t : 7; uint8_t c; } sbf_anon_pad3; -typedef struct { uint8_t : 8; uint8_t c; } tsbf_anon_pad4; -struct { uint8_t : 8; uint8_t c; } sbf_anon_pad4; -typedef struct { uint64_t : 0; uint8_t c; } tsbf_anon_pad5; -struct { uint64_t : 0; uint8_t c; } sbf_anon_pad5; -typedef struct { uint64_t : 1; uint8_t c; } tsbf_anon_pad6; -struct { uint64_t : 1; uint8_t c; } sbf_anon_pad6; -typedef struct { uint64_t : 63; uint8_t c; } tsbf_anon_pad7; -struct { uint64_t : 63; uint8_t c; } sbf_anon_pad7; -typedef struct { uint64_t : 64; uint8_t c; } tsbf_anon_pad8; -struct { uint64_t : 64; uint8_t c; } sbf_anon_pad8; -typedef struct { uint8_t bf : 1; uint8_t c; } tsbf_pad8_1; -struct { uint8_t bf : 1; uint8_t c; } sbf_pad8_1; -typedef struct { uint8_t bf : 7; uint8_t c; } tsbf_pad8_2; -struct { uint8_t bf : 7; uint8_t c; } sbf_pad8_2; -typedef struct { uint8_t bf : 8; uint8_t c; } tsbf_pad8_3; -struct { uint8_t bf : 8; uint8_t c; } sbf_pad8_3; -typedef struct { uint16_t bf : 1; uint8_t c; } tsbf_pad16_1; -struct { uint16_t bf : 1; uint8_t c; } sbf_pad16_1; -typedef struct { uint16_t bf : 15; uint8_t c; } tsbf_pad16_2; -struct { uint16_t bf : 15; uint8_t c; } sbf_pad16_2; -typedef struct { uint16_t bf : 16; uint8_t c; } tsbf_pad16_3; -struct { uint16_t bf : 16; uint8_t c; } sbf_pad16_3; -typedef struct { uint32_t bf : 1; uint8_t c; } tsbf_pad32_1; -struct { uint32_t bf : 1; uint8_t c; } sbf_pad32_1; -typedef struct { uint32_t bf : 31; uint8_t c; } tsbf_pad32_2; -struct { uint32_t bf : 31; uint8_t c; } sbf_pad32_2; -typedef struct { uint32_t bf : 32; uint8_t c; } tsbf_pad32_3; -struct { uint32_t bf : 32; uint8_t c; } sbf_pad32_3; -typedef struct { uint64_t bf : 1; uint8_t c; } tsbf_pad64_1; -struct { uint64_t bf : 1; uint8_t c; } sbf_pad64_1; -typedef struct { uint64_t bf : 63; uint8_t c; } tsbf_pad64_2; -struct { uint64_t bf : 63; uint8_t c; } sbf_pad64_2; -typedef struct { uint64_t bf : 64; uint8_t c; } tsbf_pad64_3; -struct { uint64_t bf : 64; uint8_t c; } sbf_pad64_3; -typedef struct { uint8_t b1 : 1; } tsbf_1b; -struct { uint8_t b1 : 1; } sbf_1b; -typedef struct -{ - uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; - uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; -} tsbf_8b; -struct -{ - uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; - uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; -} sbf_8b; -typedef struct { - uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; - uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; - uint8_t b9 : 1; -} tsbf_9b; -struct { - uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; - uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; - uint8_t b9 : 1; -} sbf_9b; -typedef struct { - uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; -} tsbf_18b; -struct { - uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; -} sbf_18b; -struct -{ - uint16_t bf1 : 8; - uint8_t c; - uint16_t bf2 : 8; - uint32_t bf3 : 12; - uint16_t s; -} sbf_gaps; -typedef struct -{ - uint16_t bf1 : 8; - uint8_t c; - uint16_t bf2 : 8; - uint32_t bf3 : 12; - uint16_t s; -} tsbf_gaps; - -/* unions */ -typedef union { } tue; -union { } ue; -typedef union { uint8_t c; uint64_t l; } tu1; -union { uint8_t c; uint64_t l; } u1; -typedef union { uint64_t l; uint8_t c; } tu2; -union { uint64_t l; uint8_t c; } u2; -typedef union { uint64_t l[3]; uint8_t c; } tu3; -union { uint64_t l[3]; uint8_t c; } u3; -typedef struct { union { uint8_t c; uint64_t l; }; } tsu_anon; -struct { union { uint8_t c; uint64_t l; }; } su_anon; -typedef union { uint64_t bf : 1; uint8_t ca[5]; } tu_size; -union { uint64_t bf : 1; uint8_t ca[5]; } u_size; -typedef union { uint64_t : 1; uint8_t ca[5]; } tu2_size; -union { uint64_t : 1; uint8_t ca[5]; } u2_size; -typedef union u_undef_t u_undef_t2; -typedef union { uint64_t b : 1; uint8_t ca[5]; } tu3_size; -union { uint64_t b : 1; uint8_t ca[5]; } u3_size; - -/* functions */ -extern uint32_t func1(uint8_t c); -typedef int8_t (*func_t)(void *p); - /* Necessary quoting in the regexp patters: (?n) at beginning of pattern to make ^ and $ work. @@ -287,228 +17,857 @@ typedef int8_t (*func_t)(void *p); {, } -> "\{", "\}" */ -/* { dg-final { scan-file godump-1.out "(?n)^type _c_t u?int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _s_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _i_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _l_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ll_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _uc_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _us_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ui_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ul_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ull_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _sc_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ss_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _si_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _sl_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _sll_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _i8_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _i16_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _i32_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _i64_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ui8_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _iu16_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _iu32_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _iu64_t uint\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _cc_t u?int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _vp_t \\*byte$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ipp_t \\*\\*int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ca_t \\\[0\\\]u?int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _sa2_t \\\[1\\+1\\\]int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _f_t float\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _d_t float\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^// type _ld_t INVALID-float-\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _cx_t complex\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _fcx_t complex\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _dcx_t complex\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^// type _ldcx_t INVALID-complex-\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^// type _icx_t INVALID-complex-non-real$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ni_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ni2_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ni3_t int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _et_t int$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ts0e struct \{ \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ts1e struct \{ e1 int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ts2el struct \{ e1 int\[0-9\]*; e2 \\*byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _ts2eg struct \{ e1 \\*byte; e2 int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsme struct \{ l int\[0-9\]*; c int\[0-9\]*; i int\[0-9\]*; s int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsae struct \{ sa \\\[2\\+1\\\]int\[0-9\]*; ca \\\[2\\+1\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_equiv struct \{ f float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_equiv struct \{ d float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsn struct \{ s struct \{ ca \\\[2\\+1\\\]uint\[0-9\]*; \}; i uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ Godump_0 struct \{ a uint\[0-9\]*; s uint\[0-9\]*; \}; b uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad1 struct \{ c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad4 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad5 struct \{ c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad8 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_gaps struct \{ bf1 uint\[0-9\]*; c uint\[0-9\]*; bf2 uint\[0-9\]*; Godump_0_pad \\\[2\\\]byte; s uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tue struct \{ Godump_0 \\\[0\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tu2 struct \{ l \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tu3 struct \{ l \\\[24\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ Godump_0 struct \{ c \\\[8\\\]byte; Godump_1_align \\\[0\\\]uint64; \}; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ bf \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tu2_size struct \{ Godump_0 \\\[5\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _tu3_size struct \{ b \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^type _func_t func\[(\]\\*byte\[)\] int\[0-9\]*$" } } */ +/*** integer based types ***/ +typedef char c_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _c_t u?int8$" } } */ + +char c_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _c_v1 u?int\[0-9\]*$" } } */ + +c_t c_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _c_v2 _c_t$" } } */ + +typedef short s_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _s_t int\[0-9\]*$" } } */ + +short s_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _s_v1 int\[0-9\]*$" } } */ + +s_t s_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _s_v2 _s_t$" } } */ + +typedef int i_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i_t int\[0-9\]*$" } } */ + +int i_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _i_v1 int\[0-9\]*$" } } */ + +i_t i_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _i_v2 _i_t$" } } */ + +typedef long l_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _l_t int\[0-9\]*$" } } */ + +long l_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _l_v1 int\[0-9\]*$" } } */ + +l_t l_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _l_v2 _l_t$" } } */ + +typedef long long ll_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ll_t int\[0-9\]*$" } } */ + +long long ll_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ll_v1 int\[0-9\]*$" } } */ + +ll_t ll_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ll_v2 _ll_t$" } } */ + +typedef unsigned char uc_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _uc_t uint8$" } } */ + +unsigned char uc_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _uc_v1 uint\[0-9\]*$" } } */ + +uc_t uc_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _uc_v2 _uc_t$" } } */ + +typedef unsigned short us_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _us_t uint\[0-9\]*$" } } */ + +unsigned short us_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _us_v1 uint\[0-9\]*$" } } */ + +us_t us_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _us_v2 _us_t$" } } */ + +typedef unsigned int ui_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ui_t uint\[0-9\]*$" } } */ + +unsigned int ui_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ui_v1 uint\[0-9\]*$" } } */ + +ui_t ui_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ui_v2 _ui_t$" } } */ + +typedef unsigned long ul_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ul_t uint\[0-9\]*$" } } */ + +unsigned long ul_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ul_v1 uint\[0-9\]*$" } } */ + +ul_t ul_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ul_v2 _ul_t$" } } */ + +typedef unsigned long long ull_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ull_t uint\[0-9\]*$" } } */ + +unsigned long long ull_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ull_v1 uint\[0-9\]*$" } } */ + +ull_t ull_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ull_v2 _ull_t$" } } */ + +typedef signed char sc_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _sc_t int8$" } } */ + +signed char sc_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _sc_v1 int\[0-9\]*$" } } */ + +sc_t sc_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _sc_v2 _sc_t$" } } */ + +typedef signed short ss_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ss_t int\[0-9\]*$" } } */ + +signed short ss_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ss_v1 int\[0-9\]*$" } } */ + +ss_t ss_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ss_v2 _ss_t$" } } */ + +typedef signed int si_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _si_t int\[0-9\]*$" } } */ + +signed int si_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _si_v1 int\[0-9\]*$" } } */ + +si_t si_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _si_v2 _si_t$" } } */ + +typedef signed long sl_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _sl_t int\[0-9\]*$" } } */ + +signed long sl_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _sl_v1 int\[0-9\]*$" } } */ + +sl_t sl_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _sl_v2 _sl_t$" } } */ + +typedef signed long long sll_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _sll_t int\[0-9\]*$" } } */ + +signed long long sll_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _sll_v1 int\[0-9\]*$" } } */ + +sll_t sll_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _sll_v2 _sll_t$" } } */ + +typedef int8_t i8_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i8_t int8$" } } */ + +int8_t i8_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _i8_v1 _int8_t$" } } */ + +i8_t i8_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _i8_v2 _i8_t$" } } */ + +typedef int16_t i16_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i16_t int16$" } } */ + +int16_t i16_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _i16_v1 _int16_t$" } } */ + +i16_t i16_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _i16_v2 _i16_t$" } } */ + +typedef int32_t i32_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i32_t int32$" } } */ + +int32_t i32_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _i32_v1 _int32_t$" } } */ + +i32_t i32_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _i32_v2 _i32_t$" } } */ + +typedef int64_t i64_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _i64_t int64$" } } */ + +int64_t i64_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _i64_v1 _int64_t$" } } */ + +i64_t i64_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _i64_v2 _i64_t$" } } */ + +typedef uint8_t ui8_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ui8_t uint8$" } } */ + +uint8_t ui8_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v1 _uint8_t$" } } */ + +ui8_t ui8_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v2 _ui8_t$" } } */ + +typedef uint16_t iu16_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _iu16_t uint16$" } } */ + +uint16_t iu16_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v1 _uint16_t$" } } */ + +iu16_t iu16_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v2 _iu16_t$" } } */ + +typedef uint32_t iu32_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _iu32_t uint32$" } } */ + +uint32_t iu32_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v1 _uint32_t$" } } */ + +iu32_t iu32_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v2 _iu32_t$" } } */ + +typedef uint64_t iu64_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _iu64_t uint64$" } } */ + +uint64_t iu64_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v1 _uint64_t$" } } */ + +iu64_t iu64_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v2 _iu64_t$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v1 u?int\[0-9\]*$" } } */ + +typedef const char cc_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _cc_t u?int8$" } } */ + +const char cc_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v1 u?int8$" } } */ + +cc_t cc_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _cc_v2 _cc_t$" } } */ + + +/*** pointer and array types ***/ +typedef void *vp_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _vp_t \\*byte$" } } */ + +void *vp_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _vp_v1 \\*byte$" } } */ + +vp_t vp_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _vp_v2 _vp_t$" } } */ + +typedef int **ipp_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ipp_t \\*\\*int\[0-9\]*$" } } */ + +int **ipp_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v1 \\*\\*int\[0-9\]*$" } } */ + +ipp_t ipp_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v2 _ipp_t$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1 \\\[0\\+1\\\]u?int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1b \\\[1\\+1\\\]u?int\[0-9\]*$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v2 \\\[0\\+1\\\]u?int\[0-9\]*$" } } */ + +typedef char ca_t[]; +/* { dg-final { scan-file godump-1.out "(?n)^type _ca_t \\\[0\\\]u?int8$" } } */ + +char ca_v1[]; /* { dg-warning "array 'ca_v1' assumed to have one element" } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1 \\\[0\\+1\\\]u?int8$" } } */ + +char ca_v1b[2]; +/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1b \\\[1\\+1\\\]u?int8$" } } */ + +ca_t ca_v2; /* { dg-warning "array 'ca_v2' assumed to have one element" } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v2 \\\[0\\+1\\\]u?int8$" } } */ + +typedef short sa2_t[2]; +/* { dg-final { scan-file godump-1.out "(?n)^type _sa2_t \\\[1\\+1\\\]int\[0-9\]*$" } } */ + +short sa2_v1[2]; /* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v1 \\\[1\\+1\\\]int\[0-9\]*$" } } */ + +sa2_t sa2_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v2 _sa2_t$" } } */ + + +/*** floating point types ***/ +typedef float f_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _f_t float\[0-9\]*$" } } */ + +float f_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _f_v1 float\[0-9\]*$" } } */ + +f_t f_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _f_v2 _f_t$" } } */ + +typedef double d_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _d_t float\[0-9\]*$" } } */ + +double d_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _d_v1 float\[0-9\]*$" } } */ + +d_t d_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _d_v2 _d_t$" } } */ + +typedef long double ld_t; +/* { dg-final { scan-file godump-1.out "(?n)^// type _ld_t INVALID-float-\[0-9\]*$" } } */ + +long double ld_v1; /* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v1 INVALID-float-\[0-9\]*$" } } */ + +ld_t ld_v2; /* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v2 INVALID-float-\[0-9\]*$" } } */ + +/*** complex types ***/ +typedef _Complex cx_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _cx_t complex\[0-9\]*$" } } */ + +_Complex cx_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _cx_v1 complex\[0-9\]*$" } } */ + +cx_t cx_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _cx_v2 _cx_t$" } } */ + +typedef float _Complex fcx_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _fcx_t complex\[0-9\]*$" } } */ + +float _Complex fcx_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v1 complex\[0-9\]*$" } } */ + +fcx_t fcx_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v2 _fcx_t$" } } */ + +typedef double _Complex dcx_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _dcx_t complex\[0-9\]*$" } } */ + +double _Complex dcx_v1; /* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v1 complex\[0-9\]*$" } } */ + +dcx_t dcx_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v2 _dcx_t$" } } */ + +typedef long double _Complex ldcx_t; +/* { dg-final { scan-file godump-1.out "(?n)^// type _ldcx_t INVALID-complex-\[0-9\]*$" } } */ + +long double _Complex ldcx_v1; /* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v1 INVALID-complex-\[0-9\]*$" } } */ + +ldcx_t ldcx_v2; /* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v2 INVALID-complex-\[0-9\]*$" } } */ + +typedef int _Complex icx_t; +/* { dg-final { scan-file godump-1.out "(?n)^// type _icx_t INVALID-complex-non-real$" } } */ + +int _Complex icx_v1; /* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v1 INVALID-complex-non-real$" } } */ + +icx_t icx_v2; /* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v2 INVALID-complex-non-real$" } } */ + + +/*** nested typedefs ***/ +typedef int32_t ni_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ni_t int32$" } } */ + +typedef ni_t ni2_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ni2_t int32$" } } */ + +ni2_t ni2_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ni2_v2 _ni2_t$" } } */ + +typedef ni2_t ni3_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _ni3_t int32$" } } */ + +ni3_t ni3_v2; /* { dg-final { scan-file godump-1.out "(?n)^var _ni3_v2 _ni3_t$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _e1_v1 int$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _e2_v1 int$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _et_v1 int$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _et_v2 _et_t$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _s0e struct \{ \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _s1e struct \{ e1 int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _s2el struct \{ e1 int\[0-9\]*; e2 \\*byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _s2eg struct \{ e1 \\*byte; e2 int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sme struct \{ l int\[0-9\]*; c int\[0-9\]*; i int\[0-9\]*; s int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sae struct \{ sa \\\[2\\+1\\\]int\[0-9\]*; ca \\\[2\\+1\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sf_equiv struct \{ f float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sd_equiv struct \{ d float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sn struct \{ s struct \{ ca \\\[2\\+1\\\]uint\[0-9\]*; \}; i uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ Godump_0 struct \{ a uint\[0-9\]*; s uint\[0-9\]*; \}; b uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad1 struct \{ c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad4 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad5 struct \{ c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad8 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_gaps struct \{ bf1 uint\[0-9\]*; c uint\[0-9\]*; bf2 uint\[0-9\]*; Godump_0_pad \\\[2\\\]byte; s uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _ue struct \{ Godump_0 \\\[0\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _u2 struct \{ l \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _u3 struct \{ l \\\[24\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ Godump_0 struct \{ c \\\[8\\\]byte; Godump_1_align \\\[0\\\]uint64; \}; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ bf \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _u2_size struct \{ Godump_0 \\\[5\\\]byte; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^var _u3_size struct \{ b \\\[8\\\]byte; Godump_0_align \\\[0\\\]uint64; \}$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^func _func1 \[(\]uint\[0-9\]*\[)\] uint\[0-9\]* __asm__\[(\]\"func1\"\[)\]$" } } */ + + +/*** enums ***/ +enum { E11 }; /* { dg-final { scan-file godump-1.out "(?n)^const _E11 = 0$" } } */ + +enum { EV11 } e1_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _e1_v1 int$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EV11 = 0$" } } */ + +enum { E21, E22 }; /* { dg-final { scan-file godump-1.out "(?n)^const _E21 = 0$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _E22 = 1$" } } */ + +enum { EV21, EV22 } e2_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _e2_v1 int$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EV21 = 0$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^const _EV22 = 1$" } } */ + +enum { EN1 = 3, EN2 = 77, EN3 = -1, EN4 }; /* { dg-final { scan-file godump-1.out "(?n)^const _EN1 = 3$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _EN2 = 77$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _EN3 = -1$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _EN4 = 0$" } } */ + +typedef enum { ET1, ET2 } et_t; +/* { dg-final { scan-file godump-1.out "(?n)^type _et_t int$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _ET1 = 0$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _ET2 = 1$" } } */ + +enum { ETV1, ETV2 } et_v1; +/* { dg-final { scan-file godump-1.out "(?n)^var _et_v1 int$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _ETV1 = 0$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^const _ETV2 = 1$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^const _EV11 = 0$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^const _EV21 = 0$" } } */ -/* { dg-final { scan-file godump-1.out "(?n)^const _EV22 = 1$" } } */ + +et_t et_v2; +/* { dg-final { scan-file godump-1.out "(?n)^var _et_v2 _et_t$" } } */ + + +/*** simple structs ***/ +typedef struct { } ts0e; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts0e struct \{ \}$" } } */ + +struct { } s0e; +/* { dg-final { scan-file godump-1.out "(?n)^var _s0e struct \{ \}$" } } */ + +typedef struct { int8_t e1; } ts1e; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts1e struct \{ e1 int8; \}$" } } */ + +struct { int8_t e1; } s1e; +/* { dg-final { scan-file godump-1.out "(?n)^var _s1e struct \{ e1 int8; \}$" } } */ + +typedef struct { int8_t e1; void *e2; } ts2el; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts2el struct \{ e1 int8; e2 \\*byte; \}$" } } */ + +struct { int8_t e1; void *e2; } s2el; +/* { dg-final { scan-file godump-1.out "(?n)^var _s2el struct \{ e1 int8; e2 \\*byte; \}$" } } */ + +typedef struct { void *e1; int8_t e2; } ts2eg; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts2eg struct \{ e1 \\*byte; e2 int8; \}$" } } */ + +struct { void *e1; int8_t e2; } s2eg; +/* { dg-final { scan-file godump-1.out "(?n)^var _s2eg struct \{ e1 \\*byte; e2 int8; \}$" } } */ + +typedef struct { int64_t l; int8_t c; int32_t i; int16_t s; } tsme; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsme struct \{ l int64; c int8; i int32; s int16; \}$" } } */ + +struct { int64_t l; int8_t c; int32_t i; int16_t s; } sme; +/* { dg-final { scan-file godump-1.out "(?n)^var _sme struct \{ l int64; c int\8; i int32; s int16; \}$" } } */ + +typedef struct { int16_t sa[3]; int8_t ca[3]; } tsae; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsae struct \{ sa \\\[2\\+1\\\]int16; ca \\\[2\\+1\\\]int8; \}$" } } */ + +struct { int16_t sa[3]; int8_t ca[3]; } sae; +/* { dg-final { scan-file godump-1.out "(?n)^var _sae struct \{ sa \\\[2\\+1\\\]int16; ca \\\[2\\+1\\\]int8; \}$" } } */ + +typedef struct { float f; } tsf_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +struct { float f; } sf_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sf_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +typedef struct { float f; uint8_t : 0; } tsf_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +struct { float f; uint8_t : 0; } sf_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */ + +typedef struct { double d; } tsd_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +struct { double d; } sd_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sd_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +typedef struct { double d; uint8_t : 0; } tsd_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +struct { double d; uint8_t : 0; } sd_not_equiv; +/* { dg-final { scan-file godump-1.out "(?n)^var _sd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */ + +typedef struct s_undef_t s_undef_t2; + + +/*** nested structs ***/ +typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ + +struct { struct { uint8_t ca[3]; } s; uint32_t i; } sn; +/* { dg-final { scan-file godump-1.out "(?n)^var _sn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ + +typedef struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } tsn_anon; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_align \\\[0\\\]int16; \}$" } } */ + +struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } sn_anon; +/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_align \\\[0\\\]int16; \}$" } } */ + + +/*** structs with bitfields ***/ +typedef struct { uint8_t : 0; uint8_t c; } tsbf_anon_pad1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad1 struct \{ c uint8; \}$" } } */ + +struct { uint8_t : 0; uint8_t c; } sbf_anon_pad1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad1 struct \{ c uint8; \}$" } } */ + +typedef struct { uint8_t : 1; uint8_t c; } tsbf_anon_pad2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t : 1; uint8_t c; } sbf_anon_pad2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t : 7; uint8_t c; } tsbf_anon_pad3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t : 7; uint8_t c; } sbf_anon_pad3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t : 8; uint8_t c; } tsbf_anon_pad4; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad4 struct \{ Godump_0 uint8; c uint8; \}$" } } */ + +struct { uint8_t : 8; uint8_t c; } sbf_anon_pad4; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad4 struct \{ Godump_0 uint8; c uint8; \}$" } } */ + +typedef struct { uint64_t : 0; uint8_t c; } tsbf_anon_pad5; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad5 struct \{ c uint8; \}$" } } */ + +struct { uint64_t : 0; uint8_t c; } sbf_anon_pad5; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad5 struct \{ c uint8; \}$" } } */ + +typedef struct { uint64_t : 1; uint8_t c; } tsbf_anon_pad6; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint64_t : 1; uint8_t c; } sbf_anon_pad6; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint64_t : 63; uint8_t c; } tsbf_anon_pad7; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; \}$" } } */ + +struct { uint64_t : 63; uint8_t c; } sbf_anon_pad7; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint64_t : 64; uint8_t c; } tsbf_anon_pad8; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad8 struct \{ Godump_0 uint64; c uint8; \}$" } } */ + +struct { uint64_t : 64; uint8_t c; } sbf_anon_pad8; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad8 struct \{ Godump_0 uint64; c uint8; \}$" } } */ + +typedef struct { uint8_t bf : 1; uint8_t c; } tsbf_pad8_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t bf : 1; uint8_t c; } sbf_pad8_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t bf : 7; uint8_t c; } tsbf_pad8_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +struct { uint8_t bf : 7; uint8_t c; } sbf_pad8_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; \}$" } } */ + +typedef struct { uint8_t bf : 8; uint8_t c; } tsbf_pad8_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ + +struct { uint8_t bf : 8; uint8_t c; } sbf_pad8_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ + +typedef struct { uint16_t bf : 1; uint8_t c; } tsbf_pad16_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +struct { uint16_t bf : 1; uint8_t c; } sbf_pad16_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +typedef struct { uint16_t bf : 15; uint8_t c; } tsbf_pad16_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +struct { uint16_t bf : 15; uint8_t c; } sbf_pad16_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ + +typedef struct { uint16_t bf : 16; uint8_t c; } tsbf_pad16_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_3 struct \{ bf uint16; c uint8; \}$" } } */ + +struct { uint16_t bf : 16; uint8_t c; } sbf_pad16_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_3 struct \{ bf uint16; c uint8; \}$" } } */ + +typedef struct { uint32_t bf : 1; uint8_t c; } tsbf_pad32_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +struct { uint32_t bf : 1; uint8_t c; } sbf_pad32_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct { uint32_t bf : 31; uint8_t c; } tsbf_pad32_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +struct { uint32_t bf : 31; uint8_t c; } sbf_pad32_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct { uint32_t bf : 32; uint8_t c; } tsbf_pad32_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_3 struct \{ bf uint32; c uint8; \}$" } } */ + +struct { uint32_t bf : 32; uint8_t c; } sbf_pad32_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_3 struct \{ bf uint32; c uint8; \}$" } } */ + +typedef struct { uint64_t bf : 1; uint8_t c; } tsbf_pad64_1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +struct { uint64_t bf : 1; uint8_t c; } sbf_pad64_1; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +typedef struct { uint64_t bf : 63; uint8_t c; } tsbf_pad64_2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +struct { uint64_t bf : 63; uint8_t c; } sbf_pad64_2; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_align \\\[0\\\]int64; \}$" } } */ + +typedef struct { uint64_t bf : 64; uint8_t c; } tsbf_pad64_3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; \}$" } } */ + +struct { uint64_t bf : 64; uint8_t c; } sbf_pad64_3; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; \}$" } } */ + +typedef struct { uint8_t b1 : 1; } tsbf_1b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +struct { uint8_t b1 : 1; } sbf_1b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +typedef struct +{ + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; +} tsbf_8b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +struct +{ + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; +} sbf_8b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */ + +typedef struct { + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; + uint8_t b9 : 1; +} tsbf_9b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ + +struct { + uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1; + uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1; + uint8_t b9 : 1; +} sbf_9b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */ + +typedef struct { + uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; +} tsbf_18b; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ + +struct { + uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2; +} sbf_18b; +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */ + +struct +{ + uint16_t bf1 : 8; + uint8_t c; + uint16_t bf2 : 8; + uint32_t bf3 : 12; + uint16_t s; +} sbf_gaps; +/* { 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; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct +{ + uint16_t bf1 : 8; + uint8_t c; + uint16_t bf2 : 8; + uint32_t bf3 : 12; + uint16_t s; +} tsbf_gaps; +/* { 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; Godump_1_align \\\[0\\\]int32; \}$" } } */ + +typedef struct +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} ts_nested; +/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +struct +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} s_nested; +/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +typedef struct +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} ts_nested2; +/* { 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; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + +struct +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} s_nested2; +/* { 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; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + + +/*** unions ***/ +typedef union { } tue; +/* { dg-final { scan-file godump-1.out "(?n)^type _tue struct \{ \}$" } } */ + +union { } ue; +/* { dg-final { scan-file godump-1.out "(?n)^var _ue struct \{ \}$" } } */ + +typedef union { uint8_t c; uint64_t l; } tu1; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +union { uint8_t c; uint64_t l; } u1; +/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union { uint64_t l; uint8_t c; } tu2; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu2 struct \{ l uint64; \}$" } } */ + +union { uint64_t l; uint8_t c; } u2; +/* { dg-final { scan-file godump-1.out "(?n)^var _u2 struct \{ l uint64; \}$" } } */ + +typedef union { uint64_t l[3]; uint8_t c; } tu3; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ + +union { uint64_t l[3]; uint8_t c; } u3; +/* { dg-final { scan-file godump-1.out "(?n)^var _u3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ + +typedef struct { union { uint8_t c; uint64_t l; }; } tsu_anon; +/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ + +struct { union { uint8_t c; uint64_t l; }; } su_anon; +/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union { uint64_t bf : 1; uint8_t ca[5]; } tu_size; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +union { uint64_t bf : 1; uint8_t ca[5]; } u_size; +/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union { uint64_t : 1; uint8_t ca[5]; } tu2_size; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ + +union { uint64_t : 1; uint8_t ca[5]; } u2_size; +/* { dg-final { scan-file godump-1.out "(?n)^var _u2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ + +typedef union u_undef_t u_undef_t2; + +typedef union { uint64_t b : 1; uint8_t ca[5]; } tu3_size; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +union { uint64_t b : 1; uint8_t ca[5]; } u3_size; +/* { dg-final { scan-file godump-1.out "(?n)^var _u3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_align \\\[0\\\]u?int64; \}$" } } */ + +typedef union +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} tu_nested; +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +union +{ + union + { + int64_t : 1; + union + { + int32_t bf : 1; + union + { + int16_t s; + int8_t c; + }; + }; + } u; +} u_nested; +/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ + +typedef union +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} tu_nested2; +/* { 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; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + +union +{ + struct + { + int64_t : 1; + struct + { + int32_t bf : 1; + struct + { + int16_t s; + int8_t c; + }; + }; + } u; +} u_nested2; +/* { 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; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ + + +/*** functions ***/ +extern uint32_t func1(uint8_t c); +/* { dg-final { scan-file godump-1.out "(?n)^func _func1 \[(\]uint\[0-9\]*\[)\] uint\[0-9\]* __asm__\[(\]\"func1\"\[)\]$" } } */ + +typedef int8_t (*func_t)(void *p); +/* { dg-final { scan-file godump-1.out "(?n)^type _func_t func\[(\]\\*byte\[)\] int\[0-9\]*$" } } */