This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
gdb/m2-typeprint.c does not compile with older gcc versions
- From: Peter Schauer <peterschauer at gmx dot net>
- To: gdb at sourceware dot org
- Date: Sat, 27 May 2006 13:12:28 +0200 (CEST)
- Subject: gdb/m2-typeprint.c does not compile with older gcc versions
gdb/m2-typeprint.c does not compile with older gcc versions, e.g. gcc-2.95.2.
It is caused by declarations after code, which is a gcc extension AFAIK.
The gdb-6.5 branch is affected as well.
Here is a fix:
--- m2-typeprint.c.orig 2006-05-23 18:06:34.773753000 +0200
+++ m2-typeprint.c 2006-05-23 19:55:21.047509000 +0200
@@ -504,13 +504,14 @@ m2_record_fields (struct type *type, str
}
else if (show > 0)
{
+ int i;
+ int len = TYPE_NFIELDS (type);
+
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
fprintf_filtered (stream, "RECORD\n");
else if (TYPE_CODE (type) == TYPE_CODE_UNION)
/* i18n: Do not translate "CASE" and "OF" */
fprintf_filtered (stream, _("CASE <variant> OF\n"));
- int i;
- int len = TYPE_NFIELDS (type);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
--
Peter Schauer Peter.Schauer@mytum.de