Do not emit "field_type" var if not needed on "maint print c-tdesc"
authorSimon Marchi <simon.marchi@ericsson.com>
Thu, 21 Dec 2017 23:19:17 +0000 (18:19 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 21 Dec 2017 23:21:45 +0000 (18:21 -0500)
While fiddling a bit with -Wunused-variable, Sergio noticed that "maint
print c-tdesc" was always generating code for the "tdesc_type
*field_type" variable, even when it wasn't used.  This is caught by GCC
when using -Wunused-variable, of course.

This patch changes the print_c_tdesc class to only output the field
declaration when we actually need it.

It shouldn't be necessary to do the same with the other variable
declarations (type_with_fields and element_type), because they are
always if they are declared.

The C files in features/ are regenerated, some declarations of
field_type are removed, as expected, while some others move to where
they are used for the first time.

gdb/ChangeLog:

* target-descriptions.c (print_c_tdesc) <visit>: Don't output
field_type declaration, use printf_field_type_assignment
instead.
<printf_field_type_assignment>: New method.
* features/aarch64-core.c, features/aarch64-fpu.c
features/arc-arcompact.c, features/arc-v2.c,
features/arm/arm-with-iwmmxt.c, features/i386/32bit-core.c,
features/i386/32bit-mpx.c, features/i386/32bit-sse.c,
features/i386/64bit-avx512.c, features/i386/64bit-core.c,
features/i386/64bit-mpx.c, features/i386/64bit-sse.c,
features/i386/x32-core.c, features/or1k.c,
features/rs6000/powerpc-7400.c,
features/rs6000/powerpc-altivec32.c,
features/rs6000/powerpc-altivec32l.c,
features/rs6000/powerpc-altivec64.c,
features/rs6000/powerpc-altivec64l.c,
features/rs6000/powerpc-cell32l.c,
features/rs6000/powerpc-cell64l.c,
features/rs6000/powerpc-isa205-altivec32l.c,
features/rs6000/powerpc-isa205-altivec64l.c,
features/rs6000/powerpc-isa205-vsx32l.c,
features/rs6000/powerpc-isa205-vsx64l.c,
features/rs6000/powerpc-vsx32.c,
features/rs6000/powerpc-vsx32l.c,
features/rs6000/powerpc-vsx64.c,
features/rs6000/powerpc-vsx64l.c, features/s390-gs-linux64.c,
features/s390-tevx-linux64.c, features/s390-vx-linux64.c,
features/s390x-gs-linux64.c, features/s390x-tevx-linux64.c,
features/s390x-vx-linux64.c: Re-generate.

37 files changed:
gdb/ChangeLog
gdb/features/aarch64-core.c
gdb/features/aarch64-fpu.c
gdb/features/arc-arcompact.c
gdb/features/arc-v2.c
gdb/features/arm/arm-with-iwmmxt.c
gdb/features/i386/32bit-core.c
gdb/features/i386/32bit-mpx.c
gdb/features/i386/32bit-sse.c
gdb/features/i386/64bit-avx512.c
gdb/features/i386/64bit-core.c
gdb/features/i386/64bit-mpx.c
gdb/features/i386/64bit-sse.c
gdb/features/i386/x32-core.c
gdb/features/or1k.c
gdb/features/rs6000/powerpc-7400.c
gdb/features/rs6000/powerpc-altivec32.c
gdb/features/rs6000/powerpc-altivec32l.c
gdb/features/rs6000/powerpc-altivec64.c
gdb/features/rs6000/powerpc-altivec64l.c
gdb/features/rs6000/powerpc-cell32l.c
gdb/features/rs6000/powerpc-cell64l.c
gdb/features/rs6000/powerpc-isa205-altivec32l.c
gdb/features/rs6000/powerpc-isa205-altivec64l.c
gdb/features/rs6000/powerpc-isa205-vsx32l.c
gdb/features/rs6000/powerpc-isa205-vsx64l.c
gdb/features/rs6000/powerpc-vsx32.c
gdb/features/rs6000/powerpc-vsx32l.c
gdb/features/rs6000/powerpc-vsx64.c
gdb/features/rs6000/powerpc-vsx64l.c
gdb/features/s390-gs-linux64.c
gdb/features/s390-tevx-linux64.c
gdb/features/s390-vx-linux64.c
gdb/features/s390x-gs-linux64.c
gdb/features/s390x-tevx-linux64.c
gdb/features/s390x-vx-linux64.c
gdb/target-descriptions.c

index 4f2c5c33c89212061646b2c0e4e8f92689d71f97..1b4b13aba96c5cfef145fdd7a3a2424f87bdd6f0 100644 (file)
@@ -1,3 +1,36 @@
+2017-12-21  Simon Marchi  <simon.marchi@ericsson.com>
+           Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * target-descriptions.c (print_c_tdesc) <visit>: Don't output
+       field_type declaration, use printf_field_type_assignment
+       instead.
+       <printf_field_type_assignment>: New method.
+       * features/aarch64-core.c, features/aarch64-fpu.c
+       features/arc-arcompact.c, features/arc-v2.c,
+       features/arm/arm-with-iwmmxt.c, features/i386/32bit-core.c,
+       features/i386/32bit-mpx.c, features/i386/32bit-sse.c,
+       features/i386/64bit-avx512.c, features/i386/64bit-core.c,
+       features/i386/64bit-mpx.c, features/i386/64bit-sse.c,
+       features/i386/x32-core.c, features/or1k.c,
+       features/rs6000/powerpc-7400.c,
+       features/rs6000/powerpc-altivec32.c,
+       features/rs6000/powerpc-altivec32l.c,
+       features/rs6000/powerpc-altivec64.c,
+       features/rs6000/powerpc-altivec64l.c,
+       features/rs6000/powerpc-cell32l.c,
+       features/rs6000/powerpc-cell64l.c,
+       features/rs6000/powerpc-isa205-altivec32l.c,
+       features/rs6000/powerpc-isa205-altivec64l.c,
+       features/rs6000/powerpc-isa205-vsx32l.c,
+       features/rs6000/powerpc-isa205-vsx64l.c,
+       features/rs6000/powerpc-vsx32.c,
+       features/rs6000/powerpc-vsx32l.c,
+       features/rs6000/powerpc-vsx64.c,
+       features/rs6000/powerpc-vsx64l.c, features/s390-gs-linux64.c,
+       features/s390-tevx-linux64.c, features/s390-vx-linux64.c,
+       features/s390x-gs-linux64.c, features/s390x-tevx-linux64.c,
+       features/s390x-vx-linux64.c: Re-generate.
+
 2017-12-20  Uros Bizjak  <ubizjak@gmail.com>
 
        * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Remove
index 618a7ef787cc1e671eb5318ca892d64c476b0550..3707b7e05560507328077684215218ccbad63fee 100644 (file)
@@ -10,7 +10,6 @@ create_feature_aarch64_core (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.core", "aarch64-core.xml");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "cpsr_flags", 4);
   tdesc_add_flag (type_with_fields, 0, "SP");
   tdesc_add_flag (type_with_fields, 1, "");
index 7328eb14d9de3fb43f2c8ccef1ca81aecc52a5ed..cac3981f7dd918e051826272eb69da8e7ac5269a 100644 (file)
@@ -47,8 +47,8 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum)
   tdesc_create_vector (feature, "v1i", element_type, 1);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vnd");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v2d");
   tdesc_add_field (type_with_fields, "f", field_type);
   field_type = tdesc_named_type (feature, "v2u");
