* gdb/m2-typeprint.c does not compile with older gcc versions
@ 2006-05-27 14:22 Peter Schauer
2006-05-29 12:23 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Peter Schauer @ 2006-05-27 14:22 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: gdb/m2-typeprint.c does not compile with older gcc versions
2006-05-27 14:22 gdb/m2-typeprint.c does not compile with older gcc versions Peter Schauer
@ 2006-05-29 12:23 ` Joel Brobecker
2006-05-29 14:47 ` Jim Blandy
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2006-05-29 12:23 UTC (permalink / raw)
To: Peter Schauer; +Cc: gdb, gdb-patches
On Sat, May 27, 2006 at 01:12:28PM +0200, Peter Schauer wrote:
> 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:
Thanks Peter. To me, this is an obvious fix, so I checked it in for you
in both head and 6.5 branch.
2006-05-27 Joel Brobecker <brobecker@adacore.com>
From Peter Schauer <peterschauer@gmx.net>
* m2-typeprint.c (m2_record_fields): Move variable declarations
to the begining of the block.
Tested by re-building GDB after patch.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: gdb/m2-typeprint.c does not compile with older gcc versions
2006-05-29 12:23 ` Joel Brobecker
@ 2006-05-29 14:47 ` Jim Blandy
0 siblings, 0 replies; 3+ messages in thread
From: Jim Blandy @ 2006-05-29 14:47 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Peter Schauer, gdb, gdb-patches
Joel Brobecker <brobecker@adacore.com> writes:
> On Sat, May 27, 2006 at 01:12:28PM +0200, Peter Schauer wrote:
>> 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:
>
> Thanks Peter. To me, this is an obvious fix, so I checked it in for you
> in both head and 6.5 branch.
>
> 2006-05-27 Joel Brobecker <brobecker@adacore.com>
>
> From Peter Schauer <peterschauer@gmx.net>
> * m2-typeprint.c (m2_record_fields): Move variable declarations
> to the begining of the block.
>
> Tested by re-building GDB after patch.
For what it's worth, ISO C99 allows declarations after code. I don't
know when it was introduced. GDB is supposed to only require C90,
according to doc/gdbint.texinfo, so I agree the patch is right,
though.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-05-28 22:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-27 14:22 gdb/m2-typeprint.c does not compile with older gcc versions Peter Schauer
2006-05-29 12:23 ` Joel Brobecker
2006-05-29 14:47 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox