This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: gdb/m2-typeprint.c does not compile with older gcc versions
- From: Jim Blandy <jimb at codesourcery dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Peter Schauer <peterschauer at gmx dot net>, gdb at sourceware dot org, gdb-patches at sources dot redhat dot com
- Date: Sun, 28 May 2006 15:22:02 -0700
- Subject: Re: gdb/m2-typeprint.c does not compile with older gcc versions
- References: <200605271112.k4RBCSts022936@licht.localdomain> <20060527175215.GH1062@adacore.com>
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.