index 79b6889172a9933319ef23a2391306fa8df78277..f81f0a26ba2dd4efaa5d5f353eee8f1eeffc4096 100644 (file)
@@ -52,7 +52,6 @@ initialize_tdesc_arc_arcompact (void)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "status32_type", 4);
   tdesc_add_flag (type_with_fields, 0, "H");
   tdesc_add_bitfield (type_with_fields, "E", 1, 2);
index 9908b4c5ecb1699ab7dfb2c550f795dd9aeb6113..b2254b293cfecb3890595c4398426a92458e80f0 100644 (file)
@@ -52,7 +52,6 @@ initialize_tdesc_arc_v2 (void)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "status32_type", 4);
   tdesc_add_flag (type_with_fields, 0, "H");
   tdesc_add_bitfield (type_with_fields, "E", 1, 4);
index 5d6c35762f23e95007ed17a58d7b48b856d87303..8729285a0edbe33bd5c2ce9fe4ed26c56f741284 100644 (file)
@@ -45,8 +45,8 @@ initialize_tdesc_arm_with_iwmmxt (void)
   tdesc_create_vector (feature, "iwmmxt_v2u32", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "iwmmxt_vec64i");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "iwmmxt_v8u8");
   tdesc_add_field (type_with_fields, "u8", field_type);
   field_type = tdesc_named_type (feature, "iwmmxt_v4u16");
index de2ce474d50b97f9e1fc4b61bfde9a6da61fa842..294e86d81eecbd488adb45e29644290ce5fd313e 100644 (file)
@@ -10,7 +10,6 @@ create_feature_i386_32bit_core (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core", "32bit-core.xml");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "i386_eflags", 4);
   tdesc_add_flag (type_with_fields, 0, "CF");
   tdesc_add_flag (type_with_fields, 1, "");
index 38910d3b159d87fde4f87f96df4cd9a60c074827..8f1be3a60f03243bd5decde1fcb4ba3a94773159 100644 (file)
@@ -10,8 +10,8 @@ create_feature_i386_32bit_mpx (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx", "32bit-mpx.xml");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_struct (feature, "br128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint64");
   tdesc_add_field (type_with_fields, "lbound", field_type);
   field_type = tdesc_named_type (feature, "uint64");
index 1c8a7e8010a657ebf731f670fba2d5867360d05c..cf48960353881519789986fd7f1c46b8802d9a11 100644 (file)
@@ -29,8 +29,8 @@ create_feature_i386_32bit_sse (struct target_desc *result, long regnum)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index a565f4280ef0665124d34c503c1ef40c0c91c101..e103e43464c7337f6556fb6035d953a3881f3e98 100644 (file)
@@ -29,8 +29,8 @@ create_feature_i386_64bit_avx512 (struct target_desc *result, long regnum)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index f4cad06e66043061e85c72b9868b1200dd3f964c..9e39ee42d9a31d68efbf838c47ae43b12a797e3f 100644 (file)
@@ -10,7 +10,6 @@ create_feature_i386_64bit_core (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core", "64bit-core.xml");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "i386_eflags", 4);
   tdesc_add_flag (type_with_fields, 0, "CF");
   tdesc_add_flag (type_with_fields, 1, "");
index f8730b4feb0c7cff441858c7b644e2910d3d2560..725e76a0dd99cc79e1ac10dd62cd4bcca3cf682d 100644 (file)
@@ -10,8 +10,8 @@ create_feature_i386_64bit_mpx (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx", "64bit-mpx.xml");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_struct (feature, "br128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint64");
   tdesc_add_field (type_with_fields, "lbound", field_type);
   field_type = tdesc_named_type (feature, "uint64");
index e4f99c2ebbb3b5b2895f58152672d3f9e79d3ce7..2859217f45860d52c76650fa5ad17eb9611ab8c8 100644 (file)
@@ -29,8 +29,8 @@ create_feature_i386_64bit_sse (struct target_desc *result, long regnum)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index acafc7dace255c1b6d18ba2e697eefd2a8bc1fc0..c268e11bea9e81563fe586299ccea4bde9c7497f 100644 (file)
@@ -10,7 +10,6 @@ create_feature_i386_x32_core (struct target_desc *result, long regnum)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core", "x32-core.xml");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "i386_eflags", 4);
   tdesc_add_flag (type_with_fields, 0, "CF");
   tdesc_add_flag (type_with_fields, 1, "");
index 929a5f92089e0144a1e62ce12b2e39a494965c23..9169cae940ed52386e63d06b4f9d40b387be6af7 100644 (file)
@@ -16,7 +16,6 @@ initialize_tdesc_or1k (void)
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.or1k.group0");
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_flags (feature, "sr_flags", 4);
   tdesc_add_flag (type_with_fields, 0, "SM");
   tdesc_add_flag (type_with_fields, 1, "TEE");
index ba9f12c94b14b95a26ef116e7a0e9133dbdb4b3b..58f8a69a1e2b4fac30842d2653476e3b8e6b7905 100644 (file)
@@ -152,8 +152,8 @@ initialize_tdesc_powerpc_7400 (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 9cb83cad1c25403fc732e792d59faa94aaadc0d1..bbb36c8aa59762a6df7a9b71f748147286863fdb 100644 (file)
@@ -104,8 +104,8 @@ initialize_tdesc_powerpc_altivec32 (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index afaf8ed3e41f52a189ece0697f4e0a00b01d1b1f..81862cb9ef448b001d5d958feae684fe4fb99620 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_altivec32l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 94041e113b49ec569e3aff7d52aec15aede0f23d..f7a7c729637c61d480ecf4dfcba19aa6ddb06c8b 100644 (file)
@@ -104,8 +104,8 @@ initialize_tdesc_powerpc_altivec64 (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index c7ed171cfa8b64e4d9f4f8e441092cef44a12b76..ce0bc86137edfc7e9a0fe358383b0f1dae5a9b6f 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_altivec64l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 390d7b2882442b2957d524295fc129d2a24c73a1..74c42f94bcb482db8cd220e8df4b19a7a5f74cd6 100644 (file)
@@ -110,8 +110,8 @@ initialize_tdesc_powerpc_cell32l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 39890baf83fb8d01ffce0131a742fd97445895d5..cbfda4c50ab90b48516000455d8711cd55a3cd76 100644 (file)
@@ -110,8 +110,8 @@ initialize_tdesc_powerpc_cell64l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 203bb4a71a3084b2131e330c63f1df44a026f036..09f5c075c8ab9f96c2bdfc679dc76bf458d2743c 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_isa205_altivec32l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 8f66a161ff013af0712b45b5e17dabd7dac60d83..246fcef085cd33f5f3f2ff420899c0e5b7d48742 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_isa205_altivec64l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index fc0f615cd0b4b2b94b5ca82e758d6303ca661d47..2a6e232e99470fc2197cf1df56090ab737dfe384 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_isa205_vsx32l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 3313d04a6abb5385ab06f0fbff2bbcd7c2abe093..d0e32f29b1b309621b1b0e841a0a4bac56671fc3 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_isa205_vsx64l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 1a824a825f31af6255f01d793da16cdbc5607f76..9eafb1c48232ae0d1b77c31f016ac06c7921c157 100644 (file)
@@ -104,8 +104,8 @@ initialize_tdesc_powerpc_vsx32 (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index f5bf11e675e2350ded565d8c6b660abde4549872..f08df14f9e8cf69badc6d10d0e8916d62a90a61c 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_vsx32l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 601df398e0891b36dfdccf377ae0a73c5ecb5a47..7991115cf6e41a60484db90be1f7c38d43cede67 100644 (file)
@@ -104,8 +104,8 @@ initialize_tdesc_powerpc_vsx64 (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index d34bd811fb65464a8e54aaa0f90fb96947ccc169..1726e6754fdb9ba9f99a37cd44df1578be30d263 100644 (file)
@@ -108,8 +108,8 @@ initialize_tdesc_powerpc_vsx64l (void)
   tdesc_create_vector (feature, "v16i8", element_type, 16);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type_with_fields, "uint128", field_type);
   field_type = tdesc_named_type (feature, "v4f");
index 126835b4fbf0774d12ad527b60425f3a565eb985..1416183d3db30a72c5e56d31ed38c7146cc60731 100644 (file)
@@ -135,8 +135,8 @@ initialize_tdesc_s390_gs_linux64 (void)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index a9ee9e155d43a07246c1cd27c6bc34c0ef228952..ae62e8de37249d189c6bc4403c22dbec9910e595 100644 (file)
@@ -135,8 +135,8 @@ initialize_tdesc_s390_tevx_linux64 (void)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index b6c5dda128f38abe73c6052f83a8c23624ae5ddf..d3ec08146086b272bf1c8d00668020e323c41874 100644 (file)
@@ -113,8 +113,8 @@ initialize_tdesc_s390_vx_linux64 (void)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index 5ab3e3d8c5343f8d854db9786f107a1fd02d45cb..d253a09997acaf8c52a70a39a9414b9b4e9ee54b 100644 (file)
@@ -119,8 +119,8 @@ initialize_tdesc_s390x_gs_linux64 (void)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index e5ecedfc2abcee68957ad5b75916dd8c00156846..1ac3249a0544baa46f50e7bedff3a329868350a4 100644 (file)
@@ -119,8 +119,8 @@ initialize_tdesc_s390x_tevx_linux64 (void)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index 1f243496cbf9453b12d3854e2b3e03610f86a6e9..2e3d3824a26a907e20f7621b764af35c5d71be0e 100644 (file)
@@ -97,8 +97,8 @@ initialize_tdesc_s390x_vx_linux64 (void)
   tdesc_create_vector (feature, "v2i64", element_type, 2);
 
   tdesc_type_with_fields *type_with_fields;
-  tdesc_type *field_type;
   type_with_fields = tdesc_create_union (feature, "vec128");
+  tdesc_type *field_type;
   field_type = tdesc_named_type (feature, "v4f");
   tdesc_add_field (type_with_fields, "v4_float", field_type);
   field_type = tdesc_named_type (feature, "v2d");
index 88ac55f404a56629ac5c937e24ba72c70d4d3a79..5dcc4c4c5c00a424cc5e22db2939b440377874e2 100644 (file)
@@ -1894,13 +1894,6 @@ public:
        m_printed_type_with_fields = true;
       }
 
-    if (!type->fields.empty ()
-       && !m_printed_field_type)
-      {
-       printf_unfiltered ("  tdesc_type *field_type;\n");
-       m_printed_field_type = true;
-      }
-
     switch (type->kind)
       {
       case TDESC_TYPE_STRUCT:
@@ -1949,8 +1942,8 @@ public:
                  }
                else
                  {
-                   printf_unfiltered
-                     ("  field_type = tdesc_named_type (feature, \"%s\");\n",
+                   printf_field_type_assignment
+                     ("tdesc_named_type (feature, \"%s\");\n",
                       type_name);
                    printf_unfiltered
                      ("  tdesc_add_typed_bitfield (type_with_fields, \"%s\","
@@ -1962,10 +1955,8 @@ public:
              {
                gdb_assert (f.end == -1);
                gdb_assert (type->kind == TDESC_TYPE_STRUCT);
-               printf_unfiltered
-                 ("  field_type = tdesc_named_type (feature,"
-                  " \"%s\");\n",
-                  type_name);
+               printf_field_type_assignment
+                 ("tdesc_named_type (feature, \"%s\");\n", type_name);
                printf_unfiltered
                  ("  tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
                   f.name.c_str ());
@@ -1978,9 +1969,8 @@ public:
           type->name.c_str ());
        for (const tdesc_type_field &f : type->fields)
          {
-           printf_unfiltered
-             ("  field_type = tdesc_named_type (feature, \"%s\");\n",
-              f.type->name.c_str ());
+           printf_field_type_assignment
+             ("tdesc_named_type (feature, \"%s\");\n", f.type->name.c_str ());
            printf_unfiltered
              ("  tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
               f.name.c_str ());
@@ -2018,6 +2008,25 @@ protected:
   std::string m_filename_after_features;
 
 private:
+
+  /* Print an assignment to the field_type variable.  Print the declaration
+     of field_type if that has not been done yet.  */
+  void printf_field_type_assignment (const char *fmt, ...)
+  {
+    if (!m_printed_field_type)
+      {
+       printf_unfiltered ("  tdesc_type *field_type;\n");
+       m_printed_field_type = true;
+      }
+
+    printf_unfiltered ("  field_type = ");
+
+    va_list args;
+    va_start (args, fmt);
+    vprintf_unfiltered (fmt, args);
+    va_end (args);
+  }
+
   char *m_function;
 
   /* Did we print "struct tdesc_type *element_type;" yet?  */